The Driver Relationship team wants to create some workshops and increase communication with the active drivers in InstantRide. Therefore, they requested a new database table to store the driver details of the drivers that have had at least one ride in the system. Create a new table, ACTIVE_DRIVERS, from the DRIVERS and TRAVELS tables which contains the following fields:
The Driver Relationship team wants to create some workshops and increase communication with the active drivers in InstantRide. Therefore, they requested a new
- DRIVER_ID CHAR(5) (Primary key)
- DRIVER_FIRST_NAME VARCHAR(20)
- DRIVER_LAST_NAME VARCHAR(20)
- DRIVER_DRIVING_LICENSE_ID VARCHAR(10)
- DRIVER_DRIVING_LICENSE_CHECKED BOOL
- DRIVER_RATING FLOAT
The code is supposed to look something like this but I'm getting an error
CREATE TABLE ACTIVE_DRIVERS(
DRIVER_ID CHAR(5) NOT NULL,
DRIVER_FIRST_NAME VARCHAR(20) NULL,
DRIVER_LAST_NAME VARCHAR(20) NULL,
DRIVER_DRIVING_LICENSE_ID VARCHAR(10) NULL,
DRIVER_DRIVING_LICENSE_CHECKED BOOL NULL,
DRIVER_RATING FLOAT NULL
) as select D.DRIVER_ID, D.DRIVER_FIRST_NAME, D.DRIVER_LAST_NAME, D.DRIVER_DRIVING_LICENSE_ID, D.DRIVER_DRIVING_LICENSE_CHECKED, D.DRIVER_RATING
FROM DRIVERS D JOIN TRAVELS ON D.DRIVER_ID =TRAVELS.DRIVER_ID;
Output looks like
DRIVER_ID | DRIVER_FIRST_NAME | DRIVER_LAST_NAME | DRIVER_DRIVING_LICENSE_ID | DRIVER_DRIVING_LICENSE_CHECKED | DRIVER_RATING |
---|---|---|---|---|---|
2001 | Willie | Butler | 1874501 | 1 | 4.4 |
2002 | Justin | Howard | 1953853 | 1 | 4.8 |
2003 | Anthony | Walker | 1735487 | 1 | 3.5 |
Trending now
This is a popular solution!
Step by step
Solved in 3 steps