|
-
Feb 19th, 2009, 12:03 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] Database setup question
I am working well (as far as I know) on using foreign keys to create a relational database for products to be sold. A catalog, basically.
My question is related to cars.
My final cars table has a make_id, model_id, list_price, ...
However, I would also like to sell from accessories like spare batteries, cleaning solutions, etc.
Should I make a separate table for accessories?! Or should I somehow incorporate every item that I potentially sell into one table?
It confuses me here a bit, because obviously a battery wouldn't have a make_id, for instance.
Thanks for the tips.
I use mysql.
-
Feb 19th, 2009, 01:23 AM
#2
Re: Database setup question
What do the terms "Make" and "Model" really mean?
They are simply common names used to indicate a car's manufacturer and brand/type. A battery has a Manufacturer (Duracell) and Type(Lithium). A VIN is really just a Serial No. Its all about the terminology.
-
Feb 19th, 2009, 11:38 AM
#3
Thread Starter
Fanatic Member
Re: Database setup question
Nice point. So I can infer that it is best to keep one table for my items?
I suppose it is ok to use null if a field does not have information too.
-
Feb 19th, 2009, 01:25 PM
#4
Re: Database setup question
That's what NULL is for... it means Unknown Value... don't be afraid to use nulls. Also, if you dump everything into one items table... make sure that you have an Item_Type field.... wouldn't do much good to go searching for a Door and come back with a list of Batteries.
-tg
-
Feb 19th, 2009, 03:11 PM
#5
Thread Starter
Fanatic Member
Re: Database setup question
:-) Thanks. I do have a cat_id for category id. The foreign key.
Thanks again for the posts.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|