Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 1st, 2006, 12:43 PM
Friend of Wrox
 
Join Date: Aug 2006
Posts: 107
Thanks: 0
Thanked 0 Times in 0 Posts
Default table design.. help please

hi all,

i have two tables
table1
-ID(PK)
-price
-Description
table 2
-ID(FK)
-Parts
-Details

Each product is having a unique ID.
but every product will have different parts(say 5 parts for the product with ID=23)

how can i insert(or have) multiple values for the parts and details fields for a single product(with ID=23)

is it possible?

can anyone give me an idea, how can i design my table structure(so that i can have the above requirements

hope the problem is clear to all
thanks in advance


 
Old September 1st, 2006, 01:06 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

So what kind of application are we helping you build? (Just curious because of your frequent posts)

Table 1 is ok table 2 should be

pk (int auto incerement)
product_fk (id in your example)
Parts
Details

So a row in table one could look like this:

Table 1
ID PRICE Description
1 5.00 Widget A

Table 2
PK Product_fk Parts Desc
1 1 Cog A Some Cog
2 1 Cog B Another Cog
3 1 Cog C Yet another Cog
4 2 Cog D A cog

etc

You would then just join your tables like this ... join table2 on table1.id = table2.product_fk

hth

"The one language all programmers understand is profanity."
 
Old September 1st, 2006, 01:35 PM
Friend of Wrox
 
Join Date: Aug 2006
Posts: 107
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks sir






Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with SQL table(s) design wilburb SQL Language 0 February 22nd, 2006 07:35 PM
Table Design Error? pannet1 BOOK: Expert One-on-One Access Application Development 0 April 15th, 2005 10:47 AM
database table design problems leeegglestone Access 2 August 12th, 2004 12:55 PM
Table Design Help donnapep SQL Server 2000 3 July 29th, 2004 01:13 PM
Java Design issue with UML and Design Patterns the_logical_way Apache Tomcat 0 May 31st, 2004 04:02 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.