I have an old_table with two columns: "id" and "old_attribute". I have new table with the columns "id" and "new_attribute".
old_table and new_table contain exactly the same id's. Now I want to copy all the old_attribute from old_table to the corresponding new_attribute in the new_table
Why?. You can simply rename the old_table to new_table including column names (if any).
Is that possible in a SQL script (pgadmin or psql console?) and if so, what is the syntax in this example?
I have tried something as:
insert into new_table(new_attribute) value( select old_attribute from old_table, new_table where old_table.id = new_table_id) where new_table.id = old_table.id
You need an update statement and not an insert statement.