The document lists the 10 most asked SQL questions in coding interviews including how to optimize SQL queries, the difference between correlated and non-correlated subqueries, using common table expressions, handling recursive queries, window functions, ranking functions, indexing strategies, materialized views, the MERGE statement, and pivoting and unpivoting in SQL.
The document lists the 10 most asked SQL questions in coding interviews including how to optimize SQL queries, the difference between correlated and non-correlated subqueries, using common table expressions, handling recursive queries, window functions, ranking functions, indexing strategies, materialized views, the MERGE statement, and pivoting and unpivoting in SQL.
1. How do you optimize a SQL query for performance?
2. Explain the difference between correlated and non-correlated subqueries. 3. What is a CTE (Common Table Expression)? How and when would you use it? 4. How do you handle recursive queries in SQL? 5. Explain the concept of window functions and provide an example. 6. What are the differences between RANK(), DENSE_RANK(), and ROW_NUMBER() functions? 7. How do you implement indexing strategies for a large database? 8. What is a materialized view and how does it differ from a regular view? 9. Explain the use of the MERGE statement in SQL. 10. How do you perform pivoting and unpivoting in SQL?