information_schemaからいろいろ抽出するときによく使うコード
テーブル名称を抽出する
SELECT
CONCAT(table_schema, '.', table_name)
FROM
(
SELECT
DISTINCT
table_schema
, table_name
FROM
information_schema.columns
WHERE
table_schema like '%テーブルスキーム名%'
AND
TABLE_NAME like '%テーブル名称%'
) x
;
テーブルコメント(用途)を抽出する
SELECT
CONCAT(table_schema,'.',table_name)
, table_comment
FROM
(
SELECT
DISTINCT
table_schema
, table_name
, table_comment
FROM
information_schema.tables
WHERE
table_schema like '%テーブルスキーム名%'
) x
;
カラム名称から検索
SELECT
CONCAT(table_schema, '.', table_name)
, column_name,column_comment
FRON
(
SELECT
DISTINCT
table_schema
, table_name
, column_name
, column_comment
FROM
information_schema.columns
WHERE
table_schema like '%テーブルスキーム名%'
AND
COLUMN_NAME like '%os%'
) x
;


