Interview Q&A / PostgreSQL
PostgreSQL interview questions
Indexes, EXPLAIN, transactions and isolation, JSONB and the Postgres specifics backend interviews probe.
Prefer rapid revision? Practise PostgreSQL short interview answers →
- What is a CTE (WITH clause) and why would you use one?
A common table expression names a subquery at the top of a statement so you can read it in steps and reuse it more than once. It improves readability; since PostgreSQL 12 a simple CTE is usually inlined like a subquery.
BeginnerQuick answer1 min read - Why does WHERE col = NULL return no rows in PostgreSQL, and what should you use instead?
NULL means unknown, so comparing anything to it with = gives NULL, not true, and WHERE keeps only true rows. Use IS NULL, or IS NOT DISTINCT FROM when you want NULLs treated as equal.
BeginnerQuick answer1 min read