完整性约束的信息都存储在数据字典 information_schema

    • 使用 information_schema.table_constraints 这个表来查看数据库中的所有完整性约束信息

      1. select * from information_schema.table_constraints where constraint_schema = 'DB_NAME';
    • 使用 information_schema.referential_constraints 表来查询外码相关信息

      1. select * from information_schema.referential_constraints where constraint_schema = 'DB_NAME';