Design Tip: Choosing a Primary Key for a Web-Customer Table

When you design a Web-customer table, do not make the email address the primary identifier for a user who sets up an account or a profile at your website! You know how often an email address can change, and one of the prime rules of what makes a good primary key is stability: The key's value never changes.

Instead, assign a surrogate primary key for internal identification, as I’ve done in the main article's Figure 1. The email address is fine to use as an external identifier that the Web user will recognize and use for sign-in purposes at your retail site. For more information about primary keys and how to choose a good candidate, see “SQL by Design: How to Choose a Primary Key," April 1999.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.