0% found this document useful (0 votes)
105 views

Lesson 5

This lesson teaches how to update data in database tables using the SQL UPDATE statement. It explains the syntax of the UPDATE statement including the SET keyword to specify which columns to update and the values to set. It also covers the WHERE clause to specify which rows to update. Examples are provided to demonstrate updating specific records by changing values like verified status, name, and GPA based on a user ID. Practice problems are given for students to write UPDATE statements to modify records based on conditions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
105 views

Lesson 5

This lesson teaches how to update data in database tables using the SQL UPDATE statement. It explains the syntax of the UPDATE statement including the SET keyword to specify which columns to update and the values to set. It also covers the WHERE clause to specify which rows to update. Examples are provided to demonstrate updating specific records by changing values like verified status, name, and GPA based on a user ID. Practice problems are given for students to write UPDATE statements to modify records based on conditions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Lesson 5

ESSENTIAL UPDATE

OVERVIEW
In this lesson, you will learn how to make any changes or updates the
data in your tables available in your database. We cannot avoid to make
any changes in our table, for you not to create again a database and table
at the same time, Update command is being utilized to minimize your time
in updating your database without any hassle.

LEARNING OUTCOMES

 Demonstrate the Update statement syntax in a table


 Determine the importance of Set keyword
 Determine the importance of Where Clause
 Discuss the safe mode
 Apply the basic commands to update the data in the database.
Just download this file SQL DATABASE FILE FILE http://www.mediafire.com/file/sbjl3tt...
Note: Double-click the dbSocialMedia to reload the database and it will
display the tblUsers.

Press control T (tab) to create another window to compare the last


command we used.
It is a keyword used to indicate what columns is to be updated and what
value should it use to update the data with.

It is a keyword used to update certain rows in the table


Example if you want to update the age you change it into 12, be careful
make sure that mode is on, so that all age will not be changed into 12.
Sammy Sarmiento verified his Account and his UID is 6 and changed his
first name to Samuel.
UPDATE SET VERIFIED = TRUE, FIRSTNAME= ”SAMUEL” WHERE
UID = 6;
Activity

A. Create the SQL code for the following problems


Use below table for the first set of problems

1. Display all records of IT and CS students who got a gwa of 1.75 and above (meaning
1.5, 1.25, 1.00)
2. Display all records of BBF students who got a gwa of 1.75 and CS students who got
a gwa of 1.00
3. Display all records IT students who got a gwa within the range of 1.00 to 1.75. Display
also all records of BBF students.
4. Display all student names which begins with ‘Y’
5. Yoko Hama has GWA of 2.00 her UID is 4 and changed his first name to Yoka.

Just try to do all examples available in this lesson.

You might also like