Types of SQL Commands & Roadmap
DDL, DML, DQL, DCL and TCL — the five families of SQL commands — and the full course roadmap.
Every SQL statement you will ever write belongs to a small number of command families. A developer builds the structure, an app changes the data, an analyst reads it, an admin controls access, and transactions keep everything safe. Knowing which family a command belongs to is a classic interview question and helps you understand what each statement can and can't do.
Definition
SQL commands are grouped by their purpose into sub-languages: DDL (define structure), DML (manipulate data), DQL (query data), DCL (control access) and TCL (control transactions).
The three main families (taught in this course)
| Family | Full name | Commands | What it does | Who uses it |
|---|---|---|---|---|
| DDL | Data Definition Language | CREATE, ALTER, DROP | Builds and changes the structure — tables, columns, schemas | Developer / DBA |
| DML | Data Manipulation Language | INSERT, UPDATE, DELETE | Adds, changes and removes the rows (data) | App / user |
| DQL | Data Query Language | SELECT | Reads data and answers questions | Analyst |
Think of a stadium: DDL builds the stands and seats, DML puts fans into seats or moves them, and DQL counts how many fans are sitting in each stand.
Two more families (good to know)
| Family | Full name | Commands | What it does |
|---|---|---|---|
| DCL | Data Control Language | GRANT, REVOKE, (DENY in SQL Server) | Gives or takes away permissions |
| TCL | Transaction Control Language | BEGIN TRANSACTION, COMMIT, ROLLBACK, SAVE TRANSACTION | Groups changes so they all succeed or all fail |
Note: Some books put
SELECTinside DML (because it works on data). Both views are accepted; this course treats DQL separately because reading data is the most-used part of SQL.
Example — one statement from each main family
sql
-- DDL: build the structure
CREATE TABLE fans (
fan_id INT PRIMARY KEY,
fan_name VARCHAR(50),
fav_team CHAR(3)
);
-- DML: put data in and change it
INSERT INTO fans VALUES (1, 'Aarav', 'RCB'), (2, 'Diya', 'CSK'), (3, 'Kabir', 'MI');
UPDATE fans SET fav_team = 'MI' WHERE fan_id = 2;
DELETE FROM fans WHERE fan_id = 3;
-- DQL: read the data
SELECT *
FROM fans;| fan_id | fan_name | fav_team |
|---|---|---|
| 1 | Aarav | RCB |
| 2 | Diya | MI |
How it works: CREATE made an empty table; INSERT added three fans; UPDATE changed Diya's team from CSK to MI; DELETE removed Kabir; finally SELECT showed what is left.
Example — DCL and TCL (SQL Server)
sql
-- DCL: let the analyst read players but not change them
GRANT SELECT ON dbo.players TO analyst_user;
REVOKE SELECT ON dbo.players FROM analyst_user;
-- TCL: both changes happen, or neither does
BEGIN TRANSACTION;
UPDATE players SET runs = runs + 82 WHERE id = 1;
UPDATE players SET runs = runs + 45 WHERE id = 2;
COMMIT; -- or ROLLBACK; to undo bothDROP vs DELETE — a classic confusion
DELETE (DML) | DROP (DDL) | |
|---|---|---|
| Removes | Rows (some or all) | The whole table — structure + data |
| Table still exists after? | Yes | No |
| Can use WHERE? | Yes | No |
Your course roadmap
The order of learning is structure → data → questions, but we start with questions (SELECT) because it is the most used skill.
| # | Chapter | You will learn |
|---|---|---|
| 1 | Intro to SQL | Databases, tables, data types, command types — you are here |
| 2 | Query Data (SELECT) | Read data: SELECT, WHERE, ORDER BY, GROUP BY, HAVING, DISTINCT, TOP |
| 3 | DDL | Build tables: CREATE, ALTER, DROP |
| 4 | DML | Change data: INSERT, UPDATE, DELETE |
| 5 | Filtering | WHERE with AND, OR, IN, BETWEEN, LIKE |
| 6 | JOINs & SET | Combine tables: INNER/LEFT/RIGHT/FULL JOIN, UNION, EXCEPT, INTERSECT |
| 7 | Functions | String, number, date, NULL functions and CASE |
| 8 | Aggregation | GROUP BY in depth and window (analytical) functions |
| 9 | Advanced SQL | Subqueries, CTEs, views, temp tables, stored procedures, triggers |
| 10 | Performance | Indexes, partitions, execution plans and 30 performance tips |
| 11 | AI & SQL | Using AI assistants to write and review SQL — 16 prompts |
After that: real SQL projects on IPL data!
Common mistakes
- ❌ Saying
DELETEremoves the table. ✅DELETEremoves rows;DROP TABLEremoves the table. - ❌ Thinking
ALTERchanges data. ✅ALTERchanges structure (e.g. adds a column);UPDATEchanges data.
Interview tip
Q: Classify CREATE, INSERT, SELECT, GRANT and COMMIT.
A: CREATE → DDL, INSERT → DML, SELECT → DQL (sometimes counted as DML), GRANT → DCL, COMMIT → TCL.
Key points to remember
- DDL (Data Definition Language) — CREATE, ALTER, DROP — builds and changes the structure.
- DML (Data Manipulation Language) — INSERT, UPDATE, DELETE — adds, changes and removes rows.
- DQL (Data Query Language) — SELECT — reads data; some books count it as part of DML.
- DCL (GRANT, REVOKE, DENY) controls permissions; TCL (BEGIN TRANSACTION, COMMIT, ROLLBACK) controls transactions.
- DELETE removes rows but keeps the table; DROP removes the whole table.
- Course path: Intro → SELECT → DDL → DML → Filtering → JOINs → Functions → Aggregation → Advanced → Performance → AI & SQL.
Try it yourself
DDL → DML → DQL in one script
Runs on a fresh IPL practice database in your browser · edit the query and press Ctrl + Enter
DCL and TCL (SQL Server)
-- DCL: permissions
GRANT SELECT ON dbo.players TO analyst_user;
REVOKE SELECT ON dbo.players FROM analyst_user;
-- TCL: all-or-nothing changes
BEGIN TRANSACTION;
UPDATE players SET runs = runs + 82 WHERE id = 1;
UPDATE players SET runs = runs + 45 WHERE id = 2;
COMMIT; -- use ROLLBACK; instead to undo both updatesSQL Server-specific — run this in SQL Server (SSMS / Azure Data Studio).
Practice: DELETE vs DROP
Runs on a fresh IPL practice database in your browser · edit the query and press Ctrl + Enter
Revision Flashcards
Tap a card to flip it and see the answer.
