21. Display products where the category starts with 'F' or 'A'.
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
22. Find categories with an average product price above 10000.
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
23. Update the price of all products by adding 10% as a seasonal discount.
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
24. Show products added to the table most recently.
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
25. Retrieve products with prices not divisible by 1000.
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
26. Find the difference between the highest and lowest prices 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
27. List all products showing only the first 3 characters of each name.
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
28. Retrieve products ordered by stock quantity, with Electronics first.
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
29. Find the product with the second-lowest 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
30. Delete products with a stock count below 10.
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