SQL Comprehensive Test
SQL Comprehensive Test
Table Schemas
Products Table
product_id product_na category_id price stock_quanti added_date
me ty
Categories Table
category_id category_name
1 Computers
2 Mobile
3 Accessories
Test Questions
1. Write a query to list all product names and their respective category names.
2. Write a query to find all products with a price greater than 500.
4. Write a query to get the category name and the total stock quantity for each category.
5. Write a query to count the total number of products in the Accessories category.
8. Write a query to retrieve the product name and price of all products that have a stock
quantity below 100.
10. Write a query to list all products whose names end with ‘e'.
11. Write a query to find the total stock quantity and the average price of products in the
company.
12. Write a query to list all products with a stock quantity greater than 400.
13. Write a query to find the cheapest product in the Mobile category.
14. Write a query to find all products added before January 1, 2022.
15. Write a query to get the product name and category name for products with a price
below 100.