• 1. Entity
  • 2. Weak Entity:
  • 3. Attribute and types
    • [[#2. Weak Entity:#1. Key attribute:|1. Key attribute:]]
    • [[#2. Weak Entity:#2. Composite Attribute|2. Composite Attribute]]
    • [[#2. Weak Entity:#3. Multivalued Attribute|3. Multivalued Attribute]]
    • [[#2. Weak Entity:#4. derived attribute|4. derived attribute]]
  • 4. Relationships
    • [[#2. Weak Entity:#1. One to One|1. One to One]]
    • [[#2. Weak Entity:#2. One to Many|2. One to Many]]
    • [[#2. Weak Entity:#3. Many to Many|3. Many to Many]]
    • [[#2. Weak Entity:#4. Many to one|4. Many to one]]

1. Entity

  1. An Entity may be an object with a physical existence – a particular person, car, house, or employee – or it may be an object with a conceptual existence – a company, a job, or a university course. 
  2. An entity is represented as rectangle in an ER diagram.
  3. Consider an organization as an example- manager, prodct, employee, department etc. can be taken as an entity.
  4. For example: In the following ER diagram we have two entities Student and College and these two entities have many to one relationship as many students study in a single college.

2. Weak Entity:

  1. An entity that depends on another entity called a weak entity.
  2. The weak entity doesn’t contain any key attribute of its own.
  3. The weak entity is represented by a double rectangle.
  4. For Example, A company may store the information of dependents (Parents, Children, Spouse) of an Employee. But the dependents don’t have existed without the employee. So Dependent will be a Weak Entity Type and Employee will be Identifying Entity type for Dependent, which means it is Strong Entity Type.

3. Attribute and types

  1. An attribute describes the property of an entity.
  2. For example, Roll No, Name, DOB, Age, Address, and Mobile No are the attributes that define entity type Student.
  3. In ER diagram, the attribute is represented by an oval. 

There are four types of attributes:

1. Key attribute:

  1. The attribute which uniquely identifies each entity in the entity set is called the key attribute.
  2. For example, Roll no. will be unique for each student
  3. In ER diagram, the key attribute is represented by an oval with underlying lines.

2. Composite Attribute

  1. An attribute composed of many other attributes is called a composite attribute.
  2. An attribute that is a combination of other attributes is known as composite attribute
  3. 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

  1. An attribute consisting of more than one value for a given entity.
  2. An attribute that can hold multiple values is known as multivalued attribute.
  3. It is represented with double ovals in an ER Diagram.
  4. For example – A person can have more than one phone numbers so the phone number attribute is multivalued.

4. derived attribute

  1. its an attribute that can be derive from an existing attribute
  2. for example, we can derive the age attribute from the Date of birth of the entity.

4. Relationships

  1. A relationship is used to describe the relation between entities. 
  2. A relationship is represented by diamond shape in ER diagram, it shows the relationship among entities.
  3. There are four types of cardinal relationships:

1. One to One

  1. A one-to-one relationship occurs when each record in one entity is related to only one record in another entity, and vice versa.
  2. This type of relationship is relatively rare in databases, but it is essential in specific scenarios.
  3.  each individual can only have one passport, and each passport can only belong to one person.

2. One to Many

  1. The one-to-many relationship is the most common type of relationship in DBMS
  2. In this relationship, a record in one entity can be associated with multiple records in another entity,
  3. while each record in the second entity is related to only one record in the first entity.
  4. For instance, in a customer and order database, each customer can place multiple orders, but each order is associated with only one customer.

3. Many to Many

  1. A many-to-many relationship arises when multiple records in one entity can be linked to multiple records in another entity. 
  2. each student can enroll in multiple courses, and each course can have multiple students.
  3. a customer can buy many products and a product can have multiple customers

4. Many to one

  1. When entities in one entity set can take part only once in the relationship set
  2. entities in other entity sets can take part more than once in the relationship set, cardinality is many to one.