Jump to content

Recommended Posts

Hi everyone,

 

I am trying to create a table design where i can store predifined titles and the other table to store the contents-service logs under the selected titles.

 

table 1 name:titles

Fields:

title_id tiny int autoincrement

title_desc varchar 45 not null

 

 

table 2 name: service

id int autoincrement

car_id int

title_id tiny int ->

service_desc text

date_service date

 

 

In table 2, most of the times i am storing multiple service logs for the same car i.e, if a car comes for a service in a garrage i am storing multiple records under different titles, i.e, oil filter, engine oil.

 

If a car comes for second service, than i am storing multiple records again under service table, which i can identified by the date.

 

I am not sure if this can be improved, any advise would be greatly appreciated.

 

Thanks for reading.

 

 

Link to comment
https://forums.phpfreaks.com/topic/60205-database-design-flows/
Share on other sites

I would suggest having a couple additional tables:

 

Customers - A table containing information about all your car owners:

Customer_ID

First_Name

Last_Name

Address

City

State

Zip

Home_Phone

Work_Phone

Other_Phone

 

Cars - A table containing information about all the cars:

Car_ID

Customer_ID

Year

Make

Model

Color

 

Then, modify your logs table like this:

 

ID

Customer_ID

Car_ID

Service_desc

Date_service

 

Or, if you'd like to take it one step further, come up with a list of unique service codes (short text strings that uniquely identify each service) and add a services table:

 

ID_Service

Service_Code

Service_Desc

 

Then you could replace "service_desc" with "Service_code" and have even less info.

 

This will help you minimize the duplicate info stored in particular tables, while increasing flexibility.

Link to comment
https://forums.phpfreaks.com/topic/60205-database-design-flows/#findComment-301364
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.