.
SQL UPDATE Query - How to use an update query in SQL?
SQL Update Statement
In SQL Update Statements are used to change or modify the existing record
in the table.
Syntax of Update Statement
The Basic Syntax For the update table is as Follows.
UPDATE table_nameSET column1 = value1, column2 = value2 WHERE condition;
Example of Update Statement
A basic Example of an Update statement is as follows.
UPDATE Student SET StudentName = 'Shyam', City= 'GorakhPur' WHERE RollNo = 10;
Example Explanation
In the Above Example, It Updates The Student name and City whose Rollno is 10.
- How To Update the single value in the Existing Table?
Suppose there is a student table in the databases and we want to change or modify the student name whose roll no is 10.
Example
UPDATE Student SET StudentName = 'Shyam' WHERE RollNo = 10;
- How To Update the multiple values in the existing table?
Suppose there is a student table in the databases and we want to change or modify the student name and city whose roll no is 10.
Example
UPDATE Student SET StudentName = 'Shyam', City= 'GorakhPur' WHERE RollNo = 10;
- How To Update the same value in a column in the existing table?
UPDATE Student SET StudentFee='5000';
The above SQL statement will update the student fee column with 5000 for all the students in the student table.
Hope!!! The above tutorial on "SQL Update Statement with Example" is helpful for you...
Team,
QA acharya
Tags: SQL Update statement, UPdate query is SQL, SQL Update
0 Comments