What are the DML commands in DBMS?


The structured query language (SQL) commands deal with the manipulation of data present in the database that belongs to the DML or Data Manipulation Language. This includes most of the SQL statements.

Examples of DML

The examples of DML in the Database Management System (DBMS) are as follows −

  • SELECT − Retrieve data from the database.

  • INSERT − Insert data into a table.

  • UPDATE − Update existing data within a table.

  • DELETE − Delete records from a database table.

Syntax for DML Commands

The syntax for the DML commands are as follows −

INSERT

Insert command is used to insert data into a table.

The syntax for INSERT command is as follows −

Syntax

Insert into <table_name> (column list) values (column values);

For example, if we want to insert multiple rows to the Employee table, we can use the following command −

Example

Insert into Employee(Emp_id, Emp_name) values (001, “ bhanu”);
Insert into Employee(Emp_id, Emp_name) values (002, “ hari”);
Insert into Employee(Emp_id, Emp_name) values (003, “ bob”);

SELECT

Select command is used to retrieve data from the database.

The syntax for the select command is as follows −

Syntax

SELECT * from <table_name>;

For example, if we want to select all rows from the Employee database, we can use the following command −

Example

SELECT * from Employee;

DELETE

Delete command is used to delete records from a database table.

The syntax for the delete command is as follows -

Syntax

 Delete from <table_name>WHERE condition;

For example, if we want to delete an entire row of employee id 002, we can use the following command −

Example

DELETE from Employee WHERE Emp_id=002;

UPDATE

Update command is used to update existing data within a table.

The syntax for the update command is as follows -

Syntax

UPDATE <table_name> SET column_number =value_number WHERE condition;

For example, if we want to update the name of the employee having the employee id 001, we can use the command given below −

Example

UPDATE Employee SET Emp_name= Ram WHERE Emp_id= 001;

Updated on: 02-Sep-2023

48K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements