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

SQL Questions

The document lists 50 SQL query practice questions categorized into Basic Queries, Aggregate Functions, GROUP BY, Subqueries, JOIN, UPDATE & DELETE, String Functions, and Advanced topics. These questions are designed to help individuals prepare for SQL coding interviews, particularly for freshers. Each category contains various tasks aimed at testing different SQL skills and concepts.

Uploaded by

atharvagalwade02
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)
2 views3 pages

SQL Questions

The document lists 50 SQL query practice questions categorized into Basic Queries, Aggregate Functions, GROUP BY, Subqueries, JOIN, UPDATE & DELETE, String Functions, and Advanced topics. These questions are designed to help individuals prepare for SQL coding interviews, particularly for freshers. Each category contains various tasks aimed at testing different SQL skills and concepts.

Uploaded by

atharvagalwade02
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

Here are 50 SQL query practice questions only (no theory).

Basic Queries
1. Display all employees.

2. Display employee names only.

3. Display employee names and salaries.

4. Find employees whose salary is greater than 50,000.

5. Find employees whose salary is less than 30,000.

6. Find employees between the ages of 25 and 35.

7. Find employees whose names start with 'A'.

8. Find employees whose names end with 'n'.

9. Find employees whose names contain 'ar'.

10. Display employees in ascending order of salary.

Aggregate Functions
11. Find the highest salary.

12. Find the lowest salary.

13. Find the average salary.

14. Find the total salary of all employees.

15. Count the total number of employees.

GROUP BY
16. Count employees in each department.

17. Find the average salary in each department.

18. Find the maximum salary in each department.

19. Find the minimum salary in each department.

20. Display departments having more than 5 employees.


Subqueries
21. Find the second highest salary.

22. Find the third highest salary.

23. Find the fourth highest salary.

24. Find the employee with the highest salary.

25. Find employees earning more than the average salary.

26. Find employees earning less than the average salary.

27. Find employees whose salary is equal to the minimum salary.

28. Find employees whose salary is equal to the maximum salary.

29. Find the Nth highest salary.

30. Find duplicate salaries.

JOIN
31. Display employee names with department names.

32. Display all employees, including those without a department.

33. Display departments even if they have no employees.

34. Find employees who don't belong to any department.

35. Display employee names with their manager names (Self Join).

UPDATE & DELETE


36. Increase everyone's salary by 10%.

37. Increase HR employees' salary by 20%.

38. Delete employees with salary below 20,000.

39. Delete employees older than 60.

40. Update the department of an employee.

String Functions
41. Display employee names in uppercase.
42. Display employee names in lowercase.

43. Find the length of each employee's name.

44. Display the first three characters of each employee's name.

45. Concatenate employee name and department.

Advanced
46. Find duplicate employee names.

47. Find employees whose salary is between the second and third highest
salaries.

48. Find the top 3 highest-paid employees.

49. Find employees who have the same salary.

50. Find the department with the highest average salary.

These 50 queries cover most of the SQL coding questions commonly asked in
fresher interviews.

You might also like