Vol. I · A Postgres HandbookTwelve chapters · · 756 queries

The Query & the Schema

A reading-room reference for writing PostgreSQL by hand — selects to window functions, with the schema in plain view.

FrontChaptersSchemaColophon
Chapters · Basic SELECT · Query 032 / 136
EasyBasic SELECT

Find employees with salary NULL

The query

SQL
SELECT emp_id, first_name, last_name, job_title
FROM employees
WHERE salary IS NULL;
Tested against PostgreSQL 16

Note

“IS NULL finds rows where salary was never set. Use COALESCE to replace NULLs in display.

Tables referenced

  • employees10 cols

← Previous

List all projects with their status and budget

Next →

Show customers grouped by country with count

The Query & the Schema

Set in Fraunces and Inter Tight. Printed on parchment, in oxblood and ink. No tracking, no accounts, no JavaScript on the answer pages beyond what your browser needs to copy a query.

Compiled for Postgres 16 · MMXXVI