Reputation: 2076
I'm currently planning a piece of software for dogbreeders and I'm in doubt about my datadesign...whether I'm doing something smart or stupid :)
The plan at the moment is one holistic "dog" table sorta like this...
Id | Name | FatherId | MotherId
-------------------------------
1 | A | NULL | NULL
2 | B | 1 | NULL
3 | C | NULL | NULL
4 | D | NULL | 3
5 | E | 1 | 3
6 | F | 5 | 2
7 | G | 4 | 3
My questions is, is it common to make it like this or is it really sloppy. I can see a quick lookup reason to have it but I'm really in doubt whether it's good or bad in the end. I thinking it would be better designed if I had a rel-table on the side with Id coupling, but I'm really in doubt how well any of the cases are.
A side note is that it'll only be me personally looking at the data this way (or someone adopting the project from me)
Upvotes: 0
Views: 752
Reputation: 835
Your design is fine. Parent to child is not a many-to-many relationship so there's no need for a separate link table.
Upvotes: 1
Reputation: 17018
This is a perfectly valid relational database design, you would probably be looking at doing self-joins to query the data.
Upvotes: 3