Dear friends, Can anybody tell me a real life scenario where one would need a unique key? As far as my understanding of Normalization goes, i would not need a unique key if my tables are properly normalized. Because if i am having a unique key (There would always be a primary key), then the data in my table would not depend on a single column. So i need to normalize my table untill all the data is dependent upon one single column. And this will remove any possibility of having unique key in my table.
Please correct me if i am wrong.
Thanks in advance
Nothing is impossible; for those who doesnt have to do it themselves.
myjotting.blogspot.com
There are many, many cases where you will have a unique column that is not a primary key. Sometimes business rules play in that decision, and also there are natural keys that you do not want to be primary key, because they have business logic, but you still need it to be unique.
For Primary keys, it is highly recommended to use a surrogate key. An int that gets generated from like a sequence table, then there is no business logic in the PK.
Recently i attended a technical interview and the interviewer was hell bent on asking a real life scenario where one would need the unique key. And i was unable to answer.