60 likes | 180 Views
Phone. Employee. Email. Home Phone. Mobile Phone. Employee. Personal Email. Business Email. Multivalue attribute : contains more than one value. Contrast with:. What are the pros and cons in terms of flexibility and preciseness in meaning?.
E N D
Phone Employee Email Home Phone Mobile Phone Employee Personal Email Business Email Multivalue attribute: contains more than one value Contrast with: What are the pros and cons in terms of flexibility and preciseness in meaning? Department of Computer Science and Engineering, HKUST Slide 1
Take Home Messages from the Customer-Depositor-Account Example • The exact meaning of a word may be ambiguous • What does “Amount” mean? • What does “Name” (of Customer and Account) mean? Are they the same? • Whether to put an attribute to an entity or a relationship is not easy to determine • In the example, we try to argue that if “Amount” represents the deposit amount of EACH transaction, it should be associated with the relationship, because • “Amount” is a property of the “deposit” action which is represented by the relationship between customer and account • If we associate the “Amount” of each deposit to the account or to the customer, then multi-value attributes must be used, which is discouraged (you would know why when we study the relational data model) Department of Computer Science and Engineering, HKUST Slide 2
Take Home Messages from the Customer-Depositor-Account Example • We further argue that if “Amount” is the balance of an account, there is always only one single balance for an account. It should be a property of account, not a property of the act of “depositing” money (though the act changes the balance) Department of Computer Science and Engineering, HKUST Slide 3
ISA (“is a”) Relationship • A university has both part-time and full-time students. They are largely the same but with some differences: Name Student-No Course-No Title Grade Student Course Advisor takes FT/PT Emp-Name • Problem: If only FT students have advisors and only PT students have employer names, there are lots of empty values in the database Department of Computer Science and Engineering, HKUST Slide 4
Name Student-No PT Student Emp-Name Separating the Students Name Student-No Course-No Title Grade FT Student Course Advisor takes takes Grade • Other problems are introduced • If a student changes from FT to PT, he will exist in both entities Department of Computer Science and Engineering, HKUST Slide 5
Introduce a new Relationship: ISA Name Student-No Course-No Title Grade Student Course takes ISA PT Student PT Student • A PT student “IS-A” Student • A FT student “IS-A” Student • A Professor “IS-A” Student Emp-Name Advisor Department of Computer Science and Engineering, HKUST Slide 6