Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > General > Database Concepts & Design > unique id column or not

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-14-03, 22:16
pcdunham pcdunham is offline
Registered User
 
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.
Reply With Quote
  #2 (permalink)  
Old 07-14-03, 22:36
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 13,561
Quote:
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
__________________
r937.com | rudy.ca

pre-order my book Simply SQL from Amazon
Reply With Quote
  #3 (permalink)  
Old 07-14-03, 22:45
pcdunham pcdunham is offline
Registered User
 
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On