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.

Tables in byte-shop.db
byte-shop.db3 tables

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.

products5 of 13 rows
idINTEGERnameTEXTcategoryTEXTpriceREALstockINTEGERreleasedINTEGER
1Super CometGame29.99141991
2Retro BoxConsole149.031994
3Arcade StickAccessory59.502019
4Dungeon DashGame20.0222012
5Pocket GlowConsole89.001989
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.

types
  • 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".