Presentation is loading. Please wait.

Presentation is loading. Please wait.

Entity/Relationship Model

Similar presentations


Presentation on theme: "Entity/Relationship Model"— Presentation transcript:

1 Entity/Relationship Model
Recitation

2 The E/R Data Model Data Model:
framework for organizing and interpreting data Useful in mapping the meanings and interactions of real-world enterprises onto a conceptual schema Employs three basic concepts: entity sets relationship sets attributes

3 Entity Sets An object in the real world, distinguishable from all other objects e.g. with a unique identifier such as an id An entity set is a set of entities of the same type that share the same properties, or attributes e.g. instructor, student Instructor 98988 Tanaka 12345 Shankar 00128 Zhang 76543 Brown 76653 Aoi 23121 Chavez 44553 Peltier

4 Relationship Sets Relationship - an association among several entities. For example, we can define a relationship advisor that associates an instructor with a student. Relational Database: a database structured to recognize relations among stored items of information.

5 Relationship Sets Relationship - an association among several entities. For example, we can define a relationship advisor that associates an instructor with a student. Relationship set - a set of relationships of the same type Types of Relationship Sets binary – involves 2 entity sets n-ary – more than 2 entity sets Most of the relationship sets in a database system are binary (involves two entity sets). Occasionally, however, relationship sets involve more than two entity sets i.e. n-ary relationship sets

6 Attributes An attribute of an entity set is a function that maps from the entity set into a domain Since an entity set may have several attributes, each entity can be described by a set of (attribute, data value) pairs, one pair for each attribute of the entity set. E.g. A particular instructor entity may be described by id might be the set of all text the set {(ID, 76766), (name, Stein), (dept_name, CS)}

7 Entity-Relationship Diagrams
Express the overall logical structure of a database graphically.

8 Entity-Relationship Diagrams
Express the overall logical structure of a database graphically. E-R diagrams are simple and clear Basic structure: Rectangles divided into two parts Diamonds represent relationship sets Undivided rectangles represent the attributes of a relationship Lines link entity sets to relationship sets Dashed lines link attributes of a relationship set to the relationship set

9 Entity-Relationship Diagrams

10 Relationship Set Keys super key - the combination of fields by which the row is uniquely identified candidate key - super key from which you cannot remove any fields primary key - a column or a combination of columns that uniquely identify a record. Only one candidate key can be primary key

11 Relationship Set Keys super key - the combination of fields by which the row is uniquely identified candidate key - super key from which you cannot remove any fields

12 Relationship Set Keys super key - the combination of fields by which the row is uniquely identified candidate key - super key from which you cannot remove any fields primary key - a column or a combination of columns that uniquely identify a record. Only one candidate key can be primary key

13 Existence Dependencies and Weak Entity Sets
Weak Entity Sets – their existence depends on a dominant set No super keys, use discriminators (… pno) instead Loan is dominant in Loan_Pmt Payment is subordinate in Loan_Pmt Payment is existence dependent on Loan

14 Participation Constraints
Total - every entity in E participates in at least one relationship in R Partial - only some entities in E participate in relationships in R For example, we expect every student entity to be related to at least one instructor through the advisor relationship. Therefore the participation of student in the relationship set advisor is total. In contrast, an instructor need not advise any students. Hence, it is possible that only some of the instructor entities are related to the student entity set through the advisor relationship, and the participation of instructor in the advisor relationship set is therefore partial.


Download ppt "Entity/Relationship Model"

Similar presentations


Ads by Google