Reputation: 1717
I want to drop an index, but I can't because is used in another table, but I can't find where
ALTER TABLE t_course DROP INDEX user_id
Is there a way to know where it is used ?
Upvotes: 0
Views: 2268
Reputation: 1590
To find the other table that the constraints reference:
select COLUMN_NAME, CONSTRAINT_NAME, REFERENCED_COLUMN_NAME, REFERENCED_TABLE_NAME
from information_schema.KEY_COLUMN_USAGE
where TABLE_NAME = 't_course';
Take a look at the REFERENCED_TABLE_NAME
returned from the above query.
Upvotes: 2