Back to list Standard SQL How to Remove a Primary Key in SQL Database: SQL MySQL PostgreSQL Oracle SQL Server Operators:DROP CONSTRAINT, DROP PRIMARY KEY, ALTER TABLE Problem: You want to drop a primary key from a table in a database. Example: We want to remove the primary key from the table product. Solution 1: ALTER TABLE product DROP PRIMARY KEY; Discussion: To drop a primary key from a table, use an ALTER TABLE clause with the name of the table (in our example, product) followed by the clause DROP PRIMARY KEY. Since a table can have only one primary key, you don’t need to specify the primary key column(s). Solution 2 (dropping the primary key constraint): ALTER TABLE product DROP CONSTRAINT PK_product_id; Discussion: Another way is to use ALTER TABLE with the DROP CONSTRAINT clause with the name of the primary key constraint. This is a good way to remove the primary key if you know the name of the primary key constraint. However, you must specify the name of the primary key constraint. Recommended courses: The Basics of Creating Tables Data Types in SQL SQL Constraints Recommended articles: What is a Primary Key in SQL? How to Create a Table in SQL Referential Constraints and Foreign Keys in MySQL Understanding Numerical Data Types in SQL See also: How to Create One Table From Another Table in SQL How to Create a Primary Key in SQL Tags: SQL Subscribe to our newsletter Join our weekly newsletter to be notified about the latest posts.