Collection of different types of data in a relational database
1
vote
1
answer
249
views
Let's say I have a table
Cars
(with columns such as model
, make
, year
, etc.), a table Books
(with columns such as name
, author
, ISBN
, etc.) and a table Wines
(with columns such as name
, appellation
, region
, vintage
, etc.)
Now, even if these tables don't seem related at all, I want to make a collection of all these things called "My favorites things in the world". In this list, I will find cars, books and wines.
If I only wanted to have lists of cars, I would create a table called Car_Lists
with id
and name
+ a table called Car_List_Items
with id
, car_list_id
(foreign key to the id
in the table Car_Lists
) and car_id
(foreign key to the id
in the table Cars
).
Here, as I want to have a list of different types of things, I don't really see how this could be done.
So my question: How would I represent that with a relational database?
Asked by Vinch
(113 rep)
Dec 6, 2015, 11:26 PM
Last activity: Dec 7, 2015, 01:57 AM
Last activity: Dec 7, 2015, 01:57 AM