- The ER model is a high-level data model which stands for the Entity-Relationship Model. The ER Model is used for defining the relationship and elements for any specific system.
- The ER model or the structure of the database is represented as a diagram known as the entity-relationship diagram.
- It based on a conceptual design for the databases for the smooth and straightforward view of the data.
For instance, if we make a database of any school, then the student will be considered as an entity with various attributes such as age, name, address, id, and much more. Further, the address can also become another entity which consists of attributes such as pin code, street name, city, and others. There will be a relationship between them.
Component of ER Diagram
An entity can be any place, person, object, or class. In an ER Diagram, the entity can be portrayed as rectangles.
Let an organization bean instance such as department, manager, employee, product, etc. can be considered as an entity.
A weak entity is the one which is dependent on another entity. It is portrayed by a double rectangle.
The attribute describes the entity property. An eclipse is considered to show an attribute. For instance, Contact number, ID, age, etc.
It is used to represent the major characteristics of any entity. It is represented the underlined text inside the ellipse.
A composite attribute refers to an attribute which is composed of various other attributes. It is portrayed by an eclipse, which is linked with other eclipses.
A multivalued attribute consists of more than one value. Multivalued attributes are represented by a double oval. For instance, any student can have one or more than phone numbers.
Any attribute which can be acquired by any other attribute is considered as a derived attribute. It is portrayed by a dashed ellipse. For instance, the age of the person can be changed with time and can even be derived from any other attribute such as Date of Birth.
A relationship describes the relation between each entity. A diamond portrays the relationship in any diagram.
Types of relationships:
It is said to be a one-to-one relationship when there is only one instance of any entity associated with any relationship. For instance, Any female can marry to one male and any male can only marry to one female.
You can say it is a one-to-many relationship when only one of the instances of entity is on the left, and more than just one instance of any entity are on the right associates with the respective relationship. For instance, a scientist can invent various inventions, but an invention is only done by one specific scientist.
It is considered to be Many-to-one relationship, when there are more than one instances of the entity on the left, and exclusively one instance on right associates with a relationship. For instance, Any student can join one course, but any course can have various students.
When there are more than one instance of the entity on the left and more than just one instance on the right associates with any relationship, then it is considered as a many-to-many relationship. For instance, Any employee can be assigned by various projects, and even the projects can also have multiple employees.