SQL Command Types (DDL, DML, DCL, TCL)
Part of the SQL Roadmap
In short
SQL has many commands, but they fall into just four families. Knowing which family a command belongs to tells you what it touches and how risky it is.
DDL defines structure (CREATE, ALTER, DROP), DML works with data (SELECT, INSERT, UPDATE, DELETE), DCL manages permissions (GRANT, REVOKE) and TCL controls transactions (COMMIT, ROLLBACK).

Think of it like this
Running a restaurant
Building the kitchen, adding shelves and knocking down walls is DDL. Cooking, serving and throwing out food is DML. Deciding who may enter the kitchen is DCL. Closing the bill so it is final, or tearing it up, is TCL.
Watch it happen
The four families of SQL commands
1/4DDL (Data Definition Language) builds and changes tables themselves.
The big ideas
What you need to know
DDL changes shape
CREATE TABLE, ALTER TABLE and DROP TABLE. DROP removes the table and all its rows.
DML changes rows
SELECT reads. INSERT, UPDATE and DELETE add, edit and remove rows. Some people call SELECT alone DQL.
DCL controls access
GRANT SELECT lets an analyst read a table. REVOKE takes the right away again.
TCL makes it final
COMMIT saves a group of changes. ROLLBACK cancels them as if they never happened.
See it in code
Walk through the code
1-- DDL: build structure2CREATE TABLE products (id INTEGER PRIMARY KEY, name TEXT, price NUMERIC(10, 2));3 4-- DML: work with rows5INSERT INTO products VALUES (1, 'Masala Chai Pack', 180.00);6 7-- DCL: control access8CREATE ROLE analyst;9GRANT SELECT ON products TO analyst;10 11-- TCL: group changes, then decide12BEGIN;13UPDATE products SET price = 200.00 WHERE id = 1;14ROLLBACK; -- price is back to 180.001/4DDL creates the table's structure.
One example of each family in PostgreSQL. In MySQL, use START TRANSACTION instead of BEGIN for clarity. In MySQL, DDL like CREATE TABLE commits automatically and can't be rolled back.
Save yourself the pain
Common mistakes
Oops
Using DROP TABLE when you only meant to remove some rows.
Do this instead
DROP deletes the whole table. Use DELETE ... WHERE to remove specific rows.
Oops
Assuming every change can be rolled back.
Do this instead
In MySQL and Oracle, DDL commits immediately. PostgreSQL can roll back most DDL, but don't rely on it in production.
Your mission
Sort the commands
Quick check
Which family does ALTER TABLE belong to?
Go deeper
- 1Sort 15 SQL keywords into these four groups.
- 2Note that some sources list SELECT separately as DQL.
- 3Remember that analysts spend most of their time in DML.
More topics at this stop
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.