By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,165 Members | 1,928 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,165 IT Pros & Developers. It's quick & easy.

Database Normalization/Design Question

P: n/a
Normalization Question - Please bear with me, hopefully things will be
clear at the end of the question.

Given a treaty table containg treaties; Treaty1, Treaty2 etc and a
benefit table; Benefit1, Benefit2 etc. A treaty can only have certain
benefits:-

For example Treaty 1 can process Benefit1 and Benefit2.

To maintain this relationship a new table TreatyBenefit has been
created: -

Treaty1 Benefit1
Treaty1 Benefit2

A further table called policy has been added. A treaty can have many
policies

Treaty1 Policy1
Treaty1 Policy2

A Policy can contain 1 or more benefits

Policy1 Benefit1
Policy1 Benefit2 etc.

Giving structure as follows:-

T - TB - B
|
P

Given the above, should there be a constraint between policy and
TreatyBenefit or Policy and Benefit to enforce referential integrity.
If so which constraint, if not what form of constraint / checking
should I be using, to ensure that a Policy will contain the correct
benefits.

Thanks

Adrian
Jul 23 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Based on what is described so far, treaty as 1:M with benefits and
treaty as 1:M with policy. So... Create two tables TreatyBenefit and
TreatyPolicy, with both tables's treaty column being a FK to the Treaty
table.

Jul 23 '05 #2

P: n/a
Adrian (ap*********@hotmail.com) writes:
Given a treaty table containg treaties; Treaty1, Treaty2 etc and a
benefit table; Benefit1, Benefit2 etc. A treaty can only have certain
benefits:-

For example Treaty 1 can process Benefit1 and Benefit2.

To maintain this relationship a new table TreatyBenefit has been
created: -

Treaty1 Benefit1
Treaty1 Benefit2

A further table called policy has been added. A treaty can have many
policies

Treaty1 Policy1
Treaty1 Policy2

A Policy can contain 1 or more benefits

Policy1 Benefit1
Policy1 Benefit2 etc.

Giving structure as follows:-

T - TB - B
|
P

Given the above, should there be a constraint between policy and
TreatyBenefit or Policy and Benefit to enforce referential integrity.
If so which constraint, if not what form of constraint / checking
should I be using, to ensure that a Policy will contain the correct
benefits.


I'm not sure that I understand the problem. As you have described, I
would expect a table TablePolicies and PolicyBenefits:

T - TB - B
| /
TP /
| /
P - PB

But I guess that there is something I'm missing. If treaty T1 can process
benefits B1 and B2, T1 has policies P1 and P2, can P1 then also contain
B3?

Or is a policy always a subitem of Treaty? That is, a policy can only
belong to one treaty? And a benefit can only belong to one policy?
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #3

P: n/a
Erland Sommarskog <es****@sommarskog.se> wrote in message news:<Xn********************@127.0.0.1>...
Adrian (ap*********@hotmail.com) writes:
Given a treaty table containg treaties; Treaty1, Treaty2 etc and a
benefit table; Benefit1, Benefit2 etc. A treaty can only have certain
benefits:-

For example Treaty 1 can process Benefit1 and Benefit2.

To maintain this relationship a new table TreatyBenefit has been
created: -

Treaty1 Benefit1
Treaty1 Benefit2

A further table called policy has been added. A treaty can have many
policies

Treaty1 Policy1
Treaty1 Policy2

A Policy can contain 1 or more benefits

Policy1 Benefit1
Policy1 Benefit2 etc.

Giving structure as follows:-

T - TB - B
|
P

Given the above, should there be a constraint between policy and
TreatyBenefit or Policy and Benefit to enforce referential integrity.
If so which constraint, if not what form of constraint / checking
should I be using, to ensure that a Policy will contain the correct
benefits.


I'm not sure that I understand the problem. As you have described, I
would expect a table TablePolicies and PolicyBenefits:

T - TB - B
| /
TP /
| /
P - PB

But I guess that there is something I'm missing. If treaty T1 can process
benefits B1 and B2, T1 has policies P1 and P2, can P1 then also contain
B3?

Or is a policy always a subitem of Treaty? That is, a policy can only
belong to one treaty? And a benefit can only belong to one policy?


Thanks for the responses so far. To clarify my question, a treaty can
have a number of policies, but a policy can only belong to 1 treaty.
(Essentially my policy table above is TreatyPolicy)

T
|
/|\
TP
This Policy table can contain a number of benefits but only those
benefits which the treaty supports.

What I am trying to determine is whether the constraint between the
Treaty Policy Benefit table should be with the TreatyBenefit or
Benefit table. (I know what I think it is but a collegue is
disagreeing and I would like an unbias assessment :) )

ie
T--------TB------B
| /
TP /
| /
TPTB--/

(Can get back to the treaty table via 2 routes)

OR
T----TB-----B
| /
| /
TP /
| /
TPB----/

