Question: 3. SQL queries (40 points total, 5 points each query) Write SQL query statements to query the following DoorDash like grocery delivery database Tables. Customers

3. SQL queries (40 points total, 5 points each query) Write SQL3. SQL queries (40 points total, 5 points each query) Write SQL query statements to query the following DoorDash like grocery delivery database Tables. Customers make orders from grocery stores delivered by a delivery person. cid is Customer ID. did is the ID of a deliverer. oid is the ID of an Order. Rating is the customers satisfaction rate with a driver on a certain order. Rating is a numerical value from 1 to 10 with 10 representing most satisfactory. cost is the total cost of this order. Requires a single SQL statement as answer to each question unless otherwise noted

1. Show customers first and last names whose phone number contains 333.

2. Show order ID quantity and cost for orders cost more than $10(inclusive).

3. Show total cost of the orders made by Customer id 201 assuming the customer made multiple orders.

4. Show the total number of orders costs less than $50 delivered by each deliverer.

5. Show Customers first and last names who spent more than 20 items in a single delivery

6. Show customers first and last names who gave feedback to deliverer John Doe

7. Find customers first and last names who spent more than $20 in a single delivery that is delivered by John Doe.

8. Using SQL, add a foreign key constraint to the Feedbacks and Orders table. If a Deliverers id is updated in the Deliverers table, the Deliverers id is changed to NULL in the Feedbacks table, but the id is also updated in the Orders table.

Customers Deliverers Feedbacks Orders

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related General Management Questions!