Databases

A database is the organized, persistent storage sitting behind the HTTP response from the previous topic, and this very article is a real row inside one. Data modeling is the design step of deciding what real-world entities a database needs to represent and what facts matter about each one — for this site's own glossary, that means deciding a glossary entry needs an id, a slug, the response text itself, searchable keywords, and a creation timestamp, which becomes a concrete table design before a single row gets inserted. A relational table generalizes the array-of-records idea from the data-structures topic into rows and columns with a fixed schema: every row is one entity (one glossary entry, one user, one order) and every column is one fact about it, and a primary key — usually a unique id, exactly like the id values this series has been assigning to each new topic — identifies each row unambiguously so other tables can reference it instead of duplicating its data. SQL is how a program actually talks to that table, and it is a genuinely different paradigm from the four the programming-paradigms topic already covered: it is declarative, meaning a query states what result is wanted (`SELECT response FROM articles WHERE slug = 'databases'`) without spelling out the step-by-step procedure to find it, leaving the database engine free to decide the fastest way to actually execute it. An index is the concrete reason that freedom matters: without one, finding a single row by slug means scanning every row in the table one at a time, but an index built on that column is exactly a hash table or a tree from the data-structures topic, maintained automatically as rows change, turning a slow linear scan into the same fast lookup a hash table or a binary search tree already provided for in-memory data. A transaction groups several operations — like inserting a new article's row and bumping a shared cache-version counter — into a single all-or-nothing unit: either every operation inside it succeeds and commits together, or any failure rolls every single one of them back, guaranteeing the database is never left in a half-finished state, directly satisfying the correctness guarantee the algorithm-analysis topic argued every piece of software actually needs. None of this is abstract for this series specifically: every topic deployed so far was inserted as one transaction, looked up afterward by exactly the kind of index described here, and the next topic, software engineering, is what organizes the surrounding process — requirements, design, testing, version control — that turned each of these topics from an idea into a row safely committed to a real production database.

Decide what to store
data modeling: entities, facts, relationships
Rows and columns, fixed schema
a relational table, with a primary key per row
SQL asks for data declaratively
state what you want, not the step-by-step procedure
An index makes the lookup fast
a hash table or tree built on the queried column
A transaction makes the write safe
every operation commits together, or none of them do
This Article Is a Row in a Real Table Fixed columns, one row per glossary entry id slug response keywords created_at … databases-tables-sql this entire article database, sql, index 2026-10-25 primary key data modeling happened before any row existed: someone decided a glossary entry needs exactly these five facts SELECT response FROM qa_responses WHERE slug = 'databases-tables-sql-indexes-transactions' a declarative query — the engine decides how to actually find the row every other article in this series is a different row in this same table with the exact same five columns
Index: Why This Lookup Was Instant Same idea as the hash table from data structures Without an index check row 1, check row 2, check row 3, all the way to this row — a full scan O(n) — exactly linear search With an index on slug the engine jumps straight to the matching row — a hash table or tree lookup average O(1) or O(log n) a transaction is how this series' own deploy script works: BEGIN — insert the new row — bump the cache counter — COMMIT if the byte-count check after the insert ever failed, the whole transaction rolls back and nothing is left half-written

Take databases further

Ask the copilot about this term, or have our engineers assess it against your process.