0% found this document useful (0 votes)
7 views4 pages

Module 3 Case Study 2-Worksheet

The document outlines a case study with multiple SQL queries related to vehicle and driver data. Each query specifies the required output, including vin numbers, ride heights, user IDs, average ratings, and trip instances involving emergency contacts. Additionally, it includes a request for a view to log ride-sharing activities while obscuring private information.

Uploaded by

turoawei01
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views4 pages

Module 3 Case Study 2-Worksheet

The document outlines a case study with multiple SQL queries related to vehicle and driver data. Each query specifies the required output, including vin numbers, ride heights, user IDs, average ratings, and trip instances involving emergency contacts. Additionally, it includes a request for a view to log ride-sharing activities while obscuring private information.

Uploaded by

turoawei01
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Module 3 – Case Study 2

Team members:
Member1
Member2
Member3
Member4

Module 3- Case Study 2

Query 1:

Question: Return the vin numbers of all vehicles with make “Toyota”.
Explanation: This query should return a table with only one column containing vin number(s).

Query 2:

Question: Return the vin number and ride height of the 4WD which has the highest ride height with
“alloy” wheels.
Explanation This query should return a table with two columns. The first column should contain the
vin number and the second column should contain the ride height

CRICOS Provider No: 00025B


1
Query4:

Question Return the user(s) who has been on the most trips with driver “Verity Choi”.

Explanation This query should only return a table contain a single column of userID(s).

Query5:

Question: Return a combined list of the average ratings for both vehicles and drivers.

Explanation

This query should return a table with three columns: rating type, rating identifier and
average rating value. The rating type should either be “Vehicle” or “Driver”. The rating
identifier will then be either the vehicle vin number or driverID depending on the rating
type. Note: The output screenshot for this question only needs to show 10 tuples.

CRICOS Provider No: 00025B


2
Query6:

Question: The police suspect one of our drivers may have been involved in a robbery on the
3/3/2020. They have requested the names of all drivers who were working that night anytime
from 8PM to 10PM.

Explanation: This query should return the drivers first name and last name. The time conditions
for this question are inclusive, i.e. including 8PM and 10PM. A driver is classified as “working”
between the start and end time (inclusive) of a trip which they drive for. Your solution must use
at least one non-correlated nested query.

Query7:

Question: Our Board of Directors want to perform a feasibility audit on our client emergency
contact system. We need a list of all the trip instances where an emergency contact of the
passenger was also on a trip at the same time.

Explanation: This query should return the full tuple for each instance in the Trip table which
meets the requirements. You may assume that assume the first name and last name in the
EmergencyContact table is equivalent to the first name and last name in the User table. If an
emergency contact has the same name as someone listed in the user table, they are referring to
the same person. A trip’s start and end times are inclusive of the time a user is defined as being
on a trip. Your solution must use at least one correlated nested query.

CRICOS Provider No: 00025B


3
Query8:
Question: The tax office requires all ride sharing companies to provide a log showing the
amount of time each car in our systems has been involved in ride sharing activities. Create a
view which shows this information while obscuring private trip information like the driver and
user IDs.

Explanation: Your SQL solution should create a view which shows the vehicle vin number and
the amount time that vehicles has been used in ride sharing activities. The time should be
recorded in the format, “hours:minutes:seconds”. You may need to create a secondary helper
view in order to answer this question. The view(s) can be named as you please. If you use
several views, you should only include an Output Screenshot for the final view. Note: The
output screenshot for this question only needs to show 10 tuples.

Hint: You may want to use the TIMESTAMPDIFF and SEC_TO_TIME MySQL functions

CRICOS Provider No: 00025B


4

You might also like