0% found this document useful (0 votes)
11 views2 pages

SQL Comprehensive Test

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views2 pages

SQL Comprehensive Test

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

SQL Comprehensive Test

Table Schemas

Products Table
product_id product_na category_id price stock_quanti added_date
me ty

1 Laptop 1 1200 50 2023-01-05

2 Smartphone 2 800 150 2022-08-12

3 Tablet 2 400 120 2021-03-10

4 Desktop 1 1000 30 2023-06-21

5 Headphones 3 150 200 2022-02-14

6 Smartwatch 2 250 80 2023-05-18

7 Monitor 1 300 45 2021-11-30

8 Keyboard 3 60 500 2023-07-07

9 Mouse 3 25 700 2022-05-01

10 Charger 3 20 400 2021-08-15

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.

3. Write a query to retrieve all columns of products in the Computers category.

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.

6. Write a query to find the product with the highest price.

7. Write a query to find all products added in the year 2023.

8. Write a query to retrieve the product name and price of all products that have a stock
quantity below 100.

9. Write a query to find the average price of all products.

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.

You might also like