SQL – How to copy column data to another column

The following SQL statement shows how to copy the data from one column to another.

It will replace any existing values in the destination column – so be sure to know exactly what you’re doing and use the WHERE statement if you can to minimise updates (e.g. WHERE destination_column IS NULL ).

UPDATE table 
SET destination_column = source_column
WHERE destination_column IS NULL

 

Reference: https://stackoverflow.com/questions/6308594/how-can-i-copy-data-from-one-column-to-another-in-the-same-table

Was this article helpful?

Related Articles