LoginSignup
0
0

More than 3 years have passed since last update.

【MySQL】テーブルコメント、カラムコメントの参照

Posted at

テーブルコメントの参照方法

-- 簡易ならこっち
show table status like '【テーブル名】';

-- 出力項目絞りたいならこっち
select TABLE_NAME, TABLE_COMMENT
from INFORMATION_SCHEMA.TABLES
where TABLE_SCHEMA = '【スキーマ名(DB名)】' and TABLE_NAME = '【テーブル名】'
;

カラムコメントの参照方法

-- 簡易ならこっち
show full columns from 【テーブル名】;

-- 出力項目絞りたいならこっち
select TABLE_NAME, COLUMN_NAME, COLUMN_TYPE, IS_NULLABLE, COLUMN_KEY, COLUMN_DEFAULT, EXTRA, COLUMN_COMMENT
from INFORMATION_SCHEMA.COLUMNS
where TABLE_SCHEMA = '【スキーマ名(DB名)】' and TABLE_NAME = '【テーブル名】'
order by ORDINAL_POSITION
;
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