basics01Chapter 1 of 6
Tables, rows, columns
A database keeps data in tables. Each table holds one kind of thing, a bit like one sheet of a spreadsheet, only stricter.
A database is a set of tables
The Byte Shop, the little game shop of the course, has a database with three tables: products for what is on the shelf, customers for the people who buy, and orders for who bought what.
Rows and columns
A row is one thing: one product, one customer, one order. A column is one property that every row has: a name, a price, a date.
Move the pointer over the table, or click into it and use the arrow keys. The row and the column of the cell light up.
| idINTEGER | nameTEXT | categoryTEXT | priceREAL | stockINTEGER | releasedINTEGER |
|---|---|---|---|---|---|
| 1 | Super Comet | Game | 29.99 | 14 | 1991 |
| 2 | Retro Box | Console | 149.0 | 3 | 1994 |
| 3 | Arcade Stick | Accessory | 59.5 | 0 | 2019 |
| 4 | Dungeon Dash | Game | 20.0 | 22 | 2012 |
| 5 | Pocket Glow | Console | 89.0 | 0 | 1989 |
- Point at a cell to see what it is.
Data types
Every column says what kind of value it holds. SQLite knows only a few basic types; the Byte Shop uses three of them, plus NULL for a missing value.
- INTEGERWhole numbers: ids, stock, years.
- REALDecimal numbers: prices.
- TEXTText: names, cities, and dates like 2026-01-04.
- NULLNo value at all. Not the number 0 and not empty text, but unknown or missing: Ben has no e-mail address on file.
Why it matters: a price is a number, so the database can sort and add prices correctly. Stored as text, "9.99" would come after "149.0".