4 Entity Relationship Diagram 1 2553.ppt

1y ago
13 Views
2 Downloads
619.89 KB
18 Pages
Last View : 23d ago
Last Download : 3m ago
Upload by : Averie Goad
Transcription

DatabaseSystemEntity RelationshipModelWorrakit Sanpote1ER Modelวัตถุประสงค์ �มายและรู ปแบบของ ER Model มีความรู อมูลโดยใช้ ER ModelER ModelEntity Relationship (ER) Model ER model forms the basis of an ER diagram ERD represents conceptual database as viewed by end user ERDs depict database’s main components: Entities Attributes Relationships

ER ModelER ModelEntity Relationship Diagram: ER Diagramแผนภาพเอนทิ ตีรีเลชันชิ พเป็ นการอธิ บายโครงสร้ �อธิ ��ใน �ชันชิ พ ซึ่ งเป็ �หลักการ เป็ นเครื่ องมือช่ วยในการสื่ อสารระหว่างผูอ้ �ผูใ้ ช้ฐานข้อมูลรู ปที่ 1. �อง ER ModelER Modelองค์ ประกอบทีส่ ํ �ิตรี ีเลชันชิพER ModelEntityCharacteristics of EntityEntity คือบุคคล สถานที่ วัตถุ หรื อเหตุการณ์ที่ทาํ �อมูลที่ตอ้ งการจัดเก็บ �ี้ถึงความเป็ �ว(uniquely identifiable) ��็ น 3 ประเภทด้วยกันคือ Refers to entity set and not to single entity occurrence Corresponds to table and not to row in relational environment In both Chen and Crow’s Foot models, entity is representedby rectangle containing entity’s name Entity name, a noun, is usually written in capital letters Regular Entity or Strong Entity Weak Entity Composite Entity

ER ModelER ModelRegular Entity or Strong EntityWeek Entityคือ Entity ทัว่ ๆ ไป ที่มี Attribute uple ได้ Weak entity meets two conditions Existence-dependent.Cannotexist without entity with which ithas a relationship Hasprimary key that is partially or totally derived from parententity in relationshipER ModelER Model Weak Entity คือ Entity ที่ตอ้ งอาศัย Attribute จาก Entity ��ลแต่ละ TupleStudent (Strong)รหัสชื่อSubject อวิชา45001เดชาบริ ��งสร้างRegis Detail(Weak)รหัสปี 001 1/450145002 1/450145001 1/450245002 1/4502Regis Detailสัญลักษณ์ของ Weak Entityรู ปที่ 15. ภาพแสดง Week Entity

ER ModelER ModelComposite Entity เป็ น Entity ��ธ์แบบ M:M ให้เป็ นแบบ 1:M Composite Entity จะกลายเป็ น Entity ใหม่ โดยรวมเอา Key Attributeของทั้ง 2 Entity หลัก และส่ วนสนใจอื่น ๆ Primary Key ของ Composite Entity ก็คือ Key Attribute ของทั้ง 2Entity หลักนัน่ เองENROLL สัญลักษณ์เป็ นรู ปสี่ �ด้วยสี่ เหลี่ยมรู �กษณ์ของ Composite EntityER ModelER � ปที่ 17. ภาพแสดงก่อนสร้าง Composite Entity แบบ Chen eTermรู ปที่ 18. ภาพแสดง CompositeEntity แบบ Chen Model

ER ModelER ModelRecursive Entity A recursive entity is one in which a relationship can exist betweenoccurrences of the same entity set. Found within a unary relationship.1EMPLOYEEIs married to11EMPLOYEEmanagesM MCOURSENrequiresรู ปที่ 19. ภาพแสดง Composite Entity แบบ Crow’s foot ModelER ModelER ModelAttribute Characteristics of entities In Chen model, attributes are represented by ovals and areconnected to entity rectangle with a line Each oval contains the name of attribute it represents In Crow’s Foot model, attributes are written in attribute boxbelow entity rectangleรู ปที่ 16. ภาพแสดง Recursive Entity แบบ Crow’s foot Model

ER ModelER ModelAttribute เป็ นคุณสมบัติหรื อลักษณะของ Entity เช่น Attributes ของ พนักงาน ประกอบด้วย EMP code EMP name EMP address สัญลักษณ์ Attributes � โดยมีชื่อของ Attributesกํากับอยูภ่ ายใน �อกับ Entityรู ปที่ 2. ภาพแสดง Attribute แบบ Chen Model และ Crow’s Foot ModelER ModelER ModelType of Attribute Simple Attribute Composite Attribute Key Attribute Single-Valued Attribute Multi-Valued Attribute Derived Attribute Simple Attribute Simple attribute cannot be subdivided ล้ว เช่น เพศ,เงินเดือน

