SQL Concepts and Questions

--

SQL Interview Questions and Concepts

Top 10 SQL concepts — Basic

1. Aggregate Functions (sum/avg/max/min)
2. Group By and Order By
3. JOINs (Inner/Left/Right/Self)
4. Union and Union All
5. Date and Time processing
6. String processing
7. Window Functions (Partition by)
8. Subquery
9. View and Index
10. Common Table Expression (CTE)

Top 10 SQL Interview Questions — Intermediate
1. Determine the number of duplicates in a table.
2. Find all unique combination of two rows.
3. Count the number of non-null entries in a column.
4. When to use group by vs. distinct.
5. Why use coalesce vs case statements?
6. When would you choose a left join over an inner join?
7. In what cases is a subquery a bad idea?
8. Why is a temp table a good idea? Bad idea?
9. How to filter using a join.
10. How do CTEs help an analyst?

Top 10 SQL Interview Questions — Advanced

1. When will ROW_NUMBER and RANK give different results? Give an example.
2. Is it possible for LEFT JOIN and INNER JOIN to produce the same results? If yes, when? If no, why?
3. Why would I use DENSE_RANK instead of RANK? What about RANK instead of DENSE_RANK?
4. What happens if I GROUP BY a column that is not in the SELECT statement? Why does this happen?
5. LAG and LEAD are especially useful in what type of scenarios?
6. For dealing with NULL values, why would I choose to use IFNULL vs. CASE WHEN?
7. Do temp tables make your code cleaner and faster, one of the two, or none? Why?

--

--

Ashutosh Kumar
Ashutosh Kumar

Written by Ashutosh Kumar

Backend Engineering | BIT Mesra | Building Microservices and Scalable Apps | Mentor

No responses yet