DML stands for “Data Manipulation Language.” It is a subset of SQL (Structured Query Language) used to manipulate data stored in a database. DML statements are used to retrieve, insert, update, and delete data in a database. Here are some common DML statements:
- SELECT: Used to retrieve data from one or more tables. You can specify the columns you want to retrieve and use conditions to filter the data:
SELECT first_name, last_name
FROM employees
WHERE department_id = 1;
- INSERT: Used to add new records into a table:
INSERT INTO employees (first_name, last_name, department_id)
VALUES ('John', 'Doe', 2);
- UPDATE: Used to modify existing data in a table based on specified conditions:
UPDATE employees
SET department_id = 3
WHERE last_name = 'Doe';
- DELETE: Used to remove rows from a table based on specified conditions:
DELETE FROM employees
WHERE last_name = 'Doe';
- MERGE (or UPSERT): Combines the INSERT, UPDATE, and DELETE operations into a single statement. It inserts a row if it doesn’t exist or updates it if it does:
MERGE INTO employees AS target
USING (VALUES (1, 'Alice', 'Smith', 4)) AS source (id, first_name, last_name, department_id)
ON target.id = source.id
WHEN MATCHED THEN
UPDATE SET first_name = source.first_name, last_name = source.last_name, department_id = source.department_id
WHEN NOT MATCHED THEN
INSERT (id, first_name, last_name, department_id) VALUES (source.id, source.first_name, source.last_name, source.department_id);
DML statements are fundamental for interacting with the data stored in a database. They allow you to perform a wide range of operations, from querying data to modifying its content, which is essential for maintaining accurate and up-to-date information in the database.
Key terms in plain language
Open a term for a concise explanation of language used on this page.
Cloud Computing
Computing resources—such as applications, servers, storage, or databases—delivered from remote infrastructure and scaled as requirements change.
Infrastructure as a Service (IaaS)
Cloud-based servers, storage, and networking that customers configure and manage without owning the underlying data-center hardware.
Software as a Service (SaaS)
Software accessed as an online service instead of being installed and maintained entirely on the customer’s own computers or servers.
Disaster Recovery (DRaaS)
A plan and service for restoring applications, data, and operations after an outage or disruption. DRaaS provides recovery infrastructure through a managed cloud service.
Identity and Access Management (IAM)
The systems and policies that determine who a user is, what resources they may access, and how that access is authenticated and reviewed.
API
An application programming interface is a defined way for software systems to exchange data or request functions from one another.