Skip to main content

Conditional Update in SQL

SQL database

Today I wanted to add a new column to the table that exists some data. After that, I had to add some data to the that column based on the supplier type.

example: –

Supplier type is “VENDOR” then broker must be “Broker B“.

Supplier type is “WHOLE” then broker must be “Broker A“.

Supplier table with a new column.

After executing the update query.

Note: – tested on PostgreSQL.


2967total visits,5visits today

RSS
Follow by Email
Facebook
Facebook
Google+
http://mydevgeek.com/conditional-update-sql
Twitter