Task 3: 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: 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 SQL Database Test: Create a new table to store information on active drivers Test Query: SELECT * FROM ACTIVE_DRIVERS Expected Results: 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
Task 3:
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
SQL Database Test:
Create a new table to store information on active drivers
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 |
Task 4:
The Driver Relationship team wants to have quick search options for the active drivers. The team specifically mentioned that they are using first name, last name and driving license ID to search the drivers. Create an index called NameSearch on the ACTIVE_DRIVERS table created in task 3.
SQL Database Test:
Create an INDEX to search the ACTIVE_DRIVERS table.
Test Query:
SHOW INDEX FROM ACTIVE_DRIVERS
Expected Results:
Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment | Visible | Expression |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ACTIVE_DRIVERS | 0 | PRIMARY | 1 | DRIVER_ID | A | 3 | NULL | NULL | BTREE | YES | NULL | |||
ACTIVE_DRIVERS | 1 | NameSearch | 1 | DRIVER_FIRST_NAME | A | 3 | NULL | NULL | YES | BTREE | YES | NULL | ||
ACTIVE_DRIVERS | 1 | NameSearch | 2 | DRIVER_LAST_NAME | A | 3 | NULL | NULL | YES | BTREE | YES | NULL | ||
ACTIVE_DRIVERS | 1 | NameSearch | 3 | DRIVER_DRIVING_LICENSE_ID | A | 3 | NULL | NULL | YES | BTREE | YES | NULL |
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images