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
 New to SQL Server Programming
 Please help

Author  Topic 

norty911
Starting Member

41 Posts

Posted - 2008-10-02 : 07:26:03
Hi guys,

I have three tables:

1) A Motorcycle table which contains info like:

Color of bike
Price of bike
Top Speed of bike
..etb

2) A Series table which contains the motorbike series:

E.g. F series or G series

3) A Model table which contains the bikes Model number

E.g. F650GS or F800GS

I know that mutliple Models can belong to the same Series e.g:

The F series can have : F650GS, F800GS etc.

My question is, what would that table relationships be between these three tables?

At the end of the day I want to pull a query that says

Black Bike, $1000.00, F Series, F650GS

Thanks guys

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-10-02 : 07:27:58
http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspx



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

norty911
Starting Member

41 Posts

Posted - 2008-10-02 : 07:37:44
Im confused?

I know how to build the table relationships between Series and Model but how do build the relationships between that and the Motorcycle table?

Thats all I need to know?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-10-02 : 07:44:55
how are Model and series currently related?
Go to Top of Page

elancaster
A very urgent SQL Yakette

1208 Posts

Posted - 2008-10-02 : 07:45:48
you're confused....?
if you don't even know what the relationship is between Model and Motorcycle, how could we know? it could be 1:1 it could be 1:many. it's a question of business logic and how the system was designed. with some proper sample data we could probably make a guess, but that's all it would be

Em
Go to Top of Page

norty911
Starting Member

41 Posts

Posted - 2008-10-02 : 07:49:15
They are joined by relationship table

In other words I've go three tables

MODEL
id
modelName

RELATIONSHIP
modelId_fk
seriesId_fk

SERIES
id
seriesName

How do I link those three tables back to the Motorcycle table?

(Thanks in advance ;)
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-10-02 : 07:52:43
quote:
Originally posted by norty911

They are joined by relationship table

In other words I've go three tables

MODEL RELATIONSHIP SERIES
id modelId_fk id
modelName seriesId_fk seriesName

How do I link those three tables back to the Motorcycle table?

(Thanks in advance ;)


then what you want is to have a unique valued column (identity) on relationship table and add it as a foreign key in Motorcycle relationship_fk. so each motorcycle will have correspond to relationship record which suggests its model & series.
Go to Top of Page

norty911
Starting Member

41 Posts

Posted - 2008-10-02 : 07:57:54
Thank you! ;)
Go to Top of Page
   

- Advertisement -