![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I asked this once before, but I dont think I was very clear, so here is try number 2: I have a DB with a basic users table and a table which keeps track of "challenges" (we do a smoking challenge and an environmental challenge, and a fitness challenge, etc... for young people) USER_TBL user_id firstname lastname ... CHALLENGE_TBL challenge_id name year ... For each challenge we want to gather some extra info from teh participating users: "are you a smoker?" "do you recylce?" The questions vary from challenge to challenge as does teh number of questions. As I see it, I have 2 options an none of them seem very good: OPTION 1: create a new table for each unique challenge. For example, a table like this: SMOKING_CHALLENGE_2004_INFO_TBL challenge_id user_id isSmoker yearsSmoking hasTriedQuitting ... This is not practical because it means editing the DB every time there is a new challenge and creating (over several years) a huge number of tables to manage. OPTION 2: create one generic table like this: CHALLENGE_EXTRA_INFO_TBL challenge_id user_id answer1 answer2 answer3 answer4 ... answer10 The problem here is that (a) most challenges will have fewer than 10 questions, (b) I have to keep track of what question corresponds to what answer for each challenge somewhere, (c) I am limiting the number of questions per challenge to 10 Can someone give me a good solution here. Thanks! Alex |
#3
| |||
| |||
|
|
Well, I can give you a solution. Whether or not it's good depends on whether or not you like it. ![]() Since you don't know how "wide" your rows will be, design your database to go "deep" instead. USERS (UserID, FirstName, LastName, ...) CHALLENGES(ChallengeID, Name, Year, CreatedBy, DateAdded, ...) CHAL_QUES(ChallengeID, QuestionNo, Question) CHAL_ANS(ChallengeID, UserID, QuestionNo, Answer) This will allow you to have any number of questions and answers in your challenges. "Alexander Ross" <aross (AT) dosomething (DOT) org> wrote in message news:cm8u77$mqc$1 (AT) forums (DOT) macromedia.com... I asked this once before, but I dont think I was very clear, so here is try number 2: I have a DB with a basic users table and a table which keeps track of "challenges" (we do a smoking challenge and an environmental challenge, and a fitness challenge, etc... for young people) USER_TBL user_id firstname lastname ... CHALLENGE_TBL challenge_id name year ... For each challenge we want to gather some extra info from teh participating users: "are you a smoker?" "do you recylce?" The questions vary from challenge to challenge as does teh number of questions. As I see it, I have 2 options an none of them seem very good: OPTION 1: create a new table for each unique challenge. For example, a table like this: SMOKING_CHALLENGE_2004_INFO_TBL challenge_id user_id isSmoker yearsSmoking hasTriedQuitting ... This is not practical because it means editing the DB every time there is a new challenge and creating (over several years) a huge number of tables to manage. OPTION 2: create one generic table like this: CHALLENGE_EXTRA_INFO_TBL challenge_id user_id answer1 answer2 answer3 answer4 ... answer10 The problem here is that (a) most challenges will have fewer than 10 questions, (b) I have to keep track of what question corresponds to what answer for each challenge somewhere, (c) I am limiting the number of questions per challenge to 10 Can someone give me a good solution here. Thanks! Alex |
#4
| |||
| |||
|
|
I thought of that, but that solution means that the number of rows in the chal_ans table will grow too quickly .... "CMBergin" <NoHarvestForYou (AT) NoSpam (DOT) org> wrote in message news:cm8vcb$nr5$1 (AT) forums (DOT) macromedia.com... Well, I can give you a solution. Whether or not it's good depends on whether or not you like it. ![]() Since you don't know how "wide" your rows will be, design your database to go "deep" instead. USERS (UserID, FirstName, LastName, ...) CHALLENGES(ChallengeID, Name, Year, CreatedBy, DateAdded, ...) CHAL_QUES(ChallengeID, QuestionNo, Question) CHAL_ANS(ChallengeID, UserID, QuestionNo, Answer) This will allow you to have any number of questions and answers in your challenges. "Alexander Ross" <aross (AT) dosomething (DOT) org> wrote in message news:cm8u77$mqc$1 (AT) forums (DOT) macromedia.com... I asked this once before, but I dont think I was very clear, so here is try number 2: I have a DB with a basic users table and a table which keeps track of "challenges" (we do a smoking challenge and an environmental challenge, and a fitness challenge, etc... for young people) USER_TBL user_id firstname lastname ... CHALLENGE_TBL challenge_id name year ... For each challenge we want to gather some extra info from teh participating users: "are you a smoker?" "do you recylce?" The questions vary from challenge to challenge as does teh number of questions. As I see it, I have 2 options an none of them seem very good: OPTION 1: create a new table for each unique challenge. For example, a table like this: SMOKING_CHALLENGE_2004_INFO_TBL challenge_id user_id isSmoker yearsSmoking hasTriedQuitting ... This is not practical because it means editing the DB every time there is a new challenge and creating (over several years) a huge number of tables to manage. OPTION 2: create one generic table like this: CHALLENGE_EXTRA_INFO_TBL challenge_id user_id answer1 answer2 answer3 answer4 ... answer10 The problem here is that (a) most challenges will have fewer than 10 questions, (b) I have to keep track of what question corresponds to what answer for each challenge somewhere, (c) I am limiting the number of questions per challenge to 10 Can someone give me a good solution here. Thanks! Alex |
#5
| |||
| |||
|
|
I thought of that, but that solution means that the number of rows in the chal_ans table will grow too quickly .... |
#6
| |||
| |||
|
|
Too quickly meaning what? Who decided how quickly it can grow? Oh, you must be using Access. Sorry. Well, in that case, you're pretty much stuck just creating a bunch of useless columns: USERS(UserID, FirstName, LastName, etc) CHALLENGES(ChallengeID, Name, DateAdded, ..., Question1, ... , Question50) ANSWERS(UserID, ChallengeID, Answer1, ..., Answer50) Now, of course, each question/answer pair corresponds. You just have to live with all the NULLs for shorter challenges. Sorry. Especially since that looks like your original solution, so that means I haven't helped at all. "Alexander Ross" <aross (AT) dosomething (DOT) org> wrote in message news:cm91bp$plt$1 (AT) forums (DOT) macromedia.com... I thought of that, but that solution means that the number of rows in the chal_ans table will grow too quickly .... "CMBergin" <NoHarvestForYou (AT) NoSpam (DOT) org> wrote in message news:cm8vcb$nr5$1 (AT) forums (DOT) macromedia.com... Well, I can give you a solution. Whether or not it's good depends on whether or not you like it. ![]() Since you don't know how "wide" your rows will be, design your database to go "deep" instead. USERS (UserID, FirstName, LastName, ...) CHALLENGES(ChallengeID, Name, Year, CreatedBy, DateAdded, ...) CHAL_QUES(ChallengeID, QuestionNo, Question) CHAL_ANS(ChallengeID, UserID, QuestionNo, Answer) This will allow you to have any number of questions and answers in your challenges. "Alexander Ross" <aross (AT) dosomething (DOT) org> wrote in message news:cm8u77$mqc$1 (AT) forums (DOT) macromedia.com... I asked this once before, but I dont think I was very clear, so here is try number 2: I have a DB with a basic users table and a table which keeps track of "challenges" (we do a smoking challenge and an environmental challenge, and a fitness challenge, etc... for young people) USER_TBL user_id firstname lastname ... CHALLENGE_TBL challenge_id name year ... For each challenge we want to gather some extra info from teh participating users: "are you a smoker?" "do you recylce?" The questions vary from challenge to challenge as does teh number of questions. As I see it, I have 2 options an none of them seem very good: OPTION 1: create a new table for each unique challenge. For example, a table like this: SMOKING_CHALLENGE_2004_INFO_TBL challenge_id user_id isSmoker yearsSmoking hasTriedQuitting ... This is not practical because it means editing the DB every time there is a new challenge and creating (over several years) a huge number of tables to manage. OPTION 2: create one generic table like this: CHALLENGE_EXTRA_INFO_TBL challenge_id user_id answer1 answer2 answer3 answer4 ... answer10 The problem here is that (a) most challenges will have fewer than 10 questions, (b) I have to keep track of what question corresponds to what answer for each challenge somewhere, (c) I am limiting the number of questions per challenge to 10 Can someone give me a good solution here. Thanks! Alex |
#7
| |||
| |||
|
|
I mean that using this technique, if we have 1000 users answer 10 questions for a single challenge, that is 10,000 rows of data (instead of just 1000) |
|
Over the next year we project 15000-20000 users participating in 6 challenges. if each has 10 questions and we expand our challenges for next year (as planned) then the tables will hit 1,000,000 redords within three years. At some point this will simply be too big, will it not? |
![]() |
| Thread Tools | |
| Display Modes | |
| |