Unit 5 Entity-Relationship Model: Self Assessment Question (S) (Saqs)
This document describes the entity-relationship (ER) model used for database design. It includes:
- An introduction to ER modeling and its components like entities, attributes, and relationships.
- An example ER diagram for a company database with entities like employees, departments, projects.
- Descriptions of the different elements of an ER diagram including entities, entity sets, attributes, and relationships.
- Explanations of the different types of attributes in ER modeling like simple, composite, single/multi-valued, derived, null, and key attributes.
The document provides information on conceptual database design using the ER model through definitions, examples, and diagrams. It aims to explain the basic concepts and
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
71 views20 pages
Unit 5 Entity-Relationship Model: Self Assessment Question (S) (Saqs)
This document describes the entity-relationship (ER) model used for database design. It includes:
- An introduction to ER modeling and its components like entities, attributes, and relationships.
- An example ER diagram for a company database with entities like employees, departments, projects.
- Descriptions of the different elements of an ER diagram including entities, entity sets, attributes, and relationships.
- Explanations of the different types of attributes in ER modeling like simple, composite, single/multi-valued, derived, null, and key attributes.
The document provides information on conceptual database design using the ER model through definitions, examples, and diagrams. It aims to explain the basic concepts and
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20
Database Management Systems Unit 5
Sikkim Manipal University Page No.: 75
Unit 5 Entity-Relationship Model Structure 5.1 Introduction Objectives Self Assessment Question(s) (SAQs) 5.2 Conceptual Data model for Database Design Self Assessment Question(s) (SAQs) 5.3 ER Model Concept with an example: 5.3.1 Components of an ER Model 5.3.2 Different types of Attributes Self Assessment Question(s) (SAQs) 5.4 Relationships, Roles and Structural Constraints 5.4.1 Relationships 5.4.2 Degree of relationship type Self Assessment Question(s) (SAQs) 5.5 Constraints on Relationship Types Self Assessment Question(s) (SAQs) 5.6 Summary 5.7 Terminal Questions (TQs) 5.8 Multiple Choice Questions (MCQs) 5.9 Answers to SAQs, TQs, and MCQs 5.9.1 Answers to Self Assessment Questions (SAQs) 5.9.2 Answers to Terminal Questions (TQs) 5.9.3 Answers to Multiple Choice Questions (MCQs) 5.1 Introduction Entity-relationship model is used to represent objects in the real world and the relationship among these objects, which represents the overall logical structure of a database. We have also seen that the data model that is independent of both the DBMS software and the hardware is the conceptual model. ER model is a high-level conceptual model developed by Chen in Database Management Systems Unit 5 Sikkim Manipal University Page No.: 76 1976 to facilitate database design. The ER model is extremely useful in mapping the meaning and interaction of real world enterprises onto a conceptual schema. The main usage is in the design of the database Relations: Consider a relation called PART of degree 5. The five domains are sets of values representing, respectively, part numbers, part names, part weights, part colors, and locations in which parts are stores. The 'part color' domain, for example, is the set of all valid part colors. As the figure illustrates, it is convenient to represent a relation as a table. Each row of the table represents one n-tuple [or simply one tuple] of the relation. The number of tuples in a relation is called the cardinality of the relation; e.g., the cardinality of the PART relation is four. Relations of degree one are said to be unary; similarly relations of degree two are binary. Part Relation: P# PNAME COLOUR WEIGHT CITY P1 Nut Red 12 London P2 Bolt Green 17 Parts P3 Screw Blue 17 Rome P4 Screw Red 14 London Objectives To know about: o Conceptual Data model for database design o ER model concept with an example: o Components of An ER Model o Different types of Attributes o Relationships, Roles and Structural Constraints o Relationships o Constraints On Relationship Types Database Management Systems Unit 5 Sikkim Manipal University Page No.: 77 Self Assessment Question(s) (SAQs) (For section 5.1) 1. Why do you need E-R Model? (5.1) 2. Explain the concept of relations. (5.1) 5.2 Conceptual Data model for database design: Fig: 5.1 Phase of database design (Simplified) Database Management Systems Unit 5 Sikkim Manipal University Page No.: 78 The first step in database design is requirement collection and analysis. During this step database designers interview clients to get their requirements. Without getting the exact requirement from the client it would become very difficult to design a good ER diagram. It is useful to specify functional requirements of the application. Data flow diagrams are used to specify functional requirements. The next step in the application development is to create a conceptual schema for the database. The conceptual schema is one that describes the data type, relationship and constrains. This step is called conceptual database design. This concept does not include any implementation details as well as storage details. It are usually easier to understand and can also be used to communicate with non-technical users. After conceptual schema has been designed, the next step in database design is the actual implementation of the database, using a commercial DBMS like oracle, MS access etc. This step is called logical database design. Finally the last step is the physical database design phase. During this, the internal storage structure and file organization for the database are specified. Self Assessment Question(s) (SAQs) (For section 5.2) 1. Explain different steps in database design. 5.3 ER model concept with an example The basic representation of ER model is given below. After the requirement, collection and analysis phase, we create its conceptual schema step by step by using ER model concepts. Database Management Systems Unit 5 Sikkim Manipal University Page No.: 79 E.g.: Company database consists of Several departments and each department has a manager. Several employees work for a department. A department may have several locations. Each department controls several projects. We store each employee's name, SSN, address,. An employee is assigned to one department but may work on several departments. We keep track of the number of hours per week that an employee works on each project. We need to keep track of employee department information for the purpose of insurance etc. Database Management Systems Unit 5 Sikkim Manipal University Page No.: 80 Figure 5.2: The ER conceptual schema diagram for the new COMPANY database Notations for entity relationship diagrams: The main advantage of the ER model is its simplicity, which helps in the understanding of the overall structure of a database. An ER diagram includes the following components. Database Management Systems Unit 5 Sikkim Manipal University Page No.: 81 Figure5.3:Notations Database Management Systems Unit 5 Sikkim Manipal University Page No.: 82 5.3.1 Components of an ER Model: The ER diagram represents three main concepts. 1. Entities: The fundamental item in any ER model is the entity which is a "thing" in the real world with an independent existence that is distinguishable from all other objects. E.g.: each employee in an organization is an entity. A company, a job, a book etc. all are entities. Each entity has particular properties called attributes that describe it. E.g.: An employee entity may be described by the employees name, age, address, salary etc. 2. Entity Sets: It is a set of entities of the same type that share the same properties or attributes. The set of all employees working for the same department can be defined as the entity set employee, but each entity has its own values for each attribute. Entity Type Name: Employee Company Attributes: Name, Age, Salary Name, Headquarters, President e 1 c 1 (J ohn Smith, 55, 80K) (Sunco Oil, Houston, J ohn Smith) Entity Set (Extension) e 2 c 2 (Fred Brown, 40, 30K) (Fast Computer, Dellas, Bob King) e 3 (J udy Clerk, 25, 20K) 3. Attributes: A set of properties Database Management Systems Unit 5 Sikkim Manipal University Page No.: 83 5.3.2 Different types of Attributes: Each attribute is associated with a set of values called domain. 1. Simple And Composite Attributes: Simple attributes are not divided into sub parts. They are also called atomic attributes, e.g.: AGE. Composite attributes can be divided into sub parts with an independent meaning of their own. E.g.: Address attribute can be composed of components like street number, area, city, pin code. Address Street number Area City 2. Single Valued and Multivalued Attributes: A single valued attribute is one that holds a single value for a single entity. E.g.: Age, room-number. Multi valued attribute is one that holds multiple values for a single entity. E.g.: college degree attribute for studies [B.S., M.Sc. Ph.D] 3. Derived Attributes: Is one that represents a value that is derived from the value of a related attribute. E.g.: The value of an Age can be determined from the current date [todays] and the value of that person's birthday, the age attribute, is hence called derived attribute and is said to be derivable from the birthday attribute which is called a stored attribute. Pin code Database Management Systems Unit 5 Sikkim Manipal University Page No.: 84 4. Null Attribute: A null value attribute is used when an attribute does not have any value. A null value does not mean that the value is equal to zero, but indicates no value is stored for that attribute. E.g.: Apartment number attribute of an address applies only to address that are in apartment buildings and not in other types of residence such as single-family homes. E-mail: All employees in an employee database may not have e-mail addresses. 5. Key Attribute: An entity type usually has an attribute whose values are distinct for each individual entity. Such an attribute is called a key attribute. These attributes which uniquely identify every instance of the entity are termed as the primary key. Value sets or Domain attributes: Each attribute is associated with a set of values called domain of that attribute; assume that values from a set of permitted values. E.g.: range of ages allowed for employees is between 18 and 58. Domain of the attribute name might be a set of all text strings of a certain length; mathematically an attribute A of entity type E whose value set is V can be defined as a function from E to the power set P(v) or V as A:E--- >P(v). Self Assessment Question(s) (SAQs) (For section 5.3) 1. Explain the E-R Model with the help of one example 2. Write and explain different notations used in the E-R Model. 3. Write and explain different components of the E-R Model. 4. List different types of attributes and explain each one of them by giving one example. Database Management Systems Unit 5 Sikkim Manipal University Page No.: 85 5.4 Relationships, Roles and Structural Constraints 5.4.1 Relationships: In the real world, items have relationships to one another. E.g.: A book is published by a particular publisher. The association or relationship that exists between the entities relates data items to each other in a meaningful way. A relationship is an association between entities. A collection of relationships of the same type is called a relationship set. A relationship type R is a set of associations between E, E2..En entity types mathematically, R is a set of relationship instances ri. E.g.: Consider a relationship type WORKS_FOR between two entity types - employee and department, which associates each employee with the department the employee works for. Each relationship instance in WORKS_FOR associates one employee entity and one department entity, where each relationship instance is ri which connects employee and department entities that participate in ri. Employee el, e3 and e6 work for department d1, e2 and e4 work for d2 and e5 and e7 work for d3. Relationship type R is a set of all relationship instances. Figure 5.4: Some instances of the WORKS_FOR relationship 5.4.2 Degree of relationship type: The number of entity sets that participate in a relationship set. A unary relationship exists when an association is maintained with a single entity. Database Management Systems Unit 5 Sikkim Manipal University Page No.: 86 A binary relationship exists when two entities are associated. A tertiary relationship exists when there are three entities associated.
Figure 5.5: Degree of relationship type Role Names and Recursive Relationship Each entry type to participate in a relationship type plays a particular role in the relationship. The role name signifies the role that a participating entity from the entity type plays in each relationship instance, e.g.: In the WORKS FOR relationship type, the employee plays the role of employee or worker and the department plays the role of department or employer. However in Database Management Systems Unit 5 Sikkim Manipal University Page No.: 87 some cases the same entity type participates more than once in a relationship type in different roles. Such relationship types are called recursive. E.g.: employee entity type participates twice in SUPERVISION once in the role of supervisor and once in the role of supervisee. Self Assessment Question(s) (SAQs) (For Section 5.4) Define Relationship set, role. 5.5 Constraints on Relationship Types Relationship types usually have certain constraints that limit the possible combination of entities that may participate in the relationship instance. E.g.: If the company has a rule that each employee must work for exactly one department. The two main types of constraints are cardinality ratio and participation constraints. The cardinality ratio specifies the number of entities to which another entity can be associated through a relationship set. Mapping cardinalities should be one of the following. One-to-One: An entity in A is associated with at most one entity in B and vice versa. Database Management Systems Unit 5 Sikkim Manipal University Page No.: 88 Employee can manage only one department and that a department has only one manager. One-to-Many: An entity in A is associated with any number in B. An entity in B however can be associated with at most one entity in A.
Each department can be related to numerous employees but an employee can be related to only one department Many-to-One: An entity in A is associated with at most one entity in B. An entity in B however can be associated with any number of entities in A. Many depositors deposit into a single account.
Man-to-Many: An entity in A is associated with any number of entities in B and an entity in B is associated with any number of entities in A. Database Management Systems Unit 5 Sikkim Manipal University Page No.: 89
An employee can work on several projects and several employees can work on a project. Participation Constraints: There are two ways an entity can participate in a relationship where there are two types of participations. 1. Total: The participation of an entity set E in a relationship set R is said to be total if every entity in E participates in at lest one relationship in R. Every employee must work for a department. The participation of employee in WORK FOR is called total.
Figure 5.6: Some instances of the WORKS_FOR relationship Total participation is some times called existence dependency. Database Management Systems Unit 5 Sikkim Manipal University Page No.: 90 2. Partial: If only some entities in E participate in relationship in R, the participation of entityset E in relationship R is said to be partial. Figure 5.7: Some instances of the WORKS_FOR relationship We do not expect every employee to manage a department, so the participation of employee in MANAGES relationship type is partial. Weak Entity: Some entity types may not have any key attribute of their own, they are called weak entity types. An entity set that has a primary key is termed as a strong entity type. A weak entity type always has a total participation [existence dependence] with respect to a strong entity. A weak entity type is dependent on the existence of another entity. Weak entity is also referred to as child, dependent OR subordinate entities, and strong entities as parent, owner OR dominant entities. E.g.: In the following relationship PARENT is a weak entity as it needs the entity EMPLOYEE for its existence. The entities EMPLOYEE, COMPANY etc. are strong entities. Weak entities are represented by a double lined rectangle. Database Management Systems Unit 5 Sikkim Manipal University Page No.: 91 Self Assessment Question(s) (SAQs) (For Section 5.5) 1. Explain the constraints on relationship types 2. Define Weak entity set and give one example. 5.6 Summary In this Unit we have learnt the following topics. o Conceptual Data model for database design o ER model concept with an example: o Components of an ER Model o Different types of Attributes o Relationships, Roles and Structural Constraints o Relationships o Constraints On Relationship Types 5.7 Terminal Questions (TQs) 1. Discuss the term entity. 2. What is an entity set ? Explain the differences among an entity an entity type & an entity set. 3. Explain difference between an attributes & a value set. Explain the following a) Key attribution b) Compose attribution c) Domains of attributes Database Management Systems Unit 5 Sikkim Manipal University Page No.: 92 4. What is relationship Type? Explain the difference among a relationship Instance, relationship type & a relationship set. 5.8 Multiple Choice Questions (MCQs) 1. .. is one that describes the data type, relationship and constrains. a) The conceptual schema b) Physical Schema c) Database d) None of the above 2. We create conceptual schema step by step by using concepts. a) ER model b) Data model c) Design d) None of the above 3. is a set of entities of the same type that share the same properties or attributes a) Relationship set b) Entity set c) Entity d) None of the above 4. . Refers to the number of entity sets that participate in a relationship set. a) Degree of the relationship b) Unary relationship c) Binary relationships d) None of the above Database Management Systems Unit 5 Sikkim Manipal University Page No.: 93 5.9 Answers to SAQs, TQs, and MCQs 5.9.1 Answers to Self Assessment Questions (SAQs) For Section 5.1 1. Entity-relationship model represents the overall logical structure of a database. (Refer section5.1) 2. It is an association among entities. (Refer section 5.1) For Section 5.2 1. The first step in database design is requirement collection and analysis. (Refer section 5.2) For Section 5.3 1. The basic representation of ER model is given in section 5.3. After the requirement, collection and analysis phase, we create its conceptual schema step by step by using ER model concepts. E.g.: Company database (Refer section 5.3) 2. Notations : The main advantage of ER model is its simplicity, which helps in the understanding of the overall structure of a database. An ER diagram includes many components (Refer section5.3) 3. Components of an ER Model: The ER diagram represents three main concepts (Refer section 5.3.1) 4. Attributes: A set of properties. Different types of Attributes: Simple and Composite Attribute etc. (Refer section 5.3.2) For Section 5.4 1. A collection of relationships of the same type is called the relationship set. The role name signifies the role that a participating entity from the entity type plays in each relationship instance. (Refer section 5.4.1) Database Management Systems Unit 5 Sikkim Manipal University Page No.: 94 For Section 5.5 1. The cardinality ratio specifies the number of entities to which another entity can be associated through a relationship set. (Refer section 5.5) 2. Weak Entity: Some entity type may not have any key attribute of their own; they are called weak entity type. An entity set that has a primary key is termed as a strong entity type. A weak entity type always has a total participation [existence dependence] with respect to strong entity. (Refer section5.5) 5.9.2 Answers to Terminal Questions (TQs) 1. The fundamental item in any ER model is the entity which is a "thing" in the real world, with an independent existence that is distinguishable from all other objects. (Refer section 5.3.1) 2. It is a set of entities of the same type that share the same properties or attributes. (Refer section5.3.1) 3. An attribute is a set of properties. Each attribute is associated with a set of values called domain. (Refer section5.3.2) 4. In the real world, items have relationships tone another. E.g. A book is published by a particular publisher. The association or relationship that exists between the entities relates data items to each other in a meaningful way. A relationship is an association between entities. (Refer section 5.4.1) 5.9.3 Answers to Multiple Choice Questions (MCQs) 1. A 2. A 3. B 4. A