Skip to main content

E-R Diagrams in DBMS

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

Er-Symbols-and-Notations
Er Diagram 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.
Entity
Entity
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.

Strong-Entity
Strong Entity
  • Weak entity: A weak entity does not have a primary key attribute and depends on other entity via a foreign key attribute.
Weak-Entity
Weak Entity
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.
Attribute
Attribute
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.

Composite-Attribute
Composite Attribute
  • 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,
Multi-Valued-Attribute
Multi Valued Attribute

  • 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.
For example,
  • 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.
Relationship
Relationship
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.
Unary-relationship
Unary relationship
  • 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-One
One To One
  • 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.
One-to-Many
One to Many
  • 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-One
Many To One
  • 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.
Many-To-Many
Many To Many

Comments

Popular posts from this blog

Spring Security with JWT for REST API

Spring is considered a trusted framework in the Java ecosystem and is widely used. It’s no longer valid to refer to Spring as a framework, as it’s more of an umbrella term that covers various frameworks. One of these frameworks is Spring Security , which is a powerful and customizable authentication and authorization framework. It is considered the de facto standard for securing Spring-based applications. Despite its popularity, I must admit that when it comes to single-page applications , it’s not simple and straightforward to configure. I suspect the reason is that it started more as an MVC application -oriented framework, where webpage rendering happens on the server-side and communication is session-based. If the back end is based on Java and Spring, it makes sense to use Spring Security for authentication/authorization and configure it for stateless communication. While there are a lot of articles explaining how this is done, for me, it was still frustrating to set it up for the f...

How to answer conflict-resolution interview questions

QUESTION 1: How do you deal with conflict? People aren’t going to get along with each other all the time. It’s just a fact. Employers want to know that you can respond to conflict diplomatically, says job-search and interview coach Thea Kelley. If you’re a my-way-or-the-highway type of personality, you’re not going to get very far in the interview. Start off by emphasizing communication and respectfulness as a means to conflict resolution. For example, “I always take the person aside and discuss the issue privately. I listen actively to make sure I understand the other person’s point of view, and I work with the person to develop a solution together.” Stress that even if you both don’t completely agree on the end result, you tried to at least meet each other halfway. Pro tip: “Don’t non verbally communicate resentment when telling a story,” Kelley advises. “Aggressive body language and tone of voice can show that you harbor bad feelings.” QUESTION 2: Tell me about a time when you had ...