Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a SQL query to show a table with columns Customer ID and Product ID of only products ordered by the customer and meets the

Write a SQL query to show a table with columns Customer ID and Product ID of only products ordered by the customer and meets the following requirements:
a. Customer ID should be included for all customers.
b. Product ID included are only for products ordered by the customer with Customer ID in the first column.
c. If the same customer has purchased the same product multiple times, the pair of Customer ID and Product ID should not be repeated.
Additional Notes:
- Customer ID is used to uniquely identify each customer and is available as CustomerID in SALES_ORDERS table as well as CustID in CUSTOMER table.
- Product ID is used to uniquely identify each product and is available as ProductID in both PRODUCT and ORDER_DETAILS tables.

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

Databases Illuminated

Authors: Catherine M Ricardo, Susan D Urban

3rd Edition

1284056945, 9781284056945

Students also viewed these Databases questions