Abhishek Karale Abhishek Karale -5 years ago 159
Swift Question

Swift Core Data - DataModel Entity Relationships

I'm still unsure whether I understand entity relationships. Just to confirm can I get someone to walk me through what I have created and confirm whether it is correct?

Data Model

So I'm creating a quiz app. This is my understanding of the above :

  • Category Entity - (e.g. geography) has a many to one relationship with QuizName. A single category can have multiple QuizNames.

  • A quizName (e.g. rivers in China) can have multiple Question entities. e.g. 'Which of one of these rivers are in China'

  • A Question can then have 4 possibleAnswers from which the person can choose from.

Have I made the data model correctly?


Answer Source

This model looks good, but Quiz seems better than QuizName.

If --->> is a one-to-many relationship:

Category --->> Quiz --->> Question

A Question entity could either have 4 String properties that represent answers or if each answer has specific attributes than maybe an answer should be yet another entity.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download