Primary Key
If you can teach Primary Key using lookup by roll, you know it. If you only know the heading, you don’t.
Do Primary Key once by hand. PRIMARY KEY(roll) + INDEX. Change one input. Say the new result out loud.
Primary Key exists so Meera can keep lookup by roll correct in a big table.
Use Primary Key when lookup by roll must stay clear. If a simpler SQL step works, use that instead.
Don’t do this with Primary Key — indexing a low-cardinality flag only. Interviewers spot it in ten seconds.
Primary Key is not a lonely heading. Meera ties it to lookup by roll.
Close Primary Key with — “If I skip it, lookup by roll goes wrong like this: indexing a low-cardinality flag only.”
students.id ← PK (unique)
▲
│ FK
marks.student_idBoard: lookup by roll. Dry-run Primary Key. Name the trap: indexing a low-cardinality flag only.