You are on page 1of 30

Database Systems & Applications Lecture 3 ER-Data Model

IS C 332,Database Systems & Applications , CSIS , BITSPilani,K.K.Birla Goa Campus

Outline
Main phases of DB design ER Model Basics Entities
Entity set,strong entity,weak entity

Attributes
Atomic,Multivalued,composite,derived attributes

Relationships
Degree of relationships Types of relationships /Cardinalities

IS C 332,Database Systems & Applications , CSIS , BITS-

IS C 332,Database Systems & Applications , CSIS , BITSPilani,K.K.Birla Goa Campus

Entity-Relationship(ER) Model
The ER model is a high-level conceptual data model. It is a powerful short hand often used in database design at requirement analysis phase. The ER model was introduced by Peter Chen in 1976, and is now the most widely used conceptual data model.
IS C 332,Database Systems & Applications , CSIS , BITSPilani,K.K.Birla Goa Campus 4

E-R Model
Views the real world as a set of basic objects (entities) and relationships among these objects. It is intended primarily for the DB design process by allowing the specification of an enterprise scheme. This represents the overall logical structure of the DB. ( Conceptual Design )

IS C 332,Database Systems & Applications , CSIS , BITSPilani,K.K.Birla Goa Campus

ER Model
ER-Model describes data as

Entities Attributes Relationships

IS C 332,Database Systems & Applications , CSIS , BITSPilani,K.K.Birla Goa Campus

ER Model
Entity: Real-world object distinguishable from other objects. It can be an object, a place or concept. An entity is described (in DB) using a set of attributes. E.g., student city course instructor Hostel

IS C 332,Database Systems & Applications , CSIS , BITSPilani,K.K.Birla Goa Campus

ER Model Basics
Entity Set: A collection of similar entities. E.g., all students, all courses. . All entities in an entity set have the same set of attributes (Until we consider ISA hierarchies (EER)) . Each entity set has a key. . Each attribute has a domain.

IS C 332,Database Systems & Applications , CSIS , BITSPilani,K.K.Birla Goa Campus

Example entity sets


DB1

student

course

instructor

department

IS C 332,Database Systems & Applications , CSIS , BITSPilani,K.K.Birla Goa Campus

Example entity sets


DB2
passenger train travel Station

passeneg er

train

station

Travel

IS C 332,Database Systems & Applications , CSIS , BITSPilani,K.K.Birla Goa Campus

Strong Entity & Weak Entity

Strong Entity Type (parent, owner, dominant) An entity is strong if its existence is not dependent on some other entity type. Weak Entity Type (child, dependent, subordinate) An entity is weak if its existence is dependent on some other entity type.

IS C 332,Database Systems & Applications , CSIS , BITSPilani,K.K.Birla Goa Campus

Example for Strong & Weak Entities

IS C 332,Database Systems & Applications , CSIS , BITSPilani,K.K.Birla Goa Campus

Attributes
Attribute is the particular properties that describe entity. The attribute values that describe each entity become a major part of the data stored in the database. For example Employee entity may describe by Name, Age, address, salary and job.

IS C 332,Database Systems & Applications , CSIS , BITSPilani,K.K.Birla Goa Campus

Example entity sets


DB1
student course instructor department

student

course
course_code course_name units l-t-p

instructor

st_id st_name birth_dat e gender address instructor_id name dept_code voip

department
dept_code dept_name location tel_no
15

IS C 332,Database Systems & Applications , CSIS , BITSPilani,K.K.Birla Goa Campus

Example entity sets


DB2
passenger train travel Station

passeneg er
ps_id ps_name gender address

train
train_id train_name source_id dest_id

station

travel
ps_id train_id s_id d_id

station_id station_nam e

IS C 332,Database Systems & Applications , CSIS , BITSPilani,K.K.Birla Goa Campus

Attribute & Attribute Value


Student Name Jessy Priya Attribute

ID 2007PSA4554 2007PSB4223

Major IS Comp SC.

Attribute Value

IS C 332,Database Systems & Applications , CSIS , BITSPilani,K.K.Birla Goa Campus

Attributes
Simple/Atomic Composite Single-valued Multi-valued Stored Derived

IS C 332,Database Systems & Applications , CSIS , BITSPilani,K.K.Birla Goa Campus

Atomic Attribute
Atomic Attribute is an attribute that is not divisible. Called Atomic or Simple Attributes. Example
Student

Atomic/Simple

First Name

Last Name

Age

IS C 332,Database Systems & Applications , CSIS , BITSPilani,K.K.Birla Goa Campus

Composite Attributes
Composite Attributes can be divided into smaller subparts, which represent more basic attributes with independent meanings.

Composite Attribute

Address

ZipCode Street Colony District Province Atomic Attribute


IS C 332,Database Systems & Applications , CSIS , BITSPilani,K.K.Birla Goa Campus

Single-Valued VS Multi Valued Attributes


Single-Valued : attribute has a single value for a particular entity Multi Value Attribute: has multiple values

IS C 332,Database Systems & Applications , CSIS , BITSPilani,K.K.Birla Goa Campus

Example
Attribute Age
A : 24 Years B : 27 Years

Degree
A : B.Tech B : B.Tech, M.Tech., PhD.

Attribute Value
IS C 332,Database Systems & Applications , CSIS , BITSPilani,K.K.Birla Goa Campus

Stored VS Derived Attributed


Stored Attribute Derived Attribute: an attribute value can be determined from another attribute / related entity.

IS C 332,Database Systems & Applications , CSIS , BITSPilani,K.K.Birla Goa Campus

Example
Attribute Age
A : 22 Years B : 48 Years

Birth Day
A : 13 July 1990 B : 23 Dec 1964

Stored Attribute

Attribute Value

Derived Attribute

IS C 332,Database Systems & Applications , CSIS , BITSPilani,K.K.Birla Goa Campus

Key Attribute
An attribute that whose values are distinct for each individual entity in the entity set.

Unique Not Null

IS C 332,Database Systems & Applications , CSIS , BITSPilani,K.K.Birla Goa Campus

Null Value
Some case a particular entity may not have an applicable value for an attribute. Example Degree attribute applied only to a person with collage degree. For this situations, a special value called null is create.
IS C 332,Database Systems & Applications , CSIS , BITSPilani,K.K.Birla Goa Campus

Relationships
Relationship: Association among two or more entities. E.g., Hassy registers courses course is allocated to Hassy Relationship Set: Collection of similar relationships. Same entity set could participate in different relationship sets, or in different roles in same set.

IS C 332,Database Systems & Applications , CSIS , BITSPilani,K.K.Birla Goa Campus

Dergree of Relationships
Unary, Binary, Ternary Unary: A relationship between the instances of a single entity set. Binary: A relationship between the instances of two entity sets Ternary: A simultaneous relationship between the instances of three entity sets.
IS C 332,Database Systems & Applications , CSIS , BITSPilani,K.K.Birla Goa Campus

Types of Relationships
Types of binary relationship from entity set A to entity set B one one :<-->: an entity in A is related to at most one entity in B and vice versa many one :-->: an entity in A is related to at most one entity in B many many :--: an entity in A is related to 0 or more entities in B and vice versa

IS C 332,Database Systems & Applications , CSIS , BITSPilani,K.K.Birla Goa Campus

Basic E-R notation (Figure 3-2)

Entity symbols

Attribute symbols

A special entity that is also a relationship


Relationship degrees specify number of entity types involved

Relationship symbols

IS C 332,Database Systems & Applications , CSIS , BITSPilani,K.K.Birla Goa Campus

You might also like