469,898 Members | 1,674 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,898 developers. It's quick & easy.

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
Jul 20 '05 #1
5 1644
"_Skare_Krow_" <te******@access4less.net> wrote in message
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?


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.
Jul 20 '05 #2
On Thu, 05 Aug 2004 05:26:26 +0000, Siemel Naran wrote:
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.


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.

Jul 20 '05 #3
"_Skare_Krow_" <te******@access4less.net> wrote in message
On Thu, 05 Aug 2004 05:26:26 +0000, Siemel Naran wrote:

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.


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.


The QUANTITY column would be in table of product types (3).
Jul 20 '05 #4
On Fri, 06 Aug 2004 03:08:29 +0000, Siemel Naran wrote:
"_Skare_Krow_" <te******@access4less.net> wrote in message
On Thu, 05 Aug 2004 05:26:26 +0000, Siemel Naran wrote:

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


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.


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


That was so obvius.

Thanks
Jul 20 '05 #5
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)
Jul 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Rushikesh | last post: by
5 posts views Thread by Don Vaillancourt | last post: by
5 posts views Thread by trynittee | last post: by
reply views Thread by Laurynn | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.