- DML is abbreviation of Data Manipulation Language.
- It is used to insert, update and delete data in a database.
- INSERT – Inserts data into a table
- UPDATE – Updates existing data into a table
- DELETE – Deletes all records from a table
The SQL Server Insert into statement is used to add new rows of data to a table in the database.
Following are the two basic syntaxes of INSERT INTO statement.
INSERT INTO TABLE_NAME [(column1, column2, column3,…columnN)] VALUES (value1, value2, value3,…valueN)
Insert into <table-name> values(val1,val2,val3,——–valn)
Insert into student (sno,name) values (10,’mahesh’)
Insert into student values(1,’sambireddy’,’male’,26)
- This command is used to delete the records from the table based on some condition.
Syntax: delete from <table-name> where [condition]
Example: delete from student where age = 26
- Delete all the records in a table we can use delete from <table-name>
- This command is used to modify or update the existing records in a table.
Syntax: update <table-name> set col-1=val-1, col-2=val-2, ——— col-n=val-n where [condition]
Example: update student set name=’srpv’ where sno=1
- This command is used to retrieve the information from the table.
- SQL ServerSELECT statement is used to fetch the data from a database table which returns data in the form of result table. These result tables are called result-sets.
Syntax: select col-1,col-2,col-3, – – – – – – ,col-n from <table-name>
Example: select sno, name from student
- If you select all columns we can put * instead of all column names.
Select * from <table-name>
Eg: select * from student