Pergunta

In SQL you can describe a binary relation with a table like

Husband | Wife

We know that an husband can have only one wife, and viceversa, so that's a 1:1 relationship, and you can specify costraints such that if you add an husband that is already in the table you get an error, right?

If you add a third column like this

Husband | Wife | Country

We know that in some country one husband can have many wives; now you cannot put easy costraints, you have to deal with the third column.

So from a binary relation we get a ternary relation with different behavior that depends on the third column.

This example is stupid and useless, do you know any other example? (other example of ternary relationship such that one of the column changes the tuple behavior?)

Thank you.

EDIT: Another point of view to see my problem:

You have any binary relationship, within a domain: do you know any binary relation that changes costraints (or behavior) as domain changes?

Foi útil?

Solução

Another example might be that you can apply coupons towards an order, but for certain coupon types you can only apply one per order whereas other coupon types may be combined.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top