Friday , November 8 2024

PostgreSQL Where Clause

As a result of incorrect use of the UPDATE clause, you can update all records in the table instead of only certain records. We use the where clause to avoid this error.

So what does this where word do? Where clause is the command that allows us to update the record according to which condition while updating.

Let’s explain through examples.

First, let’s see the previous state by selecting our table.

The vize grade of the person whose name is Abdullah is 38, let’s change it to 48.

Above, we see that a record has changed as a result of the Update.

Let’s check if it has changed by making a select on our table.

How can we change more than one record with one condition? Let’s make the vize grade 90 for those with the surname ERDEM.

We see that 3 records are affected above, this is because there are 3 records with the last name ERDEM.

Let’s see if the Update was successful by selecting our table.

As seen above, the vize grade has been changed to 90 in the 3 records with the surname ERDEM.

Loading

About Faruk Erdem

Leave a Reply

Your email address will not be published. Required fields are marked *