用sql语句怎么查询外键约束
时间: 2023-10-16 07:09:30 浏览: 170
sql外键约束
您可以使用以下 SQL 语句查询外键约束:
SELECT
TABLE_NAME,
COLUMN_NAME,
CONSTRAINT_NAME,
REFERENCED_TABLE_NAME,
REFERENCED_COLUMN_NAME
FROM
INFORMATION_SCHEMA.KEY_COLUMN_USAGE
WHERE
REFERENCED_TABLE_SCHEMA = '<your_database_name>'
AND REFERENCED_TABLE_NAME = '<referenced_table_name>'
AND REFERENCED_COLUMN_NAME = '<referenced_column_name>'
阅读全文