How do i identify multiple sqlite databases in my app at run time. I am making a quiz app for iphone in which i need 5-6 sqlite databases, one for each category(subject) of quiz. Help anyone
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Since this would be too long to post as a comment and it does somehow address your question,
I would suggest again to use a different structure for your application because having multiple databases is not practical for such a simple thing as a quiz.
You can find some database structure examples here Storing a multiple choice quiz in a database – deciding the schema or here Database Design For Developing 'Quiz' Web Application using PHP and MySQL
Assuming you have simple quizzes with different categories, a possible alternative would be to store your categories in a Categories table.
Where the id would be unique for each one. You could have, for example, the category sports with the id 1 and the category history with the id 2.
The questions could be stored in another table, named Questions
You can have question 1: For what team played John Doe?. In the
question_categoryfield you put 1, since 1 is the id of the Sports category. In thequestion_correct_answer_idyou will store the id of the correct answer (not the answer itself, just the id)Last but not least, an Answers table.
Here
answer_idis the id of the answer, you can store it in the Questions table if it’s the correct one, and aquestion_idto identify the question.Then you can do something like:
and get all the Sports questions.
And for each question, you can do
Be careful, my examples aren’t necessary the best solution, it’s just a basic example that uses just a single database, but with multiple tables instead of multiple databases.
My advice to you would be to consider this alternative and if you think it’s worth it, read a little about databases and design a better one.
Good luck!