
- 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
- 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.
- An entity is represented as rectangle in an ER diagram.
- Consider an organization as an example- manager, prodct, employee, department etc. can be taken as an entity.
- 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:
- An entity that depends on another entity called a weak entity.
- The weak entity doesn’t contain any key attribute of its own.
- The weak entity is represented by a double rectangle.
- 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
- An attribute describes the property of an entity.
- For example, Roll No, Name, DOB, Age, Address, and Mobile No are the attributes that define entity type Student.
- In ER diagram, the attribute is represented by an oval.

There are four types of attributes:
1. Key attribute:
- The attribute which uniquely identifies each entity in the entity set is called the key attribute.
- For example, Roll no. will be unique for each student.
- In ER diagram, the key attribute is represented by an oval with underlying lines.

2. Composite Attribute
- An attribute composed of many other attributes is called a 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 consisting of more than one value for a given entity.
- 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
- its an attribute that can be derive from an existing attribute
- for example, we can derive the age attribute from the Date of birth of the entity.

4. Relationships
- A relationship is used to describe the relation between entities.
- 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
- A one-to-one relationship occurs when each record in one entity is related to only one record in another entity, and vice versa.
- This type of relationship is relatively rare in databases, but it is essential in specific scenarios.
- each individual can only have one passport, and each passport can only belong to one person.

2. One to Many
- The one-to-many relationship is the most common type of relationship in DBMS
- In this relationship, a record in one entity can be associated with multiple records in another entity,
- while each record in the second entity is related to only one record in the first entity.
- 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
- A many-to-many relationship arises when multiple records in one entity can be linked to multiple records in another entity.
- each student can enroll in multiple courses, and each course can have multiple students.
- a customer can buy many products and a product can have multiple customers

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