Sign up ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I get the following error:

ERROR 1062 (23000) at line 1901: Duplicate entry '3-3820-50-0' for key

How can I find out which table and columns this is referring to?

share|improve this question
What version of MySQL? Are you using innodb? – Phil Oct 5 '12 at 12:02

1 Answer 1

up vote 4 down vote accepted

This should do it:

select table_schema, table_name, column_name
from information_schema.key_column_usage
order by ordinal_position
share|improve this answer
Yes it would, +1 !!! Hope you don't mind but I added table_schema so that the database of the table is known as well. – RolandoMySQLDBA Oct 5 '12 at 17:03
@RolandoMySQLDBA: good point. Thanks. – a_horse_with_no_name Oct 5 '12 at 17:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.