Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2014
    Posts
    1

    How should I define Color Columns for Products

    Excuse my ignorance in understanding database structure, but I'm defining our product for a database with Excel and intend to upload them to a mySQL database. But I need your help with consolidation of attributes or keeping them unique based on each product types.

    My issue is we sell multiple different types of products and one of the key attributes is COLOR. Lets say I sell a baseball (ID 1) that is white with red stitching, but I also sell tennis balls that are white (ID 2), blue (ID 3), and green (ID 4). How do I structure the columns and input the data.

    Do I:
    Sheet (all product)
    id/color/stitch_Color
    1/White/Red
    2/white/"null"
    3/blue/"null"
    4/green/"null"

    Or do I define them separately, and have two different spreadsheets and import them separately:
    Sheet 1 (baseballs)
    id/baseball_color/stitch_color
    1/white/red

    Sheet 2 (tennis balls)
    id/tennis_ball_color/
    2/white
    3/blue
    4/green

    Thanks for you help.

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    The spreadsheet layout is a presentation issue. It has very little if anything to do with the database schema.

    The database schema needs to track detail at the level that you need to answer questions. If you need to keep stitch level detail, then you probably want to have a column for stitch color. I would very strongly recommend one table for all of your inventory, anything else will make you insane!

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  3. #3
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    You could use a bitmask to store up to 31 possible colors in a single field, but you'd be better off with a subtable that described not only the color, but also WHAT was colored on the object.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •