Wednesday, March 28, 2012

Relationship between two tables

Hi,
We can create more than one
relationship between two tables. Could you tell me a situation where we nee
d two relationships between two tables?
ThanksSay you have a customers table and a table that represents a transaction bet
ween two customers holding two columns with a customer id. The referencing t
able would need to have two foreign keys pointing on the customerid
--
BG, SQL Server MVP
www.SolidQualityLearning.com
"Chrissi" <anubisofthydeath@.hotmail.com> wrote in message news:OM$bER0VFHA
.1404@.TK2MSFTNGP09.phx.gbl...
Hi,
We can create more than one
relationship between two tables. Could you tell me a situation where we nee
d two relationships between two tables?
Thanks|||Hi
You can have that kind of relationship but it violates 2nd and 3rd Normal
Forms:
For Eg:
Table_Student
Name Subject-ID Room-Number
Table_Class Room
Subject-ID Subject-Desc Room-Number
was this your question?
best Regards,
Chandra
http://chanduas.blogspot.com/
http://www.examnotes.net/gurus/default.asp?p=4223
---
"§Chrissi§" wrote:

>|||> You can have that kind of relationship but it violates 2nd and 3rd Normal
Not necessarily. Suppose we have the following
Create Table Employees
(
Id Int Primary Key
, LastName VarChar(25)
, FirstName VarChar(25)
)
Create Table ManagerStaff
(
Id Int Primary Key
, ManagerId Int References Employee(Id)
, SubordinateId Int References Employee(Id)
, StartDate DateTime
, EndDate DateTime
)
I have two relationships to the Employees table yes this is still normalized
to
third normal form.
Thomas

No comments:

Post a Comment