Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 Help on database design

Author  Topic 

Neven1986
Starting Member

6 Posts

Posted - 2010-10-24 : 15:34:52
Please help me with some advice. I'm doing on project for my catalog, and I have some doubts. Lets say I have one model of T-shirt called XYZ. XYZ comes in S,M,L sizes and in red,blue and yellow color. What you thing which is the best option for storing that kind of data. My thought was for every color and size put new row in table, like this:

Name Size Color Qnt

XYZ S Red 1
XYZ S Blue 2
XYZ M Blue 6
etc...

But i don't think that is optimal design for database, because I have a lot of data to put in database.

Please if someone has some advice to share I would be appreciated.

Thanks in advance

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-10-24 : 15:43:42
That's optimal for speed. For reads and writes.



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

slimt_slimt
Aged Yak Warrior

746 Posts

Posted - 2010-10-24 : 15:44:10
this is just fine.
for every t-shirt combination (colour, size, name) you ought to put a new row (new productID in your Product Table).
XYZ S Red - ID1
XYZ M Red - ID2
...etc.

quantity must be put in different table (not in Product table) because it refers to sales.
Go to Top of Page

Neven1986
Starting Member

6 Posts

Posted - 2010-10-24 : 15:54:37
Thank you for quick reply :)
Go to Top of Page

ahmeds08
Aged Yak Warrior

737 Posts

Posted - 2010-11-16 : 08:12:50
you can maintain seperate master tables for two columns.'colour','size'.then you can refer the primary key of the two tables in your table which contains t-shirt names.so now each t-shirt name will be mapping to diffrent size and colour.
Go to Top of Page
   

- Advertisement -