Print Page | Close Window

Poll system DB design

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=8035
Printed Date: 30 March 2026 at 10:10am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Poll system DB design
Posted By: theSCIENTIST
Subject: Poll system DB design
Date Posted: 12 December 2003 at 9:52am

Hi folks, I'm beginning to develop a polling system for a web site, the coding is no problem, but my question is in relation to the database design.

What would work best:

  1. One DB, one table, each row is a poll.
  2. One DB, each table is a poll.
  3. Each DB is a poll.

To help you to help me, let me tell you a bit about this system, it will be used only by the site registered users, so each vote can be traceable and done once only from that user.

Then I also want users to be able to create polls with the question and answers, data of who creates the poll is also collected.

I'm inclined to adopt option N.1, that would work faster, but each row (poll) would have to have lots of colums, not only for the creator, but also for the question, answers, votes, who voted and when and all the rest of it.

If I'm not going for option N.1, it would mean that tables and/or databases have to be dynamically created, and even worse, several calls to several DB's and/or tables have to be made.

Do you guys think going for option N.1 is the best or possible at all?




Replies:
Posted By: Mart
Date Posted: 12 December 2003 at 9:56am
One Db

2 tables

Poll list
Columns
[ID]
[Name]

Votes
Columns
[ID]
[PollID] (relates to ID in Poll list table)
etc.


Posted By: zaboss
Date Posted: 12 December 2003 at 10:35am

Even Better:

a: 1 question/multiple options.

Table Questions with QuestionID, PollQuestion, PollLauncher
Table Options: OptionID, QuestionID, Votes
TableVotes: OptionID, Voted by

This way you can have as many options you want.

b) multiuple questions/poll with multiple options

Table Polls: PollID, PollLauncher...
Table Questions: PollID, QuestionID, PollQuestion,
Table Options: OptionID, QuestionID, Votes
TableVotes: OptionID, Voted by

This way you can have as many questions want with as many options you need.



-------------
Cristian Banu
http://www.soft4web.ro - Soft 4 web



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