50 likes | 54 Views
Here is how to update a column based on another column in SQL Server, MySQL, PostgreSQL.<br>Visit: https://ubiq.co/database-blog/how-to-update-a-column-based-on-another-column-in-sql/
E N D
Description Sometimes you may need to update a column in table based on value of another column in table. Here is how to update a column based on another column in SQL Server, MySQL, PostgreSQL.
Characteristics Here are the steps to update a column based on another column in SQL. Let us say you have the following table employees(id, first_name, last_name)
Two Ways To Update Here’s the SQL query to update first_name column based on value of id columns using WHERE clause. In the above statement, the UPDATE statement will first select rows that match the WHERE clause and update value of our column first_name You can also use logical operators like AND/OR in your WHERE clause as shown below.
Thank You Visit: https://ubiq.co/database-blog/how-to-update-a-column-based-on-another-column-in-sql/