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 082 / 136
IntermediateBasic SELECT

Constraint Practice: Add CHECK constraint variant #8

The query

SQL
ALTER TABLE practice_table_8
ADD CONSTRAINT chk_data_8 CHECK (LENGTH(data_value) > 3);
Tested against PostgreSQL 16

Note

“Ensuring data integrity through check constraints (Pattern #8).

← Previous

DDL Practice: Create table variant #8

Next →

DDL Practice: Create table variant #9

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