| Author |
Understanding of SQL Relationships
|
Ravi Kiran Va
Ranch Hand
Joined: Apr 18, 2009
Posts: 2234
|
|
My apologizes if this is not the right post .
One-to-one relationships are single-valued in both directions.
My understanding with the above is that
Consider a Zip Table
ZipNo Studentname
12 Harry
13 Kiran
And a Student Table
ID Name ZipNo
101 Harry 12
and there should not be any more student with zipno 12 . Then this will be a One to One
Am i right ?
|
Save India From Corruption - Anna Hazare.
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32654
|
|
No, that is not a one-to-many relationship because it is not a relationship.
It is only a relationship when the data join different tables.
Student table-----Tuition fees table
That will be a one-to-one relationship
Student table
Campbell 1234
Ravi 1235
Tuition Fees table
1234 $1.23
1235 $938475937459676734096740364376093470687234096732472340.99
You can have a one-to-many relationship
Student table as before
Residences table
King's Hall 99
Queen's Hall 98
Accommodation table
1234 99
1235 99
You can work out from that, both students shown live at King's Hall at present, and one has rather more tuition fees to pay than the other.
|
 |
Ravi Kiran Va
Ranch Hand
Joined: Apr 18, 2009
Posts: 2234
|
|
Thanks Campbell , Your explanation is very nice .
I understood how the tables should be written for supporting relationships.
|
 |
 |
|
|
subject: Understanding of SQL Relationships
|
|
|