The class attendance binder
A school binder has a page per class, each a table of rows (students) and columns (name, grade, ID). The ID column is the key — the unique thing that tells two students named Alex apart. Relational databases store data in exactly these keyed tables.
Data in rows and columns
A relational database stores data in tables. Each row is a record; each column is a field. A primary key is a column whose value uniquely identifies each row. A foreign key in one table points to the primary key of another, linking them.
students(id PK, name) enrollments(id PK, student_id FK, course)
Lab · Pick the key
- In a students table with id, name, and email, which column best uniquely identifies a row?
- Decide why name is a poor choice.
- Name the column that links enrollments to students.
What you should see: id is the primary key (unique); names can repeat. student_id is the foreign key linking to students.