Professional Documents
Culture Documents
L4 Er Model
L4 Er Model
Lecture 3
ENTITY
2
Attributes
3
Symbol
4
SAMPLE
5
ER MODEL
6
Composite Attributes
7
Retrieve and show the following information about manager
who joined in 1991-06-19
• Operation:
Delete the EMPLOYEE tuple with Ssn = ‘999887777’.
ANS. Employee and Works_on
• Operation:
Update the Dno of the EMPLOYEE tuple with Ssn = ‘999887777’ to 7
ER Diagram
• An Entity Relationship Diagram (ERD) is a visual representation of different
data using conventions that describe how these data are related to each other.
For example, the elements writer, novel, and consumer may be described using
ER diagrams this way:
• An inventory software used in a retail shop will have a database that monitors
elements such as purchases, item, item type, item source and item price.
Rendering this information through an ER diagram would be something like
this:
HISTORY
• It uses a foreign key combined with its attributed to form the primary key.
• An entity like order item is a good example for this. The order item will be
meaningless without an order so it depends on the existence of order.
Composite Attribute
• Attributes can also have their own specific attributes
Multivalued Attribute
• If an attribute can have more than one value it is called an multivalve attribute.
• It is important to note that this is different to an attribute having its own
attributes.
• For example a teacher entity can have multiple subject values.
Derived Attribute
• An attribute based on another attribute. This is found rarely in ER diagrams.
• For example for a circle the area can be derived from the radius.
21
22
23
24
Requirement
New books, authors and clients are entered into the system.
When a client checks out a book, the system will register the
date the book was loaned and calculate the days the book can be
loaned. It will also calculate the date the book is due to be
returned. If the borrower returns the book late, he must pay a
fine based on the number of days overdue."
25
Requirement
"I would like my customers to be able to browse my catalog of books and place
orders over the Internet. Currently, I take orders over the phone. I have mostly
corporate customers who call me and give me the ISBN number of a book and a
quantity; they often pay by credit card.
I then prepare a shipment that contains the books they ordered. If I don't have
enough copies in stock, I order additional copies and delay the shipment until
the new copies arrive; I want to ship a customer's entire order together.
My catalog includes all the books I sell. For each book, the catalog contains its
ISBN number, title, author, purcha.se price, sales price, and the year the book
was published. Most of my customers are regulars, and I have records with their
names and addresses.
New customers have to call me first and establish an account before they can
use my website. On my new website, customers should first identify themselves
by their unique customer identification number. Then they should be able to
browse my catalog and to place orders online."
26
Recursive Relationships
27
Cardinality Ratios for Binary Relationship
N 1
29
M:N Relationship
An employee can
work on
several projects and
a project can have
several employees.
30
Participation constraint
• If a company policy states that every employee must work for a department, then an
employee entity can exist only if it participates in at least one WORKS_FOR
relationship instance.
32