Question: 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 SALESORDERS 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 ORDERDETAILS tables.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
