DML: Insert, Update, and Delete
DML is the change-focused subset of database languages like SQL that adds, modifies, and removes data. It appears in every write to a table. The footgun is assuming SELECT belongs in DML; read-only querying is sometimes split out as DQL instead.
WHY IT EXISTS: A data manipulation language exists because adding, deleting, and modifying data in a database is a distinct job from the broader language it lives inside. By isolating these operators into a sublanguage, programmers get a focused set of commands for routine data changes without clutter from other capabilities.
THE MENTAL MODEL: Think of a database language like SQL as a full toolbox. DML is the specific set of tools that edits the contents already stored. While the broader language might contain other operators, DML is strictly the insert, update, and delete actions that change existing data rather than the surrounding structure.
HOW IT WORKS: A DML provides operators that target data already in a database. As a sublanguage of a broader database language such as SQL, the DML comprises some of the operators in the language, specifically those that insert, update, or delete. Read-only selecting of data is sometimes distinguished as being part of a separate data query language, but it is closely related and sometimes also considered a component of a DML. Some operators may perform both selecting and writing.
WHEN TO USE IT: Use DML whenever you need to change the actual contents of a database. That means adding new records, correcting existing values, or removing outdated entries. Any operation that alters stored data rather than the database language itself falls under this sublanguage.
WHEN NOT TO USE IT: Do not use DML when the task involves broader language concerns outside of inserting, updating, or deleting data. Also avoid assuming that read-only queries are automatically part of DML, because some systems classify selecting separately under DQL instead of grouping it with the writing operators.
ONE CANONICAL EXAMPLE: In SQL, inserting a new row into an existing table is a textbook DML operation. Updating a column in that row or deleting it entirely are also DML actions. If you then run a command to retrieve the row, that read-only selection may or may not be considered DML depending on whether your environment treats it as part of DQL or includes it within DML.
Read the original → en.wikipedia.org
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.