ER ModelER Model Composite AttributeSNameSIDGPAStudent Composite attribute can be subdivided มีลกั ษณะตรงข้ามกับแบบ Simple �่อยไปได้อีก เช่น ชื่อสกุล �ด้เป็ น Attributes ชื่อ และสกุลรู ปที่ 3. ภาพแสดง Simple AttributeER ModelER Model Key AttributeFirstNameSIDComposite AttributeLastNameSNameGPAStudentรู ปที่ 4. ภาพแสดง Composite Attribute An attribute (or combination of attributes) that uniquelyidentifies individual instances of an entity type. เป็ น Attributes �งเอกลักษณ์ของ Entity �� าํ กัน) เวลาเขียน ER Diagram es ที่เป็ น Key ด้วย

ER ModelER Model Single-Valued AttributeFirstNameKey AttributeLastNameSNameSIDGPA Single-value attribute can have only a single value เป็ น Attributes �ยกย่อยไปได้อีก เช่น ชื่อสกุล �ด้เป็ น Attributes ชื่อ และ สกุลStudentรู ปที่ 5. ภาพแสดง Key AttributeER ModelER Model Multi-Valued AttributeSHELF NUMBOOK TYPEBOOK CODEPUBLISH CODEBOOKAUTHOR CODEรู ปที่ 6. ภาพแสดง Single-Valued Attribute Multi valued attributes can have many values มีลกั ษณะตรงข้ามกับแบบ Single �ข้อมูลได้หลายค่ า เช่ น เบอร์ โ ทรที่ ป ระกอบด้ว ยรหัส พื้ น ที่ แ ละตามด้ว ยหมายเลขโทรศัพท์ สัญลักษณ์เป็ น วงรี สองเส้น

ER ModelER Model Derived AttributeMOD CODECAR NUMCAR YEARCAR COLORCARMulti-Valued Attribute Attribute whose value may be calculated (derived) from otherattributes Need not be physically stored within database Can be derived by using an algorithm เป็ น Property �นวณ โดยอาศัยค่าใน Property อื่น ๆเช่น ค่าของอายุ ที่ได้มาจาก Property วันเกิด สัญลักษณ์เป็ น วงรี ��่อมกับวงรีรู ปที่ 7. ภาพแสดง Multi-Valued AttributeER ModelER ModelNameSurnameName SurnameIDKeyDerived Attributeรู ปที่ 8. ภาพแสดง Derived AttributeSexBirthdayStudentAgeTelMulti - Valuedรู ปที่ 9. ภาพสรุ ป Attribute ชนิดต่างๆDerived

ER ModelER ModelRelationship or Connectivity หมายถึง Entity �ธ์ระหว่าง 2 Entity ขึ้นไป เป็ �่าง Entity ที่มี Attributes ร่ วมกัน �นธ์จะถูกระบุดว้ d) และคําที่อธิ �์น้ นั ๆ ��หว่าง Entity นั้น ๆ ด้วย ความสัมพันธ์มี 3 ประเภท ดังนี้ One-to-One (1:1) One-to-Many (1:M) Many-to-Many (M:N) One-to-One (1:1) เป็ �มาชิ กของใน Entity หนึ่ �ชิกของใน Entity อีกอันหนึ่ง �่านั้นChen ModelEmployee1OwnerOwnerEmployee Many-to-Many (M:N) เป็ �มาชิ กของใน Entity หนึ่ �ชิกของใน Entity อีกอันหนึ่ง มากกว่า 1 สมาชิก เป็ �มาชิกมากกว่า 1 สมาชิก ของใน Entity หนึ่ งไปสัมพันธ์กบั กับสมาชิ กของใน Entityอีกอันหนึ่ ง มากกว่า 1สมาชิกChen ModelEmployeeCarER Model One-to-Many (1:M)1CarCrow’s foot ModelER ModelEmployee1HaveOwnerCrow’s foot ModelChen ModelMCarCarCustomerEmployeeMBelong toOwnerCrow’s foot ModelNAccountCar

