Print Page | Close Window

How to normalize these tables..help pls

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Database Discussion
Forum Description: Discussion and chat on database related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=10849
Printed Date: 30 March 2026 at 12:10pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: How to normalize these tables..help pls
Posted By: PrivateEye
Subject: How to normalize these tables..help pls
Date Posted: 13 June 2004 at 8:12am

I want to conduct a survery on my website where users can select answers of a question. I am confused how to normalize the database. I am writing here the table definitions:

tblUsers

UserID, Username, PhoneNumber

tblQuestions

QuestionID, Question_Description

tblChoices

ChoiceID, QuestionID, Choice_Description

* A question has more than one choices, users can select multiple answers.

Now I want to know how to save users options against a question. I think that there is missing table(s) which are confusing for me. If anyone can normalize this database, I will be thankfull.



-------------
The Judgement Day



Replies:
Posted By: michael
Date Posted: 13 June 2004 at 10:49am
Just add one table

tblSurvey

AnswerID, UserID, QuestionID, ChoiceID
 
 
This way a user can have as many answers as you want, thus you can write a constraint to limit the number or asnwers for each users


-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker


Posted By: PrivateEye
Date Posted: 13 June 2004 at 11:24am

Thanx michael. Will you be kind enough to write a query here showing results of the survery from tblSurvery table for each user (by question and its choice) so that I can print out the survery. This time I am confused how to Join tables. Thanx in advance.



-------------
The Judgement Day


Posted By: michael
Date Posted: 13 June 2004 at 11:41am
Actually scratch the Question ID column from the tblSurvey, did not see you had it in there.....
After that just do a simple join between the tables....


-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net