A data manipulation language (DML) is a computer programming language used for adding (inserting), deleting, and modifying (updating) data in a database. A DML is often a sublanguage of a broader database language such as SQL, with the DML comprising some of the operators in the language. Read-only selecting of data is sometimes distinguished as being part of a separate data query language (DQL), but it is closely related and sometimes also considered a component of a DML; some operators may perform both selecting (reading) and writing.
A popular data manipulation language is that of Structured Query Language (SQL), which is used to retrieve and manipulate data in a relational database. Other forms of DML are those used by IMS/DLI, CODASYL databases, such as IDMS and others.
SQL
In SQL, the data manipulation language comprises the SQL-data change statements, rather than the data stored within them, is considered to be part of a separate data definition language (DDL). In SQL these two categories are similar in their detailed syntax, data types, expressions etc., but distinct in their overall function. so the DML consists of all SQL-data statements, not only the SQL-data change statements. The <code>SELECT ... INTO ...</code> form combines both selection and manipulation, and thus is strictly considered to be DML because it manipulates (i.e. modifies) data.
Data manipulation languages have their functional capability organized by the initial word in a statement, which is almost always a verb. In the case of SQL, these verbs are:
- <code>SELECT ... FROM ... WHERE ...</code> (strictly speaking DQL)
- <code>SELECT ... INTO ...</code>
- <code>INSERT INTO ... VALUES ...</code>
- <code>UPDATE ... SET ... WHERE ...</code>
- <code>DELETE FROM ... WHERE ...</code>
For example, the command to insert a row into table employees:
<syntaxhighlight lang="sql">
INSERT INTO employees (first_name, last_name, fname) VALUES ('John', 'Capita', 'xcapit00');
</syntaxhighlight>
Variants
Most SQL database implementations extend their SQL capabilities by providing imperative, i.e. procedural languages. Examples of these are Oracle's PL/SQL and IBM Db2's SQL_PL.
Data manipulation languages tend to have many different flavors and capabilities between database vendors. There have been a number of standards established for SQL by ANSI,
