23 SQL Command Types
There are five different sql commands types.
- DDL (Data Definition Language)
- DQL (Data Query Language)
- DML (Data Manipulation Language)
- DCL (Data Control Language)
- TCL (Transaction Control Language)
Sometimes, DQL, TCL and DML are considered as one type, DML (Data Manipulation Language) commands.
Data Definition Language (DDL) | Data Query Language(DQL) | Data Manipulation Language (DML) | Data Control Language (DCL) | Transaction Control Language (TCL) |
---|---|---|---|---|
Define objects | Update/Delete/Insert | Security for database | begin transaction | |
CREATE | SELECT | GRANT | commit transaction | |
DROP | INSERT | REVOKE | rollback | |
ALTER | UPDATE | DENY | save transaction | |
DELETE |
23.1 DQL vs DML
Normal SELECT command is clearly DQL but distinction between DQL and DML when it comes to other select statements is not clear. Some says that adding joins, group by and other commands make that commands DML.
Nonetheless, INSERT/UPDATE/DELETE and other statements are clearly DML.
Also dialects could decide about the statements for example TRUNCATE Table command is DML in SQL Server but DDL in Oracle.
In this course, we see every select statement as DQL.