Last week I had to do an assignment, and I did not agree with my teacher's ERD. She used a n-ary relationship while I used two binary relationships. I would like to know a true dba's (you) opinion on this.
The original assignment was to design an ERD, but since the ERD notation we use at school is very uncommon I'm going to ask what the relational diagram is supposed to look like. I think I can figure it out by myself once I know what the relational diagram is supposed to look like.
There's a housing assocation company that wants a database.
When a customer registers, the customer has to fill in his details (name, dob, phonenumber), and at that moment he also has to fill in a second form. There, he has to specify what city's he wants to live in, and what types of houses he wants to live in (house, mansion, villa etc.). It's required the customer fills in at least one city and one house.
The second form also has some other fields that the customer must fill in, such as a maximum price and a remark (e.g. the house has to have a swimming pool).
CUSTOMER: customer# (PK), firstname, lastname, dob, phonenumber FORM: customer# (PK), dateofregister, remark, maxprice contains1: customer# (PK), city (PK) contains2: customer# (PK), housetype (PK)
- CUSTOMER 1..1 FORM
- FORM 1..n contains1
- FORM 1..n contains2
My teachers answer
She merges both
FORM into the same table since they have the same key
customer#, and creates the table
CONTAINS: customer# (PK), city (PK), housetype (PK).
I don't agree with her, since I could specify
housetype twice with the same
customer#. Same thing goes for
city. I also don't agree on the fact that she puts all the
FORM attributes into the
CUSTOMER table. It looks sloppy IMO, and I believe you would split it up in the 3rd normal form and you would end up with my result again...