1

I am working on a directory website for the car's part, in this site the shop owner can register themself and then the user can search for the part based on the year, model submodel and type of the engine of the car after he/she searched. the user chooses the specific part for example Door ..

in this case, the user should see the door only for the car which he/she already searched for (specific car search) .. now for the tables I have created are:

1- shop owner table like:

 user_Id, Name, Info, location

a car's part table which is 6 tables is like this:

 Door table :
 user_Id (reference from shop owner id),side, front/rear, color, price, car 
 model, car submodel, car year.
 Fender table:
 user_Id (reference from shop owner id), side, front/rear, color, price, car 
 model, car submodel, car year.

my question is: a car model, car submodel, car year attribute for all the tables, is there any way to get rid of this redundancy (repeating attribute)? I must use relational database

  • 1
    May be introduce a car table? – mustaccio Jan 11 at 17:08
1

you should have a table for the brands, another one for the models related to their respective brand, another one for the submodels related to the submodels and in the last table use compound keys with the keys of the tables and the year and create views for queries.

|improve this answer|||||
0

You can use one table and such as 'car' and have a field to store the part name as door, wheel, etc

car(user_Id, part_Id, part_name, position, color, price, car_model, car_submodel, car_year)

postion = side, front/rear

or

you can create another table to store the ids

 car(car_Id, car_model, car_submodel, car_year)

and use the car_Id in other tables

|improve this answer|||||
  • thanks,, but i want to have an independent table for each part like door table, wheel table because I have some attribute which depends on the part. – Diari Jan 11 at 18:08
  • then you can create another table to store the ids in a way that there is a primary key which maps to other ids and use that primary key in other tables, check the updated answer – Binara Medawatta Jan 11 at 18:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.