Question: Write a SQL query to display all products where there is an order containing exactly two units of the product for each of the products.

Write a SQL query to display all products where there is an order containing exactly two units of the product for each of the products.

 

In database_1 there is the following:

Orders(order_id(Primary, int), registered_date(date), user_id(MUL, int)

OrdersProducts(order_id(Primary, int), price(float), product_id(Primary, int), quantity(int)

Ratings(order_id(Primary, int), product_id(Primary, int), rate(int), comment(VARCHAR)

Users(email(UNIQUE, VARCHAR), name(VARCHAR), password(VARCHAR), registered_date(date), username(UNIQUE, VARCHAR), user_id(Primary, int)

Step by Step Solution

3.34 Rating (145 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

You can use the following SQL query to display all pro... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!