ADVANCED
Advanced
SQL
Interview
Questions
for Entry-
Level Roles
Pradeep M
@pradeepanalyst
1
1. What is the difference between RANK(),
DENSE_RANK(), and ROW_NUMBER()?
2. How do you identify and delete duplicate
rows from a table?
3. Explain how a WITH clause (CTE) works and
when to use it.
4. How would you find the second highest
salary in a table?
5. What are window functions? Give an
example.
6. How can you pivot and unpivot data in
SQL?
7. How do you handle NULLs in SQL joins and
conditions?
2
8. What is a correlated subquery and how is it
different from a regular subquery?
9. How would you optimize a slow-running
SQL query?
10. What is the use of EXISTS vs IN? When
would you choose one over the other?
11. Explain the concept of indexing and how
it affects query performance.
12. What is the difference between UNION
and UNION ALL?
13. How do you calculate running totals using
SQL?
14. Write a query to find the Nth highest
salary from an employee table.
3
15. What is normalization? Explain different
normal forms.
16. What is a common table expression (CTE),
and can it be recursive?
17. How do you identify missing values or
gaps in a sequence of dates or IDs?
18. How would you write a SQL query to
transpose rows into columns?
19. What is the difference between DELETE,
TRUNCATE, and DROP?
20. Explain ACID properties in the context of
SQL transactions.
21. How do you use CASE statements in SQL
queries?
4
22. What’s the difference between a primary
key and a unique key?
23. How do window functions differ from
aggregate functions?
24. Write a query to get the top 3 employees
by salary in each department.
25. How would you find consecutive dates or
repeating patterns in data?
26. What are the differences between
VARCHAR, CHAR, and TEXT data types?
27. What is the purpose of the MERGE
statement? Provide a use case.
28. How can you find anomalies or outliers
using SQL?
I hope you find this
valuable!
A like from you would be a great
encouragement
Pradeep M
@pradeepanalyst