Data Storage

How SQL databases store data in tables.

Tables, Rows, and Columns

SQL databases organize data into tables. A table is like a spreadsheet. Each row represents a single record (e.g., a user), and each column represents an attribute of that record (e.g., username).

Primary Key

A column (or set of columns) that uniquely identifies each row in a table. Usually a simple auto-incrementing integer named `id`.

Visualizing a Table

  [authors] table
+----+------------+
| id | name       |  <-- Columns (Attributes)
+----+------------+
| 1  | Alice      |  <-- Row (Record)
+----+------------+
| 2  | Bob        |  <-- Row (Record)
+----+------------+