Foreign Key
Amit only reaches for Foreign Key when lookup by roll has to stay correct in a big table.
Foreign Key order — meaning → PRIMARY KEY(roll) + INDEX → one limit. Dumping ten features helps nobody.
Without Foreign Key, a big table gets messy and lookup by roll is hard to trust.
Use Foreign Key when lookup by roll must stay clear. If a simpler SQL step works, use that instead.
Foreign Key miss — indexing a low-cardinality flag only. Fix it before you talk about advanced SQL.
Place Foreign Key next to nearby SQL work — PRIMARY KEY(roll) + INDEX is the link.
One breath for Foreign Key, then lookup by roll, then indexing a low-cardinality flag only. Sit down.
students.id ← PK (unique)
▲
│ FK
marks.student_idBoard: lookup by roll. Dry-run Foreign Key. Name the trap: indexing a low-cardinality flag only.