Find top SQL resources from global universities, cool projects, and learning materials for data analytics.
Admin: @coderfun
Useful links: heylink.me/DataAnalytics
Promotions: @love_data
Post #2103
3.56K
โ
Top 10 SQL Interview Questions ๐ผ๐
1๏ธโฃ What is a CTE (Common Table Expression)?
A temporary result set used for complex queries.
2๏ธโฃ Difference between RANK(), DENSE_RANK(), and ROW_NUMBER()?
โฆ
โฆ
โฆ
3๏ธโฃ What is a window function?
Calculations across a set of rows related to the current row, using
4๏ธโฃ Difference between WHERE and HAVING?
โฆ
โฆ
5๏ธโฃ What is indexing and how does it work?
Speeds up queries by creating fast-lookups, like a bookโs index.
6๏ธโฃ How to remove duplicate records in SQL?
7๏ธโฃ Difference between UNION and UNION ALL?
โฆ
โฆ
8๏ธโฃ How to update data using JOIN?
9๏ธโฃ Explain COALESCE() vs ISNULL().
โฆ
โฆ
๐ What is a correlated subquery?
A subquery referencing outer query columns, executed row-by-row.
๐ฌ Tap โค๏ธ for more!
1๏ธโฃ What is a CTE (Common Table Expression)?
A temporary result set used for complex queries.
WITH temp AS (SELECT * FROM employees WHERE salary > 50000)
SELECT * FROM temp;
2๏ธโฃ Difference between RANK(), DENSE_RANK(), and ROW_NUMBER()?
โฆ
ROW_NUMBER(): Unique sequence numberโฆ
RANK(): Skips ranks for tiesโฆ
DENSE_RANK(): No gaps in ranking3๏ธโฃ What is a window function?
Calculations across a set of rows related to the current row, using
OVER(PARTITION BYโฆ).4๏ธโฃ Difference between WHERE and HAVING?
โฆ
WHERE: Filters rows before aggregationโฆ
HAVING: Filters rows after aggregation5๏ธโฃ What is indexing and how does it work?
Speeds up queries by creating fast-lookups, like a bookโs index.
6๏ธโฃ How to remove duplicate records in SQL?
SELECT DISTINCT * FROM table_name;
7๏ธโฃ Difference between UNION and UNION ALL?
โฆ
UNION: Removes duplicatesโฆ
UNION ALL: Includes all rows8๏ธโฃ How to update data using JOIN?
UPDATE emp
SET emp.salary = dept.bonus
FROM emp
JOIN dept ON emp.dept_id = dept.id;
9๏ธโฃ Explain COALESCE() vs ISNULL().
โฆ
COALESCE(): Returns first non-null from a listโฆ
ISNULL(): Replaces NULL with a specified value (SQL Server)๐ What is a correlated subquery?
A subquery referencing outer query columns, executed row-by-row.
๐ฌ Tap โค๏ธ for more!
- โค 8
- ๐ 1




