0

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 ?

1
  • check the indexes with the data base management tool you use. They have both the local field and the table and field they referencing Commented Sep 21, 2018 at 13:27

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

i am getting same error and this query returns null REFERENCED_COLUMN_NAME, and REFERENCED_TABLE_NAME

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.