CSE Roadmap

Core tier · about 2 hours · 5 parts

Part 2 of 5 · 1 min read

The four pieces, named precisely

Table, row, column and schema, stated as exact, reusable definitions.

Think of a spreadsheet with a fixed, named set of columns across the top. Every row below must fill in a value for each column, or explicitly leave it blank. No row is allowed to mean two different things at once.

In plain words: a relational database stores data as a set of tables. A table has a fixed set of named columns, decided in advance. Every row in a table is one record. A row holds exactly one value per column. The set of column names and types, for one table, is that table's schema. The schema for every table together is the database's schema.

A worked example. The customers table has three columns: customer_id (a whole number), full_name (text), address (text). One row might be (107, "Asha Rao", "14 MG Road, Pune"). That row is one customer. Every other row has the same three columns, in the same order, holding different values.

The key lines. The schema from the previous module, shown again because this page is about naming its pieces precisely:

CREATE TABLE customers (
    customer_id INTEGER PRIMARY KEY,
    full_name   TEXT NOT NULL,
    address     TEXT NOT NULL
);

Table, schema, instance

A table is a named set of columns, plus every row currently stored under them. A schema is the structure alone: the column names and types. It stays fixed. An instance is the actual rows a table holds right now. It changes as data is inserted, updated or deleted.

Example: customers(customer_id, full_name, address) is a schema. The 400 actual customer rows stored under it, today, are one instance of that schema. Tomorrow's 401 rows would be a different instance of the exact same schema.