MySQL schema question
Posted on 2007-08-10
I'm creating a simple schema with vehicle information.
Each vehicle has a make/model/trim. Currently I have a vehicles table with a vehicle_id as my primary key.
I also have a makes table with make_id and vehicle_id as primary keys with make_name as an attribute.
The models table with make_id, vehicle_id and model_id as primary keys with model_name as an attribute.
My question is how do I create a schema that correlates all three in the vehicle table for when I pull information? Users will have the option to add makes/models without attaching a vehicle to them, so that makes me think that adding a vehicle_id as an attribute to the makes/model tables won't work. I will need to populate them from the db, then probably pick the selected ones and put them into the vehicle database.