E-Learning Platform
0 of 139 builtAlways freeSign in
← Database Foundations I
1.02

Tables, Rows & Columns

On this stop
  • Tables
  • Records & rows
  • Fields & columns

Last lesson you stood outside the library. Time to pull open a drawer and see how the facts are actually kept. The answer is pleasingly plain: in grids. Nearly every database you'll ever meet keeps its facts in tables — and once you can read a table, you can read most of the data in the world.

One table, one kind of thing

A table is a drawer in the library with a firm rule: it holds one kind of thing, and only that kind. A drawer for members. A drawer for books. A drawer for loans. The drawer's label tells you what lives inside.

Here's a table a school might keep — read it once, then let's take it apart:

Up closeText
students
id | name       | age | class
---+------------+-----+--------
1  | Sara Ali   | 14  | Music
2  | Marcus Lee | 15  | Art
3  | Amara Obi  | 14  | Music

Rows: one card per thing

Read the grid across, and each line is one student. Row 2, read aloud, says: "Marcus Lee, fifteen, takes Art." In library terms, a row is one index card — everything the drawer knows about one member. Databases call one row a record, and the two words are used interchangeably: one row, one record, one actual thing in the world.

New student joins? A new card goes in the drawer — a new row, and only a new row. The grid grows downward.

Columns: one fact about everything

Now read the grid down. The age column is every student's age, in one line. A column is one kind of fact that every card in this drawer carries — a labeled blank on the card, if you like. Databases call these fields. When someone says "the name field," they mean the name column, the blank where every record keeps its name.

So one grid answers two shapes of question. Across a row: "tell me everything about Marcus." Down a column: "tell me everyone's age." Keep both directions in your head; the next unit turns each into a question you can actually ask.

The one-kind rule earns its keep

Here's the classic beginner mistake: the everything drawer. Students and teachers feel similar, so why not one people table? Because the cards stop matching. Teachers have salaries; students don't. Students have guardians; teachers don't. Soon half your columns are blank on half your rows, and "how many students are 14?" quietly counts a teacher who joined the staff at 14... years ago. When two kinds of thing share a drawer, keep them in two tables. Drawers are free.

You can now read any table like a librarian: label for what kind, rows for each one, columns for each fact. But look again at that age column — what stops someone from writing "fourteen" in one row and 14 in another? Nothing yet. Next lesson, every column gets a type, and the drawers start enforcing standards.