Interview Q&A · questions with model answers
SQL & Databases Interview Questions
Part of the study plan for: Backend Engineer · Full Stack Engineer · Data Engineer
Ordered by how often they're asked. Most-asked answers are free to read in full; members see every answer and can rate their confidence on each.
-
SQL interview: explain UNION vs UNION ALL.
UNION dedupes; UNION ALL keeps duplicates and is cheaper.
-
SQL interview: explain EXISTS vs IN.
EXISTS often efficient for existence checks; NULL pitfalls with IN.
-
Data modeling: surrogate vs natural keys?
Surrogates stable; naturals meaningful but can change.
-
Data modeling: OLTP vs OLAP?
Transactional point queries vs analytical scans/aggregations.
-
Indexing/performance: sequential vs index scan?
Planner chooses based on selectivity/stats.