Schema And Constraints
Schema and Constraints
Designing a schema that's correct, fast, and evolvable — types, keys, references, and the normalisation forms in plain English.
Suggest an editSchema and Constraints
Foundations covered DDL syntax. This module covers schema design — choosing types, modelling relationships, deciding when to normalise and when to denormalise, and the cascade of foreign-key behaviours that makes referential integrity a first-class concern.
Place in the curriculum
- Prerequisites: Data Definition for the syntax. Joins and Anti-joins for the queries that motivate FK constraints.
- Followed by: Indexes and Performance. Schema choices determine which indexes are useful.
Chapters
- Types — choosing the right type for each column. Numeric, text, temporal, JSON, arrays.
- Keys and References — primary keys, foreign keys,
ON DELETE/ON UPDATEcascade behaviour, unique and check constraints in depth. - Normalisation — 1NF, 2NF, 3NF, BCNF in plain English. When to normalise; when to denormalise for performance.
Mark as read