SELECT
F1.TABLE_SCHEMA AS TABLE_SCHEMA
,F1.TABLE_NAME AS TABLE_NAME
,F1.COLUMN_NAME AS COLUMN_NAME
,F2.CONSTRAINT_TYPE AS CONSTRAINT_TYPE
,F2.CONSTRAINT_NAME AS CONSTRAINT_NAME
FROM
information_schema.KEY_COLUMN_USAGE F1
LEFT JOIN information_schema.TABLE_CONSTRAINTS F2 ON F1.TABLE_SCHEMA = F2.TABLE_SCHEMA
AND F1.CONSTRAINT_NAME = F2.CONSTRAINT_NAME
WHERE
F2.CONSTRAINT_TYPE = 'FOREIGN KEY'
;
0 件のコメント:
コメントを投稿