Reply
Is this database structure correct? Please help
Old 10-14-2009, 03:12 AM Is this database structure correct? Please help
Novice Talker

Posts: 6
Name: AJ
Trades: 0
I am fairly new to mysql and wanted to practice making a database and tables. As well as filling the tables with made up data and then practicing queries. I wanted to emulate a real life database project.

So I decided to make a database for a Car Dealership.

the database consists of three tables...Car...Buyer..Repairs. The structure is displayed below.


CAR table -

car_id int(5) primary key
make varchar(15)
model varchar(15)
year int(4)
origin varchar(15)
buyer int(5) foreign key references buyer_id in the BUYER table
cost double(5,2)



BUYER table -

buyer_id int(5) primary key
name varchar(20)
address varchar(20)
tel int(10)
car_id int(5) foreign key references car_id in the CAR table


REPAIRS table-

part_id int(5) primary key
origin varchar(15)
cost double(5,2)
car_id int(5) foreign key references car_id in the CAR table




Do you see any problems in this structure?
anything I should have done differently?
anything I could do to improve database performance?

Please bare with me as I am new to this and wish to be a DBA one day soon!

All comments will be appreciated!!

Thanks people
badmanmc is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 10-14-2009, 04:54 AM Re: Is this database structure correct? Please help
chrishirst's Avatar
Super Moderator

Posts: 22,223
Location: Blackpool. UK
Trades: 0
The "repairs" table is a little simplistic for a real application but it will be Ok for practise. Performance is more how you structure the queries rather than the tables, provided of course you keep the redundancy down to an absolute minimum (or none).

BTW it's "bear with me" as "bare with me" would involve a mutual removal of clothing and I guess that is not what you meant
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Growing old is mandatory - Growing up is optional
Code Samples | People Counting System | Bits & Bobs
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 10-14-2009, 01:16 PM Re: Is this database structure correct? Please help
Skilled Talker

Posts: 91
Name: Sidney shieldon
Trades: 0
Hmm.... It will work bro. Make things easy for users and you will have awesome results. Best of luck.
infotech rules is offline
Reply With Quote
View Public Profile
 
Old 10-14-2009, 01:36 PM Re: Is this database structure correct? Please help
Clarence_82's Avatar
Skilled Talker

Posts: 85
Name: Clarence
Trades: 0
As long as the database is built to hold all the information you will need, then that is all you will need. The only thing I would suggest though, is always adding an id with the auto increment feature to every table. This way everything entered into a table will be given a unique id in case you ever need to sort them this way. If you don't ever need to, it won't hurt having it, just don't use it.

In the future, your sure to want to make changes to all sites, and having the id field will truly come in handy more than you realize now.
__________________
-Clarence Cowan

Texas Web Design
Clarence_82 is offline
Reply With Quote
View Public Profile
 
Old 10-14-2009, 07:24 PM Re: Is this database structure correct? Please help
Novice Talker

Posts: 6
Name: AJ
Trades: 0
Thanks!!

I have taken all your replies on board and will adjust the database accordingly.

lol BEAR with me..apologies..lets not all get naked!


Appreciate the replies
badmanmc is offline
Reply With Quote
View Public Profile
 
Old 10-15-2009, 04:38 AM Re: Is this database structure correct? Please help
Average Talker

Posts: 26
Trades: 0
The "bare" thing is funny. But good you figured it out, best of luck!
justin11 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Is this database structure correct? Please help
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.11603 seconds with 13 queries