DDL, DML, AND DQL: COMPONENTS OF SQL
While SQL purports to be a single language, it is not. There are subtle distinctions, both within and outside of the language.
By now, it has become abundantly clear that there are several SQL in existence, similar in many ways, but distinct enough to pose problems when moving SQL statements between RDBMSs. In fact, there are distinct areas within the language itself.
When SQL is used to create, modify, or destroy objects within an RDBMS, it puts on its Data Definition Language (DDL) hat. Here you have the CREATE, ALTER, and DROP statements, plus a couple of others.
The Data Manipulation Language (DML) is the domain of INSERT, UPDATE, and DELETE, which you use to manipulate data.
Some bundle the Data Query Language (DQL) into DML, arguing that it also manipulates data. There are merits to this argument, not least that there is but a single member in this category: the SELECT statement.
Additionally, you might hear about the Transaction Control Language (TCL), which includes transaction statements such as COMMIT, ROLLBACK, or SAVEPOINT (see Chapter 10 for more information on transactions); and the Data Control Language (DCL), which deals with GRANT(ing) and REVOKE(ing) privileges to RDBMS objects.
The formal classification does not affect the way you use the language, but it will help you to be better prepared for a discussion with software developers and when taking your SQL mastery to the next level. As a Chinese saying has it, wisdom begins ...
Get Discovering SQL: A Hands-On Guide for Beginners now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.