What is a relational database and how does it organize data?
Take a moment.
Say your answer out loud or write it down first — retrieval is what makes it stick. Reveal when you're ready.
Short answer
A relational database stores data in tables (rows and columns) with a fixed schema, where rows relate to each other through keys. You query and manipulate it with SQL, and the engine enforces structure, types, and relationships so data stays consistent.
Detailed explanation
The relational model organizes data into tables: each table has named columns with fixed types (INTEGER, TEXT, TIMESTAMP) and rows holding one record each. A schema declares the tables, columns, constraints, and relationships up front, so every write is validated. Tables connect through keys: a primary key uniquely identifies each row, and a foreign key in one table points at a primary key in another, letting you JOIN related rows at query time instead of duplicating data. SQL is the standard language for all of it — SELECT to read, INSERT/UPDATE/DELETE to write, CREATE TABLE/ALTER TABLE to evolve the schema. The engine guarantees durability (data survives crashes via write-ahead logging) and lets many clients query concurrently. Classic examples are PostgreSQL, MySQL, and SQLite. The model's strength is structured data with clear relationships and a need for correct, queryable records — orders linked to customers, posts linked to authors.
Example
-- Two related tables linked by a foreign key
CREATE TABLE customers (
id SERIAL PRIMARY KEY,
email TEXT UNIQUE NOT NULL
);
CREATE TABLE orders (
id SERIAL PRIMARY KEY,
customer_id INTEGER NOT NULL REFERENCES customers(id),
total_cents INTEGER NOT NULL,
placed_at TIMESTAMPTZ DEFAULT now()
);
-- Reassemble the relationship at query time
SELECT c.email, o.total_cents
FROM orders o
JOIN customers c ON c.id = o.customer_id;Interview tip
Name the three building blocks — tables, keys, SQL — then give one concrete two-table example. Mentioning that joins reassemble relationships at query time shows you think relationally.
Common mistakes
- Describing tables without mentioning keys and relationships.
- Forgetting that the schema is enforced on every write.