is my data normalized?

前端 未结 5 1533
悲哀的现实
悲哀的现实 2020-12-14 05:20

I\'m making a simple quiz database, where a question has an answer and one or more image files, and belong to a subtopic which in turn belongs to a topic. Also each group ma

5条回答
  •  臣服心动
    2020-12-14 05:36

    1. You should name ids after their tables, e.g., question_id, media_id, etc. (In their primary key locations, that is, not just when they are used as foreign keys.) This makes joins easier, since you can say things like FROM question JOIN MEDIA USING (question_id)).
    2. The question table is missing a subtopic_id.
    3. You may want to replace level with level_id, having a foreign key on a LEVEL table, but that's not a hard-and-fast rule, just a suggestion. It's more flexible, but also more work; it ultimately comes down to what makes sense for your problem domain.

    Other than those minor errata, it looks fine to me.

提交回复
热议问题