แบบจำลองความสัมพันธ์ระหว่างข้อมูล
description
Transcript of แบบจำลองความสัมพันธ์ระหว่างข้อมูล
-
The Entity-Relationship Model
-
Semantic Model -
-
Semantic Model Entity Property EntityProperty Entity IdentityRelation Entity Type 2 Entity Type Subtype Entity Type Entity
-
- (Entity-Relationship Model)- -Entity Property Relation Entity SubType SuperType
-
Entity Relationship Diagram ER
-
ER ModelER-Model Peter Pin Shan Chen
(Weak Entity)
-
ER model()
(Weak Relationship) primary key
-
ER model()
()
-
ER model()E1E2R
(derived attribute)
E2 E1 E2 total participation E1
-
ER model()E1E2R
E1 E2 E2 partial participation E1
-
E-R diagramEntity Customer, department, division, employee building, room, branch, campus book, machine, product, raw material invoice, order, registration, reservation account, bond, course, stock
-
E-R diagramEntity 2 Strong Entity Weak Entity
-
E-R diagramAttributes Entity attribute entity -
-
E-R diagramAttribute 6 1. Simple Attribute: attribute sex salary atomic attribute2. Key Attribute : ID_people , ID_student
Attribute Domain : attribute
-
E-R diagramAttribute 6 3. Composite Attribute: attribute address street, area, city zipcode
-
E-R diagramAttribute 6 4. Single-Value Attribute: entity branch attribute Bno Single-Value Attribute B3 Bno (Branch_no)
-
E-R diagramAttribute 6 5. Multi-value Attribute: attribute
-
E-R diagramAttribute 6 6. Derived Attribute: entity attribute entity attribute attribute /// attribute
-
E-R diagramRelation () Entity 2 entity entity attribute entity entity
-
Cardinality Constraints (ratio) (one-to-one relationship) : entity entity
-
Cardinality Constraints (ratio) (one-to-many relationship): entity entity
-
Cardinality Constraints (ratio) (many- to- many relationship): entity
-
entity entity (Cardinality of Relationships)One to One relationship (1 : 1)One to Many relationship (1 : M)Many to Many relationship (M : M)
-
Mapping CardinalitiesOne to oneOne to many
-
Mapping Cardinalities Many to oneMany to many
-
One to One Relationship
11
-
One to Many
1M
-
Many to Many
1 1
-
Entity(Degree of Relationship)Unary (Recursive) Relationship Binary Relationship 2 Ternary Relationship 3
-
Entity(Degree of Relationship) 1mUnaryMMMTernaryBinaryMM
-
Fan Trap EntityChasm Trap -
-
-Fan Trap Entity one-to-many
-
-
-
-
-
-Chasm Trap entity entity 2 entity
-
-
-
-
-
-- Entity Entity Entity Entity-
-
-- 2
-
ER 1. CustomerCusIDCusNameCusSurNameCusAddCustomer (CusID, CusName, CusSurName, CusAdd)
-
ER ()2. 2.1 1 to 1 pk TeacherThIDThNameThSurNameTeacher (ThID, ThName, ThSurName)Faculty (FacID,FacName,ThID*)FacultyFacIDFacName11
-
ER ()2. 2.2 1 to M pk 1 M
CustomerCusIDCusNameCusSurNameCustomer (CusID, CusName, CusSurName)Orders (OID,OrderDate, ReqDate ,CusID*)OrdersOIDOrderDate1MReqDate
-
ER ()2. 2.3 NullCustomerCusIDCusNameCusSurNameCustomer (CusID, CusName, CusSurName)Orders (OID,OrderDate, ReqDate ,CusID*)OrdersOIDOrderDate1MReqDate
-
ER ()3. M to M PK PK Product (PID, PName, Price) Orders (OID,OrderDate, ReqDate ,CusID*)OrderDetail (OID*, PID*, Discount, Amount, UnitPrice) pk OrderDetail (id,OID*, PID*, Discount, Amount, UnitPrice)
-
ER ()4. PK PK Customer (CusID, CusName, CusSurName)CusCredit (CusID*, CreditNum)
-
ER ()5. PK PK PK Invoice (Inv no, Date)InvoiceDetail ( Inv no* ,Line)M