Your SQL should look like this:
SELECT Breed.Breed, Gender.Sex, Dog.Name FROM Dog
JOIN Gender ON Dog.GenderID = Gender.ID
JOIN Breed ON Gender.BreedID = Breed.ID
WHERE Dog.ID = 'YourDogIDHere'
And it would return the following:
Breed | Sex | Name
——–|——–|——-
Collie | Male | Fluffy
Collie | Female | Holey
Edit: Edited to include breed and reorder columns.
4
solved Database with hierarchy and joins [closed]