Parent-child table layout

Posted by cyberzed on Stack Overflow See other posts from Stack Overflow or by cyberzed
Published on 2010-04-29T15:13:14Z Indexed on 2010/04/29 15:17 UTC
Read the original article Hit count: 140

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    | 0        | 0
2  | B    | 1        | 0
3  | C    | 0        | 0
4  | D    | 0        | 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)

© Stack Overflow or respective owner

Related posts about database-design

Related posts about best-practices