Question: QUESTION 5 (10 marks) Write SELECT statements that implement the following queries. (1) (2) 3) (4) Find the first and the last names of all

QUESTION 5 (10 marks) Write SELECT statements that implement the following queries. (1) (2) 3) (4) Find the first and the last names of all drivers who are not on leave. (1 mark) Find the registration numbers of all trucks that have not been used so far. (1 mark) Find the registration numbers of all trucks that have been used more than 50 times. (1 mark) Find the distinct names of all cities visited during the trip number 30 or the trip number 33. Note that a city is visited if it is either a departure city or a destination city of any leg included within a trip. (1 mark) Find the registration numbers of all trucks that have been used by both drivers with a driving licence number 311607 and with a driving license number 901107. (1 mark) Data security is an important consideration when operating a database system, consider the database as outlined on page 2, as the Database Administrator what security considerations would you address. How would you address these issues to reduce the chance of the problem occurring? What would you do if the problem occurs? Provide an original example to illustrate your answer. (5 marks) (5) (6) QUESTIONS 3, 4, 5, 6 and 7 REFER TO THE RELATIONAL TABLES LISTED BELOW CREATE TABLE STAFF ENUM DECIMAL (12) NOT NULL Staff employee number FNAME VARCHAR(50) NOT NULL, / First name LNAME VARCHAR (50) NOT NULL 7. Last name DOD DATE NULL. 1 Date of birth CONSTRAINT SZAFF_PKEY PRIMARY KEY (ENUM) : CREATE TABLE DRIVER ENUM DECIMAL (12) NOT NULL 7. Staff employee number LNUM DECIMAL (8) NOT NULL / Driving license number STATUS VARCHAR(10) NOT NULL, Driver status CONSTRAINT DRIVER_PKEY PRIMARY KEY (ENUM). CONSTRAINT DRIVER UNIQUE UNIQUE (LINUM). CONSTRAINT DRIVER FKEY FOREIGN KEY (ENUM) REFERENCES STAPE IENUM). CONSTRAINT DRIVER STATUS CHECK STATUS IN ("AVAILABLE", IN SERVICE, ON LEAVE >> CREATE TABLE TRUCKA REGNUM VARCHAR(10) NOT NULL, Registration number CAPACITY DECIMAL (7) NOT NULL, /* Capacity WEIGHT DECIMAL (7) NOT NULL Weight STATUS VARCHAR(10) NOT NULL, 7 Present status CONSTRAINT TRUCK PREY PRIMARY KEY REGNUM), CONSTRAINT TRUCK STATUS CHECK STATUS IN "AVAILABLE", USED, MAINTAINED). CONSTRAINT TRUCK_WRIGHT CHECK (WEIGHT > 0.0 AND WEIGHT 0.0 AND CAPACITY
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
