E-R Diagrams in DBMS: Components, Symbols, And Notations: E-R diagram is the short form of “Entity-Relationship” diagram. An e-r diagram efficiently shows the relationships between various entities stored in a database. In this article, we will discuss what are ER Diagram, ER Diagrams Symbols, Notations, Their various components like Entity, Attribute and Relationship.
E-R Diagrams in DBMS: Components, Symbols, And Notations
E-R diagrams are used to model real-world objects like a person, a car, a company etc. and the relation between these real-world objects. An e-r diagram has following features:
- E-R diagrams are used to represent E-R model in a database, which makes them easy to be converted into relations (tables).
- E-R diagrams provide the purpose of real-world modeling of objects which makes them intently useful.
- E-R diagrams require no technical knowledge & no hardware support.
- These diagrams are very easy to understand and easy to create even by a naive user.
- It gives a standard solution of visualizing the data logically.
ER Diagrams Symbols, And Notations
Components of an E-R diagram
An E-R diagram constitutes of following Components
A. Entity:- Any real-world object can be represented as an entity about which data can be stored in a database. All the real world objects like a book, an organization, a product, a car, a person are the examples of an entity. Any living or non-living objects can be represented by an entity. An entity is symbolically represented by a rectangle enclosing its name.
Entities can be characterized into two types:
- Strong entity: A strong entity has a primary key attribute which uniquely identifies each entity. Symbol of strong entity is same as an entity.
- Weak entity: A weak entity does not have a primary key attribute and depends on other entity via a foreign key attribute.
B. Attribute:- Each entity has a set of properties. These properties of each entity are termed as attributes. For example, a car entity would be described by attributes such as price, registration number, model number, color etc. Attributes are indicated by ovals in an e-r diagram.
A primary key attribute is depicted by an underline in the e-r diagram. An attribute can be characterized into following types:
- Simple attribute:- An attribute is classified as a simple attribute if it cannot be partitioned into smaller components. For example, age and sex of a person. A simple attribute is represented by an oval.
- Composite attribute:- A composite attribute can be subdivided into smaller components which further form attributes. For example, ‘name’ attribute of an entity “person” can be broken down into first name and last name which further form attributes. Grouping of these related attributes forms a composite attribute. ‘name is the composite attribute in this example.
- Single valued attribute:- If an attribute of a particular entity represents single value for each instance, then it is called a single-valued attribute. For example, Ramesh, Kamal and Suraj are the instances of entity ‘student’ and each of them is issued a separate roll number. A single oval is used to represent this attribute.
- Multi valued attribute:– An attribute which can hold more than one value, it is then termed as multi-valued attribute. For example, phone number of a person. Symbol of multi-valued attribute is shown below,
- Derived attribute: A derived attribute calculate its value from another attribute. For example, ‘age’ is a derived attribute if it calculates its value from ‘current date’ & ‘birth date’ attributes. A derived attribute is represented by a dashed oval.
C. Relationships:- A relationship is defined as bond or attachment between 2 or more entities. Normally, a verb in a sentence signifies a relationship.
- An employee assigned a project.
- Teacher teaches a student.
- Author writes a book.
A diamond is used to symbolically represent a relationship in the e-r diagram.
Various terms related to relationships
a). Degree of relationship:- It signifies the number of entities involved in a relationship. Degree of a relationship can be classified into following types:
- Unary relationship:- If only single entity is involved in a relationship then it is a unary relationship. For example, An employee(manager) supervises another employee.
- Binary relationships:- when two entities are associated to form a relation, then it is known as a binary relationship. For example, A person works in a company. Most of the times we use only binary relationship in an e-r diagram. The teacher-student example shown above signifies a binary relationship.
Other types of relationships are ternary and quaternary. As the name signifies, a ternary relationship is associated with three entities and a quaternary relationship is associated with four entities.
b.) Connectivity of a relationship:- Connectivity of a relationship describes, how many instances of one entity type are linked to how many instances of another entity type. Various categories of connectivity of a relationship are;
- One to One (1:1) – “Student allotted a project” signifies a one-to-one relationship because only one instance of an entity is related with exactly one instance of another entity type.
- One to Many (1:M) – “A department recruits faculty” is a one-to-many relationship because a department can recruit more than one faculty, but a faculty member is related to only one department.
- Many to One (M:1) – “Many houses are owned by a person” is a many-to-one relationship because a person can own many houses but a particular house is owned only a person.
- Many to Many (M:N) – “Author writes books” is a many-to-many relationship because an author can write many books and a book can be written by many authors.
So it was all about E-R Diagrams in DBMS: Components, Symbols, And Notations. If you have any doubt then please comment below.