Reputation: 613
I am relatively new to db design, so any help here would be appreciated. I am working on developing an iPhone app, and keep getting stuck, so I'm thinking my database design is junk. In my app, I have basically three items I need to pull from a db. A book title value, a chapter number value, and a segment content value(comprised of a number of different records) . The app simply displays a number of different short books. Inside each short book, they choose from which chapter they want, and then clicking on the chapter will load a detailview with a batch of related segments creating the readable content. So a chapter has many segments exclusively related to that chapter. A book has many chapters related related to that book, and there are several different books. For my db design, should each book be its own separate table? With columns for book_title, chapter_number, and segment_content? I'm basically just running into issues trying to output my data because it may not be organized all that well. Any thoughts or insights would be appreciated! Thanks
Upvotes: 0
Views: 506
Reputation: 60095
Usually you have to create a table for each entity in your application. Your entities are Book, Chapter, Segment. So you have three tables, where row in Chapter references row in Book and row in Segment references Chapter and may be Book.
Upvotes: 1
Reputation:
I know you are asking about Database design, but I would really recommend using Core Data for something as small was what you are trying to model. Then you don't have to worry about all the sqllite details you just deal with objects and that is it. The book is a good reference for all things iPhone, there are more Core Data articles at that link.
Upvotes: 1