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

后端 未结 13 825
忘了有多久
忘了有多久 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:43

    To find all tables containing a particular foreign key such as employee_id

    SELECT DISTINCT TABLE_NAME 
    FROM INFORMATION_SCHEMA.COLUMNS
    WHERE COLUMN_NAME IN ('employee_id')
    AND TABLE_SCHEMA='table_name';
    
    0 讨论(0)
提交回复
热议问题