1
我需要获取有关MySQL外部约束的信息。如何获得外键的ON DELETE和ON UPDATE操作值?
我需要知道表foreign column
,constraint name
和ON DELETE和ON UPDATE操作。
我能够获得references
表,foreign column
和constraint name
但需要知道的数值为ON DELETE
和ON UPDATE
这是我用来获取上述
SELECT
referenced_table_name AS `references`
,column_name AS `foreign`
,referenced_column_name AS `on`
FROM
information_schema.key_column_usage AS u
WHERE
referenced_table_name IS NOT NULL AND table_schema = 'test' AND table_name = 'borroweds';
检查'DELETE_RULE'和[23.19的INFORMATION_SCH'UPDATE_RULE'列EMA REFERENTIAL_CONSTRAINTS表](https://dev.mysql.com/doc/refman/5.7/en/referential-constraints-table.html)。 – wchiquito