The Purpose of Primary Keys

by Jasmine C
The article I read discussed primary keys.  The article states that primary keys are derived from candidate keys.  The focus of this key is to uniquely identify a row in a table.  As a rule of thumb, a candidate key should “contain the fewest number of attributes possible to identify rows individually and uniquely” (Schraml).  If a table does contain any composite keys then a surrogate key is created.  The purpose of this key it to basically create a data item that would not exist.  A problem that was stated in the article is that many people confuse the concept that a primary key is a logical and not a physical concept. When designers implement the physical aspect, an example of a mistake would be that they add extra columns onto the primary key. As a result, the logical primary key no longer exists which can eventually lead to your database system not operating properly.

This article relates to class because just this week we were discussing primary keys and how they need to uniquely identify and entity.  This can be confusing for beginners because what one might think uniquely identifies an entity may not, and as a result, your database is not going to operate the way you want it to. We can also have a combination of two attributes that can uniquely identify an entity and they both will be used as primary keys.  Hopefully, when we eventually learn about the physical concept, we will not mess up our logical primary keys.

I liked this article because I can see how easy it is to confuse yourself as to what qualifies as a primary key.  We have to make sure that we are careful when we define what our primary keys are because if we are not, then we are going to have some serious problems in the long run.   We always need to remember that whatever attribute can uniquely identify an entity is probably the primary key.

 

Schraml, T. (2010). Keys are keys and indexes are indexes. Database Trends & Applications24(1), 30. Retrieved January 27, 2012, from http://xerxes.calstate.edu/pomona/metasearch/record?group=2012-01-27-002342&resultSet=061968&startRecord=000003&return=%2Fpomona%2Fmetasearch%2Ffacet%3Fgroup%3D2012-01-27-002342%26amp%3BresultSet%3D061981%26amp%3Bfacet%3D2%26amp%3Bnode%3D1

4 thoughts on “The Purpose of Primary Keys”

  1. This just further shows how when designing a database it is always good to have a good foundation because everything builds off of one another. There are so many steps in creating a database that it is no wonder some can fail. Every step no matter how big or small play a big roll in the overall development of a database.

  2. Cool article. I can see why database design can be confusing. We have to make sure we choose our keys wisely or else it can mess up our entire database. There’s so many things that we have to consider when we create the database.

  3. I totally agree with Antonio, it seems like every step no matter how big or small, makes a difference and i can see why so may people have issues with databasing. It is also interesting that there are so many different keys and how precise a primary key must be. It has to be a unique identifier of the entity.

  4. Great article. I agree that primary key is little confuse. We should work on it more so we will familiar with primary key. Thank you for posting this article.

Comments are closed.