DML Commands In SQL Server

Overview

SQL Server is a database, which is used to store and retrieve information in database table.This information is stored or retrieved with the help of DML command.

DML Commands

DML is an abbreviation of Data Manipulation Language. It clearly shows its functionality by its name, which means what is going to perform in the database. Manipulation simply indicates that it is going to perform some task i.e: Alter, Delete, Edit the data in the database.

DML provides the functionality to insert, update, delete and select the data from the database with the help of simple database query.

Types of DML(Data Manipulation Language ) commands

  • Select Command
  • Insert Command
  • Update Command
  • Delete Command
Now, I am going to explain different types of commands, which are as follows.

Select Command

To retrieve the data from the database only for read operation, we use Select command .

Syntax

You can use the given query to read the data from SQL table.e.g.
  1. Select * from Employee  
Result

database

Insert Command

To insert the record in the database table, which can be used for the future, we use Insert command.

Syntax
  1. Select * from Employee  
  2. Insert single row value in database table e.g  
  3. insert into Employee values('Sumit''Delhi''Delhi''SE')  
  4. Insert in some column in database table e.g  
  5. insert into Employee(name, city, Designation) values('Nitin''Pune''PO')  
Result

database

If we insert the value in the specific column, the remaining column shows null value.

Update Command

To modify the existing data in the database table, we use Update command.

Syntax
  1. update Employee SET name = 'Sohan'  
  2. where id = 1  
Result

database

Delete Command

To delete the row from the database table, we use Delete command.

Syntax
  1. Delete only one row according to where clause condition  
Delete from Employee where id=1

Result


database

Delete all row from table
  1. delete from Employee  
Result

database
Ebook Download
View all
Learn
View all