Re: I think my book may be wrong about cardinality, but I'm not sure

From: David Cressey <cressey73_at_verizon.net>
Date: Tue, 24 Jul 2007 20:35:46 GMT
Message-ID: <Cotpi.7328$XL4.3907_at_trndny04>


"beginner16" <kaja_love160_at_yahoo.com> wrote in message news:1185301676.680771.29780_at_b79g2000hse.googlegroups.com...
> hello
>
>
> 1)
> The following quote ( well I shortened it a bit ) is from a chapter
> briefly describing MARTIN E-R notation
>

I wonder if you shortened it correctly. Sometimes the diagram can make it look as if the cardinalities are written at the wrong end.

> "Say we have entities ORDER and PRODUCT. One ORDER must include at
> least one product, but it can also have more than one product. One
> PRODUCT can be related to zero or more ORDERS. Thus cardinality of
> PRODUCT is ( 1, N ) and cardinality of ORDER is ( 0, N )"
>
> But to my understanding, the cardinality of ORDER entity should be
> ( 1,N ) --> where 1 means min number of connections and N max number
> of connections an individual ORDER entity can have. And cardinality of
> PRODUCT entity should be ( 0,N ). But my book claims just the
> opposite!
>
>
I would have said it differently: the cardinality of the PRODUCT-ORDER relationship with respect to ORDERS is (1,N). the cardinality of the PRODUCT-ORDER relationship with respect to PRODUCTS is (0,N). I think you and I are on the same page, but may need to reread Martin.

> 2)
> Relationship between two entities is called binary connection or
> second degree relationship. But connection can exists between more
> than just two entities. Level of connection is determined by the
> number of different entity types that exist in a connection.
>
> Now as far as relational DB goes, don't tables have only binary
> connections ( second degree relationship )?
>

No. You can have a relational table whose key is made up of three foreign keys.
This implements a ternary relationship.

Take an airline reservation system. A single instance of a reservation might be made up of three keys: passenger_id, flight_id, and date. Date is often not thought of as an "entity", but it can be awfully handy to have a table with one row per date, with all the attributes of the date. Note that without any one of the three items, the reservation is ambiguous.

There is another way to model this situation, but I've chosen the way that illustrates reservation as a ternary relationship.

> So if in real world three entities are related to each other, but
> relational DB only supports binary connections, do we at conceptual
> level ( using E-R diagrams ) represent relationships between these
> three entities as one connection ( ternary connection ), or do we
> decompose it into two or more binary relationships?
>
>
Not necessarily. Some E-R diagramming techniques use a diamond for relationships that are more than binary. (arity higher than 2) Received on Tue Jul 24 2007 - 22:35:46 CEST

Original text of this message