Query to find foreign keys

前端 未结 3 1746
梦毁少年i
梦毁少年i 2021-01-05 00:17

I have a database where I need to drop some foreign keys, but I don\'t know beforehand whether the foreign keys still exist.

I\'ve found some stored procedures (http

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-05 01:08

    Why don't You use the table "INFORMATION_SCHEMA" to this?

    SELECT *
    FROM information_schema.TABLE_CONSTRAINTS
    WHERE CONSTRAINT_TYPE = 'FOREIGN KEY'
    

提交回复
热议问题