SelectFromData
AnalyticsLesson 2 of 4 · 10 min

Tables, Rows, and Columns — It's a Spreadsheet, With Rules

Everything in a database lives in tables. If you can read the next picture, you can read a database.

The one mental model

A table is a grid, like a single spreadsheet tab:

  • Each column is one kind of fact, with a name and a type: product (text), quantity (a number), order_date (a date).
  • Each row is one real-world thing or event: one order, one customer, one appointment.

Here's an orders table, exactly the kind you'll query in a minute:

order_idproductquantitystatus
1Espresso Beans5completed
2Filter Beans4completed
3Ceramic Mug5completed
4Gift Card2completed
5Espresso Beans10cancelled
order_idproductquantitystatus
1Espresso Beans5completed
2Filter Beans4completed
3Ceramic Mug5completed
4Gift Card2completed
5Espresso Beans10cancelled
The orders table: each ROW is one order, each COLUMN is one fact about it.

Read row 1 out loud: order number 1 was for 5 Espresso Beans, and it was completed. That's all a row is — one recorded fact, spread across named columns.

"With rules" is what makes it trustworthy

The difference from a spreadsheet is discipline, and it's a feature:

  • Every row has the same columns. No surprise notes scribbled in column H. If the column is quantity, every single row has a quantity.
  • Every column has one type. A number column holds numbers — never "five-ish". So when SQL sums it, the sum is right.
  • Nobody edits cells by hand. Data arrives from systems (the till, the website, the app). Your job is to question it, not to type into it.

That discipline is why a company will bet money on a number that came from SQL, in a way they never would on "a spreadsheet someone maintains".

Key idea

Columns are the questions a table can answer; rows are the evidence. When you face a new table, read its column names first — they tell you what you can ask it.

Databases hold many tables

A real database is a collection of tables that reference each other. The coffee shop has orders (one row per sale) and products (one row per item it sells, with its price and category). Later you'll learn to combine them — that's the famous JOIN — but one table at a time is plenty for today.

Check yourself

In the orders table above, what does ROW number 5 represent?

Up next

You know what a table is. Time to ask one a question — for real, in your browser, right in the next lesson.