Primary and foreign keys - How to find your rowsThis section deals with primary and foreign keys; candidate keys and secondary keys. It will contain excerpts from the eBook on Primary Keys, which is to be released later.
I will be presenting a few keynotes here taken from the eBook.
Finding and defining unique identifiers for your entities is an important task. These identifiers will eventually become primary keys in your tables.
The primary key definition of one table will be propagated to related tables (underlying tables) as foreign keys in each table.
Tables may have several candidate keys: Columns that are considered to be used as primary keys.
And, you may want to define secondary keys, unique or non-unique, for performance reasons: After the system is built, you may discover bottlenecks that can be removed by adding indexes on columns that are not a part of the primary or foreign keys.
Some analysts and developers claim that the only right thing to do is to assign just a computer generated number, without any meaning, as primary keys. This is what is called surrogate, or synthetic primary keys.
Then others again tell you that you should always have natural keys, based on attributes that evolve during the analysis phase, as primary keys.
What shall one do?
Free eBookSubscribe to my newsletter and get my ebook on Entity Relationship Modeling Principles as a free gift:
What visitors say...
"I just stumbled accross your site looking for some normalization theory and I have to say it is fantastic.Read more Testimonials
I have been in the database field for 10+ years and I have never before come across such a useful site. Thank you for taking the time to put this site together."
Theory & Practice
SQL Server DBA
Install SQL Server
Database Normalization eBook:
Copyright © www.databasedesign-resource.com / Alf A. Pedersen
All rights reserved.
All information contained on this website is for informational purposes only.
Disclaimer: www.databasedesign-resource.com does not warrant any company, product, service or any content contained herein.
Return to top
The name Oracle is a trademark of Oracle Corporation.