FROM (SELECT COLUMN_NAME FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = 'test' GROUP BY COLUMN_NAME, COLUMN_TYPE) AS colmuns GROUP BY COLUMN_NAME HAVING COUNT(*) >=2; 不不整合となるカラムを検出するために 下記のクエリを実⾏行行すると・・・
TABLE_NAME, COLUMN_NAME, COLUMN_TYPE, COLUMN_COMMENT FROM information_schema.COLUMNS AS colmuns WHERE EXISTS(SELECT COLUMN_NAME FROM (SELECT COLUMN_NAME FROM (SELECT COLUMN_NAME FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = 'test' GROUP BY COLUMN_NAME, COLUMN_TYPE) AS colmuns GROUP BY COLUMN_NAME HAVING COUNT(*) >=2) AS dup_colmuns WHERE colmuns.COLUMN_NAME = dup_colmuns.COLUMN_NAME) AND TABLE_SCHEMA = 'test' ORDER BY COLUMN_NAME, COLUMN_TYPE; 詳細なリストを取得する場合は 下記のクエリを実⾏行行します