ER ModelER Model1. Unary2.BinaryRelationship’s Degree A relationship’s degree indicates the number of associated entities orparticipants. Unary Relationship : single entity is associated. Binary Relationship : two entities are associated. Ternary Relationship : three entities are associated. Quandary Relationship : four entities are associated.StaffIs managerOwnsStaff4. Quaternary3.TernaryStaffFinancial ictorรู ปที่ 10. ภาพแสดง Relationship’s DegreeER ModelCarER ModelCardinality The specific number of entity occurrences associated with oneoccurrence of the related entity. การระบุจาํ นวนของ Entity �พันธ์กบั อีก Entity หนึ่งรู ปที่ 11. ภาพแสดง CardinalityBid

ER ModelER ModelChen ModelRelationship ParticipationManager Optional หมายถึง Entity �พันธ์กบั Entity หนึ่ งหรื อไม่กไ็ ด้ Mandatory หมายถึง Entity �มพันธ์กบั Entity andatoryOptionalSectionManagerBest SellerSellerClassTeacherClassTeacher1teaches Week Relationship Strong RelationshipSectionselectedBest �ู ปที่ 12. ภาพแสดง Cardinality แบบ Chen Model และ Crow’s foot ModelER ModelRelationship row’s foot ModelER Model Week Relationship Exists if PK of related entity does not contain PK component ofparent entity Primary Key ของอีก Entity หนึ่งเป็ น Foreign key ของอีก Entityหนึ่งโดยไม่ทาํ เป็ น Primary key เส้น Relationship เป็ นเส้นประ (ใช้ได้เฉพาะใน Crow’s foot modelเท่านั้น)

ER ModelER ModelEx. การมีส่วนร่ �ี่ Class Entity เป็ น Optional (แบบเลือกได้) ที่ Professor Entity เป็ น Mandatory (แบบบังคับ) �าง Entity เป็ นแบบ Weak (อ่อนแอ)รู ปที่ 13. ภาพแสดง Week RelationshipER ModelEx. การมีส่วนร่ �ี่ Class Entity เป็ น Mandatory (แบบบังคับ) ที่ Course Entity เป็ น Mandatory (แบบบังคับ) �าง Entity เป็ นแบบ Weak (อ่อนแอ)ER Model Strong Relationship Exists when PK of related entity contains PK component of parententity Primary Key ของอีก Entity หนึ่งเป็ น Foreign key ของอีก �ป็ น Primary key เส้น Relationship เป็ นเส้นทึบ

ER ModelER ModelSupertype and Subtype Relationshipsเป็ �อ้ มูลแบ่ งออกเป็ นกลุ่ มย่อยได้มากกว่า 1กลุ่ ม โดยข้อ มู ล กลุ่ ม ย่อ ยนั้น มี ร ายละเอี ย ดหลัก ซํ้า กัน ๆ เช่ น พนัก งานแบ่งเป็ นพนักงานรายเดือน พนักงานรายชัว่ โมง The generalization hierarchy depicts then parent-child relationship. The super type contains the shared attributes, while the subtypecontains the unique attributes.รู ปที่ 14. ภาพแสดง Strong Relationship A subtype entity inherits its attributes and its relationships from thesupertype entity.ER ModelER Modelการออกแบบฐานข้ อมูลด้ วย ER ้อมูลด้วย ER Model �อน non-overlapUNDERGRADUATEGRADUATESubtypeรู ปที่ 20. ภาพแสดง Supertype and Subtype Relationship1. �ะลักษณะหน้ าทีง่ านของระบบ �อียด �งระบบ ssiness Rules �

ER Model2. กําหนด Entity ทีค่ วรมีในระบบฐานข้ อมูล ูล �ด้เป็ นกี่ Entity �่ง ๆ อาจจะมีจาํ นวน Entity เป็ นจํานวนมาก ซึ่ งก็ขึ้นอยูท่ ี่ผใู ้ ช้วา่ �มูลมากเพียงใด โดยการกําหนด Entity จะต้องคํานึงถึง Entity �บบแข็งแรงด้วยER Model4. �ะของ Entity เป็ �ติ (Attributes) ให้กบั Entity �้วย Attributes ใดบาง �้วยว่า Attributes ใดบ้างที่จะเป็ น Composite Attributes Derived AttributesER Model3. การกําหนดความสั มพันธ์ ระหว่ าง Entity ว่าแต่ละ Entity �กนั นั้น จะสัมพันธ์กนั ด้วยเงื่อนไขใด �ธ์เป็ นอย่างไร One to One Relationship One to Many Relationship Many to Many RelationshipER Model5. การกําหนด Primary Key ของแต่ ละ Entity เป็ นการกําหนดให้ Entity แต่ละ Entity ��้อย่างไม่ซ้ าํ ซ้อน นัน่ ก็คือการกําหนด Primary Key นัน่ เอง

