2. 步驟一:將各個實體畫出,並加上屬性,並將主鍵標為 PK ( 組合屬性為 Name 、 Fname 、 Minit 、 Lname ,則 Name 不需要加上去,如上所示 ) Employee Ssn Bdate Name Fname Minit Lname Address Salary Sex Employee Eependents_of Dependents_of 1 N Name Sex Birth_date Relationship PK Supervision 1 Supervisor N Superises Sex Salary Address Bdate Ssn Lname Minit Fname
3. Employee FK PK 步驟二:將弱實體前,加上強實體的主鍵,成為外來鍵 步驟三:下頁說明->為了配合圖形,先說明步驟四 步驟四:若有 1:N 時,將 1 那邊實體的主鍵, 加到 N 那邊成為外來鍵 ( 若是遞迴關係,則將主鍵從新命名, 原因:為了避免在同一個欄位出現兩個相同的 ssn) FK PK PK ( 因此原本是 ssn ,從新命名後變成 Super_ssn) Employee Dependent 請參考前一頁投影片上的 ER 圖 Sex Salary Address Bdate Ssn Lname Minit Fname Relationship Birth_date Sex Name Employee_ssn Super_ssn Sex Salary Address Bdate Ssn Lname Minit Fname
4. Department Name Locations Number Manages 1 1 步驟三: 1 對 1 時,將任一個實體的主鍵 加到另一邊上,成為外來鍵 PS :若是如上圖所以,有一邊是完全參予 的話,則將 1 條線上實體的主鍵,加 到 2 條線時那邊成為外來鍵 PK FK Department 如上圖,將 employee 的主鍵 放到 department 當外來鍵 Number Name Employee_ssn