11. Display the product with the lowest stock quantity.

Code In Sql

-- Table Name : Products -- Product_ID | Product_Name | Category | Price | Stock -- ------------+ -------------+-------------+-------+------- -- 1 | Laptop | Electronics | 55000 | 15 -- 2 | Mobile Phone | Electronics | 30000 | 30 -- 3 | Office Chair | Furniture | 7000 | 10 -- 4 | Coffee Maker | Appliances | 4000 | 20 -- 5 | Dining Table | Furniture | 15000 | 5 -- Your Query Here

Output

Click Run Button to view compiled output

12. List all unique categories and count the products in each.

Code In Sql

-- Table Name : Products -- Product_ID | Product_Name | Category | Price | Stock -- ------------+ -------------+-------------+-------+------- -- 1 | Laptop | Electronics | 55000 | 15 -- 2 | Mobile Phone | Electronics | 30000 | 30 -- 3 | Office Chair | Furniture | 7000 | 10 -- 4 | Coffee Maker | Appliances | 4000 | 20 -- 5 | Dining Table | Furniture | 15000 | 5 -- Your Query Here

Output

Click Run Button to view compiled output

13. Find products whose names start with 'C'.

Code In Sql

-- Table Name : Products -- Product_ID | Product_Name | Category | Price | Stock -- ------------+ -------------+-------------+-------+------- -- 1 | Laptop | Electronics | 55000 | 15 -- 2 | Mobile Phone | Electronics | 30000 | 30 -- 3 | Office Chair | Furniture | 7000 | 10 -- 4 | Coffee Maker | Appliances | 4000 | 20 -- 5 | Dining Table | Furniture | 15000 | 5 -- Your Query Here

Output

Click Run Button to view compiled output

14. Show all products, replacing null values in stock with 0.

Code In Sql

-- Table Name : Products -- Product_ID | Product_Name | Category | Price | Stock -- ------------+ -------------+-------------+-------+------- -- 1 | Laptop | Electronics | 55000 | 15 -- 2 | Mobile Phone | Electronics | 30000 | 30 -- 3 | Office Chair | Furniture | 7000 | 10 -- 4 | Coffee Maker | Appliances | 4000 | 20 -- 5 | Dining Table | Furniture | 15000 | 5 -- Your Query Here

Output

Click Run Button to view compiled output

15. Update the stock of "Mobile Phone" by reducing it by 5.

Code In Sql

-- Table Name : Products -- Product_ID | Product_Name | Category | Price | Stock -- ------------+ -------------+-------------+-------+------- -- 1 | Laptop | Electronics | 55000 | 15 -- 2 | Mobile Phone | Electronics | 30000 | 30 -- 3 | Office Chair | Furniture | 7000 | 10 -- 4 | Coffee Maker | Appliances | 4000 | 20 -- 5 | Dining Table | Furniture | 15000 | 5 -- Your Query Here

Output

Click Run Button to view compiled output

16. List the top 2 most expensive products in each category.

Code In Sql

-- Table Name : Products -- Product_ID | Product_Name | Category | Price | Stock -- ------------+ -------------+-------------+-------+------- -- 1 | Laptop | Electronics | 55000 | 15 -- 2 | Mobile Phone | Electronics | 30000 | 30 -- 3 | Office Chair | Furniture | 7000 | 10 -- 4 | Coffee Maker | Appliances | 4000 | 20 -- 5 | Dining Table | Furniture | 15000 | 5 -- Your Query Here

Output

Click Run Button to view compiled output

17. Find products priced as a multiple of 5000.

Code In Sql

-- Table Name : Products -- Product_ID | Product_Name | Category | Price | Stock -- ------------+ -------------+-------------+-------+------- -- 1 | Laptop | Electronics | 55000 | 15 -- 2 | Mobile Phone | Electronics | 30000 | 30 -- 3 | Office Chair | Furniture | 7000 | 10 -- 4 | Coffee Maker | Appliances | 4000 | 20 -- 5 | Dining Table | Furniture | 15000 | 5 -- Your Query Here

Output

Click Run Button to view compiled output

18. List products grouped by category and sorted by price.

Code In Sql

-- Table Name : Products -- Product_ID | Product_Name | Category | Price | Stock -- ------------+ -------------+-------------+-------+------- -- 1 | Laptop | Electronics | 55000 | 15 -- 2 | Mobile Phone | Electronics | 30000 | 30 -- 3 | Office Chair | Furniture | 7000 | 10 -- 4 | Coffee Maker | Appliances | 4000 | 20 -- 5 | Dining Table | Furniture | 15000 | 5 -- Your Query Here

Output

Click Run Button to view compiled output

19. Retrieve the total number of Electronics items in stock.

Code In Sql

-- Table Name : Products -- Product_ID | Product_Name | Category | Price | Stock -- ------------+ -------------+-------------+-------+------- -- 1 | Laptop | Electronics | 55000 | 15 -- 2 | Mobile Phone | Electronics | 30000 | 30 -- 3 | Office Chair | Furniture | 7000 | 10 -- 4 | Coffee Maker | Appliances | 4000 | 20 -- 5 | Dining Table | Furniture | 15000 | 5 -- Your Query Here

Output

Click Run Button to view compiled output

20. Show products with prices within 20% of the maximum price.

Code In Sql

-- Table Name : Products -- Product_ID | Product_Name | Category | Price | Stock -- ------------+ -------------+-------------+-------+------- -- 1 | Laptop | Electronics | 55000 | 15 -- 2 | Mobile Phone | Electronics | 30000 | 30 -- 3 | Office Chair | Furniture | 7000 | 10 -- 4 | Coffee Maker | Appliances | 4000 | 20 -- 5 | Dining Table | Furniture | 15000 | 5 -- Your Query Here

Output

Click Run Button to view compiled output

ad vertical

2 of 3