Update table in SQL
UPDATE QUERY:- The SQL UPDATE Query is used to modify the existing records in the table. While using UPDATE Query you have to use WHERE clause with the UPDATE query to update the selected rows, otherwise, all the rows would be updated.


SYNTAX:-
UPDATE table_name
SET column1 = value1 , column2 = value2, ...
WHERE condition;
In the above syntax, you will mention the table name which you want to UPDATE and SET column which you want to update with the updated data.you can set multiple column values separated by a comma. In addition to this, you have to use where clause for the condition so that you will update only that data which is met by the specified condition.
Consider the "STUDENTS" table having the following records −
The following query will update the "Address" and "Name" for a Student whose ID=2 in the table.
EXAMPLE:-
UPDATE STUDENTS
SET Address = 'Pune' ,FirsteName = 'Marry'
WHERE StudentID = 2;
OUTPUT:-
Comments
Post a Comment