Javatpoint Logo
Javatpoint Logo

PostgreSQL UPDATE statement

In PostgreSQL, UPDATE statement is used to modify the existing records in a table. To update selected rows, you have to use WHERE clause otherwise all rows would be updated.

Syntax:

Following is the basic syntax of update statement:

See this example:

Consider a table named "EMPLOYEES" having the following data.

postgresql update postgresql update

Follow the steps given below to update a table

  • Select table "EMPLOYEES" and right click on that. You will see an option script, move your cursor over scripts, you will see "UPDATE script" option. Click on that.
  • You will get a page like this:
  • postgresql update
  • Put the values on the place of "?" and fulfill the WHERE condition then click on the "play" button to execute the query.

Let's take an example:

Update ID, AGE and SALARY of the table "EMPLOYEES".

postgresql update

Output:

You can see that three columns have been updated: ID, AGE and SALARY.

postgresql update
Next TopicPostgreSQL Delete




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA