Hi, im new to php and mysql and im working on my first mini project to help me progress my knowledge and skills.
im building a simple carwash/valeting website that allows users to provide contact details and details of their car
ive created 3 tables as below,
contact details
make
model
how should i link the make and model table to the main contact details table, would i also need a 4th table to link the make and models together?
the intention is to have some kind of fee scale/band linked to the model of car ie big car will cost you more. to then complicate matters further the existing condition of the car will also +/- a percentage ie bad condition will cost you more
please could someone provide some assistance to get me started, i really want to do things correctly, rather than just stick everything in one/two tables
thanks
Rob
normalization help
Moderator: General Moderators
Re: normalization help
The make table should have an id, and the model table would use it as make_id to link the model to the make (foreign key).
In the contact table, there should be a make_id and model_id field to link it to the make and models tables.
That is how I would do it, I think.
EDIT| Let me explain the tables a little bit more, for example
[text]contact
id | name | phone | etc | make_id | model_id
make
id | make
model
id | make_id | model[/text]
In the contact table, there should be a make_id and model_id field to link it to the make and models tables.
That is how I would do it, I think.
EDIT| Let me explain the tables a little bit more, for example
[text]contact
id | name | phone | etc | make_id | model_id
make
id | make
model
id | make_id | model[/text]
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Re: normalization help
thanks for this, i think its just what i need to get started
Re: normalization help
s.dot wrote:[text]contact
id | name | phone | etc | make_id | model_id
make
id | make
model
id | make_id | model[/text]
The contact table doesn't need both make_id and model_id - it's already in the model table. so it should be:
[text]contact
id | name | phone | etc | model_id
make
id | make
model
id | make_id | model[/text]
There are 10 types of people in this world, those who understand binary and those who don't