What are the different types of SQL statements?
SQL (Structured Query Language) statements are categorized based on their functionality. Here’s a breakdown of the different types:
1. Data Definition Language (DDL)
These statements define the structure of the database objects.
CREATE– Create database objects like tables, views, indexes.ALTER– Modify existing database objects.DROP– Delete database objects.TRUNCATE– Remove all records from a table quickly without logging individual row deletions.RENAME– Rename database objects.
2. Data Manipulation Language (DML)
These are used for manipulating data in tables.
SELECT– Retrieve data from the database.INSERT– Add new data.UPDATE– Modify existing data.DELETE– Remove data.
3. Data Control Language (DCL)
Used to control access to data.
GRANT– Give privileges to users.REVOKE– Take back privileges.
4. Transaction Control Language (TCL)
Manage transactions in a database.
COMMIT– Save the transaction permanently.ROLLBACK– Undo changes since the last commit.SAVEPOINT– Set a point in a transaction to rollback to.SET TRANSACTION– Set properties for a transaction.
5. Data Query Language (DQL)
Some also categorize this separately:
SELECT– Though technically part of DML, it’s often separated as DQL since it only queries data without modifying it.
Quick Summary Table:
| Category | Statements |
|---|---|
| DDL | CREATE, ALTER, DROP, TRUNCATE, RENAME |
| DML | SELECT, INSERT, UPDATE, DELETE |
| DCL | GRANT, REVOKE |
| TCL | COMMIT, ROLLBACK, SAVEPOINT, SET TRANSACTION |
| DQL | SELECT |
If you’re learning SQL, want examples, or need practice queries for any category, I can help with that too!
Your Feedback
Help us improve by sharing your thoughts
Online Learner helps developers master programming, database concepts, interview preparation, and real-world implementation through structured learning paths.
Quick Links
© 2023 - 2026 OnlineLearner.in | All Rights Reserved.
