❌

Normal view

There are new articles available, click to refresh the page.
Before yesterdayMain stream

Update data on table

UPDATEΒ statement allows you to update data in one or more columns of one or more rows in a table.

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

In this syntax:

  • First, specify the name of the table that you want to update data after theΒ UPDATEΒ keyword.
  • Second, specify columns and their new values afterΒ SETΒ keyword. The columns that do not appear in theΒ SETΒ clause retain their original values.
  • Third, determine which rows to update in the condition of theΒ WHEREΒ clause
Code:
UPDATE company SET salary = salary * 2
WHERE salary = 150000;

TheΒ WHEREΒ clause is optional. If you omit theΒ WHEREΒ clause, theΒ UPDATEΒ statement will update all the column values in the table.

Code:
UPDATE company SET salary = salary * 2

Summary :
  • Use theΒ UPDATEΒ statement to update data in one or more columns of a table.
  • Specify a condition in a WHERE clause to determine which rows to update data.
  • Use theΒ RETURNINGΒ clause to return the updated rows from theΒ UPDATEΒ statement

Reference :

❌
❌