How does the lunch line know which Felix is which?
Lesson 3.1 · Two Sams, Zero Mix-ups
Felix
Two Sams. Zero mix-ups. Not because of the name.
There are two Sams in Felix’s grade.
The lunch line has never once charged the wrong one. The library has never handed the wrong Felix a fine.
Something in the system tells them apart, and it isn’t the name.
The short answer
The card carries a student ID, not a name. The system looks up the ID, finds one row, charges that row. The name on the row is just for the person at the register to say hi.
Try it yourself
The office is building a Students table. Tap every column that belongs in it.
Tap everything that fits, then check.
What you just did has a name
Table, row, column, ID
A table holds one kind of thing.
Each row is one of them. Each column is one fact about it.
The ID column is a made-up number that belongs to exactly one row, so two Sams stay two rows.
A few more things
IDs are boring on purpose
A student ID means nothing. That’s the point. Names repeat, addresses change, birthdays collide. A number the system made up never does any of that, so everything links to it.
One thing per table
Students in one table. Lunch purchases in another. Library loans in a third. Mixing them into one giant sheet is how you end up typing Felix’s name 400 times and misspelling it 12.
Every row is the same shape
Every student has the same columns, even if a few are blank. That shape is what makes a table structured, and it’s what lets a computer sort and count it without reading it.
Go deeper
The longer version, if you want it.
Keys
The ID column that identifies a row is called the primary key. When another table stores that same ID to point at the student, like the lunch purchases table storing the student ID on every purchase, that copy is called a foreign key. The pair is how tables link.
Good primary keys never change and never repeat. That rules out names, emails and phone numbers, all of which people change. Made-up numbers win.
Quick check
A vet clinic keeps a Pets table. Two dogs named Max come in the same week. What keeps their records from merging?
Let’s take it slower
Think of a table as a class roster. Every kid is a row. Every heading, name, grade, homeroom, is a column, and every kid gets a value under each one. Now the ID: it’s the number printed next to each kid’s spot, and it never changes, even if the kid changes their name or moves. When any other system wants to talk about that kid, it says the number, not the name. Numbers don’t have twins.
More examples
Your order number
When a store texts “order 48213 has shipped,” that number is the ID of one row in their Orders table. Your name is on thousands of orders across the country. That number is on exactly one, which is why support asks for it first.
The team roster
A coach’s roster is a table: one player per row, columns for position, jersey and phone. Two Jordans on the team are still two rows. If the coach used names as the ID, one Jordan would get both fines.
Back to the question
So how does the lunch line tell the Sams apart?
Show the answer
The card carries a student ID, not a name. The system looks up the ID, finds one row, charges that row. The name on the row is just for the person at the register to say hi.
More on this: What is a database?
One last question
Ashley asks what an ID column is for.
Talk Card
Talk Card · 3.1
A table is one kind of thing, one row each, one fact per column. The ID column is a made-up number that keeps two Sams from becoming one.
Data to AI · pettigrewlab.com/learn
