DATASPACE ACADEMY
SQL ASSIGNMENT-1
Create a data base name “Store” and create a table name “sales” and load the following details.
id product_name category price quantity country sales_date
1 Laptop Electronics 800 5 USA 2024-01-12
2 Phone Electronics 500 8 India 2024-02-15
3 TV Electronics 600 2 UK 2024-02-20
4 Chair Furniture 150 10 India 2024-03-05
5 Table Furniture 250 4 USA 2024-03-10
6 Pen Stationery 5 100 USA 2024-03-12
7 Notebook Stationery 3 200 India 2024-03-15
8 Camera Electronics 700 3 UK 2024-04-01
9 Sofa Furniture 900 1 USA 2024-04-05
10 Bed Furniture 1200 2 India 2024-04-10
11 Marker Stationery 2 150 USA 2024-04-12
12 Watch Electronics 400 7 India 2024-04-15
13 Bottle Stationery 10 50 UK 2024-04-20
14 Headphones Electronics 150 9 USA 2024-04-22
15 Cupboard Furniture 600 2 India 2024-04-25
Give the answer of the following question.
1. Write a query to display all columns from the sales table.
2. Display only product_name and price for all rows.
3. Show product_name and a new column total_value (price × quantity) for each product.
4. Find all products where category is 'Furniture'.
5. Display all products from 'India' with a price greater than 500.
6. Show products sold in 'USA' or 'UK' after 2024-03-01.
7. Display all products ordered by price in descending order.
8. List products in the 'Stationery' category sorted by quantity in ascending order.
9. Show the top 5 most expensive products using ORDER BY and LIMIT.
10. Display total quantity sold for each category.
11. Find the average price of products for each country.
12. Show the highest price in each category.
13. Show the total sales value (price × quantity) per country, sorted from highest to lowest.
14. List the top 3 countries with the most products sold (quantity sum).
15. Display the average price of 'Electronics' products in 'India'.
Use “MySQL” to solve the above question. Copy the query and paste it in word file and submit the above
word file.