The Entity-Relationship Data Model
The Entity-Relationship Data Model
Entity sets
Attributes
relationships
2.1.1 Entity Sets
Is an abstract object of some sort, and a
collection of similar entities forms an entity
set.
MultiValued Attributes:
Attribute that has more than one value: set of telephone numbers
set of addresses in :
1 Person
2 Name
2 telephone#
2 address
Derived Attributes
Attribute whose value is derived from other attributes
1 Person
2 Name
2 telephone#
2 address
2 DOB
2 Age derived from DOB
and current date
2.1.3 Relationships
Relationship are connections among two
or more entity sets .
year
type
Owns name
studios
address
2.1.5 Instances of an E/R Diagram
E/R diagrams are notation for describing the
schema of databases, that is their structure
Lecturer Subject
Then :
Many to many
M 1
Many to one
1 1
lecturer taught subject
One to one
One-To-One Relationships
Design Issue:
Here, manufacturer is an Entity Set.
In earlier diagrams it is an attribute.
Which is right?
One-To-Many Relationship
Representation of Many-One
M N
stars contracts movie
studio
movie Sequel-of
Unary
1 relationship
subject prerequisit
e
M
2.1.8 Roles in Relationships (cont)
Stars Movies
M M
Contracts
Producing
Studio of star
studio
1
1
Studios
Connectivity
1 M
PROFESSOR Teaches CLASS
(1,4) (1,1)
Cardinalities
CHEN MODEL
2.1.9 Cardinality in Relationships
Connectivity
PROFESSOR CLASS
Teaches
Cardinalities
(a)An INVOICE is written by a SALESREP. Each sales representative can write many invoices, but each invoice is written by a single sales representative.
(b)The INVOICE is written for a single CUSTOMER. However, each customer can have many invoices.
(c) An INVOICE can include many details (DETAIL), which describe the products bought by the customer.
(d) The product information is stored in a PRODUCT entity.