Syntax and Usage of the UPDATE SQL Command, Assignments of Database Programming

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

2021/2022

Available from 03/28/2022

asimahsan45
asimahsan45 🇵🇰

5

(1)

40 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
UsingUPDATESQL command
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
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
pf3

Partial preview of the text

Download Syntax and Usage of the UPDATE SQL Command and more Assignments Database Programming in PDF only on Docsity!

Using UPDATE SQL command

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

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 ;