2014년 12월 9일 화요일

Mysql database organization

Ok. I'm a newbie, developing an android app. It will be an online testing app, where the app will load the list of available tests, then the user selects one and the app will load its questions, answers and other datas (haven't decided yet if I should load everything at once or load them as the users choose tests, so this can be question number 1, if you have an advice for me).
Now everything seemed ok, until I had to build the database. I have one table of user information, name surname etc.
A second table has to hold questions, answers, choices, etc.
some tests are multiple choice, some are fill in the blank, so there has to be a tests table.
I will record student answers online, (or reports, like 4 true, 6 false answers, haven't decided yet, too), so I thought I should store them in the user information table, but then I'd have to add as many columns as there are tests.
so overall, there will possibly be performance issues on the server side, and I have no experience with such staff, I decided to if you could give me some advice on these things. In a nutshell, how can I organize the above mentioned information and tables best, and how will I even tie these tables together?



I like vertabelo.com for a free starter data modelling site.
They have good tutorials in their blog.
Their zero-install sharing is good for teams and public criticism.



Starting out with the wrong data model can bog you down terribly,
so I'll give you a small starter model ...

Table name:  Tests
key(s): TestName (text)
Description (text)

Table name:  TestQuestions
key(s): TestName (text), QuestionNumber (Numeric)
Question (text)
Score(numeric)

TableName:  TestQuestionPrompts
key(s): TestName (text), QuestionNumber (Numeric), PromptNumber(Numeric)
Prompt(text)
(A fill-in question would not have any rows in this table)

TableName:  TestQuestionAnswers
key(s): TestName (text), QuestionNumber (Numeric), Answer(text)
(I made the Answer text a key to allow multiple correct answers to a question.
The Answer texts should be stored trimmed of blanks and lower cased for comparison.)

TableName:  Students
key(s): StudentID(text)
StudentName(text)

Table name: StudentTestAttempts
key(s): StudentID(text), TestName (text), AttemptNumber(numeric)
CompletionDate (Date)
Score (numeric)

Table name: StudentTestAnswers
key(s): StudentID(text), TestName (text), AttemptNumber(numeric), QuestionNumber (Numeric)
AnswerGiven(text)
Score(numeric)

This is a pretty flexible and powerful model,
that will let you create and run multiple tests with
fill-in or multiple choice questions, with
varying scores for easy or hard questions.

If you set this up in Vertabelo, it should be
possible to export a MySQL schema.



I'll try those out at once. Thank you for the suggestions.


댓글 없음:

댓글 쓰기