Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.ms-sqlserver > #1876 > unrolled thread
| Started by | "Tony Johansson" <johansson.andersson@telia.com> |
|---|---|
| First post | 2015-02-06 18:40 +0100 |
| Last post | 2015-02-06 20:44 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.databases.ms-sqlserver
Problem with E-R model "Tony Johansson" <johansson.andersson@telia.com> - 2015-02-06 18:40 +0100
Re: Problem with E-R model Erland Sommarskog <esquel@sommarskog.se> - 2015-02-06 20:44 +0100
| From | "Tony Johansson" <johansson.andersson@telia.com> |
|---|---|
| Date | 2015-02-06 18:40 +0100 |
| Subject | Problem with E-R model |
| Message-ID | <mb2ua7$5im$1@dont-email.me> |
This is a question about horse jumping. I have these relations one Rider can have many horses but one horse can only be owned by one rider.So here we have one to many counted from the Rider side. One Rideclub can have many member which is Riders but one Rider can belong to only one RideClub. So here we have one to many counted from Rideclub One Rider can participate in many classes and one class can have many Rider so here we have many to many. For example Nisse Hult owns the two horses Trisdan and Sylfid. In my current E-R design I can tell which horse the Rider is using in a special class I can only know that Nisse Hult is using any of the horses that he owns. If I for example change the conditions so that I have one to one relationhip between Rider and Horse that will solve the problem because if Hisse Hult is starting in a class he owns only one horse. The other solution is that I can create a new table with is the contents of Horse and Rider and then remove the Horse and Rider. But if I do so I get a lot of double information as you can see here. So if I do this I can see directly which horse Nisse Hult is using becuse the Id will be put in the relation table in between Rider and Class Id social sec number Rider Horse ImgHorse DescHorse ImgRider RiderDesc Phone 1 123456-0001 NisseHult Trisdan ImgTrisdan Info about Trisdan img Nisse Hult Info Nisse Hult 123 45 2 123456-0001 NisseHult Kitty ImgKitty Info about Kitty Img Nisse Hult Info Nisse Hult 123 45 I hope you can understand what I'm trying to say. So what is the best solution if I want to know which Horse the Rider is starting with in a Class? //Tony
[toc] | [next] | [standalone]
| From | Erland Sommarskog <esquel@sommarskog.se> |
|---|---|
| Date | 2015-02-06 20:44 +0100 |
| Message-ID | <XnsA439D301CA94Yazorman@127.0.0.1> |
| In reply to | #1876 |
Tony Johansson (johansson.andersson@telia.com) writes: > I have these relations one Rider can have many horses but one horse can > only be owned by one rider.So here we have one to many counted from the > Rider side. From what I have understood, a horse can be co-owned by several people. And the rider does not necessarily own the horse at all. But it might be that a horse typically only has one rider. > For example > Nisse Hult owns the two horses Trisdan and Sylfid. > > In my current E-R design I can tell which horse the Rider is using in a > special class I can only know that Nisse Hult is using any of the horses > that he owns. Not sure that I follow. If you tie the horse to the class, then you also know the rider. As long as we can assume that the horse can only have one rider. Since this is not my business domain, I am not sure how safe this assumption is. Else you would need both horse, rider and class to be the key in that table. > The other solution is that I can create a new table with is the contents > of Horse and Rider and then remove the Horse and Rider. > But if I do so I get a lot of double information as you can see here. Right, as you have realised that is not the way should go. -- Erland Sommarskog, Stockholm, esquel@sommarskog.se
[toc] | [prev] | [standalone]
Back to top | Article view | comp.databases.ms-sqlserver
csiph-web