I’m developing a quiz application. I have 100 questions. For example, what city is the capital of Great Britain?
A. Rome
B. Milan
C. London
D. Oslo
Which is the best solutions to store a data (coredata or sql)?
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.
Core Data is a bit more complex to set up than SQL, however in my opinion Core Data is MUCH easier to work with, and keeps you in “objective-c land” where as SQL requires writing tons of SQL statements (as far as I know).
Specific to your use-case, I would think CoreData would be a better fit. You would probably have a Question object with an NSString text property for the actual question and then an NSArray of Answer objects. In CoreData/SQL speak, you would have a table of Questions with a text column. Each Question has a to-many relationship with a table of Answer objects (CoreData handles the dirty work for relationships, but in SQL you’d use primary keys).
As I said in a comment on another answer below, because your database isn’t very large and complex initially, you could package a plist or download one from a server to initially populate the CoreData database. Using CoreData instead of a plist means it’s much easier to update values on the fly, so you can do things like have a property on each answer object that you can set if the user chooses that answer so you can save state between launches.
Check out Core Data vs SQLite 3 and many other stack overflow answers that talk about the pros and cons of several different methods.