Tables, rows and columns
A relational database stores data in tables. Each table holds one kind of thing — customers, orders, products.
A row (or record) is one instance: one customer. A column (or field) is one attribute of every instance: the customer's email. Every column has a data type that constrains what it can hold.
Primary keys
A primary key uniquely identifies each row. No two rows share one, and it can never be null.
customers
----------------------------
customer_id name city
1 Ana Houston
2 Ben Dallas
Here customer_id is the primary key. Most tables use a generated integer or UUID rather than something meaningful like an email, because real-world values change.
Foreign keys and relationships
A foreign key is a column that points at another table's primary key.
orders
---------------------------------
order_id customer_id total
101 1 250.00
102 1 75.00
103 2 120.00
orders.customer_id references customers.customer_id. Ana has two orders, Ben has one — a one-to-many relationship, the most common shape you will meet.
That relationship is why joins exist, and why a join can multiply rows: joining customers to orders gives Ana two rows, not one.
Why the structure matters
Splitting data across related tables avoids repetition. Ana's address is stored once, not copied onto every order she places, so correcting it is one update rather than many.
The cost is that answering a question usually means recombining tables, which is what most of SQL is about.