tag:blogger.com,1999:blog-694855878384792308.post8704791516906810824..comments2024-03-15T23:19:22.318-07:00Comments on Java67: Difference between Primary key vs Unique key in SQL Database? Answerjavin paulhttp://www.blogger.com/profile/15028902221295732276noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-694855878384792308.post-27678315517595648682019-04-24T04:32:44.702-07:002019-04-24T04:32:44.702-07:00good summary. it will be more helpful if you can p...good summary. it will be more helpful if you can put exampleAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-2885130062067257462016-11-14T16:26:52.474-08:002016-11-14T16:26:52.474-08:00thanks Abhishek!thanks Abhishek!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-18544065392490176862016-04-17T10:11:05.050-07:002016-04-17T10:11:05.050-07:00Abhishek Kumar...your analysis is to focused to th...Abhishek Kumar...your analysis is to focused to the point and simple and easily understood by everyone ...thanksAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-54751669067786718122015-08-10T04:28:25.244-07:002015-08-10T04:28:25.244-07:001. Behavior: Primary Key is used to identify a row...1. Behavior: Primary Key is used to identify a row (record) in a table whereas Unique-key is to prevent duplicate values in a column.<br /><br />2. Indexing: By default Sql-engine creates Clustered Index on primary-key if not exists and Non-Clustered Index on Unique-key.<br /><br />3. Nullability: Primary key does not include Null values whereas Unique-key can.<br /><br />4. Existence: A table can have at most one primary key but can have multiple Unique-key.<br /><br />5. Modifiability: You can’t change or delete primary values but Unique-key values can.Anonymoushttps://www.blogger.com/profile/03177985847876349033noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-32531079454091638052012-10-21T20:52:48.981-07:002012-10-21T20:52:48.981-07:00Here are few more differences between primary and ...Here are few more differences between primary and unique key :<br /><br />1) Primary key by default creates clustered index while Unique key creates nonclustered index.<br /><br />2) Only one Primary key per table but you can have as many Unique key as you need.Anonymousnoreply@blogger.com