insert, delete and update queries using mssql server

Insert Query

insert into table_name(column1,column2,column3,column4)

We can also use design view to insert values into table.

If you dont know how to create a table please follow the previous post create a table in mssql server .

Just Right click on the Table_name in which you need to insert the table and select open table.

Now put the values in relative columns(Cells) and just press Enter to insert the value to the table.


Delete Query

delete from table_name where condition_of_delete

Here condition may depend your need like delete from table_name where salary=0

And in design view it is even more simpler, you just have to select the row which you want to delete and just press delete button. The Entire row will be deleted. You can also select multiple rows to delete them simultaneously.

Note: But using sql query to delete is more practical and error free. You can also use some column like deletestatus to assign some logical value so that the rows will be not deleted physically but will be deleted logically. Now you can fetch records by extra column deletestatus and your record will safe.

Update query

update table_name set column1_name=New_Value1, column2_name=new_value2 where condition

Here again condition is logical condition on which update operation will be done otherwise the entire records will be update.




How useful was this post?

Click on a star to rate it!

Average rating / 5. Vote count:

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: