Skip to main contentSkip to solution

Which of the following is the correct query for removing the primary key constraint?

Solution

✅ Correct Option: 1

The SQL (MySQL) syntax for removing a primary key is ALTER TABLE tablename DROP PRIMARY KEY;\texttt{ALTER TABLE tablename DROP PRIMARY KEY;}. The ALTER TABLE statement changes the structure of a table, and DROP removes a constraint or column from it.


Option 2: DELETE is a DML command for removing rows, and it cannot be used in ALTER TABLE to remove a constraint.

Option 3: the keyword TABLE is missing, so the statement is invalid.

Option 4: MODIFY changes a column's definition, and it does not remove a primary key.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question