C# Corner
Tech
News
Videos
Forums
Trainings
Books
Events
More
Interviews
Jobs
Live
Learn
Career
Members
Blogs
Challenges
Certifications
Bounties
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
.NET
ADO.NET
Android
ASP.NET
C#
Databases & DBA
Design Patterns & Practices
Java
Learn iOS Programming
OOP/OOD
SharePoint
Software Testing
Web Development
WPF
View All
11
Reply
Define Unique Key?
Ankur Jain
11y
3.5k
0
Reply
Delete Row
Delete Column
Insert Link
×
Insert
Cancel
Embed YouTube Video
×
Width (%)
Height (%)
Insert
Cancel
Table Options
×
Rows
Columns
First row as header
Create Table
Insert Image
×
Selected file:
Alignment
Left
Center
Right
Select an image from your device to upload
Upload to Server
Cancel
Submit
The UNIQUE constraint uniquely identifies each record in a database table. The UNIQUE and PRIMARY KEY constraints both provide a guarantee for uniqueness for a column or set of columns. A PRIMARY KEY constraint automatically has a UNIQUE constraint defined on it. Note that you can have many UNIQUE constraints per table, but only one PRIMARY KEY constraint per table.
Shivam Shukla
10y
1
UNIQUE key also work same as primary key and allows only unique value in table, but the other feature is that it allows ONLY ONE NULL VALUE also (because NULL also a value for database) whereas primary key does not allows any NULL value in table.
Piyush R.
11y
1
Unique key is a one or more column that must be unique for each row of the table. It is similar to primary key. Primary key column will not accept a null. Whereas the unique key column will accept a null values.
Ankur Jain
11y
1
Unique keys can be more than one
Mukesh Kumar
8y
0
UNIQUE key also work same as primary key and allows only unique value in table, but the other feature is that it allows ONLY ONE NULL VALUE also (because NULL also a value for database) whereas primary key does not allows any NULL value in table.
Piyush R.
11y
0
unique key eliminates the duplication of values and does allow the values uniquely. but unique key allows the NULL values. if u take primary key it won't allow duplications and it won't allow NULL values also.. one more important thing is, if you want to import the foreign key on any column that column must imposed with primary key. here you can't use the unique key...
Yadagiri Reddy
11y
0
it allows unique values only
Amol Ghanwat
11y
0
To ensure no duplicate values are entered in specific columns that do not participate in a primary key. Creating a unique constraint automatically creates a corresponding unique index.
Sarath Kumar
11y
0
Primary key is only one in a table but unique key can be more then one. primary key does not have null value but unique can have one null value. primary key is by default clustered index but unique is by default non-clustered index. primary key has reference key in another table and unique key also has reference key in another table.
Munesh Sharma
11y
0
http://dotnet-munesh.blogspot.in/2013/12/difference.html
Munesh Sharma
11y
0
Unique key is a constraint which enforces uniqueness of values.
Roymon TP
11y
0
What are the different types of cursor?
Define Joins?
Message