Video in progress
What do table, row and column mean in a relational database, and where does the word "relational" come from?
A table is a collection of things of one kind (say, users), a row is one record, a column is one attribute of every record. "Relational" means tables are linked to each other through keys.
📖 Answer
Say you have a users table. Each row is one user, and the columns are id, email, created_at. Every column has a strict type: email is text, created_at is a timestamp. You can't put a number in one row and a date in the next in the same column, and the database enforces that.
CREATE TABLE users (
id bigint PRIMARY KEY,
email varchar(255) NOT NULL,
created_at timestamptz NOT NULL DEFAULT now()
);
CREATE TABLE orders (
id bigint PRIMARY KEY,
user_id bigint NOT NULL REFERENCES users(id), -- the link is here
total numeric(12,2) NOT NULL
);
The name actually comes from the mathematical term "relation" (a set of tuples), but in practice developers read it as "tables are linked to each other". An order doesn't copy the user; it stores only the user's id, and when you need the user you combine the two with a JOIN.
PostgreSQL, MySQL, Oracle all work on this model and are queried with SQL.
Sign up to mark studied questions and save your progress.