Data Modelling Basics: Entities, Keys, Relationships
With foreign key checks off, SQLite accepted a repair for bike 99, which does not exist.
Video #250 ยท Data modelling
Steps in the video
- 0:00 A repair for a bike that does not exist
- 0:33 The idea
- 1:06 Setup
- 1:25 Customer and bike
- 1:58 Mechanic and repair
- 2:25 Made-up rows, and the connection
- 2:53 The diagram, from the schema
- 3:28 Three attempts and a join
- 3:48 Run the diagram
- 4:38 What this does not show
- 5:03 Mistakes to avoid
- 5:43 My take and next steps
- 6:10 Recap
Files
- erd.py (20 lines)
- run.py (41 lines)
- schema.py (47 lines)
Tested with
Python 3.12.15
What this does not show
A made-up four-table bike shop in SQLite; it does not cover many-to-many relationships, deletes or a graphical diagram.
Sources
Learning IT by Example.