๐Ÿ—„๏ธ

SQL Interview Questions

50 questions ยท Queries, joins, indexes, transactions and database design interview questions.

50 results

1
SQLBeginner#fundamentals

What is SQL?

Open
2
SQLBeginner#fundamentals

What is the difference between DBMS and RDBMS?

Open
3
SQLBeginner#ddl#dml

Difference between DELETE, TRUNCATE and DROP?

Open
4
SQLIntermediate#joins

Explain all types of JOIN with an example.

Open
5
SQLIntermediate#joins

What is a SELF JOIN?

Open
6
SQLIntermediate#aggregates

Difference between WHERE and HAVING?

Open
7
SQLIntermediate#queries

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

Open
8
SQLBeginner#keys

Primary key vs unique key vs foreign key?

Open
9
SQLBeginner#keys

What is a composite key?

Open
10
SQLIntermediate#keys

What is a candidate key and a super key?

Open
11
SQLIntermediate#normalization

What is normalization? Explain 1NF, 2NF and 3NF.

Open
12
SQLAdvanced#normalization

What is BCNF?

Open
13
SQLIntermediate#normalization

What is denormalization and when do you use it?

Open
14
SQLBeginner#sets

UNION vs UNION ALL?

Open
15
SQLIntermediate#sets

What are INTERSECT and EXCEPT/MINUS?

Open
16
SQLIntermediate#indexes#performance

What is an index? What are the trade-offs?

Open
17
SQLAdvanced#indexes

Clustered vs non-clustered index?

Open
18
SQLAdvanced#indexes#performance

What is a covering index?

Open
19
SQLAdvanced#indexes#performance

Why might an index not be used by a query?

Open
20
SQLIntermediate#subqueries

What is a subquery? Correlated vs non-correlated?

Open
21
SQLIntermediate#subqueries

Difference between IN, EXISTS and JOIN?

Open
22
SQLIntermediate#queries#cte

What is a CTE (Common Table Expression)?

Open
23
SQLAdvanced#cte

How do you write a recursive CTE?

Open
24
SQLIntermediate#views

What is a view? What is a materialized view?

Open
25
SQLIntermediate#transactions

Explain the ACID properties.

Open
26
SQLAdvanced#transactions

What are transaction isolation levels?

Open
27
SQLAdvanced#transactions

What is a deadlock and how do you avoid it?

Open
28
SQLAdvanced#transactions#concurrency

What are optimistic and pessimistic locking?

Open
29
SQLIntermediate#procedures

What is a stored procedure and how does it differ from a function?

Open
30
SQLIntermediate#triggers

What is a trigger?

Open
31
SQLBeginner#aggregates#nulls

What are aggregate functions and how do NULLs affect them?

Open
32
SQLBeginner#nulls

How do you handle NULL values in SQL?

Open
33
SQLBeginner#functions

What is the difference between COALESCE and CASE?

Open
34
SQLAdvanced#windows

What is a window function?

Open
35
SQLAdvanced#windows

Difference between ROW_NUMBER, RANK and DENSE_RANK?

Open
36
SQLAdvanced#windows

What do LAG and LEAD do?

Open
37
SQLIntermediate#queries#windows

How do you find the Nth highest salary?

Open
38
SQLIntermediate#queries

How do you find and delete duplicate rows?

Open
39
SQLIntermediate#queries

How do you find employees earning more than their department average?

Open
40
SQLIntermediate#joins#queries

How do you find records in table A that are missing in table B?

Open
41
SQLBeginner#datatypes

CHAR vs VARCHAR vs TEXT?

Open
42
SQLAdvanced#performance

What is the difference between an execution plan and EXPLAIN ANALYZE?

Open
43
SQLAdvanced#performance

How do you optimise a slow SQL query?

Open
44
SQLAdvanced#scaling

What is partitioning and how does it differ from sharding?

Open
45
SQLIntermediate#architecture

OLTP vs OLAP?

Open
46
SQLIntermediate#security

What is SQL injection and how do you prevent it?

Open
47
SQLAdvanced#aggregates

What is GROUP BY with ROLLUP?

Open
48
SQLIntermediate#queries#performance

How do you paginate results efficiently?

Open
49
SQLBeginner#fundamentals

What are DDL, DML, DQL, DCL and TCL?

Open
50
SQLIntermediate#joins

What is the difference between a natural join and an equi join?

Open