I created them, but I forgot which ones they are.
I just want to
The OP asked for a single table, which this will do.
In addition, removing the last where
clause will show all columns for a database which are protected by unique constraints:
SELECT
CONSTRAINT_NAME,
TABLE_NAME,
COLUMN_NAME
FROM information_schema.KEY_COLUMN_USAGE
WHERE
CONSTRAINT_NAME LIKE 'UNIQ%'
AND TABLE_SCHEMA = 'your_database_name'
AND TABLE_NAME = 'your_table_name';
Unfortunately mysql doesn't facilitate the removal of indexes based on a query result. You could execute the output of the following query to drop all unique columns in 2 queries:
SELECT CONCAT(
'ALTER TABLE ',
TABLE_NAME,
' DROP INDEX ',
CONSTRAINT_NAME,
'; -- drops ',
COLUMN_NAME,
' constraint'
)
FROM information_schema.KEY_COLUMN_USAGE
WHERE
CONSTRAINT_NAME LIKE 'UNIQ%'
AND TABLE_SCHEMA = 'your_database_name';