Download presentation
Presentation is loading. Please wait.
Published byGarey Charles Modified over 9 years ago
1
ENTITY RELATIONSHIP DATA MODEL ELIZABETH GEORGE
2
INTRODUCTION Architect Aeronautical engineers Computer architects Traffic engineers
3
DATA MODEL Data Model is made to transform the client requirements into specifications which are then given to the database builder
4
BENEFITS OF DATA MODELING Focusing on essentials Ease of communication and understanding Product or process improvement Exploring alternatives
5
TYPES OF MODELS Descriptive Prescriptive Representative
6
PHASES OF DATABASE MODELING Conceptual modeling Logical design phase Implementation
7
AN EXAMPLE: COMPANY DATABASE The company database keeps track of a company’s employees, departments, and projects. The company is organized into departments. Each department has a unique name, a unique number, and a particular employee who manages the department. We keep track of the start date when that employee began managing the department. A department may have several locations. A department controls a number of projects, each of which has a unique name, a unique number and a single location We store each employee’s name, social security number, address, salary, sex, and birth date. An employee is assigned to one department, but may work on several projects, which are not necessarily controlled by the same department. We keep track of the number of hours per week that an employee works on each project. We also keep track of the direct supervisor of each employee. We want to keep track of the dependents of each employee for insurance purposes. We keep each dependent’s first name, sex, birth date, and relationship to the employee.
8
ENTITIES AND ENTITY SETS Entity is a real or abstract object that can be distinctly identified and is of interest. The part of and enterprise that is of interest is called the Universe of Discourse (UoD) An entity set is a set of objects called entity instances or entity occurrences An entity set is an individual object of a given entity type
9
RELATIONSHIPS, CARDINALITY, ATTRIBUTES A relationship is an association among entities. Cardinality Ratio of a relationship: It is the maximum number of relationship instances that an entity can participate in. Information about entities which are of interest are called attributes.
10
ATTRIBUTES The description of each entity instance in an entity set and the information of interest is called entity attributes 10
11
TYPES OF ATTRIBUTE Simple or Composite Single or Multi-valued Stored or Derived Required or Optional Null attributes 11
12
ENTITY KEY, CANDIDATE KEY AND SUPER KEY A group of attributes (possibly one) used for identifying each entity in an entity set is called an entity key Primary key – is an attribute or a set of attributes that uniquely identifies a specific instance of an entity. Every entity in an ER model must have a primary key 12
13
CANDIDATE KEY When an entity has more than one attribute (or a set of attributes) that can serve as a primary key, each of such keys is called a candidate key. One and only one of the candidate keys is chosen as the primary key for the entity 13
14
WEAK ENTITY Weak entity – an entity that depends on another entity for identification Weak entity relation – a relation that is used for identifying entities Regular entity relation – a relation not used for identifying entities 14
15
NAMING CONVENTIONS: ENTITIES 1.Each entity name should come from the entity description 2.Each entity name should be a noun 3.The first letter should be a uppercase 4.Underscores should join the words 5.Names of the entities should be meaningful and should not conflict with other entity names 15
16
NAMING CONVENTIONS: RELATIONSHIPS 1.Each relationship name should be a verb that fits the sentence structure 2.Can use underscores to join the words 16
17
CROW’S FOOT DIAGRAMMATIC NOTATION 1:1 relation 17 EmployeeOffice Attributes
18
MANY TO ONE.. ETC… 18 n:1 relation EmployeeOffice Attributes
19
CARDINALITY RATIOS One – to – One One – to – Many Many – to – Many 19
20
WEAK ENTITY TYPES A weak entity is also called a subordinate entity since its existence depends on another entity. This is called existence dependence. The primary key of a weak entity is found by taking the primary key of the strong entity on which it is existence dependent combined with the discriminator of the weak entity set.
21
WEAK ENTITY SETS (CONT.) We depict a weak entity set by double rectangles. We underline the discriminator of a weak entity set with a dashed line. payment_number – discriminator of the payment entity set Primary key for payment – (loan_number, payment_number)
22
GENERALIZATION, SPECIALIZATION AND AGGREGATION “is a” relation For example: Car “is a” vehicle An entity cannot exist in a database which merely belongs to subclass, it should also belong to the super class The characteristics of car apply to all the vehicle If a general class entity participates in a particular relationship type, then the specialized class entity should also participate in that relation 22
23
SPECIALIZATION The Process of creating a subclass out of a given entity type is called specialization Ford Figo “is a” car “is a” vehicle The reverse process of taking 2 or more entity types and clubbing them under a common super class is called generalization 23
24
AGGREGATION Aggregates a particular ER schema and makes it into an entity at higher level of abstraction “contains” Offering “contains” offer Mostly used for Knowledge Management like ontology process 24
25
Aggregation n Consider the ternary relationship works-on, which we saw earlier n Suppose we want to record managers for tasks performed by an employee at a branch 25
26
E-R Diagram With Aggregation 26
27
27
28
28
29
TYPES OF GENERALIZATION AND SPECIALIZATION Disjoint Overlapping Union 29
30
30
31
31
32
32
33
SPECIALIZATION Is the process of defining a set of subclasses of a superclass The set of subclasses is based upon some distinguishing characteristics of the entities in the superclass Example: {SECRETARY, ENGINEER, TECHNICIAN} is a specialization of EMPLOYEE based upon job type. May have several specializations of the same superclass 33
34
EXAMPLE OF A SPECIALIZATION 34
35
GENERALIZATION The reverse of the specialization process Several classes with common features are generalized into a superclass; original classes become its subclasses Example: CAR, TRUCK generalized into VEHICLE; both CAR, TRUCK become subclasses of the superclass VEHICLE. We can view {CAR, TRUCK} as a specialization of VEHICLE Alternatively, we can view VEHICLE as a generalization of CAR and TRUCK 35
36
UNION TYPE Example: Database for vehicle registration, vehicle owner can be a person, a bank (holding a lien on a vehicle) or a company. Category (subclass) OWNER is a subset of the union of the three superclasses COMPANY, BANK, and PERSON A category member must exist in at least one of its superclasses Note: The difference from shared subclass, which is subset of the intersection of its superclasses (shared subclass member must exist in all of its superclasses). 36
37
EXAMPLE OF CATEGORIES (UNION TYPES) 37
38
SELF STUDY ER diagram conventions/ notations Strengths and Weakness of ER Diagram The database design process (step by step) i.Requirement analysis ii.Identify entity sets iii.Identify relationship sets iv.ER diagram v.Value sets and attributes vi.Primary keys vii.Prototype viii.Implementation 38
39
REFERENCES Database Management Systems, G.K. Gupta www.nptel.ac.in 39
40
THANK YOU! 40
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.