Skip to main contentSkip to solution

What is the correct syntax for removing primary key from a table?

Solution

✅ Correct Option: 1

Changing a table's structure needs the DDL command ALTER TABLE, and removing a constraint or column uses the keyword DROP. So the primary key is removed with ALTER TABLE table_name DROP PRIMARY KEY;.


Options 2 and 4: DELETE is a DML command that removes rows of data, not structural elements like constraints.

Options 3 and 4: UPDATE changes the values stored in existing rows, and UPDATE TABLE is not valid SQL syntax.

In MySQL, a table has only one primary key, so DROP PRIMARY KEY needs no name. Other databases such as SQL Server and Oracle usually drop it by constraint name with DROP CONSTRAINT.

Keyboard Shortcuts

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