Tap a column in the orders table below and try typing a word where a number belongs.
| 101 | 1 | Running shoes | 89 |
| 102 | 2 | Desk lamp | 34 |
| 103 | 1 | Headphones | 149 |
| 104 | 3 | Coffee grinder | 59 |
| 105 | 2 | Monitor arm | 72 |
Tap a column name. A column is one kind of fact that every row has — the rows go down, the facts go across.
The database refused. Every column has a type, every row is one order, and the whole grid is a table.
PostgreSQL's tutorial: "Each table is a named collection of rows. Each row of a given table has the same set of named columns, and each column is of a specific data type."
orders
order 1
- user_id
- 1 (Ana)
- item
- Mug
- total
- 12.00
order 2
- user_id
- 1 (Ana)
- item
- Poster
- total
- 20.00
order 3
- user_id
- 2 (Ben)
- item
- Mug
- total
- 12.00
Every row gets an ID that never repeats. It's how the app points at exactly one thing.
The user_id column is the bridge: it holds the ID of a row in the users table. That's how "Ana's orders" are found.
It's also the column the security rules use. "Show people only rows where user_id is them" is exactly what Row Level Security does.
Try it with the rules off. In the sandbox, delete Ana from the users table while her orders still point at her. A careful database stops you or tidies up; with the rules off, you get orders that belong to nobody.
Check yourself
0/4 got itSaved on this device only. No account, no streaks.
Next in where your data lives: What is a query?.




