In a nutshell
SQL is
the instruction sheet handed to a DBMS.
What else?
“From the XX table, get this, and this, with these conditions, sorted like this.”
DBMS: “Sure, got it.”
“Starting from the XX table and the XX table, take this, this, and this, add this condition, run it through a correlated subquery, and then...”
DBMS: “Shut up.”
What Is SQL?
SQL stands for Structured Query Language.
It is usually pronounced “S-Q-L.”
The director’s instruction sheet
If you came from the DBMS article, you may groan, “This metaphor again?” Bear with me.
Say a TV station is making a program of past footage.
The director hands the editor an instruction sheet: “Only this athlete, only this event.”
The sheet has a set format.
The set format for instruction sheets handed to the DBMS (the editor). That is SQL.
Director (person, app)
| instruction sheet (SQL)
v
Editor (DBMS)
| find, store, fix, delete
v
Archive (data)
SQL is the language for writing requests to a DBMS.
Reading an instruction sheet
Take the clip list from the relational database article.
Clip | Content | Athlete |
|---|---|---|
5001 | Final | 101 |
5002 | Semifinal | 102 |
5003 | Qualifier | 101 |
A sheet asking for “the content of clips with athlete 101” looks like this.
SELECT content
FROM clips
WHERE athlete = 101
ORDER BY clip;
- SELECT: what to take out (content)
- FROM: from which table (clips)
- WHERE: under what condition (athlete is 101)
- ORDER BY: how to sort (by clip number)
Two results come back: “Final” and “Qualifier”.
It lines up what, from where, under what condition, and in what order, close to an English sentence.
The point: you just write what you want.
Four basic requests
Matching the DBMS’s jobs, SQL has four basic words.
SQL word | Request | At a TV station |
|---|---|---|
SELECT | Take out | Find footage and hand it over |
INSERT | Put away | Add new footage to the archive |
UPDATE | Fix | Rewrite a clip’s details |
DELETE | Delete | Remove footage from the archive |
Putting away, fixing, and deleting are written in the same set format (PostgreSQL, “Data Manipulation”).
Following numbers to link tables
The clip list has no athlete names. It only has athlete numbers.
The names are in another table, the athlete list.
SELECT clips.content, athletes.name
FROM clips
JOIN athletes
ON clips.athlete = athletes.athlete;
JOIN links two tables by number into one answer (PostgreSQL, “Joins Between Tables”).
Results come back with names, like “Final Sato,” “Semifinal Suzuki,” and “Qualifier Sato.”
This is how tables can be joined!
Nearly the same words for any DBMS
SQL is an international standard, formally named ISO/IEC 9075 (PostgreSQL, “SQL Conformance”).
Because of the standard, the basic way of writing is shared by PostgreSQL and other DBMSs.
Small details do differ from one DBMS to another.
One more thing: instruction sheets need protecting. Slipping malicious commands in through an input field is called SQL injection (OWASP, “SQL Injection”).
Countermeasures are covered in the DBMS article.
Takeaways
Finally, SQL.
The format is strict, but write only what you want and it works out how to find it.
Subqueries, CTEs, UNION.
It goes pretty deep.
If you can write it fluently, that’s cool 👍
Not me...
Trivia
- SELECT: The SQL word for taking data out.
- JOIN: The SQL word for linking two tables by number.
- ISO/IEC 9075: The formal name of the international SQL standard.
- SQL injection: An attack that slips malicious commands in through an input field.
- System R: An IBM prototype of a table-based database from the 1970s.
History
The beginning: asking without knowing where things are
In 1970, Edgar Codd of IBM published the idea of holding data in tables (Codd, “A Relational Model of Data for Large Shared Data Banks”).
Codd believed users should be able to work closer to natural language, without worrying about where data was stored (IBM, “The relational database”).
Walls and turning points: turning an idea into usable words
Many doubted the idea, so from 1973 IBM tested it in practice with System R (IBM, “The relational database”).
That is where Donald Chamberlin and Raymond Boyce created SQL (IBM, “The relational database”).
In 1977, the company that became Oracle released the first commercial relational database. IBM shipped DB2 in 1983 (IBM, “The relational database”).
SQL later became an international standard and kept being revised (PostgreSQL, “SQL Conformance”).
Different companies, the same words for asking.
What is in development now
- In 2023, the latest version of the standard, ISO/IEC 9075:2023 (SQL:2023), came out (PostgreSQL, “SQL Conformance”).
- In October 2026, the first release candidate of PostgreSQL 19 came out (PostgreSQL, October 15, 2026).
What comes next
Ways to have AI translate natural-language questions into SQL are also being introduced (Microsoft Learn, “Develop intelligent applications with AI frameworks”).
Fifty years on, things are getting closer to the “near natural language” Codd aimed for.
Whether people will stop writing SQL themselves is still unknown.
Timeline
| Period | Key events | Key people and organizations | Country or region | Notes |
|---|---|---|---|---|
| 1970 | Paper on holding data in tables | Edgar Codd | USA (IBM) | The idea SQL is built on. [Codd (1970)](https://www.seas.upenn.edu/~zives/03f/cis550/codd.pdf) |
| 1973 | Development of System R begins | IBM | USA | Tested the table idea in practice, and SQL was born here. [IBM](https://www.ibm.com/history/relational-database) |
| 1977 | First commercial relational database | Relational Software (later Oracle) | USA | Table-based databases went on sale. [IBM](https://www.ibm.com/history/relational-database) |
| 1983 | DB2 ships | IBM | USA | Products you ask with SQL spread. [IBM](https://www.ibm.com/history/relational-database) |
| 2023 | SQL:2023 | ISO/IEC | International | The latest version of the SQL standard. [PostgreSQL](https://www.postgresql.org/docs/current/features.html) |
| October 2026 | First release candidate of PostgreSQL 19 | PostgreSQL Global Development Group | International | The version before the final release came out. [PostgreSQL](https://www.postgresql.org/about/news/postgresql-19-rc-1-released-3409/) |