Back to Prep Library
Category Blueprint

SQL Interview Library

Index architectures, table joins & analytical queries

Questions50
Views34.4k
Upvotes2.0k
Filter

Question Catalog

(50 visible)
SQL· DSA

What is the difference between a primary key and a foreign key?

1.2k7
easy
SQL· DSA

What is the difference between a primary key and a unique constraint?

1.1k32
easy
SQL· DSA

What is the logical order of execution of a SQL query?

1.1k70
easy
SQL· DSA

What is the CASE expression?

1.0k12
easy
SQL· DSA

What is the difference between WHERE and HAVING?

1.0k45
easy
SQL· DSA

What are the different types of SQL joins?

98430
easy
SQL· DSA

What does DISTINCT do and what is its cost?

85959
easy
SQL· DSA

When would you use a transaction explicitly?

60459
easy
SQL· DSA

What do COALESCE and NULLIF do?

2099
easy
SQL· DSA

What is a CHECK constraint?

12216
easy
SQL· DSA

What is the difference between CHAR, VARCHAR, and TEXT?

9455
easy
SQL· DSA

What is a subquery and what is a correlated subquery?

1.2k4
medium
SQL· DSA

How do you read an EXPLAIN query plan?

1.1k19
medium
SQL· DSA

What is a covering index?

1.1k64
medium
SQL· DSA

How does GROUP BY work with aggregate functions?

1.1k27
medium
SQL· DSA

What are COMMIT, ROLLBACK, and SAVEPOINT?

1.1k52
medium
SQL· DSA

How do you aggregate values into a single string?

1.1k22
medium
SQL· DSA

What is the difference between COUNT(*), COUNT(col), and COUNT(DISTINCT col)?

96768
medium
SQL· DSA

Why might EXISTS outperform a JOIN for existence checks?

94735
medium
SQL· DSA

How does SQL handle NULL values?

94073
medium
SQL· DSA

What is a view and a materialized view?

93531
medium
SQL· DSA

What are transaction isolation levels?

92331
medium
SQL· DSA

What are foreign key cascade options?

79928
medium
SQL· DSA

What is the difference between EXISTS and IN?

76263
medium
SQL· DSA

What is a CTE (Common Table Expression)?

73273
medium
SQL· DSA

How do you update a table based on another table?

7188
medium
SQL· DSA

What is an UPSERT?

6620
medium
SQL· DSA

What are ACID properties?

63023
medium
SQL· DSA

What is the difference between UNION and UNION ALL?

59444
medium
SQL· DSA

How do you paginate efficiently in SQL?

34243
medium
SQL· DSA

What are the common aggregate functions?

29219
medium
SQL· DSA

What is the difference between DELETE, TRUNCATE, and DROP?

20713
medium
SQL· DSA

What is a stored procedure?

14345
medium
SQL· DSA

What is a self join?

11337
medium
SQL· DSA

What is an index and how does it speed up queries?

8265
medium
SQL· DSA

What do GROUP BY ROLLUP and CUBE do?

6038
medium
SQL· DSA

What is a database trigger?

4718
medium
SQL· DSA

What is database normalization?

1.2k46
hard
SQL· DSA

How do recursive CTEs work?

1.1k28
hard
SQL· DSA

What do the LAG and LEAD window functions do?

1.0k49
hard
SQL· DSA

What is a LATERAL join?

96951
hard
SQL· DSA

How do you optimize a slow SQL query?

81667
hard
SQL· DSA

What is the difference between ROW_NUMBER, RANK, and DENSE_RANK?

7407
hard
SQL· DSA

How do you pivot rows into columns?

65177
hard
SQL· DSA

Why does column order matter in a composite index?

58577
hard
SQL· DSA

How do you find the Nth highest salary?

51666
hard
SQL· DSA

What are window functions?

47778
hard
SQL· DSA

What is a deadlock and how do you prevent it?

36662
hard
SQL· DSA

What is the difference between a clustered and non-clustered index?

4438
hard
SQL· DSA

What is table partitioning?

4331
hard

Difficulty Distribution

Easy11 (22%)
Medium26 (52%)
Hard13 (26%)

Tested Topics

#foreign-key#null#aggregate#transactions#primary-key#constraints#order-of-execution#case

Study Guide

Practice query optimizer execution plans, indexing mechanisms (B-Trees), transaction isolation levels (ACID), and window calculations.