Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

ER Diagram in DBMS An Entity–relationship model (ER model ..., Slides of Design

Symbol In My Driveway. Jack Johnson. Traffic In The Sky. James Arthur. Say You Won't Let Go. James Bay. Let It Go. Jason Isbell. Cover Me Up. Jason Isbell.

Typology: Slides

2021/2022

Uploaded on 09/27/2022

shally_866
shally_866 🇺🇸

4.5

(24)

32 documents

1 / 14

Toggle sidebar

Related documents


Partial preview of the text

Download ER Diagram in DBMS An Entity–relationship model (ER model ... and more Slides Design in PDF only on Docsity! Entity Relationship Diagram – ER Diagram in DBMS An Entity–relationship model (ER model) describes the structure of a database with the help of a diagram, which is known as Entity Relationship Diagram (ER Diagram). An ER model is a design or blueprint of a database that can later be implemented as a database. The main components of E-R model are: entity set and relationship set. What is an Entity Relationship Diagram (ER Diagram)? An ER diagram shows the relationship among entity sets. An entity set is a group of similar entities and these entities can have attributes. In terms of DBMS, an entity is a table or attribute of a table in database, so by showing relationship among tables and their attributes, ER diagram shows the complete logical structure of a database. Lets have a look at a simple ER diagram to understand this concept. Facts about ER Diagram Model: ER model allows you to draw Database Design It is an easy to use graphical tool for modeling data Widely used in Database Design It is a GUI representation of the logical structure of a Database It helps you to identifies the entities which exist in a system and the relationships between those entities Why use ER Diagrams? Here, are prime reasons for using the ER Diagram Helps you to define terms related to entity relationship modeling Provide a preview of how all your tables should connect, what fields are going to be on each table Helps to describe entities, attributes, relationships ER diagrams are translatable into relational tables which allows you to build databases quickly ER diagrams can be used by database designers as a blueprint for implementing data in specific software applications A simple ER Diagram: In the following diagram we have two entities Student and College and their relationship. The relationship between Student and College is many to one as a college can have many students however a student cannot study in multiple colleges at the same time. Student entity has attributes such as Stu_Id, Stu_Name & Stu_Addr and College entity has attributes such as Col_ID & Col_Name. Here are the geometric shapes and their meaning in an E-R Diagram. We will discuss these terms in detail in the next section (Components of a ER Diagram) of this guide so don’t worry too much about these terms now, just go through them once. Rectangle: Represents Entity sets. Ellipses: Attributes Diamonds: Relationship Set Lines: They link attributes to Entity Sets and Entity sets to Relationship Set Double Ellipses: Multivalued Attributes Dashed Ellipses: Derived Attributes Double Rectangles: Weak Entity Sets Double Lines: Total participation of an entity in a relationship set Components of a ER Diagram 1. Key attribute: A key attribute can uniquely identify an entity from an entity set. For example, student roll number can uniquely identify a student from a set of students. Key attribute is represented by oval same as other attributes however the text of key attribute is underlined. 2. Composite attribute: An attribute that is a combination of other attributes is known as composite attribute. For example, In student entity, the student address is a composite attribute as an address is composed of other attributes such as pin code, state, country. 3. Multivalued attribute: An attribute that can hold multiple values is known as multivalued attribute. It is represented with double ovals in an ER Diagram. For example – A person can have more than one phone numbers so the phone number attribute is multivalued. 4. Derived attribute: A derived attribute is one whose value is dynamic and derived from another attribute. It is represented by dashed oval in an ER Diagram. For example – Person age is a derived attribute as it changes over time and can be derived from another attribute (Date of birth). E-R diagram with multivalued and derived attributes: 3. Relationship Cardinality: Defines the numerical attributes of the relationship between two entities or entity sets. A relationship is represented by diamond shape in ER diagram, it shows the relationship among entities. There are four types of cardinal relationships: 1. One to One 2. One to Many 3. Many to One 4. Many to Many 1. One to One Relationship When a single instance of an entity is associated with a single instance of another entity then it is called one to one relationship. For example, a person has only one passport and a passport is given to one person. 2. One to Many Relationship When a single instance of an entity is associated with more than one instances of another entity then it is called one to many relationship. For example – a customer can place many orders but a order cannot be placed by many customers. 3. Many to One Relationship When more than one instances of an entity is associated with a single instance of another entity then it is called many to one relationship. For example – many students can study in a single college but a student cannot study in many colleges at the same time. 4. Many to Many Relationship When more than one instances of an entity is associated with more than one instances of another entity then it is called many to many relationship. For example, a can be assigned to many projects and a project can be assigned to many students. Total Participation of an Entity set A Total participation of an entity set represents that each entity in entity set must have at least one relationship in a relationship set. For example: In the below diagram each college must have at-least one associated Student. For Course Entity, attributes could be Duration, Credits, Assignments, etc. For the sake of ease we have considered just one attribute. Step 5) Create the ERD A more modern representation of ERD Diagram Best Practices for Developing Effective ER Diagrams  Eliminate any redundant entities or relationships  You need to make sure that all your entities and relationships are properly labeled  There may be various valid approaches to an ER diagram. You need to make sure that the ER diagram supports all the data you need to store  You should assure that each entity only appears a single time in the ER diagram  Name every relationship, entity, and attribute are represented on your diagram  Never connect relationships to each other  You should use colors to highlight important portions of the ER diagram Summary  The ER model is a high-level data model diagram  ER diagrams are a visual tool which is helpful to represent the ER model  Entity relationship diagram displays the relationships of entity set stored in a database  ER diagrams help you to define terms related to entity relationship modeling  ER model is based on three basic concepts: Entities, Attributes & Relationships  An entity can be place, person, object, event or a concept, which stores data in the database  Relationship is nothing but an association among two or more entities  A weak entity is a type of entity which doesn't have its key attribute  It is a single-valued property of either an entity-type or a relationship-type  It helps you to defines the numerical attributes of the relationship between two entities or entity sets  ER- Diagram is a visual representation of data that describe how data is related to each other  While Drawing ER diagram you need to make sure all your entities and relationships are properly labeled. DBMS Generalization Generalization is a process in which the common attributes of more than one entities form a new entity. This newly formed entity is called generalized entity. Generalization Example Lets say we have two entities Student and Teacher. Attributes of Entity Student are: Name, Address & Grade Attributes of Entity Teacher are: Name, Address & Salary The ER diagram before generalization looks like this: These two entities have two common attributes: Name and Address, we can make a generalized entity with these common attributes. Lets have a look at the ER model after generalization. The ER diagram after generalization: We have created a new generalized entity Person and this entity has the common attributes of both the entities. As you can see in the following ER diagram that after the generalization process the entities Student and Teacher only has the specialized attributes Grade and Salary respectively and their common attributes (Name & Address) are now associated with a new entity Person which is in the relationship with both the entities (Student & Teacher). Note: 1. Generalization uses bottom-up approach where two or more lower level entities combine together to form a higher level new entity. 2. The new generalized entity can further combine together with lower level entity to create a further higher level generalized entity. DBMS Specialization Specialization is a process in which an entity is divided into sub-entities. You can think of it as a reverse process of generalization, in generalization two entities combine together to form a new higher level entity. Specialization is a top-down process. The idea behind Specialization is to find the subsets of entities that have few distinguish attributes. For example – Consider an entity employee which can be further classified as sub- entities Technician, Engineer & Accountant because these sub entities have some distinguish attributes. Specialization Example In this diagram, we can see that we have a higher level entity “Employee” which we have divided in sub entities “Technician”, “Engineer” & “Accountant”. All of these are just an employee of a company, however their role is completely different and they have few different attributes. Just for the example, I have shown that Technician handles service requests, Engineer works on a project and Accountant handles the credit & debit details. All of these three employee types have few attributes common such as name & salary which we had left associated with the parent entity “Employee” as shown in the above diagram.
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved