

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The syntax and usage of the UPDATE SQL command with examples. It also demonstrates how to update a single record and multiple records in a table. The document uses a real-world example of Facebook's status update editing feature to explain the concept. useful for students studying SQL or database management.
Typology: Assignments
1 / 3
This page cannot be seen from the preview
Don't miss anything!


Let's take an example of a real-world problem. These days, Facebook provides an option for Editing your status update, how do you think it works? Yes, using the Update SQL command. Let's learn about the syntax and usage of the UPDATE command.
UPDATE command is used to update any record of data in a table. Following is its general syntax, UPDATE table_name SET column_name = new_value WHERE some_condition; WHERE is used to add a condition to any SQL query, we will soon study about it in detail. Lets take a sample table student , student_id name age 101 Adam 15 102 Alex
103 chris 14 UPDATE student SET age= 18 WHERE student_id= 102 ; S_id S_Name age 101 Adam 15 102 Alex 18 103 chris 14 In the above statement, if we do not use the WHERE clause, then our update query will update age for all the columns of the table to 18. Updating Multiple Columns We can also update values of multiple columns using a single UPDATE statement. UPDATE student SET name='Abhi', age= 17 where s_id= 103 ;