Top 50 SQL Interview Questions & Answers | Codecaf
SQL Interview Preparation

Top 50 SQL Interview Questions

Precise, simple, interview-ready answers covering SQL fundamentals, queries, joins, window functions, transactions, performance, and common coding problems.

Showing 50 questions
0 answers viewed
#1 SQL Fundamentals Easy

What is a Primary Key?

#2 SQL Fundamentals Easy

What is a Foreign Key?

#3 SQL Fundamentals Easy

What is the difference between WHERE and HAVING?

#4 SQL Fundamentals Easy

What is an INNER JOIN?

#5 SQL Fundamentals Easy

What is a LEFT JOIN?

#6 SQL Fundamentals Easy

DELETE vs TRUNCATE vs DROP?

#7 SQL Fundamentals Easy

What is a Database Index?

#8 SQL Fundamentals Easy

What is a UNIQUE constraint?

#9 SQL Fundamentals Easy

What is NULL in SQL?

#10 SQL Fundamentals Easy

UNION vs UNION ALL?

#11 SQL Fundamentals Easy

What is a Subquery?

#12 SQL Fundamentals Easy

What is a CTE?

#13 Advanced SQL Medium

What is a Window Function?

#14 SQL Fundamentals Medium

What is Database Normalization?

#15 Advanced SQL Medium

What is Denormalization?

#16 SQL Fundamentals Easy

What is a Transaction?

#17 Advanced SQL Medium

What does ACID mean?

#18 SQL Fundamentals Easy

What does GROUP BY do?

#19 SQL Fundamentals Easy

What does DISTINCT do?

#20 SQL Fundamentals Easy

COUNT(*) vs COUNT(column)?

#21 SQL Queries Easy

What does COALESCE do?

#22 SQL Queries Easy

What is CASE in SQL?

#23 SQL Fundamentals Easy

What is a View?

#24 Advanced SQL Medium

What is a Stored Procedure?

#25 SQL Fundamentals Medium

What is a Composite Key?

#26 SQL Queries Medium

What is a Self Join?

#27 SQL Queries Medium

What is a CROSS JOIN?

#28 Interview Problems Medium

How do you find duplicate records?

#29 Interview Problems Medium

How do you find the second-highest salary?

#30 Interview Problems Hard

How do you find the Nth-highest salary?

#31 Interview Problems Medium

How do you find employees without a department?

#32 Interview Problems Easy

How do you find duplicate email addresses?

#33 Interview Problems Medium

How do you find records in one table but not another?

#34 Interview Problems Hard

How do you find the top 3 salaries in each department?

#35 Advanced SQL Medium

What is ROW_NUMBER()?

#36 Advanced SQL Medium

RANK() vs DENSE_RANK()?

#37 Advanced SQL Medium

How do you calculate a running total?

#38 Advanced SQL Hard

What are transaction isolation levels?

#39 Advanced SQL Hard

What is a Deadlock?

#40 Advanced SQL Hard

What is Database Locking?

#41 Advanced SQL Medium

What is an Execution Plan?

#42 Advanced SQL Medium

How do you improve SQL query performance?

#43 Advanced SQL Medium

What is SQL Injection?

#44 SQL Queries Medium

EXISTS vs IN?

#45 SQL Fundamentals Easy

CHAR vs VARCHAR?

#46 SQL Queries Medium

Why can't you use = NULL?

#47 Interview Problems Hard

How do you remove duplicate rows while keeping one?

#48 Interview Problems Hard

How do you find employees earning above their department average?

#49 Interview Problems Hard

How can you compare a row with the previous row?

#50 SQL Fundamentals Medium

Primary Key vs UNIQUE constraint?

No questions found

Try a different keyword or change the filters.

Built for developers by Codecaf.
Practice the fundamentals. Understand the query. Ace the interview.