SQL UPDATE
The UPDATE command in SQL is a DML (Data Manipulation Language) command used to modify or change existing data in a table.
👉 In simple words:
UPDATE is used to change the values of one or more columns in existing records.
Important Points:
1️. UPDATE modifies existing records
2️. Always use WHERE to avoid updating all rows
3️. Can update one or multiple columns
4️. Works only with existing data
Syntax
UPDATE table_name SET column1 = value1, column2 = value2 WHERE condition;
Update a Single Column
UPDATE Students SET Age = 22 WHERE Student_ID = 102;
Update Multiple Columns
UPDATE Students SET Name = 'Ram', Age = 23 WHERE Student_ID = 103;
Update Multiple Columns
UPDATE Students SET Age = 25;
Simple Definition:
UPDATE is a DML command used to modify existing records in a table based on a specified condition.