Results 1 to 5 of 5

Thread: [RESOLVED] Database setup question

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2008
    Posts
    790

    Resolved [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.

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    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.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2008
    Posts
    790

    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.

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    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
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2008
    Posts
    790

    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
  •  



Click Here to Expand Forum to Full Width