Skip to content
  • SQL Interview Q&A · SQL

SQL Interview Q&A

LearnViaNotes @learnvianotes· 4 min read

Rapid-fire theory questions with crisp answers. Each links to the topic where it is explained with runnable examples.

Fundamentals

What is the difference between DELETE, TRUNCATE and DROP?

What is the difference between WHERE and HAVING?

What is the logical order of execution of a SELECT?

What is NULL? How do you test for it?

UNION vs UNION ALL?

What are the types of joins?

CHAR vs VARCHAR?

Design

Primary key vs unique key?

What is a foreign key?

What is normalization? Name the normal forms.

When would you denormalize?

Advanced querying

What is a CTE? A recursive CTE?

What are window functions?

RANK vs DENSE_RANK vs ROW_NUMBER?

Correlated vs non-correlated subquery?

EXISTS vs IN vs JOIN?

Performance & internals

What is an index? What are its downsides?

Clustered vs non-clustered index?

What is a covering index?

What makes a query non-sargable?

How do you find why a query is slow?

Transactions & security

What is ACID?

Name the isolation levels and the anomalies they prevent.

What is a deadlock?

What is SQL injection and how do you prevent it?

View vs materialized view?

Stored procedure vs function?

What is a trigger?

Free for students and teachers

Write notes like this one

Cards for every idea, quizzes and flashcards, read aloud — on the web and your phone.

Something wrong with this note? Open it to report