

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the difference between MySQL PRIMARY KEY and UNIQUE constraint?
The following table will provide us the differences between PRIMARY KEY and UNIQUE constraint −
PRIMARY KEY | UNIQUE Constraint |
---|---|
1. Only one Primary key can be created on a table. | 1. More than one UNIQUE Constraints can be added to a table. |
2. Primary key creates clustered index by default. | 2. UNIQUE Constraint creates a non-clustered index by default. |
3. We cannot insert null values in the column which is defined as PRIMARY KEY. | 3. We can insert null values in the column having a UNIQUE constraint. |
- Related Questions & Answers
- Difference between Primary Key and Unique key
- Difference between Primary Key and Candidate key
- Difference Between Primary and Candidate Key
- Primary key Vs Unique key
- Difference between Primary key and Foreign key in Database
- Difference Between Primary key and Foreign key in DBMS
- Difference between Primary key and Foreign key in SQL Database
- Is the primary key automatically indexed in MySQL?
- What is the difference between Symmetric Key Cryptographic and Asymmetric Key Cryptography?
- What is the primary difference between the XPath and CSS selector in Selenium?
- How can we apply the PRIMARY KEY constraint to the field of an existing MySQL table?
- Remove Primary Key in MySQL?
- Reset Primary Key in MySQL
- What is the difference between SQL and MySQL?
- Difference Between Primary and Secondary Memory
Advertisements