Solved

Database Structure & Code Assistance

Posted on 2012-03-21
3
236 Views
Last Modified: 2012-06-27
Greeting Friends,

I trying to develop a survey app and in need of assistance.  

For each question the survey author can choose from three answer types, rating, yes/no and text. If they choose rating as the question type they are required to enter the rating choices separated by a comma (question1options).

The issue is with joining the questions that have a type set as rating.

So here the db current structure.
- Survey Table -  
surveyId
question1
question1Type
question1options
question2
question2Type
question2options
ect...

- Answers Table -
answerId
surveyId = 1
answer1

What the data looks like

- Survey Table -
surveyId    = 1
question1 =    How would you rate the service?  
Question1Type =  rating
question1Options =   Terrible, Okay, Neutral, Average, Excellent


- Answers Table -
answerid      surveyid      answer1
1                    1                Average
2                    1                Okay
3                    1                Average  


What I'm trying to accomplish with the results:

1. How would you rate the service
    Terrible - 0
    Okay - 1
    Neutral - 0
    Average - 2
    Excellent - 0
 
Thank you in advance for reviewing my question.
0
Comment
Question by:GrantBailey
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
DcpKing earned 500 total points
ID: 37749035
eek!!

This has to be a matter of personal design, but ...

I'd try starting with a Questions table like this:
QuestionID  (just an int)
QuestionType  (1, 2, or 3 for your three types)
QuestionText
Other info so you can display the question

And a SurveyQuestions table (that defines which questions go in a survey, and their basic sequence

SurveyID
SequenceNr  (an int, just 1, 2, 3, 4)
QuestionID  (which question from Questions)


And a Reactions table, which defines, for each question, what question to go to next for each reaction (when the user has a ratings question). You use this to define destinations for each of a set of possible answers defined by radio buttons (so you can go one place if the user gets it right and somewhere else if he gets it wrong!)

SurveyID
QuestionID
ResultValue       (what was selected)
SequenceNr    (where to go to because of this selection)

That's how I'd start out building it, and then add on things needed for displaying the questions and storing the answers  ...
0
 

Author Closing Comment

by:GrantBailey
ID: 37749514
Your right the structure is completely wrong. Thanks for the assistance.
0
 
LVL 16

Expert Comment

by:DcpKing
ID: 37750102
Happy to help out!
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question