'Find name, category, and date of born of all sold animals?

I am wondering if what I have done makes any sense.

We have the following database

ANIMAL(AnimalID, Name, Category, DateBorn, ListPrice)
SALEANIMAL(SaleID, AnimalID, SalePrice)

I now have to find the name, category, and date of born of all sold animals

This is my idea, first I just select the columns I want in return, and from both those table, I take the rows where the SaleID is equal to AnimalID. I believe this is the way to see what animals are sold. Here is the code:

SELECT Name, Category, DateBorn
FROM ANIMAL A, SALEANIMAL S
WHERE S.SaleID=A.AnimalID

Any tips would be appreciated, I'm new to SQL



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source