SQL - UPDATE data in table
Update in SQL is one of the operation in Data Management Language. In update we do updation of data already created or inserted into table. Update is really useful for doing changes in existing data without deleting and reinserting the data with changes.
Update - this should be done carefully otherwise it will create a problem like without filtering the required record change providing change that could be reflected for all the records.
Let see with an example,
Syntax:
UPDATE table_name SET column_name= required_data WHERE column_name= value;
WHERE clause is optional, it requires only when the data update pertaining to some records not all.
Example:
Database name dailyupdates and table name user there want to update user id 3 data last name as Smith
USE dailyupdates
GO
UPDATE user SET LAST_NAME='Smith' WHERE id=3
GO
Check whether it has updated to id =3 only and then give commit command the transactions would be saved permanently.
Comments
Post a Comment