Update Command - dotnet and db

Follow us on Facebook

SQL Server Mountain View Mountain View Mountain View

Wednesday, August 1, 2018

Update Command



Update statement in SQL is used to modify the data of an existing table. We can modify a single cell value or entire column values in a table. We can modify a group of columns values also.


Syntax:
UPDATE <tablename> SET col1 = val1, col2 = val2,... WHERE condition


Example:
To modify all values under the password column
UPDATE EmployeeInfo SET [Password]='111'
SELECT * FROM EmployeeInfo;

To modify one employee password column
UPDATE EmployeeInfo SET [Password]='112' where  ID=2;
SELECT * FROM EmployeeInfo;

To modify one employee password,Empdept column
UPDATE EmployeeInfo SET [Password]='112',EmpDept=3 where ID=2;
SELECT * FROM EmployeeInfo;



No comments:

Post a Comment

x

Get Updates On

Discussion updates

Straight Into Your INBOX!

Enter your email address to subscribe to this website and receive notifications of new posts by email.