database design

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • _Skare_Krow_

    #1

    database design

    I've been working on a project for awhile now and can't seem to get it
    working the way I want. What I've got is a database with different
    category's and products below them. The thing I'm having trouble with is
    the products all have different sizes and colors, and each (different)
    product has it's own id and quantity. My first idea was to create one
    huge table and deal with it. Is there a better way to do this? Is there
    some resources on database design which would point me in the right
    direction?

    Aaron
  • Siemel Naran

    #2
    Re: database design

    "_Skare_Kro w_" <tenchi25@acces s4less.net> wrote in message
    [color=blue]
    > I've been working on a project for awhile now and can't seem to get it
    > working the way I want. What I've got is a database with different
    > category's and products below them. The thing I'm having trouble with is
    > the products all have different sizes and colors, and each (different)
    > product has it's own id and quantity. My first idea was to create one
    > huge table and deal with it. Is there a better way to do this? Is there
    > some resources on database design which would point me in the right
    > direction?[/color]

    The exact design depends on the problem you're trying to solve, and there's
    no right or wrong answer.

    One possibility is: (1) A table of categories with column NAME, (2) A table
    of products with columns NAME and a foreign key to the table of categories,
    (3) A table of product types with columns SIZE and COLOR and a foreign key
    to the table of products.


    Comment

    • _Skare_Krow_

      #3
      Re: database design

      On Thu, 05 Aug 2004 05:26:26 +0000, Siemel Naran wrote:
      [color=blue]
      > The exact design depends on the problem you're trying to solve, and there's
      > no right or wrong answer.
      >
      > One possibility is: (1) A table of categories with column NAME, (2) A table
      > of products with columns NAME and a foreign key to the table of categories,
      > (3) A table of product types with columns SIZE and COLOR and a foreign key
      > to the table of products.[/color]

      Well the biggest challenge I'm facing is each product (Let's say a
      t-shirt) has a distinct size, color, and quantity. I may have 5 red xl
      tshirts but only 1 blue xl shirt and there is where my problem lies.

      Comment

      • Siemel Naran

        #4
        Re: database design

        "_Skare_Kro w_" <tenchi25@acces s4less.net> wrote in message[color=blue]
        > On Thu, 05 Aug 2004 05:26:26 +0000, Siemel Naran wrote:[/color]
        [color=blue][color=green]
        > > One possibility is: (1) A table of categories with column NAME, (2) A[/color][/color]
        table[color=blue][color=green]
        > > of products with columns NAME and a foreign key to the table of[/color][/color]
        categories,[color=blue][color=green]
        > > (3) A table of product types with columns SIZE and COLOR and a foreign[/color][/color]
        key[color=blue][color=green]
        > > to the table of products.[/color]
        >
        > Well the biggest challenge I'm facing is each product (Let's say a
        > t-shirt) has a distinct size, color, and quantity. I may have 5 red xl
        > tshirts but only 1 blue xl shirt and there is where my problem lies.[/color]

        The QUANTITY column would be in table of product types (3).


        Comment

        • _Skare_Krow_

          #5
          Re: database design

          On Fri, 06 Aug 2004 03:08:29 +0000, Siemel Naran wrote:
          [color=blue]
          > "_Skare_Kro w_" <tenchi25@acces s4less.net> wrote in message[color=green]
          >> On Thu, 05 Aug 2004 05:26:26 +0000, Siemel Naran wrote:[/color]
          >[color=green][color=darkred]
          >> > One possibility is: (1) A table of categories with column NAME, (2) A[/color][/color]
          > table[color=green][color=darkred]
          >> > of products with columns NAME and a foreign key to the table of[/color][/color]
          > categories,[color=green][color=darkred]
          >> > (3) A table of product types with columns SIZE and COLOR and a foreign[/color][/color]
          > key[color=green][color=darkred]
          >> > to the table of products.[/color]
          >>
          >> Well the biggest challenge I'm facing is each product (Let's say a
          >> t-shirt) has a distinct size, color, and quantity. I may have 5 red xl
          >> tshirts but only 1 blue xl shirt and there is where my problem lies.[/color]
          >
          > The QUANTITY column would be in table of product types (3).[/color]

          That was so obvius.

          Thanks

          Comment

          • Raqueeb Hassan

            #6
            Re: database design

            Well, you might try "The Definitive Guide to MySQL" too. It's great
            book next to that SQL cookbook. You can see an overview of that book
            here at http://www.kofler.cc/mysql/mysqlbook.html

            And the best part, chapter 5, (Database design: The idea of relational
            databases. Relations, normalization, indices, hierarchies. MySQL data
            types. Many samples) is available online!

            Thanks to Michael Kofler.


            --
            raqueeb hassan
            congo (drc)

            Comment

            Working...