Answered step by step
Verified Expert Solution
Link Copied!

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, e-mail, and the number of orders.
Write a select statement that returns one r ?bar($) w for each customer_id showing the customer's ID, email address, and COUNT of ORDER_ID. You will need to join two tables, OE.CUSTOMERS and OE.ORDERS. Use a LEFT JOIN. Do NOT use a natural join.
Grouping by CUSTOMER_ID, you will need to show the following columns:
The CUSTOMER_ID column from the OE.CUSTOMERS table.
The CUST_EMAIL column from the OE.CUSTOMERS table
The COUNT of ORDER_ID from the OE.ORDERS table with an alias of NUM_ORDERS
Sort the result set in ascending order by the CUSTOMER_ID field
If you use a left join, you may get an "ORA-00918: column ambiguously defined" error. This is because the CUSTOMER_ID is in both the OE.CUSTOMERS and OE.ORDERS table. You will need to either use a natural join or explicitly pick one, e.g. OE.CUSTOMERS.CUSTOMER_ID.
image text in transcribed

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

Step: 3

blur-text-image

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

More Books

Students also viewed these Databases questions

Question

What are the components of a quality control chart?

Answered: 1 week ago