If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Entity Attribute Design Question

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-09-07, 06:05
db2hrishy db2hrishy is offline
Registered User
 
Join Date: Jun 2004
Posts: 115
Entity Attribute Design Question

Hi

I am about to design an application wherein i need to store the ethnicity user.

a)Should i be storing it as
User isChineese isAmerican isTurkish isAfrican

or would it be better if i use

b)User Ethinicty with a check constrain on ethinicty to include a valid set of ethinicty values.

I am tending more towards B) but i am not a datamodeller just exp with Relational DB's .

what do you guys think.

regards
Hrishy
Reply With Quote
  #2 (permalink)  
Old 11-09-07, 07:09
Shurik12 Shurik12 is offline
Registered User
 
Join Date: May 2006
Posts: 18
Hi,

Something similar to

Table1:

ethinicity_key (PK) ' primary key
ethinicity_desc (U) ' unique constrain

In any other table in your database which should include
this info, you'll include ethinicity_key as FK (foreignkey)

Regards,
Shurik.
Reply With Quote
  #3 (permalink)  
Old 11-09-07, 07:37
pootle flump pootle flump is offline
King of Understatement
 
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
Agreed. You've got a normalisation problem with idea #1. Idea #2 means you need to change your DDL everytime any ethnicity types are added\ deleted\ changed. You would also need to somehow match up what you expose to the user as available ethnicities with the check constraint. Using a table & foreign key constraints solves all these issues.
Reply With Quote
  #4 (permalink)  
Old 11-09-07, 08:41
db2hrishy db2hrishy is offline
Registered User
 
Join Date: Jun 2004
Posts: 115
Hi Guys

Thank you very much i appreciate the response.

regards
Hrishy
Reply With Quote
  #5 (permalink)  
Old 11-09-07, 10:16
blindman blindman is offline
World Class Flame Warrior
 
Join Date: Jun 2003
Location: Ohio
Posts: 11,726
Problem is, people today are too racially diverse to categorize.

I suggest using a bigint to store the RGB value of their skin tone.
__________________
If it's not practically useful, then it's practically useless.

blindman
www.chess.com: "sqlblindman"
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

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