Question: Assume we are given a shop's database containing two tables named Products and Orders. The Products table consists of four columns, namely ProductID ProductName, SupplierID,

Assume we are given a shop's database containing two tables named Products and Orders. The Products table consists of four columns, namely ProductID ProductName, SupplierID, and Price. The second table consists of three columns, namely OrderID, ProductID, and Quantity. The column Quantity shows how many quantities of ProductID exist in the relevant OrderID. Examples of these two tables are shown below.
i. Write a SQL query to find the product IDs with maximum and minimum prices.
5%
ii. Write a SQL query to find the product name with the highest number of quantities ordered.
10%
iii. Write SQL queries to find the order ID that has the highest total price (To calculate the total price of each order, you need to multiply the price of each product in that order by its quantity, repeat this process for all products in that order, and sum the results).
20%
Products
\table[[ProductID,ProductName,SupplierID,Price],[1,Name1,1,4],[2,Name2,1,5],[3,Name3,2,10],[4,Name4,2,15],[5,Name5,3,25]]
Orders
\table[[OrderID,ProductID,Quanity],[1,1,1],[1,2,1],[2,3,6],[3,2,2],[3,5,4],[3,4,2],[4,5,12],[4,2,3]]
 Assume we are given a shop's database containing two tables named

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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!