0% found this document useful (0 votes)
0 views3 pages

SQL Practice

The document contains a comprehensive list of 50 SQL practice questions categorized into four levels: Beginner, Intermediate, Advanced, and Expert. Each category includes various SQL concepts such as SELECT, JOIN, subqueries, and window functions, with questions designed to test and enhance SQL skills. Additionally, there are challenge problems that further challenge the user's understanding and application of SQL in real-world scenarios.

Uploaded by

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

SQL Practice

The document contains a comprehensive list of 50 SQL practice questions categorized into four levels: Beginner, Intermediate, Advanced, and Expert. Each category includes various SQL concepts such as SELECT, JOIN, subqueries, and window functions, with questions designed to test and enhance SQL skills. Additionally, there are challenge problems that further challenge the user's understanding and application of SQL in real-world scenarios.

Uploaded by

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

50 SQL Prac ce Ques ons (Beginner → Advanced)

Beginner (SELECT, WHERE, ORDER BY, LIMIT)

1. List all students.

2. Show all products that cost more than ₹300.

3. Get the first 5 courses ordered by credits.

4. List students enrolled in 2023.

5. Find all books in the Products table.

6. Count how many students are majoring in CS.

7. Show the most expensive product.

8. Show all sales made a er Jan 1, 2025.

9. Find all students younger than 21.

10. List the names of students and their ages, ordered by age descending.

Intermediate (JOIN, GROUP BY, AGGREGATES)

11. Show each student's name and the total number of courses they are enrolled in.

12. List the course name and the number of students enrolled in it.

13. Calculate total sales (price × quan ty) per product.

14. Get the average product price by category.

15. Find students who are enrolled in more than 2 courses.

16. List all courses along with student names who are enrolled.

17. Count how many students received each grade.

18. Find the total quan ty sold per product category.

19. Show total and average quan ty sold per day.

20. List all student-course-grade combina ons using JOIN.


Advanced (Subqueries, HAVING, CASE, DATE func ons)

21. Find the product with the highest total sales revenue.

22. Show students who have never received a grade (i.e. NULL grade).

23. List students enrolled in the course with the most credits.

24. Show students who enrolled in 2021 and are taking courses in the Econ department.

25. Show average grade per course (treat A=4, B=3, C=2, D=1, F=0).

26. List students with more than average enrollments.

27. Find courses not taken by any student.

28. Calculate running total of sales quan ty over me.

29. Find all sales where quan ty > average quan ty sold.

30. Show names of students and their best grade.

Expert (CTEs, Window Func ons, Complex Subqueries)

31. Show top 3 most enrolled courses.

32. For each student, list number of courses and average grade.

33. Rank products by total sales revenue using RANK() or DENSE_RANK().

34. Use a CASE to categorize students as 'Freshman', 'Sophomore', etc., by


enrollment_year.

35. Show daily revenue using a CTE.

36. For each major, show the student with the most enrollments.

37. Show courses that are enrolled by both Student A and Student B.

38. Find students enrolled in all courses from the CS department.

39. Show percent contribu on of each product to total sales revenue.

40. Use a WITH clause to calculate average grades per department.


Challenge Problems

41. Find students enrolled in their own department’s courses.

42. Show the product with the lowest total quan ty sold.

43. For each day, find the product with the highest sales.

44. Show grade distribu on across all departments.

45. Show students who improved their grades across mul ple courses.

46. Generate a report of monthly sales.

47. List the 2nd highest-selling product.

48. Show students not enrolled in any course.

49. List students whose total course credits exceed 10.

50. Create a leaderboard of top students by GPA using custom grading scale.

You might also like