 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP 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. | 
Advertisements
 