What Is SQL?
SQL (Structured Query Language) is a special-purpose language designed specifically for defining, manipulating, and querying data stored in a relational database. It was developed at IBM in the 1970s by Donald Chamberlin and Raymond Boyce, directly inspired by E. F. Codd’s relational model. Originally called “SEQUEL” (Structured English Query Language), it was later shortened to SQL — which is why many people still pronounce it “sequel” rather than spelling out the letters.
SQL was standardized by ANSI in 1986 and by ISO shortly after, and it has remained, with periodic revisions, the universal language for relational databases ever since.
The five sub-languages of SQL
SQL isn’t really one monolithic language — it’s a small family of sub-languages, each responsible for a different category of task. Commands from every category get mixed together constantly in real-world use, but it helps to know which bucket a given command falls into.
Category | Stands for | Purpose | Example commands |
|---|---|---|---|
DDL | Data Definition Language | Defines and modifies the structure of the database itself |
|
DML | Data Manipulation Language | Adds, changes, or removes the actual data |
|
DQL | Data Query Language | Retrieves data without changing it |
|
DCL | Data Control Language | Manages who is allowed to do what |
|
TCL | Transaction Control Language | Groups statements into all-or-nothing units of work |
|
You will spend the vast majority of your time with DQL (querying) and DML (changing data) — but understanding all five categories helps make sense of SQL documentation and error messages once you start seeing terms like “DDL statement” used casually.
One command from each category
-- DDL: define a table
CREATE TABLE employees (
id SERIAL PRIMARY KEY,
name VARCHAR(100)
);
-- DML: change data
INSERT INTO employees (name) VALUES ('Jane Doe');
-- DQL: read data
SELECT * FROM employees;
-- DCL: control access
GRANT SELECT ON employees TO reporting_user;
-- TCL: control a transaction
COMMIT;SQL is declarative, not procedural
This is arguably the single most important mindset shift when coming to SQL from a language like Python, Java, or JavaScript. In a procedural (or imperative) language, you write out the exact step-by-step instructions for how to accomplish something — loop through this list, check this condition, append to that array. SQL works differently: it is declarative, meaning you describe what result you want, and the database engine decides how to actually produce it.
Declarative: describe the result, not the steps
SELECT name, department FROM employees WHERE salary > 80000 ORDER BY department;
Nowhere in that query do you tell the database to loop over rows, or which index to use, or in what order to scan the table. You simply state the conditions the result must satisfy. Behind the scenes, the database’s query optimizer decides the actual execution strategy — a topic covered in more depth on the next page.