
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
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
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