6
5

More than 5 years have passed since last update.

Mysqlでカラム名を検索する

Posted at

コマンド

とりあえず、コマンドが分かれば検索できるので最初に書いときます。
※mysqlで動かしましたが他のDBでは動かしてません。

sql
select
  *
from
  information_schema.columns 
where
    COLUMN_NAME = "カラム名"
    and table_schema = "データベース名"; 

これだけだと、表示されるselectが多いから適宜「*」を変えて検索

検索したいカラム名が含まれるテーブル名を検索したい時

sql
select
  table_name, column_name
from
  information_schema.columns 
where
    COLUMN_NAME = "カラム名"
    and table_schema = "データベース名"; 

名称備忘

information_schema.columns

テーブル内のカラムに関する情報を表示してくれる。

以下のリンクが公式のサイト
mysalServerの公式

6
5
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
6
5