(Not restricting the treaty policy benefit table by just those
benefits which belong to the treaty)

Hope I'm making sense :)

Thanks

Adrian
Jul 23 '05 #4

P: n/a
Adrian (ap*********@gmail.com) writes:
Thanks for the responses so far. To clarify my question, a treaty can
have a number of policies, but a policy can only belong to 1 treaty.
(Essentially my policy table above is TreatyPolicy)
...
This Policy table can contain a number of benefits but only those
benefits which the treaty supports.

What I am trying to determine is whether the constraint between the
Treaty Policy Benefit table should be with the TreatyBenefit or
Benefit table. (I know what I think it is but a collegue is
disagreeing and I would like an unbias assessment :) )

T--------TB------B
| /
TP /
| /
TPTB--/

(Can get back to the treaty table via 2 routes)


This looks better than the other, but I'm sure that it's the right one.
I have a killer question: Can a benefit be associated with a treaty
without appearing in none of the policies of the treaty? If not, your
TB table appears to be superfluous. (Unless there is data on the TB
connection which is independent of the policy.)
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #5

P: n/a
Erland Sommarskog <es****@sommarskog.se> wrote in message news:<Xn**********************@127.0.0.1>...
Adrian (ap*********@gmail.com) writes:
Thanks for the responses so far. To clarify my question, a treaty can
have a number of policies, but a policy can only belong to 1 treaty.
(Essentially my policy table above is TreatyPolicy)
...
This Policy table can contain a number of benefits but only those
benefits which the treaty supports.

What I am trying to determine is whether the constraint between the
Treaty Policy Benefit table should be with the TreatyBenefit or
Benefit table. (I know what I think it is but a collegue is
disagreeing and I would like an unbias assessment :) )

T--------TB------B
| /
TP /
| /
TPTB--/

(Can get back to the treaty table via 2 routes)


This looks better than the other, but I'm sure that it's the right one.
I have a killer question: Can a benefit be associated with a treaty
without appearing in none of the policies of the treaty? If not, your
TB table appears to be superfluous. (Unless there is data on the TB
connection which is independent of the policy.)


Yes, a benefit can be associated with a treaty without any policies
for that treaty having the benefit.

Essential a treaty can have any benefit, but a policy can only have
benefits in which the treaty to which it belongs allows those
benefits.

So if the complete benefit list contains the benefits BEN1, BEN2,
BEN3. But Treaty 1 only allows BEN1 and BEN2, then any policy
belonging to Treaty 1 should only be allows BEN1 and BEN2 as well.

Cheers

Adrian
Jul 23 '05 #6

P: n/a
On 7 Feb 2005 01:43:13 -0800, Adrian wrote:
Yes, a benefit can be associated with a treaty without any policies
for that treaty having the benefit.

Essential a treaty can have any benefit, but a policy can only have
benefits in which the treaty to which it belongs allows those
benefits.

(snip)

Hi Adrian,

Based on this and your previous postings, the *FIRST STEP* in my design
would look like this:

T-----TB-----B
| | /
| | /
TP | /
\ | /
\ | /
TPTB

I tried to put in some crowfoots to depict cardinalty, but the drawing
would have become a mess - I trust you can work that out for yourself,
though :-)

In the *SECOND STEP*, I would recognise that the relationship between TPTB
and B is superfluous, as it's already implied by the relationship between
TPTB to TB in combination with the relationship between TB and B. That
means it's safe to remove the TPTB - B relationship, leaving this as the
final design:

T-----TB-----B
| |
| |
TP |
\ |
\ |
TPTB

Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)
Jul 23 '05 #7

P: n/a
Hugo Kornelis <hugo@pe_NO_rFact.in_SPAM_fo> wrote in message news:<7u********************************@4ax.com>. ..
On 7 Feb 2005 01:43:13 -0800, Adrian wrote:
Yes, a benefit can be associated with a treaty without any policies
for that treaty having the benefit.

Essential a treaty can have any benefit, but a policy can only have
benefits in which the treaty to which it belongs allows those
benefits.

(snip)

Hi Adrian,

Based on this and your previous postings, the *FIRST STEP* in my design
would look like this:

T-----TB-----B
| | /
| | /
TP | /
\ | /
\ | /
TPTB

I tried to put in some crowfoots to depict cardinalty, but the drawing
would have become a mess - I trust you can work that out for yourself,
though :-)

In the *SECOND STEP*, I would recognise that the relationship between TPTB
and B is superfluous, as it's already implied by the relationship between
TPTB to TB in combination with the relationship between TB and B. That
means it's safe to remove the TPTB - B relationship, leaving this as the
final design:

T-----TB-----B
| |
| |
TP |
\ |
\ |
TPTB

Best, Hugo


Hugo,

thanks for this. I totally agree with your reasoning and very well explained.

Thanks

Adrian
Jul 23 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.