I have a problem, it is as follows:
An internet store wants to send e-mails to customers. It wants to keep a database to record what messages have been sent to which customer. Suppose an e-mail has a message id (M-id), a subject (Subject), and message body (Body). The customer is identified by his e-mail address, other customer information includes name (Name), gender (Gender), and address (Address).
When the internet store sends an email to the customer, SendDate is recorded.
Now we're suppposed to draw an ERD with the information given above and then draw a relational database schema.
Based on the bold statement, I drew the following ERD, not knowing what to do with cardinality and participation:
The answer to the problem is this:
Note that Send is a weak entity, and that there is full participation between email and contains, sends and customer.
Q1: Why can't I use a ternary relationship for this example?
Q2: Regardless of this problem, in a ternary relationship, how do we determine the cardinality and participation?
Q3: How does one arrive to the final answer?
Q1: Why can't I use a ternary relationship for this example?
The question indicates that e-mail is recorded on behalf of a single internet store. There's no need to specify it in each association, the entire database belongs to the store.
If you were modeling e-mail sent to customers at multiple internet stores, a ternary relationship would be appropriate.
Q2: Regardless of this problem, in a ternary relationship, how do we determine the cardinality and participation?
The cardinality of each role in a relationship is the number of values in that role that can be associated with each valid combination of the other roles. E.g. if you have a relationship (A, B, C)
, then the cardinality of A
is the number of values from A
that can appear for each valid combination of (B, C)
. If (B, C)
is a superkey then the cardinality of A
is one.
Participation is simpler: for each role, must all the values in the associated entity set necessarily participate in the relationship, or can some exist independently? I suggest you also see my answer to this question: is optionality (mandatory, optional) and participation (total, partial) are same?.
Q3: How does one arrive to the final answer?
I disagree with the final answer you posted. In the ER model, weak entity sets can't have multiple identifying relationships, and usually have a weak key. I suspect the author may be using some network data model concepts (such as conflating relationships with foreign key constraints and/or thinking only entities can have attributes).
My own answer to the question would look like this: