Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Your supervisor has asked you to write a report showing how many orders each customer has made. They are requesting that you show the customer
Your supervisor has asked you to write a report showing how many orders each customer has made. They are requesting that you show the customer ID email, and the number of orders.
Write a select statement that returns one r $ w for each customerid showing the customer's ID email address, and COUNT of ORDERID You will need to join two tables, OECUSTOMERS and OEORDERS. Use a LEFT JOIN. Do NOT use a natural join.
Grouping by CUSTOMERID you will need to show the following columns:
The CUSTOMERID column from the OECUSTOMERS table.
The CUSTEMAIL column from the OECUSTOMERS table
The COUNT of ORDERID from the OEORDERS table with an alias of NUMORDERS
Sort the result set in ascending order by the CUSTOMERID field
If you use a left join, you may get an "ORA: column ambiguously defined" error. This is because the CUSTOMERID is in both the OECUSTOMERS and OEORDERS table. You will need to either use a natural join or explicitly pick one, eg OECUSTOMERS.CUSTOMERID
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started