Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (6.1k points)

I want to remove a unique key from my MySQL table. How can I remove that using the MySQL query?

I attempted this, though it is not working

alter table tbl_quiz_attempt_master drop unique key;

Can anyone help me with this?

1 Answer

0 votes
by (12.7k points)

All the keys are named, you should be using something like below:

ALTER TABLE tbl_quiz_attempt_master
  DROP INDEX index_name;

To drop the primary key you can use the following:

ALTER TABLE tbl_quiz_attempt_master
  DROP INDEX `PRIMARY`;

Are you interested to learn SQL in detail? Sign up for the SQL Training course by Intellipaat.

For more details on MySQL, refer to the below MySQL Tutorial video. 

Related questions

0 votes
1 answer
asked Jul 12, 2019 in SQL by Tech4ever (20.3k points)
0 votes
1 answer
asked Jan 7, 2021 in SQL by Appu (6.1k points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...