MySQL Forums
Forum List  »  Newbie

Re: Primary key in table
Posted by: Peter Brawley
Date: September 16, 2017 01:44PM

A table in a relational database isn't really a table unless it has a primary key; there <i>must</i> be a way to uniquely identify each row, otherwise, for example, how would you write a SQL statement to update a value in a specific row? Consider reading a relational database primer, eg http://www.artfulsoftware.com/mysqlbook/sampler/mysqled1ch01.html.

Auto_increment is a mechanism designed to do just one thing: create keys guaranteed to be unique. Auto_increment keys are surrogate keys. You can form primary keys from one or more existing columns (candidate keys).

US SSNs, however, are poor candidate keys. Why? Generally, if a key depends on the outside world, it is subject to change, but primary keys shouldn't require edits. SSNs are often fake, often misreported, and some people don't have them or don't know theirs. In addition, some states have laws restricting the use and display of SSNs. Don't try to use SSNs as PKs.

Options: ReplyQuote


Subject
Written By
Posted
September 16, 2017 10:22AM
Re: Primary key in table
September 16, 2017 01:44PM
September 16, 2017 02:40PM
September 16, 2017 02:56PM
September 19, 2017 05:08AM
September 20, 2017 11:29AM
September 20, 2017 12:20PM
September 20, 2017 12:42PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.