Вы находитесь на странице: 1из 22

Entity-Relationship Model

Leo Mark
(May 2002)
The Real World The Model
real
customers
customer
surrogates
Entity Type and entity surrogates

airport

• entity type names must be unique


Single-valued Properties
airport

airport
name
Hartsfield Logan
Kastrup

• property values are lexical, visible, audible, ….they


are things that name other things
Identifying Properties
cph
lax
airport atl
code bos

airport

• for each identifying property value there is at most one


instance of the identified entity
• every entity must be uniquely referenceable
Multi-valued Properties

su
th mo th
weekdays we we
mo mo

flt-schedule
Composite Properties

1 Flughafen St
airport
400 Flight Av
airport 12 Logan Rd
street

airport airport Hamburg


city address
Denver
airport Boston
zip

90123
56789
12345
1-1 relationship types
1 1
female- current male-
customer marriage customer

partial functions

• the names of multiple relationship types between


the same two entity types must be unique
0-N and 1-N relationship types
1 N
airport from flt-schedule

partial function
Mandatory 0-N and 1-N
relationship types
1 N
airport from flt-schedule

total function
N-M relationship types
N M
customer reservation flt-instance
N-ary relationship types

plane-part-
supplier L supply plane-part
M

supplier# N quantity part#

repair- flt-repair-
order# order

• many ternary relationship types cannot be reduced


to a conjunction of binary relationship types
Identifying relationship types &
weak entity types

flt#

• flt-instance cannot exist


flt-schedule
without flt-schedule
• flt-instance cannot be
identified without flt-
schedule from
• (flt#, date) identifies flt-
instance date
flt-instance
recursive relationship types

out

connection flt-schedule flt#

in

departure arrival
time time
Are relationships entities?
Or, are they just “glue”?

1 N
airport from flt-schedule

departure
time

• relationships may have attributes


• for 1-N (and 1-1) relationships, attributes may
be moved to the entity on the “many-side”
Are relationships entities?
Or, are they just “glue”? (cont....)

N M
customer reservation flt-instance

payment
method

• in N-M relationships, the attributes cannot be


moved to the entities
• how can non-entities have attributes?
Are relationships entities?
Or, are they just “glue”? (cont....)
N M
customer reservation flt-instance

payment
method

1 N M 1
customer reservation flt-instance

payment
method

An objectified relationship type


supertypes and subtypes?
Male

x
passenger
Female

economy class first class


passenger passenger

business class
passenger
UNION entity types

company person

payer
property or entity type?

family
name

customer
relationship type or entity type?

flt-instance

reservation

customer
What’s the Result Type of a
Query?

Вам также может понравиться