Professional Documents
Culture Documents
RELATIONSHIP
DIAGRAM
DATABASE
ARCHITECTURE
External level concerned with the way
individual users see the data
Conceptual level can be regarded as a
community user view a formal description
of data
of interest to the organisation
Internal level concerned with the way in
which the data is actually stored
In
It
ER
It
ENTITY
It
ENTITY TYPE
Entity
ENTITY SET
Collection
STUDENT
Entity type
Entity
ATTRIBUTE
Attributes
entities.
Attribute names are enclosed by ovals and
connected to their entities by single line.
Set of attribute values of a given attribute is the
value set or domain
Ssn
EMPLOYEE
Salary
Bdate
SIMPLE ATTRIBUTE
COMPOSITE ATTRIBUTE
Cannot be split in to
further
attributes(indivisible)
Also known as Atomic
attribute
Ex: Ssn(Social
Security Number)
DERIVED ATTRIBUTE
STORED ATTRIBUTE
Attributes from
which the values of
other attributes are
derived
Key
IDENTIFIER
ATTRIBUTE
OR KEY
ATTRIBUTE
Name
STUDENT
Flighti
d
No-ofpassengers
FLIGHT
Choose
Avoid
Compositehierarchy
City
State
Street
Address
Streetadd
Apartm
ent-no
Ssn
EMPLOYEE
Phoneno
multivalued
Primary-key
Salary
Bdate
Age
derived
stored
COMPLEX
ATTRIBUTE
Composite and mutivalued attribute can also
be nested arbitrarily to form complex key.
Areacode
Phoneno
Street
Phone
Streetadd
AddressPhone
Apartme
ntno
State
Address
City
Zip
If
Ex:
RELATIONSHIP TYPE
When
Ex:
Attribute
In
Ex:
The
Each
EMPLOYEE
WORK
S-FOR
DEPARTMENT
DEGREE OF A RELATIONSHIP
It is the number of entity types that participate in a
relationship
SALESASSIST
SELLS
CUSTOMER
PRODUCT
Binary-relationship
Unary
isor
v
r
e
p
su
EMPLOYEE
superv
isee
SUPERVI
SION
CARDINALITY CONSTRAINTS
The number of instances of one entity that can or
must be associated with each instance of another
entity.
If we have two entity types A and B, the
one-to-one
EMPLOYEE
one
MANAGE
1 S
DEPARTMENT
to many
WORKSN FOR
EMPLOYEE
DEPARTMENT
many-to-many
WORKSON
EMPLOYEE
PROJECT
N
ROLE NAME
Some
PARITICIPATION
CONSTRAINTS(OPTIONALITY)
Specifies if existence of an entity depends on it being
related to another entity via relationship.
Specifies
EMPLOYEE
WORKSFOR
DEPARTMENT
ATTRIBUTE OF RELATIONSHIP
TYPE
Relationship
EMPLOYEE
WORKSON
Hours
PROJECT
Attributes
EMPLOYEE
MANAGE
S
Start-date
DEPARTMENT
Because
So
So
For
WORKSFOR
Start-date
DEPARTMENT
For
WORKSON
Hours
PROJECT
Relationshi
p
EMPLOYEE
HAS
DEPENDENTS
Employe
e
Dependent
-name
But
Partial
line.
Weak
Choice
If
Also
EMPLOYEE
Departme
nt
DEPARTMENT
Employee
s
EMPLOYEE
WORKSFOR
DEPARTMENT
B)
Ex:
INSTRUCTOR
Deptname
STUDENT
Deptname
COURSE
Deptname
Can be refined as
DEPARTMENT
WORK
S-FOR
INSTRUCTOR
REGIST
ERED
STUDENT
BELON
GS-TO
COURSE
Inverse
ALTERNATE
NOTATIONS
We
SUPPL
Y
Sname
PROJECT
Pname
PART
Partno
We
Pname
Sname
Qty
SUPPLIER
SUPPLI
ES
CAN
SUPPL
Y
PROJECT
USES
PART
Partno
CAN_SUPPLY
USES
SUPPLIES
The
Solution
So
Qty
Sname
SUPPLIER
1
SS
Pname
N
SUPPLY
N
SP
1
PART
Partno
1
SPJ
PROJECT
SALESASSISTANT
SELLS
SELLS
PRODUCT
SELLS
CUSTOMER
The
SALESASSISSTAN
T
SALE
REQ
UES
T
CUSTOMER
OLV
ES
PRODUCT
REMOVING REDUNDANT
RELATIONSHIP
Entities can be related indirectly by two relationships.
A relationship is redundant if it can be
completely represented by alternate
transitive relationships
CONFIRMING OPTIONALITY
AND CARDINALITY OF
RELATIONSHIP
Use
1.
CONSTRUCTING AN ER MODEL
Before
ER
EXAMPLE
A Country Bus Company owns a number of
busses. Each bus is allocated to a particular route,
although some routes may have several busses. Each
route passes through a number of towns. One or more
drivers are allocated to each stage of a route, which
corresponds to a journey through some or all of the
towns on a route. Some of the towns have a garage
where busses are kept and each of the busses are
identified by the registration number and can carry
different numbers of passengers, since the vehicles vary
in size and can be single or double-decked. Each route is
identified by a route number and information is
available on the average number of passengers carried
per day for each route. Drivers have an employee
number, name , address, and sometimes a telephone
number.
ENTITIES
Bus
RELATIONSHIPS
A
ER DIAGRAM
ATTRIBUTES
Bus
(reg- no,make,size,deck,no-pass)
Route (route-no,avg-pass)
Driver (emp - no,name,address,tel-no)
Town (name)
Stage (stage - no)
Garage (name,address)
ALTERNATIVE DIAGRAMATIC
NOTATIONS
FOR ER
MODELS
Displaying attributes
CROW-FOOT NOTATION
ENHANCED ER
DIAGRAM
The EER diagram includes the concepts
of
SUBCLASS SUPERCLASS
AND
INHERITANCE
In
Here
An
SPECIALIZATION
Specialisation is a process of defining set of
subclasses of an entity type.
This
The
The
Attributes
Subclass
IN SPECIALISATION:
1.Define a set of subclass of entity type
GENERALISATION
The reverse process of abstraction in which we
suppress the differences among several entity
types, identify their common features and
generalize them in to single super class of which
original entity types are special subclasses.
Pric
e
Vehicleid
No-ofpass
CAR
Maxspeed
Vehicleid
Licen
se-no
TRUCK
No-ofaxles
Tonnag
e
Price
Licens
e-no
Licen
se-no
Pric
e
Vehicleid
VEHICLE
No-ofpass
TRUCK
CAR
Maxspeed
No-of-axles
Tonnag
e
CONSTRAINTS ON SPECIALIZATION
AND
GENERALIZATION
Predicate-defined subclasses
Disjoint, total
Disjoint, partial
Overlapping, total
Overlapping, partial
SPECIALIZATION /
GENERALIZATION
HIERARCHIES, LATTICES
A
In
In
In
SPECIALIZATION / GENERALIZATION
LATTICE
EXAMPLE (UNIVERSITY)
ENTITY
ATTRIBUTE
CONSTRAINTS
1.Customer
accountId
Key
lastName
Not null
firstName
shippingAddresse Multivalued
s
composite with
components
name, street,
city,
state, zipcode
emailAddress
creditCards
Multivalued
composite with
components
type,
accountNumber ,
expiration
password
ENTITY
2. Movie
ATTRIBUTE
Movieid
Title
CONSTRAINTS
Key
Genre
Media
3. DVD
Languages
Either dvd or
videotape
determines
subclass
Subclass of
Movie
Videoformat
Captioning
4. Videotape
Format
Soundtrack
Subclass of
Movie
ENTITY
5. Sale
ATTRIBUTE
SaleId
Totalcost
CONSTRAINTS
Key
DateSold
CreditCard
6. ShoppingCart CartId
DateCreated
Composite with
components
type,
accountNumber
, and expiration
key
RELATIONSHIPS
Relation Entity
ship
Class
Type
Purchases Custom
er
Includes
Sale
Selects
Includes
Custom
er
Movie
Entity
Class
Cardina
lity
Ratio
Sale
one-tomany
Movie
manyto-many
Shopping one-toCart
many
Shopping manyCart
to-many
Attribut
es
quantity
quantity
THANK
YOU