In the following table structure:
Fruits
(
fruit_id,
fruitName
)
Vegetables
(
vegetable_id,
vegetableName
)
favoriteFoods
(
food_id,
foodName,
type_id (References either a fruit or a vegetable)
)
I realize that I could forgo using a foreign key constraint on the favoriteFoods table and then simply add a type field to the favoriteFoods table to differentiate between fruits and vegetables. But how would you structure the tables so that you could actually create the necessary foreign key constraints?