Databases
ER model, keys and relational algebra
Entities, relationships, the kinds of key, and the operators that build queries.
In two minutes
One idea to a line
A superkey determines every attribute. A candidate key is a minimal superkey. The primary key is the one candidate key chosen; the others are alternate keys.
A foreign key refers to a candidate key of another relation (or the same one) and enforces referential integrity.
Selection (σ) picks rows, projection (π) picks columns and removes duplicates, join (⋈) combines relations on a condition.
A many-to-many relationship becomes its own table whose key combines the keys of both sides.
A weak entity has no key of its own and depends on an owner entity.
Slips people make here
Interviewers know them too
Calling any set of attributes that is unique a candidate key without checking it is minimal.
Forgetting that projection removes duplicate rows in relational algebra (SQL does not unless asked).
Thinking a foreign key must be a primary key: a candidate key is enough.
Your practice here
Not started
13 written questions, and 2 kinds of calculation that change every time
No answers yet