Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3234620
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:24:46+00:00 2026-05-17T17:24:46+00:00

Almost every table in every database I’ve seen in my 7 years of development

  • 0

Almost every table in every database I’ve seen in my 7 years of development experience has an auto-incrementing primary key. Why is this? If I have a table of U.S. states where each state where each state must have a unique name, what’s the use of an auto-incrementing primary key? Why not just use the state name as the primary key? Seems to me like an excuse to allow duplicates disguised as unique rows.

This seems plainly obvious to me, but then again, no one else seems to be arriving at and acting on the same logical conclusion as me, so I must assume there’s a good chance I’m wrong.

Is there any real, practical reason we need to use auto-incrementing keys?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T17:24:47+00:00Added an answer on May 17, 2026 at 5:24 pm

    No.

    In most cases, having a surrogate INT IDENTITY key is an easy option: it can be guaranteed to be NOT NULL and 100% unique, something a lot of “natural” keys don’t offer – names can change, so can SSN’s and other items of information.

    In the case of state abbreviations and names – if anything, I’d use the two-letter state abbreviation as a key.

    A primary key must be:

    • unique (100% guaranteed! Not just “almost” unique)
    • NON NULL

    A primary key should be:

    • stable if ever possible (not change – or at least not too frequently)

    State two-letter codes definitely would offer this – that might be a candidate for a natural key. A key should also be small – an INT of 4 bytes is perfect, a two-letter CHAR(2) column just the same. I would not ever use a VARCHAR(100) field or something like that as a key – it’s just too clunky, most likely will change all the time – not a good key candidate.

    So while you don’t have to have an auto-incrementing “artificial” (surrogate) primary key, it’s often quite a good choice, since no naturally occuring data is really up to the task of being a primary key, and you want to avoid having huge primary keys with several columns – those are just too clunky and inefficient.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my Database almost every table has its own translations table. I.e. Sports has
Almost 5 years ago Joel Spolsky wrote this article, The Absolute Minimum Every Software
Almost every Python web framework has a simple server that runs a wsgi application
Duplicate post, see: When do you use the "this" keyword? On almost every project
We're upgrading from SQL Server 2005 to 2008. Almost every database in the 2005
Almost every Java book I read talks about using the interface as a way
Almost every new Java-web-project is using a modern MVC-framework such as Struts or Spring
I don't edit CSS very often, and almost every time I need to go
Alright, after doing a ton of research and trying almost every managed CPP Redist
In almost all projects, the choice of the database system is 'almost' automatic ..

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.