LoginSignup
0
0

More than 1 year has passed since last update.

追加したカラムに既存のカラムの値を指定する

Last updated at Posted at 2021-07-02

地道にやりましょう。

ALTER TABLE my_table
ADD COLUMN new_column VARCHAR(255);

UPDATE my_table SET new_column = old_column
WHERE new_column IS NULL;

既存のカラムを消したければ。

ALTER TABLE my_table
DROP COLUMN old_column CASCADE;

おわり。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0