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 →
- How do you use a CHECK constraint, and what does it ignore?
CHECK rejects a row when a boolean expression on its columns is false. It passes when the result is true or NULL, so pair it with NOT NULL when the column must always be present. It cannot see other rows.
BeginnerQuick answer1 min read - What do ON DELETE CASCADE, RESTRICT, SET NULL and NO ACTION mean on a foreign key?
They decide what happens to child rows when the parent row is deleted. CASCADE deletes the children, SET NULL clears the reference, RESTRICT blocks the delete immediately, and NO ACTION blocks it at the end of the statement (the default).
BeginnerQuick answer1 min read