Data Manipulation Language (DML)

Express database queries and updates.

A data-manipulation language (DML) is a language that enables users to access or manipulate data as organized by the appropriate data model. The types of access are:

• Retrieval of information stored in the database.
• Insertion of new information into the database.
• Deletion of information from the database.
• Modification of information stored in the database.

The part of a DBMS interface enabling clients to manage data. Should be:

  • physically data independent, devoid of any need to mention or understand physical metadata, and can also be
  • declarative or non-procedural, devoid of any algorithmic details on how data is manipulated.

Two types of DMLs:

  1. Procedural DMLs require a user to specify what data are needed and how to get those data.
  2. Declarative DMLs (also referred to as nonprocedural DMLs) require a user to specify what data are needed without specifying how to get those data.

A query is statement to retrieve information. There’s a portion of DML that involves information retrieval called query language.

SQL Data Manipulation Language (DML)

The SQL query language is nonprocedural. A query takes as input several tables (pos- sibly only one) and always returns a single table. Here is an example of an SQL query that finds the names of all instructors in the History department:

select instructor.name
from instructor
where instructor.dept_name = 'History';
  • It outputs a table with only one column displaying names of instructors that are in the history department from the instructor table.

Now, we can retrieve information from more than one table. The following query finds the instructor ID and department name of all instructors associated with a department with a budget of more than $95,000.

select instructor.ID, department.dept 
from instructor, department
where instructor.dept_name = department.dept_name and
	department.budget > 95000;
  • The query outputs the instructor id and their department of the professors in the department that has a budget more than 95000. So, for example, the departments of CS and Finance have more than 95000 budget, all the professors in those department will be outputted.