Introduction
SQL Server is a database used to store and retrieve information in a database table. This information is stored or retrieved with the help of the DML command.
DML Commands in SQL Server
DML is an abbreviation of Data Manipulation Language. It clearly shows its functionality by its name, which means what it will perform in the database. Manipulation indicates that it will perform some tasks, i.e., Alter, Delete, and Edit the database data.
DML provides the functionality to insert, update, delete, and select the data from the database with the help of a simple database query.
Types of DML(Data Manipulation Language ) commands
- Select Command
- Insert Command
- Update Command
- Delete Command
Now, I will explain different types of commands, which are as follows.
Select Command in SQL Server
We use the Select command to retrieve the data from the database only for a read operation.
Syntax
You can use the given query to read the data from the SQL table. e.g.
Select * from Employee
Result
Insert Command in SQL Server
We use the Insert command to insert the record in the database table, which can be used in the future.
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 a null value.
Update Command in SQL Server
We use the Update command to modify the existing data in the database table.
Syntax
update Employee SET name = 'Sohan'
where id = 1
Result
Delete Command in SQL Server
We use the Delete command to delete the row from the database table.
Syntax
Delete only one row according to where clause condition
Delete from Employee where id=1
Result
Delete all rows from a table.
delete from Employee
Result
Summary
This article taught us about DML Commands in SQL Server.