RDBMS1.5

Unit-I Unit-II  Unit-III Unit-IVUnit-V
Part-I Part-II Part-I Part-IPart-ITotal
Part-III Part-IV Part-II Part-IIPart-II
Part-VPart-III


 

ENTITY RELATIONSHIP (ER) MODEL

10.     Explain ER- Model With neat Diagram?

Ans:

Entities

• An entity is an object of concern used to represent the things in the real world, e.g., car, table, book, etc.

• An entity need not be a physical entity, it can also represent a concept in real world, e.g., project, loan, etc.

• It represents a class of things, not any one instance.

e.g:  ‘STUDENT’ entity has instances of ‘Ramesh’ and ‘Mohan’.


Entity Set or Entity Type:

A collection of a similar kind of entities is called an Entity Set or entity type.

Example :

The collections of all the students entities form a entity set STUDENT. Similarly collection of all the courses form an entity set COURSE.

Types of Entities

Strong entity type 

An entity type is referred to as  strong if its existence does not depend upon the existence of another entity type. A characteristic of a strong entity type is that each entity occurrence is uniquely identified using the primary key attribute(s) of that entity type

Branch, we can uniquely identify each member of staff using the staffNo attribute, which is the primary key for the Staff entity type.

 

Weak entity type

A weak entity type is whose existence depends on another entity type.

For example, a company insurance policy insures an employee and his/her dependents. For the purpose of describing an insurance policy, an employee might or might not have a dependent, but the dependent must be associated with an employee. Moreover, the dependent cannot exist without the employee. dependent is the weak entity in the relationship “employee has dependent.”


Attributes

An attribute is a property used to describe the specific feature of the entity.

For example, a student entity may be described by the student’s name, age, address, course, etc.

RollNo: 1234

Name: Supriya

Age: 18

Address: B-4, Mayapuri, Delhi.

Course: B.Sc. (H)

Types of attributes

Attributes can be classified as :

1.     Simple

2.     Composite,

3.     Single-valued

4.     Multi-valued,

5.     Derived.


Simple Attribute

The attribute which can not be subdivided into smaller subparts are called simple attributes. Simple attributes are sometimes called atomic attributes.

Example: position and salary.

 

Composite Attribute

An attribute can be subdivided into two or more other attributes

Example  Name can be divided into First name, Middle Name, Last Name.

Attribute ADDRESS can be subdivided into street, city, state and zip code.

Single-valued Attribute

An attribute that holds a single value for each occurrence of an entity type. The majority of attributes are single-valued.

Example

1. branchno= b003

2. stu_rollno = 468001

3. stu_lname = rakesh etc

 

 Multi-valued Attribute

An attribute that holds multiple values for each occurrence of an entity type.

Example

Phone_No  attribute

(for example, branch number B003 has telephone numbers 0141-339-2178 and 0141-339-4439)

 

Derived Attributes

A derived attribute is an attribute whose value is calculated (derived) from other attributes.

Example: STU_AGE is a derived attribute because STU_AGE is calculated from the attributes STU_DOB for Student date of birth and SYSDATE for the current date.

I.e.

STU_AGE = SYSDATE – STU_DOB

 

Domains:

• Each simple attribute of an entity type contains a possible set of values that can be attached to it. This is called the domain of an attribute.

Relationships

A relationship can be defined as:

• a connection or set of associations, or

• a rule for communication among entities:

Example: In college the database, the association between student and course entity, i.e.,

“Student opts course”

is an example of a relationship.

Relationship sets

A relationship set is a set of relationships of the same type.

For example, consider the relationship between two entity sets student and course.

Collection of all the instances of relationship opts forms a relationship set called relationship type.

Degree

The degree of a relationship type is the number of participating entity types.

The relationship between two entities is called binary relationship.

A relationship among three entities is called ternary relationship.

Similarly relationship among n entities is called n-ry relationship.

Relationship Cardinality

Cardinality specifies the number of instances of an entity associated with another entity participating in a relationship. Based on the cardinality binary relationship can be further classified into the following categories:

One-to-one: An entity in A is associated with at most one entity in B, and an entity in B is associated with at most one entity in A.

One-to-many: An entity in A is associated with any number of entities in B. An entity in B is associated with at the most one entity in A.

Many-to-one: An entity in A is associated with at most one entity in B. An entity in B is associated with any number in A.
Many-to-many:  Entities in A and B are associated with any number of entities from each other. 

No comments:

Post a Comment