I have SQL code that adds a new column with a default value for each row in a table in my database.
I need it to also remove that same column from another table at the same time, and I'm not sure about the syntax.
create procedure remove_a_column()
begin
IF ( *some given condition* ) = 0
THEN
ALTER TABLE static.new_table ADD COLUMN column_to_move smallint(6) DEFAULT 2, ADD FOREIGN KEY (column_to_move) REFERENCES static.other_table(pk);
<***>
END if;
end
at the <***> point, I want to add the code that will delete the column column_to_move
from the table static.old_table
, no matter what's the value there.