SQL Quest · episode 00 · world 1

A Short Story
of SQL

A boring-titled paper, a word game, a startup that beat IBM, and a language that was declared dead and came back stronger. This is how 50-year-old SQL still runs the data world. Grab a tea and start the timer.

2026-11-16·10 min read·#sql #history #postgresql

rainy night · SELECT on screen · study cat on duty (asleep)

1 · start the timerThe Pomodoro timer in the corner gives you 25 minutes of focus. Rain sounds are optional.
2 · read a chapterHover the purple terms for a quick definition.
3 · reach the save pointRead the cat's tip, tick "cleared", then try the quiz at the end.

// level map: 1960s → today

Every banking app, every flight booking, every dashboard your boss opens: somewhere underneath, there's a SELECT finding one row among billions in milliseconds.

In the 1960s, the same job meant a programmer writing pages of custom code just to find your record on a disk. SQL is older than the internet and older than the PC, trendy tools have tried to replace it, and it's still here, more popular than ever.

How does a 50-year-old language beat everything? Let's play through it, one level at a time.

level 011960s

The dark ages of data

Picture this. It's 1965, and your boss walks over: "How many customers in Milan ordered more than 100 lamps last year?" Today you'd type one line of SQL. Back then? You'd say "give me two weeks."

Data lives in one of two shapes. In the hierarchical model (like IBM's IMS) it's a family tree: a customer owns orders, each order owns items. In the network model (CODASYL) it's a web of records tied together by physical disk addresses, called pointers.

Imagine a library where books aren't sorted by title, but tied to each other with ropes. To find one book, the librarian starts at the door, follows the blue rope to shelf 4, jumps to shelf 12, climbs a ladder… And if the library moves a single shelf, every set of directions ever written is wrong.

That was 1960s software: the meaning of the data was glued to where it sat on disk. Move a file, and every program reading it crashed. Ask a new question, and someone had to write a brand-new navigation program.

Someone at IBM is about to ask: what if we cut all the ropes? →

💾 save point · the cat says

Before SQL, data was glued to the disk, and every new question meant a new program.

level 021970

The paper that changed everything

June 1970. Edgar F. "Ted" Codd, a British mathematician, Oxford-educated and working at IBM's lab in San Jose, publishes an 11-page paper with possibly the most boring title in computer history: "A Relational Model of Data for Large Shared Data Banks." Even some colleagues find it too mathematical to read.

But inside it is a revolution, and it fits on a sticky note: separate what the data means from where it's stored. Codd calls this data independence. Store everything as simple tables. Link tables by matching values (a customer ID), not by disk addresses. Then if someone reorganizes the disk, your tables, and your programs, don't even notice.

idnamecity1GiuliaMilan2MarcoRome3TuyenPordenonecustomersrelation= tabletuple= rowattribute= columnmath word → today's word
Codd wrote in math, we speak in tables. Linking tables by matching values (like a customer id) instead of disk pointers is what makes data independence possible.

And the best part: you just say what you want, and the machine works out how to get it.

You don't give the taxi driver directions. You just give the address.

That idea is called declarative. Codd also gives us normalization: rules for splitting data so that every fact lives in exactly one place, and never contradicts itself. In 1981 he receives the Turing Award, the "Nobel Prize" of computing.

1960s · you walk the treequestion: who lives in Milan?customersC1 RomeordordC2 MilanordordC3 Turinordord123456→ follow pointers, one record at a time1970 → · you describe itSELECT nameFROM customersWHERE city = 'Milan'optimizerpicks the route for younameGiulia
Same question, two eras. Left: you write every step. Right: you write the result you want, and the optimizer (the cat) finds the route.

But who will turn a math paper into something people can actually type? →

💾 save point · the cat says

Data independence: programs ask for meaning, not disk locations. Declarative: say WHAT, not HOW.

level 031973–1974

A language anyone could read (almost)

Codd's own query notation is pure math: symbols, quantifiers, subscripts. Beautiful, and terrifying for normal people. So in 1973 IBM starts a research project called System R to build a real, working version of Codd's model, and two young researchers, Donald Chamberlin and Raymond Boyce, get the job of designing its language.

Their first try, SQUARE, uses subscripts you can't even type on a keyboard. So they throw out the math symbols and keep the English. Their secret weapon is a game: one invents a question about the data, the other writes it in the new language, then they swap. Question, answer, question, answer, until it reads like a sentence:

SELECT the name FROM customers WHERE the city is Pordenone.

They call it SEQUEL, and one language now does it all: read data (SELECT), count and sum (COUNT, SUM), change data (INSERT, UPDATE, DELETE) and build tables (CREATE TABLE). Then the lawyers call: a UK aircraft company, Hawker Siddeley, already owns the name "SEQUEL". So they drop the vowels, and SQL is born. That's why both "S-Q-L" and "sequel" are right.

There's a sad twist. In 1974, shortly after the two present SEQUEL to the world, Raymond Boyce dies suddenly of a brain aneurysm, still in his twenties. He never sees his language take over the world.

// the side effect you still feel today

Humans write SELECT first because that's how an English sentence starts. The machine runs FROM first, because it has to find the table before it can pick columns. That's why a SELECT alias doesn't exist yet when WHERE runs.

you write ↓the database runs ↑SELECTFROMWHEREGROUP BYHAVINGORDER BYLIMITFROMstep 1WHEREstep 2GROUP BYstep 3HAVINGstep 4SELECTstep 5ORDER BYstep 6LIMITstep 7
Read the lines: WHERE is step 2, SELECT is step 5. An alias made in SELECT doesn't exist yet when WHERE runs.

Beautiful language. But the bosses have one question: "Isn't this going to be slow?" →

💾 save point · the cat says

SQL was designed to read like English. We write SELECT first, the engine runs FROM first.

level 041979

The skeptics vs. the optimizer

Enterprise bosses aren't impressed. "A computer choosing its own route? It'll never be as fast as code written by hand." If declarative SQL is slow, it's dead on arrival.

Enter Patricia Selinger, a researcher on the System R team. In 1979 she publishes the answer: the cost-based optimizer. Before running your query, the database lists the possible ways to run it (scan the whole table? use an index? join A then B, or B then A?), uses statistics about the tables to estimate what each way will cost in disk reads and CPU, and picks the cheapest.

It's a GPS for your query: same destination, it just picks the fastest road.

Her work proves that a declarative language can be as fast as hand-written code. Nearly every SQL database today, including PostgreSQL, still uses this idea.

// meanwhile, in my lab (2026)

I met Selinger's idea without knowing it. EXPLAIN shows the optimizer's choice and its estimated cost=…, and ANALYZE refreshes the statistics it uses to guess. On a 1-million-row table I never told PostgreSQL to use an index. Once the index existed, the optimizer picked it on its own.

My Lab 1 result on PostgreSQL 16: the optimizer switched plans by itself once the index existed. Hover a bar for details.

IBM now has the model, the language and the optimizer. So why is someone else about to win? →

💾 save point · the cat says

The optimizer estimates the cost of each possible plan and picks the cheapest. That's why SQL can be declarative and fast.

level 051979–1983

The startup that beat IBM at its own game

Here's the plot twist. IBM invented the model, the language and the optimizer, but it's in no hurry to sell any of it. It's making a fortune from its old database, IMS, and a better product would eat those sales.

IBM's researchers publish their papers openly, though. In California, a young entrepreneur named Larry Ellison reads them and thinks: "IBM will sell this one day. What if we sell it first?"

His tiny company, Relational Software, Inc., builds its own SQL database and ships it in 1979, the first SQL database anyone could buy. Their marketing trick? They call it Version 2, because who would trust a Version 1? IBM follows with SQL/DS in 1981 and Db2 in 1983. Ellison's company later renames itself after its product: Oracle.

Oracle also brings its own flavour of SQL, PL/SQL, and with it packages: a way to group functions and procedures that PostgreSQL still doesn't have.

Now everyone wants to sell SQL. What could go wrong? →

💾 save point · the cat says

IBM invented it, Oracle sold it first (1979). Never protect an old product so hard that you skip the new one.

level 061986 →

Everyone speaks SQL. Nobody speaks it the same.

By the mid-1980s, SQL is a gold rush. Dozens of companies sell databases, and each adds its own words to SQL, like Italian in Milan versus Italian in Naples. Same language, different accent, and code written for one database doesn't run on the next.

To stop the chaos, SQL becomes an official standard: ANSI in 1986, ISO in 1987. The first edition is a slim book. Today the standard runs to thousands of pages. Like a dictionary, it gets a new edition every few years:

1986SQL-86first one↳ SELECT…1989SQL-89keys, checks↳ PK / FK1992SQL-92JOIN, CASE↳ everyday1999SQL:1999CTE, triggers↳ updated_at2003SQL:2003window funcs↳ RANK, LAG2016SQL:2016JSON↳ my JSONB
The SQL standard grows one edition at a time. The ↳ lines show what each step added, or where I meet it in my labs. (Newer editions keep coming, like SQL:2023.)

But here's the catch: a standard is a recommendation, not a law. Each database picks the features it likes, in its own way, on its own schedule. That's why every SQL tutorial you'll ever read says "in PostgreSQL it's like this, in MySQL it's like that."

Two of those dialects are about to become very famous, and very free. →

💾 save point · the cat says

The standard is a recommendation, so every database speaks its own dialect.

level 071986–1996

Two free heroes

Every story needs heroes who don't charge money. Ours has two.

Hero #1, the careful professor. At UC Berkeley, Michael Stonebraker has already built a database called Ingres. In 1986 he starts the next one and names it, literally, "Post-Ingres": Postgres. Funny detail: at first it doesn't even speak SQL. In 1994, two students teach it SQL and release it as Postgres95. In 1996 it gets the name it still has: PostgreSQL. Careful, standards-loving, and free.

Hero #2, the fast kid. In 1995, a Swedish company releases MySQL, quick and simple, made for the young web. It ends up powering millions of websites, but it grows up slowly. Look how long it took to get window functions:

200320062009201220152018SQL:2003in the standardPostgreSQL 8.4has them ✓MySQL 8.0finally ✓MySQL arrived 9 years after PostgreSQL
Window functions: from the standard (2003) to PostgreSQL (2009) to MySQL (2018).

MySQL 8.0 is also the release that finally throws out its old query cache, the outdated step you still see in many "how a query works" diagrams.

SQL looks unbeatable. Then the internet gets really, really big. →

💾 save point · the cat says

PostgreSQL loves the standard. MySQL started simple and caught up in 8.0.

level 082008 → today

"SQL is dead." Plot twist: it wasn't.

Late 2000s. Google, Facebook, and Amazon are drowning in data, too much for any single machine. New tools appear that throw SQL away: Hadoop to crunch data across thousands of computers, and databases like Cassandra and MongoDB. Around 2009, the movement gets a rebellious name: NoSQL. Blogs declare SQL a dinosaur.

But there's a problem. To ask Hadoop a question, you have to write a Java MapReduce program. A handful of engineers can do that, and they get a mountain of requests. Thousands of analysts can't write Java, but they all know SQL.

So Facebook does the most ironic thing possible: in 2008 it open-sources Hive, which puts SQL on top of Hadoop. Then the dominoes fall: Spark SQL, Presto, BigQuery, Snowflake, Databricks, Microsoft Fabric. The standard learns JSON in 2016, so SQL can read the document data NoSQL was famous for. dbt turns SQL into real code that lives in Git. And today, AI models turn plain-English questions into… SQL.

The dinosaur didn't go extinct. It learned to fly.

HiveSpark SQLPrestoBigQuerySnowflakeDatabricksMicrosoft FabricdbtAI text-to-SQLSQL
Modern data platforms, old language. Learn SQL once, use it everywhere.
💾 save point · the cat says

Tools come and go. SQL stays. Even AI answers your questions by writing SQL.

Glossary

All the new words from today, in one place.

Boss level: quick quiz

Seven questions. No pressure, the cat isn't grading.

// epilogue · where I come in

Codd's idea from 1970 is still the same: say what you want, and let the machine find the way. What has changed is the size: from a few thousand rows on an IBM mainframe to billions of rows in the cloud.

SELECT lesson FROM history WHERE years = 50;

For a data engineer, that's the lesson. Tools change every few years, from QlikView to Power BI, from Hadoop to Fabric. SQL has lasted fifty years, and it will probably still be there when I change jobs. When I learn how it really works, the optimizer, indexes, and window functions, I'm learning something that works on every platform I'll use.

next episode → ep01 · your first query

// sources

  1. E. F. Codd, "A Relational Model of Data for Large Shared Data Banks", Communications of the ACM 13(6), June 1970 (PDF).
  2. History of Information, Edgar Codd publishes the definitive model for relational database management systems.
  3. The Register, Fifty years of SQL (interview with Don Chamberlin), 2024.
  4. LearnSQL.com, The History of SQL – How It All Began.
  5. SQLServerCentral, A Brief History of SQL (SEQUEL → SQL trademark).
  6. Oracle Docs, History of SQL.
  7. O'Reilly, The Commercial Development of SQL through the 1980s.
  8. Wikipedia, Edgar F. Codd (Turing Award 1981, IBM and IMS).
  9. P. Griffiths Selinger et al., "Access Path Selection in a Relational Database Management System", ACM SIGMOD 1979 (PDF).
  10. The Morning Paper, Access Path Selection (plain-language summary of Selinger's paper).
  11. SQL Reunion '95, Remembering Ray Boyce (Don Chamberlin).
  12. Wikipedia, SQL (history and standard editions).
  13. PostgreSQL Docs, A Brief History of PostgreSQL.
  14. MySQL Blog, What's New in MySQL 8.0 (window functions).
  15. MySQL Blog, MySQL 8.0: Retiring Support for the Query Cache.
  16. Stacksync, The Paper Nobody Acted On: The Origin Story of Oracle (the "Version 2" trick, IBM SQL/DS in 1981).
  17. My NotebookLM study notes on SQL history (data independence, SQUARE, SQL-89/92 details), cross-checked against the sources above.
  18. Hello, World! (Dale Biagio), The Last Thing They Did Together (Chamberlin & Boyce's "query game").
  19. Engineering at Meta, Hive – A Petabyte Scale Data Warehouse using Hadoop, 2009.
← all episodesep01 · Your first query (soon) →