BEGINNER · 12 MIN · FREE LESSON
ER modelling
Explore er modelling through a visual, step-by-step model.
Loading interactive lesson…
BEGINNER · 12 MIN · FREE LESSON
Explore er modelling through a visual, step-by-step model.
Loading interactive lesson…
Small customers/orders relations. Customer and order IDs are primary keys; nullable customerId is a foreign key. SQL equality never matches NULL. Duplicates and orphan keys are reported; enforced constraints reject the example relation before query execution. JOIN outputs preserve bag multiplicity. Query-order mode applies WHERE before grouping, then HAVING, ORDER and LIMIT.
Loading architecture diagram…
Identify entities, keys and the one-to-many relationship before evaluating a query.
C customers, O orders and G groups. This is an explicit logical query evaluator, not PostgreSQL optimizer order or a claim about indexed/hash joins.
Join comparisons, seed 42. Plotted sample sizes respect each lesson’s explicit input limits.
Keyboard: Space play/pause · ←/→ step · R restart · 1–5 speed. Reduced motion disables transitions.
The line between Customer and Order is a rule about valid data, not decoration.
Inspect the relation or dependency state, then follow each validated decision. Use presets first; custom JSON preserves the displayed schema and bounds.
Customer and Order are entities. Each customer may own zero or many orders; each order references zero or one customer because the foreign key is nullable. Enforce distinct order IDs, customer identity and existing non-null references. A mandatory relationship would additionally need NOT NULL. Many-to-many relations need an association entity and a unique pair or its own key.
Try an order without a customer, an orphan customerId and duplicate entities. Explain which changes require a new relationship constraint. Predict the next constraint, match or dependency decision before advancing.
The player names its measured operation and reports the core model cost. Separate fixture construction and index maintenance from the operation being measured; the displayed assumptions name each bound. These are teaching algorithms, not real database latency benchmarks.
Four language references implement the core mechanism over validated example data. The reference containers illustrate the declared model scope; real persistence, distributed coordination, recovery and provider limits require their own implementation. The interactive prose identifies baseline references or additional player experiments explicitly.
Before choosing table keys, relationship constraints and ownership boundaries.
Cardinality and optionality are separate choices. An ER diagram does not enforce a database constraint or prove that a business identifier is unique. The model implements one optional one-to-many relationship, not a general ER editor.
Explain a valid result, name the governing invariant and distinguish logical semantics from a physical implementation.
MAKE IT STICK
Progress saves on this device and merges with your account after sign-in.
0 / 5000 · Saved on this device; synced when signed in.