0
Challenge · 82CS Fundamentals

Keys and normal forms

DBMSused in ~88% of apps

Primary key, candidate key, super key, foreign key, and then three normal forms with definitions that sound like law. It is the most reliably asked DBMS topic and the one most often answered by reciting words nobody understood.

Core idea. A super key is any set of columns that identifies a row uniquely. A candidate key is a super key with nothing spare in it. The primary key is whichever candidate you picked. Normal forms are rules for removing repeated facts, and every one of them is about a column that depends on the wrong thing.
Playground, this isn't a screenshot
tick the behaviours an item needs
with inheritance
class PlainItem
One class per combination. Three behaviours need 8 classes, and a fourth needs 16.
with composition
traits: []
One item, a list of behaviours. Three behaviours need 3 functions, and a fourth needs 4.

Inheritance grows as two to the number of behaviours. Composition grows as the number of behaviours.

↑ play a little first, then dig in