Entity relationship(er) model

Post on 25-Dec-2014

1.140 views 3 download

description

 

Transcript of Entity relationship(er) model

Entity Relationship Model

Rahul Khanvani

BinaryBuzz.Wordpress.com

Presentation on:

Rahul Khanvani For More Visit BinaryBuzz.Wordpress.com

• The approach of concentrating on database structures constraints during database design we present the model concept of Entity Relationship (ER) Model.

Rahul Khanvani For More Visit BinaryBuzz.Wordpress.com

• Frequently used in conceptual design of database applications.

• Diagrammatic notation associated with ER model

is called ER diagrams

Rahul Khanvani For More Visit BinaryBuzz.Wordpress.com

1) Requirement collection & analysis

1) Data Requirements.

2) Functional Requirements.

3) User Defined Operations-Transections.

Rahul Khanvani For More Visit BinaryBuzz.Wordpress.com

1) Conceptual Schema/Design

1) Include Implementation details.

2) Implementation Of Database

1) Logical Design.

3) Physical Design

1) Internal Storage Structure.

Rahul Khanvani For More Visit BinaryBuzz.Wordpress.com

• Entities: ▫ Entities Specifies

Individual Items in an Application

Person

Picture

Thing

Concept

Process Rahul Khanvani For More Visit BinaryBuzz.Wordpress.com

•Relationship: ▫ A relationship is

defined as an association among Entities.

Rahul Khanvani For More Visit BinaryBuzz.Wordpress.com

•Attributes: ▫ Each Entity has

specific characteristic that is defined by attribute.

Student Entity has Name

Address

Result as attributes.

Rahul Khanvani For More Visit BinaryBuzz.Wordpress.com

• The basic object to the ER Model

• Which is a thing in real world

• It may be an Object With ▫ Physical Existence

Person , Car , House , Employee.

▫ Conceptual Existence

Company , Job , Course. Rahul Khanvani For More Visit BinaryBuzz.Wordpress.com

E-R Diagram

Relationship

Entity

Attributes

• Every Entity has an Attribute- particular Property

To describe It.

• For Example EMPLOYEE Entity Described by Employee’s ▫ Name ,Address

▫ Salary,Job Rahul Khanvani For More Visit BinaryBuzz.Wordpress.com

1. Composite & Single Attributes

2. Single valued & Multi valued Attributes

3. Stored & Derived Attributes

4. Null valued Attributes & Complex Attributes Rahul Khanvani For More Visit BinaryBuzz.Wordpress.com

Composite & Simple Attribute

• Composite Attribute Are Those which can be divided into smaller subparts which represent more attributes with independent meaning. ▫ Employee address divided into street address

,city , state & zip(pin).

• Attributes that are not divisible

are called simple Attributes.

Composite & Simple Attribute

Rahul Khanvani For More Visit BinaryBuzz.Wordpress.com

Address

Street

Add

Street no

Apartment name

Apartment no

city pin state

Rahul Khanvani For More Visit BinaryBuzz.Wordpress.com

Single Valued & Multi valued Attributes

•An Attribute has a single value for particular entity is called single valued Attribute ▫ Phone no Of employee

▫ Age of employee. Rahul Khanvani For More Visit BinaryBuzz.Wordpress.com

• If an Attribute can have set of values for the same entity is known as Multi-valued Attribute.

• For Example ▫ College Degree

▫ One person may not have degree, another may have one , A third person may have two.

▫ So at that time Attribute Should be Multi-Valued.

Rahul Khanvani For More Visit BinaryBuzz.Wordpress.com

Degree

S.S.C

H.S.C

F.Y

S.Y

T.Y Rahul Khanvani For More Visit BinaryBuzz.Wordpress.com

Stored & Derived Attribute

• An attribute which is derivable from another Attribute is called derived attribute. ▫ Age is derived from Birth date.

• Where the derived attributes derivable from the base attribute so the base attribute is stored attribute.

Stored & Derived Attribute

Rahul Khanvani For More Visit BinaryBuzz.Wordpress.com

Current Date

Birth date

Age

Stored Attribute

Derived Attribute

Rahul Khanvani For More Visit BinaryBuzz.Wordpress.com

• When a particular entity set have any applicable value for an attribute so it considered as null value attribute.

▫ Fax No.

▫ Tele. No.

• Complex Attribute

▫ Complex attributes are nothing but combination of composite and multi value attributes.

Null Value & Complex Attribute

Rahul Khanvani For More Visit BinaryBuzz.Wordpress.com

• {Phone(areacode,Phoneno)}

Address_phone

• (Number , • street, • apartment_number)

city , state ,zip))

Address(Street

Address Rahul Khanvani For More Visit BinaryBuzz.Wordpress.com

Entity types & entity Sets

• An entity type defines a collection or set of entities that have same attributes.

• Entity types that do not have key attributes of their own are called weak entity.

Rahul Khanvani For More Visit BinaryBuzz.Wordpress.com

Name

Ram

Om

Age

25

37

Salary

20000

30000

Entity Type

Entity

Set

Rahul Khanvani For More Visit BinaryBuzz.Wordpress.com

• An important constraint on entity of an entity type in the key or uniqueness constraint.

• Hose values are distinct for each individual entity in entity set.

• Used to identify each entity Uniquely Called Key Attribute. ▫ For Example

Employee Number

Key attributes

Rahul Khanvani For More Visit BinaryBuzz.Wordpress.com

Value Sets(Domains) of attributes

• Each Simple attribute of an entity type is associated with the value set which specifies set of values Assigned to the Attributes. ▫ Employee salary-Numeric Value Set

▫ Employee Name-String/Char Value Set

• Value set are not displayed in E-R Diagram

• Specified as Basic data-type Available in most programming language. Rahul Khanvani For More Visit BinaryBuzz.Wordpress.com

• Whenever an attribute one entity type refers to another entity type Is indicates the relation between one entity to another.

Rahul Khanvani For More Visit BinaryBuzz.Wordpress.com

• One To One(1:1) :

• One To Many(1:M) :

• Many To Many(M:N)

Relationship Types

Rahul Khanvani For More Visit BinaryBuzz.Wordpress.com

• The One To One relationship between entity set indicates that for each entity there in one most entity associated with it.

▫ For example

▫ One department has only one Manager.

One To One Relationship

Manager Department Has

1 1

Rahul Khanvani For More Visit BinaryBuzz.Wordpress.com

• The One To Many relationship between entity set indicates that for each entity there is no of entities associated with it.

▫ For example

▫ One employee has No Of employees.

One To Many Relationship

Manager Employee Has

M 1

Rahul Khanvani For More Visit BinaryBuzz.Wordpress.com

• The Many To Many relationship between entity set indicates that There is no restrictions Entities have no of entity sets associated with it.

▫ For example

▫ One employee has No Of employees.

Many To Many Relationship

Employee Project Has

N M

Rahul Khanvani For More Visit BinaryBuzz.Wordpress.com

Thank You

Prepared By… Rahul Khanwani..

Rahul Khanvani For More Visit BinaryBuzz.Wordpress.com