System Design
4. Database FundamentalsAnimated
Database Constraints
Rules the database enforces on data.
The idea
NOT NULL, UNIQUE, CHECK and foreign keys stop bad data at the source.
Watch it work
Press play, pause, or step through. Some animations have settings you can change.
- client
- gateway / proxy
- service
- cache
- data store
- queue / stream
Presentation tier: the browser shows the interface.
- step:
- 1/4
- at:
- Browser
1/9
The green dot is a request moving through the system.
Step by step
- 1Declare the rule on the table
- 2The database checks every write
- 3Violations are rejected
- 4Applications handle the error
Where it is used
Data integrity.
Watch out for
Relying only on application validation.