Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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]]
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions