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.
Result
Insert Command
To insert the record in the database table, which can be used for the future, we use Insert command.
Syntax
- Select * from Employee
- Insert single row value in database table e.g
- insert into Employee values('Sumit', 'Delhi', 'Delhi', 'SE')
- Insert in some column in database table e.g
- insert into Employee(name, city, Designation) values('Nitin', 'Pune', 'PO')
Result
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
- update Employee SET name = 'Sohan'
- where id = 1
Result
Delete Command
To delete the row from the database table, we use Delete command.
Syntax
- Delete only one row according to where clause condition
Delete from Employee where id=1
Result
Delete all row from table
Result