Hello. Newbie here.
lets just say that
There is animals with ID, Name and a Foreign Key that is Species ID.
so that would be like
animalID animalname Species_specID(FK)
another one would be species ID and name
another one would be diet Id and number of feeds per day
and the last one would be the table for diet and animal
and the goal is to find how many of the specIDs is getting fed with number of feeds example (3 feeds perday)
but since there can be no relation to diet and species. how can i find that?
What I have tried:
i tried using joins but feels like , i am using it wrong
my code looks like this
select count(species.specID) as Total_species
inner join animal on
species.specID = animal.species_specID
inner join diet_feeds_animal on
animal_animalID = diet_dietID
inner join diet on
diet.dietID = species.specID
but this one keeps returning 0 as value. Can someone explain to me?