使用するDBを選択
use データベース名
DB内のテーブル一覧
show tables;
もしくは
show tables from データベース名;
テーブル内のカラム型やデフォルト値等を確認
desc テーブル名;
カラムの追加
alter table テーブル名 add 新カラム名 カラム型;
カラムの削除
alter table テーブル名 drop column カラム名;
カラムを指定した位置に移動
(カラムAのうしろにカラムBを移動)
alter table テーブル名 modify カラムB カラム型 after カラムA;
カラム型の変更
alter table テーブル名 modify カラム名 データ型;
結合された2つのDBの差分抽出
select * from テーブル1 as w right join テーブル2 as t on w.カラム名 == t.カラム名;
More than 5 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme
List of users who liked
10