I have been working on a fix for an issue for the last couple days and haven't gotten anywhere with it. What I am doing is updating a questionnaire. This questionnaire has some answers in drop down, some in radiobutton and some in checkbox. This questionnaire is created created by loading the questions (one table in the database), answers (another table in the database) and the user responses are stored in another table. These are loaded by a select case function. So when I update the default answers in the database and try to view questionnaires with the old answers, I get an error stating the object was not set to an instance. So my question is, how do I allow more than one option to be readable in a select case, but have the same value for radiobuttons, or checkboxes.
Example:
How has the performance of your apprentice been:
X Good
X Bad
(needs to be viewable)
And new answers:
How has the performance of your apprentice been:
X Good
X Could Be Improved
Any insight would be appreciated. The language is VB and the database is SQL
I am writing an app that is basically a survey and I've written almost everything but this last part where I need to get stats from the survey.
The table looks like this:
user_id|question_id|answer
I need to get the average for each answer while still knowing which question ID that average value is associated with. Keep in mind that there can be multiple answers for the same question and multiple and multiple questions with the same answer. The only thing unique is the user_id. The database is Oracle but im sure I can adapt the query if needed. Just need some help with getting started.
I was able to answer my own question.
Select avg (answer), question_id
From table
Group By question_id
I've some doubts about my database design. I've four tables that follow the following rules:
One form can have many questions (0..n).
One form can have many responses (0..n).
A question belongs to one form (1).
A response belongs to one form (1).
A response have many anwers to a question (Answer table) (0..n).
An Answer belongs to an specific question of a form(1).
The design has led to a circular looking dependency graph like the following:
Form <------------------------------- Question
^ ^
| |
| |
Response <---------------------------- Answer
Can anyone help me? Thanks for all.
The approach seems wrong. "One form can have many questions. One form can have many answer. An answer belongs to one form."
No, an answer should refer to a specific question. If a question belongs to a form, then the answers do belong to that form implicitly, but only indirectly, because they belong to a question.
It boils down to:
One form can have many questions.
One question can have many answers.
In the form of tables:
table form (form_id, ...)
table question (question_id, question_text, ..., form_id)
table answer (answer_id, answer_text, ..., question_id)
UPDATE according to latest request edit:
So you have forms, questions and aswers as shown above. Additionally you want to store the responses. A response contains several answers and some statistics.
table response (response_id, form_id, submit_time, ...)
table response_answer (response_id, answer_id)
I am working to create a report for our users which provides the data as to what questions and answers users answered for a certain conference. The questions for each conference are unique, so I don't know in advance the number of questions.
My data is currently showing up as follows
I want the data to be laid out this way
currently I'm using max case to accomplish this, but as mentioned before all conferences have varying degrees of sessions, so I have to change my query every time for each conference to ensure that the correct question_id and session_id is being used.
There's gotta be a better way...please help.
Thanks in advance.
I am designing an online math quiz for a college project and having some trouble with designing my database.
The basic idea of the website is as follows:
A teacher, once registered may log in and add questions to their account. They can choose between making the questions multiple choice OR true or false. They can also choose between making their questions public or private. (If they choose to make the questions public, other teachers may view the questions.)
At any time the teacher may create a quiz for their students using the questions in their private bank and / or questions from the public bank. Each question may be used in multiple quizzes.
The idea is that the students will later log in and do the quiz; their answers are stored and the teacher can generate reports and check how the students did individually / highest and lowest scoring questions etc.
I am having some trouble deciding how to store the quizzes and questions which I hope somebody may be able to help me with.
So far I have the following:
‘Question’ table with attributes: QuestionID, SubjectArea, Concept, QuestionText, TeacherID, QuestionType, PublicYorN
‘MCQuestions’ table with attributes: QuestionID, AnsA, AnsB, AnsC, AnsD, AnsE, CorrectAns
‘TorFQuestions’ table with attributes: QuestionID, CorrectAns
‘Quiz’ table with attributes: QuizID, CreationDate, TeacherID
I think I then need another table as follows:
‘QuizQuestions’ and the only attributes will be QuizID, QuestionID which together make a concatenated primary key.
I feel like I should have a separate table to store answers to questions and I'm not sure if I need to separate true or false questions and multiple choice questions as I have done above.
(Obviously there are other tables containing user data etc. but this is the part I’m concerned with.)
Any advice / input is greatly appreciated!
A simple yet flexible design would be something like this:
Questions table (id, text, correct answer id, all the other question related data)
Answers table (id, question id text, all the other answer related data)
Quiz table (id, text, all the other quiz related data)
Quiz questions table (quiz id, question id, question display order, other related data such as question weight might also be added)
Quiz results table (quiz id, question id, answer id, user id, all the other related data such as date of answer and such).
I think my only input to this open ended question is:
Combine MCQuestions and TorF Questions to have a different format. Answers table has 4 cols. QID, AnswerID,answer,Correct Y/N.
Then a true or false question has 2 rows - eg. QID=888, AID=1,Ans=TRUE,true. Next row is QID=888, AID=2,Ans=FALSE,false.
Multiple choice has several - so which is the bright yellowy thing? QID=889, AID=3,Ans=Moon,false. QID=889, AID=4,Ans=Sun,true. QID=889, AID=5,Ans=Mars,false.
Then you grab a list of answers and can populate a set of radio buttons with the QID and AID values. Then you are matching integers in your code rather than long text strings which will need to be passed around for matching. Might make it a bit easier in case of special chars in the answers or whatever and you're matching the quiz results to a unique key.
Apart from that minor change it's difficult to help without knowing any other constraints...
Nick