I guess this question is quite basic, but imo those are the hardest.
So lets say I want to create a table about the extras cars can have, and lets say they are 5, so the cars could have, none, all, one or some of those extras.
Is it recommendable to use the set() field with the 5 options? seems the logic way to do it but I’ve read that set() fields are not friendly with searches in big databases.
The other options I had in mind are:
-
To have a foreign key to a table with the car’s id and each of the extras(so that would make 5 rows if the car has all the extras)
-
Having 5 extra boolean columns for each extra in the original
table.
Which would be the best way, considering the database/table would be big?
It doesn’t sound logic way to me. It could make sense to use a
SET()for continents but not car extras. Extras are expected to change in time and you don’t want to alter your application and database design every time that happens. The obvious design is to create a table for extras and link it via foreign key.