How do I see all foreign keys to a table or column?

后端 未结 13 985
忘了有多久
忘了有多久 2020-11-22 09:14

In MySQL, how do I get a list of all foreign key constraints pointing to a particular table? a particular column? This is the same thing as this Oracle question, but for MyS

13条回答
  •  情深已故
    2020-11-22 09:18

    Using REFERENCED_TABLE_NAME does not always work and can be a NULL value. The following query can work instead:

    select * from INFORMATION_SCHEMA.KEY_COLUMN_USAGE where TABLE_NAME = '';
    

    提交回复
    热议问题