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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 How to link a composite table to another?

Author  Topic 

petre
Starting Member

11 Posts

Posted - 2010-01-04 : 12:21:38
hi friend,

In the link http://www.mediafire.com/i/?t2czxn2ihjg
has six tables:

tblMovies - collection of movies
tblMovieCopies - has copies of each movie. eg.: Movie = Avatar has PK of 1000 it has three copies there in teh tblMovieCopies:
CopyIndex MovieNumber CopyNumber(NOT number of copies)
1 1000 0
2 1000 1
3. 1000 2

tblMediaType - MediaType such DVD, VHS, Blue Ray.....

tblLoanTypes - Type of loans per movie: Overnight, Weekly, Fortnightly

tblLendingRates - A rate for a combination of MediType and LoandType
e.g: Assume Movie Avatar, it could be in MediaTypes DVD, VSH and Blue Ray, A DVD of "Avatar"(a copy) can be rented as "Overnight" for the rate of $25
A DVD of "Hancock" can be rented as "Weekly" for 15

there fore the combination of Mediaype and LoanType is unique.

Finally
tblLoans - consider this as a cart that the member adds all the renting movie to

The problem that i have is the relationship between tblLoans and tbllendingRates is M:N thus makes relatioship complicated.

How should i link tblLoand and tblLendingRates?

thanks

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-01-04 : 14:23:43
tblLendingRates links the M:N relationship between tblMediaType and tblLoanTypes.

Why not build a new table to link tblLoans and tbllendingRates in the same way?

M:N always needs such a table.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -