[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.
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.
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.
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
Re: Database setup question
:-) Thanks. I do have a cat_id for category id. The foreign key.
Thanks again for the posts.