Data Manipulation Language ( DML ) is the language used to maintain the database in a DMBS. The SQL (Structured Query Language) is the most popular language to manipulate databases.
The DML commands perform following tasks on database.
The SQL being a DML can do above task without any problem. Other than inserting, deleting or querying database, the SQL has advanced commands to change the schema of relations or create new relations.
It is used for maintaining the database and they are called Data Definition Language (DDL) commands. You can create table, delete a table and do other operations to maintain the structure of your database.
The schema for Manager relation is given in the previous post about DDL commands.
There are two types of query – Selection(σ) and Projection(π).
This unary operator selects all the tuple in a relation that meet specific condition using normal conditional operators and logical operator such as AND, OR and NOT.
σage > 30(Manager), will return all the tuples that has age greater than 30.
This unary operator select columns, but you can add selection with those retrieved columns.
πage,salary(Manager), will return two column – age and salary.
(ρ)Ename,Sal → Name,Pay(MANAGER)
The rename operator will rename the existing field of a relation to a different specified name. Alter is a DDL command that modifies the relation name.
The UPDATE command modify the value for one or more tuple in the relation. In the following example, we have updated salary of manager whose salary is less than 20000.
The result of update is as follows
The following figure show the relation Manager after the delete operation.Note that one entry is already deleted successfully.
Ramakrishnan, Johannes Gehrke and Raghu. 1996. Database Management Systems. McGraw Hill Education; Third edition (1 July 2014).
Wikipedia. n.d. Data definition language. Accessed March 14, 2018. https://en.wikipedia.org/wiki/Data_definition_language.