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 > Mapping questions to relational tables

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-05-06, 06:45
grooverinthesouth grooverinthesouth is offline
Registered User
 
Join Date: Mar 2006
Posts: 36
Question Mapping questions to relational tables

I am storing answers to an application form.
An example I am unsure of is the following:
What are the criteria for euthanasia? (Multiple-selection)
Options: a: sickness b: behavioural problems c: lack of space d: other, please describe:________________;

This is a one-to-many scenario and I have created 3 tables to map the question. My tables are as follows:

EUTHANASIA (euth_id, soc_id[FK], .........) ;parent table
EUTH_CRITERIA (id, euth_id[FK], criteria);
EUTH_CRITERIA_OTHER (id, euth_id[FK], other_description);

criteria stores the selections of a,b,c,d;
EUTH_CRITERIA_OTHER stores the description if 'other' is chosen.

Is this a good way of storing data. I know it prevents null values being entered, I'm just not sure its the best way to do it. Are there any flaws that I'm not seeing? Your comments would be appreciated.

Last edited by grooverinthesouth; 05-05-06 at 08:52.
Reply With Quote
  #2 (permalink)  
Old 05-05-06, 08:43
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
it is not clear from your post whether those tables are to store the questions or the answers

if they are for the questions, then of course the EUTH_CRITERIA_OTHER table is not required, since the "other" reason isn't given in the question

if they are for the answers, where is the column to indicate whose answers they are?
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 05-05-06, 08:46
grooverinthesouth grooverinthesouth is offline
Registered User
 
Join Date: Mar 2006
Posts: 36
The EUTHANASIA table has a foreign key called 'soc_id' which refers to the society for which the euthanasia question refers to.
The tables store the answers. Its basically a data capture db which will produce reports and summaries on societies.

NOTE: I have included the foreign key in my original post now.

Last edited by grooverinthesouth; 05-05-06 at 08:51.
Reply With Quote
  #4 (permalink)  
Old 05-05-06, 09:11
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
yeah, that works

me, personally, i wouldn't have a separate table for other_description, i would make it a nullable column in the criteria table

now hang on to your hat because the relational nazis will be along any second to castigate my intelligence and cast aspersions on my lineage

__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #5 (permalink)  
Old 05-05-06, 10:19
grooverinthesouth grooverinthesouth is offline
Registered User
 
Join Date: Mar 2006
Posts: 36
You vain bastŁ$d! ;-) Cheers for the comments. Much appreciated!
Clears my chest.
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