Have a table for Types
The types table have references among them
Types Table
id name parent_id
1 Animal null
2 Pet 1
3 Dog 2
4 Cat 2
Have the actual animals reference the Types
id name type_id
1 Rover 3
2 Oscar 4
Now, you can get the relationships out of these.