Assignment 05 ANSWERS
Assignment 05 ANSWERS
Assignment 05 ANSWERS
Operators
Instructions:
Please share your answers filled in line in the Word document. Submit
code separately wherever applicable.
1. Create a Supermart_DB with the tables created from the datasets shared
(Customer.csv, Sales.csv and Product.csv files)
a. Create a new database in your database management system, and
name it Supermart_DB.
b. Create a new table called "customers" in the Supermart_DB
database
c. Load the data from the Customer.csv file into the customers table
d. Create a new table called "products" in the Supermart_DB
database
e. Load the data from the Product.csv file into the products table
f. Create a new table called "sales" in the Supermart_DB database
g. Load the data from the Sales.csv file into the sales table
GROUP BY OPERATORS:-
1. Create a display with the information below for each product ID.
a. Total sales (in $) order by this column in descending
b. Total sales quantity
c. The number of orders
d. Max Sales value
e. Min Sales value
f. Average sales value
2. Get the list of product ID’s where the quantity of product sold is greater
than 10
ANSWERS:
SELECT *
FROM customer
WHERE Discount > 0
ORDER BY Discount DESC;
SELECT
ProductID,
SUM(Sales) AS TotalSales,
SUM(Quantity) AS TotalSalesQuantity,
COUNT(DISTINCT OrderID) AS NumberOfOrders,
MAX(Sales) AS MaxSalesValue,
MIN(Sales) AS MinSalesValue,
AVG(Sales) AS AverageSalesValue