Is it possible to copy data from column A to column B for all records in a table in SQL?
UPDATE table SET columnB = columnA; This will update every row. This will also work if you want to transfer old value to other column and update the first one: UPDATE table SET columnA = 'new value', columnB = columnA . Like other answer says - don't forget the WHERE clause to update only what's needed.
Select the row or column that you want to move or copy. In the cell, click where you want to paste the characters, or double-click another cell to move or copy the data. or press Ctrl+V. Press ENTER.
INSERT INTO SELECT Syntax WHERE condition; Copy only some columns from one table into another table: INSERT INTO table2 (column1, column2, column3, ...)
In such a case, you can use the following UPDATE statement syntax to update column from one table, based on value of another table. UPDATE first_table, second_table SET first_table. column1 = second_table. column2 WHERE first_table.id = second_table.
How about this
UPDATE table SET columnB = columnA;
This will update every row.
UPDATE table_name SET destination_column_name=orig_column_name WHERE condition_if_necessary
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With