Question: I was doing more SQL work and these are the questions I got stuck on table: The queries listed below must be implemented as SELECT
I was doing more SQL work and these are the questions I got stuck on
table:

The queries listed below must be implemented as SELECT statements with JOIN or OUTER JOIN operation.
- Find the first and the last name of the drivers who are on leave at the moment.
- Find the registration numbers of trucks that are used just now and that have been used for at least one trip in 2016.
- Find the first and the last names of drivers who performed at least one trip in January 2016. It is your task to find an appropriate standard function that can be used to extract a month and year from a date.
- Find the first and last names of employees who are not drivers.
- Find the first and last names of drivers who performed no trips so far.
- Find the total number of trips performed by each driver. List the driving licence numbers associated with the total number of trips. Do not ignore the drivers who performed no trips so far.
CREATE TABLE EMPLOYEE ( ( ENUM DECIMAL (12) NOT NULL, FNAME VARCHAR(50) NOT NULL, INITIALS VARCHAR(5) NULL, LNAME VARCHAR(50) NOT NULL, ' DOB DATE A. NULL, ' BLDG DECIMAL (3) NOT NULL, STREET VARCHAR(50) NOT NULL, ' SUBURB VARCHAR(50) NOT NULL, STATE VARCHAR(5) NOT NULL, ZIPCODE DECIMAL (4) NOT NULL, CONSTRAINT EMPLOYEE_PKEY PRIMARY KEY (ENUM)); /* RRRRRR */ CREATE TABLE DRIVER ENUM DECIMAL (12) NOT NULL, LNUM DECIMAL (8) NOT NULL, STATUS VARCHAR(10) NOT NULL, CONSTRAINT DRIVER_PKEY PRIMARY KEY (ENUM), CONSTRAINT DRIVER_UNIQUE UNIQUE (LNUM), CONSTRAINT DRIVER_FKEY FOREIGN KEY (ENUM) REFERENCES EMPLOYEE (ENUM), CONSTRAINT DRIVER_STATUS CHECK ( STATUS IN ('AVAILABLE', 'BUSY', 'ON LEAVE')); / */ CREATE TABLE ADMIN ENUM DECIMAL (12) NOT NULL, POSITION VARCHAR(50) NOT NULL, CONSTRAINT ADMIN_PKEY PRIMARY KEY (ENUM), CONSTRAINT ADMIN_FKEY FOREIGN KEY(ENUM) REFERENCES EMPLOYEE (ENUM)); /* - WWW */ CREATE TABLE TRUCK REGNUM VARCHAR(10) NOT NULL, DET CAPACITY DECIMAL (7) NOT NULL, WEIGHT DECIMAL (7) NOT NULL, STATUS VARCHAR(10) NOT NULL, CONSTRAINT TRUCK_PKEY PRIMARY KEY (REGNUM), CONSTRAINT TRUCK STATUS CHECK ( STATUS IN ('AVAILABLE', 'USED', 'MAINTAINED')), CONSTRAINT TRUCK_WEIGHT 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
