Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Queries Filename: queries.sql Write SELECT statements to complete the following queries. Query 1 Driver List Write a query that returns the order number and customer

Queries Filename: queries.sql

Write SELECT statements to complete the following queries.

Query 1 Driver List Write a query that returns the order number and customer email for each order. If an order does not have a customer name, display Anonymous instead:

Query 2 Order Aggregate Write a query that shows the order date, customer email, delivery address and combined total cost for each order. Order the results by the order date. Orders without a registered customer should list Anonymous as their email. Using the Order View in this query is recommended.

image text in transcribed

Query 3 Top products A products popularity is based on how many times it appears as a customers favourite product. Write a query that selects the top 3 most favorited products. List the products name, type and number of times favorited.

Query 4 Best Customers The company wants to send discounts to their most loyal customers. Write a query that selects the email addresses of any customers who have spent more money than the average customer. That is, the total cost of all of their orders is greater than the average amount spent by other customers

Query 5 Stolen Order Investigation A customer has reported that a staff member has stolen their order. The customer does not remember what email address they used to sign up but they have only made three orders and one of them was two days ago. They dont remember exactly what was stolen but one of the items started with the letter F. The stolen order is their most recent order. Write a single query that uses the above information to find the name of the staff member who delivered the missing order.

image text in transcribed

Qhang 1 - Derww tils Queng L - beter Aewriate

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced MySQL 8 Discover The Full Potential Of MySQL And Ensure High Performance Of Your Database

Authors: Eric Vanier ,Birju Shah ,Tejaswi Malepati

1st Edition

1788834445, 978-1788834445

More Books

Students also viewed these Databases questions

Question

What is a learning organization?

Answered: 1 week ago

Question

5. Prepare for the role of interviewee

Answered: 1 week ago

Question

6. Secure job interviews and manage them with confidence

Answered: 1 week ago