Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2003
    Posts
    11

    unique id column or not

    I was wondering if there is any advantage performance or otherwise to having a primary key column be a number datatype instead of varchar. I have a table that stores the possible valid status values for a user account with a record for each possible status value. There will not be more than 20 records and will rarely change. I originaly had a table with two columns, an id number and status value. But since all values in the status column are unique there is no real need for another column used to identify each record unless it will have a performance benefit in the db or application. The db is Oracle 9i and application will be in Java/J2EE.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    I originaly had a table with two columns, an id number and status value
    you probably had a third column, the status description, because if you really only had two, and you removed the id number, leaving only the status value, then i really don't see what this buys you in terms of relational design

    as for numeric primary keys versus "real" ones, this is an old argument, and a very good one, and you will find cogent arguments on both sides

    do a google search for "natural or surrogate key"

    rudy
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Jul 2003
    Posts
    11
    The purpose of the table was to have a foreign key from a users table to the status table to make sure an invalid status value was not entered in the users table. That search returned some good sites, thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •