Hacker News new | past | comments | ask | show | jobs | submit login

  > By "Pet" class, do you mean a table for pet records?
Yes.

  > Having an AnimalRabbit table implies a many-to-many relationship between Animal and Rabbit. Are you storing different rabbit types as parent records?
The whole point on making an Animal table was so that it could be referenced by the Pet table, because Pets can be more than one type. If I include Dog and Cat directly in Pet table then there will be lots of fields in the Pet table empty; also tomorrow if I want to add Rabbit as a Pet then I need to modify the Pet table to include Rabbit fields with null values in the previous rows. Having a separate Animal table allows me to add new types of Pets without modifying the Pet table and also saves table space.



To reiterate, without knowing about your application, it isn't easy to make recommendations.

It sounds like the Animal table is going to be the join table between Pet and the different types of animal tables. Correct?

You haven't mentioned a need to store differentiating information - e.g. species, genus, family - in the different animal tables (Dog, Cat, etc.). So it sounds like you could skip the one table per animal notion and just have the Animal table contain animal types like rabbit, dog, etc. Then it becomes the "one" in the one-to-many relationship with Pet.


  > It sounds like the Animal table is going to be the join table between Pet and the different types of animal tables. Correct?
Yes, that is correct.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: