SQL Update Query - Update Query in SQL - Update Statement in SQL



Demo wikitechydatabase

  • Below is a selection from the wikitechytable table used in the examples:
sql-sql-update-1

The SQL UPDATE Statement

  • The UPDATE statement is used to modify the existing records in a table.

UPDATE Syntax

 UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;

Note : Be careful when updating records in a table! Notice the WHERE clause in the UPDATE statement. The WHERE clause specifies which record(s) that should be updated. If you omit the WHERE clause, all records in the table will be updated!

UPDATE Table

  • Here's an example of how you might use the UPDATE statement:
UPDATE wikitechytable SET name='aaisha', course='Networking', fees = 500 WHERE id = 1

Output

sql-sql-update-2

UPDATE Multiple Records

  • It is the WHERE clause that determines how many records will be updated.
UPDATE wikitechytable SET fees = 500 WHERE fees <= 500;

Output

sql-sql-update-3

Related Searches to SQL Update Query - Update Query in SQL - Update Statement in SQL