SQL UPDATE Command : Introduction
- SQL UPDATE command is a must have command while dealing with large data set. If by chance, any values in the table are inserted incorrectly, UPDATE command is there to help you out.
- The UPDATE command is used to “Update or Modify” the existing values/records in the database tables. The records which needs to be modified can be a single one or multiple values which can be manipulated based upon the query used.
- Also, with the help of SQL Clauses, modification on specific rows/values can also be done.
SQL UPDATE Command : Syntax
- The syntax of UPDATE Command in SQL looks like :
SQL UPDATE Command : Syntax
SQL UPDATE Command : Example
- Consider the table of student_details and teacher_details.
Table : student_details
Table : teacher_details
Example-1 : Now if we wish to update marks of student “SAURAV”. Then, it can be done by executing the below query.
Query : UPDATE student_details SET marks = ’70’ where roll_no = 1;
|
Output :
Example-2 : If we wish to update the name of the teacher. Then it can be done by executing below query.
Query : UPDATE teacher_details SET name = ‘Ganesh’ where E.ID = 102;
|
Output :