• subscribe
September 19, 2001 12:00 AM

What Makes a Good Primary Key?

SQL Server Pro
InstantDoc ID #21897

Good primary keys are essential to good database design. They let you query and modify each table row individually without changing other rows in the same table. When you evaluate candidates for a table's primary key, follow these rules:

  • The primary key should consist of one column whenever possible.
  • The name should mean the same 5 years from now as it does today.
  • The data value should be non-null and remain constant over time.
  • The data type should be either an integer or a short, fixed-width character.
  • If you're using a character data type, the primary key should exclude differential capitalization, spaces, and special characters, which might be difficult to remember.

For additional information about choosing a good primary key, see SQL by Design, "How to Choose a Primary Key," April 1999.



ARTICLE TOOLS

Comments
    There are no comments to display. Be the first one!
You must log on before posting a comment.

Are you a new visitor? Register Here
  • SP1?
    I know there is a SP1 for SQL 2008 R2 available....and there is a "feature pack" as well... ...
  • SQL database mirroring
    I have SQL Server 2008 R2 Enterprise 64bit on Windows 2008 R2 Enterprise 64bit.  Each SQL Server has...
  • Dell Compellent Disk Drive
    Does anybody has experience with Dell Compellent Disk Drive? Basically, this system manages all disk...
  • Sql server performance tuning
    I need to find a tool that help me to optimize sql server,queries,improve the performance and solve ...