Download presentation
Presentation is loading. Please wait.
1
CS34311 The Entity- Relationship Model Part II.
2
CS34312 Database Design Stages Application Requirements Conceptual Design Logical Design Physical Design Conceptual Schema Logical Schema Physical Schema
3
CS34313 Relationship types in ER Model 3-ary “supplies” relationship: Supplier supplies Products to Consumers
4
CS34314 Recursive Relationship Types and Roles Recursive relationship type : Part-Subpart Roles: There are Parts that play the role of superPart There are Parts that play the role of subPart
5
CS34315 ER Model so far Structures Entity Types Relationship Types Binary, ternary, n-ary Recursive Attributes For entity types and relationship types Simple, composite, multivalued Roles
6
CS34316 ER Model: Key Constraints How : Underline the key attribute/attributes Key for Student is sNumber Key for Movie is Note: We can represent key for entity type consisting of more than 1 attribute (e.g.: Movie) We cannot represent multiple keys for an entity type (e.g: key for Student can be either sNumber or sName)
7
CS34317 ER Model: Cardinality Constraints How : Expressed using (min, max) Student can take >= 2 and <= 3 Courses Course can have >= 0 and <= * (infinity) Students min and max are non-negative integers max > min
8
CS34318 Cardinality Constraints 1:1 relationship type: A Dept has exactly one Manager, A Person can manage at most one Dept Person pNumber pName Dept dNumber dName Manages
9
CS34319 Cardinality Constraints 1:1 relationship type: A Dept has exactly one Manager, A Person can manage at most one Dept
10
CS343110 Cardinality Constraints 1:1 relationship type: A Dept has exactly one Manager, A Person can manage at most one Dept
11
CS343111 Cardinality Constraints 1:many relationship type: A Person works for exactly one Dept, A Dept can have any number of Persons Person pNumber pName Dept dNumber dName Works For
12
CS343112 Cardinality Constraints 1:many relationship type: A Person works for exactly one Dept, A Dept can have any number of Persons
13
CS343113 Cardinality Constraints 1:1 relationship type: A Dept has exactly one Manager, A Person can manage at most one Dept 1:many (1:n) relationship type: A Person works for exactly one Dept, A Dept can have any number of Persons Person pNumber pName Dept dNumber dName Manages (0, 1)(1, 1) Person pNumber pName Dept dNumber dName Works For (1, 1)(0, *)
14
CS343114 Cardinality Constraints 1:1 relationship type: A Dept has exactly one Manager, A Person can manage at most one Dept 1:many (1:n) relationship type: A Person works for exactly one Dept, A Dept can have any number of Persons
15
CS343115 Cardinality Constraints many:many (m:n) relationship type: A Person works for one or more Depts, A Dept can have any number of Persons Person pNumber pName Dept dNumber dName Works For
16
CS343116 Cardinality Constraints many:many (m:n) relationship type: A Person works for one or more Depts, A Dept can have any number of Persons
17
CS343117 Cardinality Constraints for n-ary relationships A Supplier supplies at least one Product to some Consumer Supplier sName sLoc Consumer cName cLoc Supply price Product pName pNumber qty
18
CS343118 Cardinality Constraints for n-ary relationships A Supplier supplies at least one Product to some Consumer
19
CS343119 Cardinality Constraints for n-ary relationships What about the following constraints : (1) A Consumer gets a Product from only one Supplier (2) Each Supplier supplies exactly 2 Products
20
CS343120 Cardinality Constraints for Recursive Relationships A Part can be subpart of one superPart A Part can have many subParts Contains Part pName pNumber subPartsuperPart quantity
21
CS343121 Cardinality Constraints for Recursive Relationships A Part can be subpart of one superPart A Part can have many subParts
22
CS343122 Cardinality Constraints for Recursive Relationships A Part can be subpart of one superPart A Part can have many subParts A Part can be subpart of many superParts A Part can have many subParts
23
CS343123 Cardinality Constraints for Recursive Relationships A Part can be subpart of one superPart A Part can have many subParts A Part can be subpart of many superParts A Part can have many subParts
24
CS343124 ER Model Constraints Summary Key Constraints Cardinality Constraints Expressed using (min, max) Binary relationship types are called 1:1, 1:many, many:many
25
CS343125 Summary of ER Structures Entity Types Relationship types – binary, ternary, n-ary. recursive Attributes For entity types or relationship types Simple, composite or multi-valued Constraints – key, cardinality Roles of entity types in a relationship type ISA relationship types Weak Entity Types – identifying relationship type, identifying entity type
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.