ER ModelER Modelตัวอย่ างการออกแบบฐานข้ อมูลด้ วย E-R �ยู่ 3 คณะ คือ เกษตร, ��าสตร์- ��ง ๆ- ��์หลายๆ คน- �ได้หลายวิชา ��ดียว- �ละภาคก็จะมีหวั หน้าภาค1. �ะลักษณะหน้ าทีง่ านของระบบ (โจทย์ กาํ หนด)2. กําหนด Entity ทีค่ วรมีในระบบฐานข้ อมูล Entity Faculty �คณะ Entity Department �แผนก Entity Teacher �อาจารย์ Entity Subject �วิชาER ModelER Model3. กําหนดความสั มพันธ์ ระหว่ าง EntityM1M1M1M1MM1

ER Model4. �ง Entity FacultyER Model Teacher Subject DepartmentER ModelER Model5. การกําหนด Primary Key ของ Entity Entity Faculty คือ Faculty ID Entity Department คือ Dep ID Entity Teacher คือ Teacher ID Entity Subject คือ Subject IDรู ปที่ 21. ภาพแสดง ER Model (Chen’s Model) �

ER ModelData ModelDepartmentPKFacultyUnderDep IDPKDep NameFaculty IDFaculty NameFaculty IDTeacherUnderUnderPKTeacher IDTeacher NameSalarySubjectPKDep IDSubject IDTeachingSubject NameUnitPK, FK1PK, FK2Dep IDรู ปที่ 22. ภาพแสดง ER ModelLeaderIs DepLeaderSubject IDTeacher IDTerm(Crow’s Foot Model) �70

A relationship's degree indicates the number of associated entities or participants. Unary Relationship : single entity is associated. Binary Relationship : two entities are associated. Ternary Relationship : three entities are associated. Quandary Relationship : four entities are associated. ER Model Staff Is manager Owns Car

Related Documents:

WIRING DIAGRAM DIRECTORY WARNING: Wiring direct to battery not recommended. Install actuator after ignition switch, or master power switch. Diagram 1 Diagram 2 Diagram 3 Diagram 4 Diagram 5 Diagram 6 Diagram 7 Diagram 8 Diagram 9 Diagram 10 Diagram 11 Diagram 12 Diagram 13 Diagram 14 Diagram 15 On/Off, 12VDC, 3-wire/3-pin, SPST On/Off, 12VDC, 3 .

1 IV. Entity Relationship Modeling 2 Entity-Relationship Model (ERM) Basis of an Entity-Relationship Diagram (ERD) A design technique Diagrams entities sets (with attributes) and the relationship between the entity sets. Recall previous definitions Entityrefers to the entity set and not a single entity occurrence E-R diagrams are the deliverablesof the

Structured analysis Object-oriented analysis System boundary Context diagram Use case diagram Functionality Data flow diagram Activity diagram Interaction diagrams Data Entity-relationship diagram Class diagram Object diagram Control State diagram State diagram Structured methods System as a set of nested processes accessing system data.

2.1 Entity-Relationship Diagram The concept for Entity-Relationship diagram (also called ER diagram) was introduced in a 1976 paper by Peter Chen six years after E.F. Codd published his seminal work defining the relational model of data. Chen's notation provided a way to graphically show relationships between data models.

A weak entity can be identified uniquely only by considering the primary key of another (owner) entity. Owner entity set and weak entity set must participate in a one-to-many relationship set (one owner, many weak entities). Weak entity set must have total participation in this identifying relationship set. Employees ssn name lot

Note: The diagram shown above is for reference only. Use the instructions beginning on the next page to draw your Package diagram. Creating a Package Diagram from the Use Case Diagram The package diagram is a type of class diagram and can be created from a use case diagram. 1. Make sure the Use Case diagram c

Figure 2: A sequence diagram that has incoming and outgoing messages Notice that in Figure 2 the diagram's label begins with the letters "sd," for Sequence Diagram. When using a frame element to enclose a diagram, the diagram's label needs to follow the format of: Diagram Type Diagram Name UML basics: The sequence diagram Page 3 of 24 http .

Animal Nutrition & Health addresses the nutrition additives segment of the feed and pet food markets. Human Nutrition & Health largely addresses nutrition and functional ingredients segment of the food markets. Personal Care is focusing on the actives and ingredients in the sun care, skin care and hair care industries. DSM is the only producer who can supply the lawsuits, and public rejection .