Professional Documents
Culture Documents
Introduction
Part I. ISD for well structured data – relational and other DBMS
Info storage (modeling, normalization)
Info retrieval (Relational algebra, Calculus, SQL)
DB integrated API’s
Customers are identified by their SSN (equiv to HKID). The bank stores each customer’s name
and address. Customers may have accounts, and can take out loans. A customer may be associated
with a particular banker, who may act as a loan officer of personal banker for that customer.
Bank employees are also identified by SSN. The bank stores the Name, address, phone #, start day
of employment of each employee, the name of all dependents of the employee, and the manager of
the employee.
The bank offers two types of accounts: savings and checking. Accounts can be held by more than
one customer, and a customer may have many accounts. Each account has a unique account
number. We store each account’s balance, and the most recent date when the account was accessed
by each customer holding the account. Each savings account has an interest rate, and overdrafts
are recorded for each checking account.
A loan originates at a particular branch, and is held by one or more customers. Each loan has a
unique number. For each loan, the bank stores the loan amount and the payments (date and
amount) . Payment numbers are not unique, but a payment number uniquely identifies a payment
for a specific loan.
Information Storing: ER models
customer
ER models: entity types
Types of entities
- Regular entity:
one or a combination of attribute values uniquely identifies the entity in a set.
- Weak entity:
no combination of attribute values can uniquely identify the entity in a set.
customer loan-payment
ER models: attribute types
- Multi-valued dependent-name
A unique entity may have multiple values for this attribute
- Derived attribute
If the value of the attribute can be derived/computed employment-length
from some other values
ER models: relationships
Total participation: if each entity of some set has at least one relationship
of type ‘borrows’, then it has total participation in that relationship type.
n m
customer borrows loan
1:n cardinality
e.g.: Each employee can have at most one manager (manager is also an employee)
1
employee manages
n
1:1 cardinality
e.g.: Each branch can have at most one manager, and each employee can manage at most 1 branch
ER models: Superkeys, Candidate Keys
customer
ER models: Specializations
Suppose all entities of a given set can be categorized further into a few subsets.
e.g. entity account may be of type savings or checking. The subsets form
categories, or specializations.
account_no balance
account
isa
interest-rate overdraft
savings checking
isa
standard gold
Regular entity
Weak entity
simple attribute
multi-valued attribute
derived attribute
relationship
participation
total participation
isa specialization
Bank ER
ER Diagrams: use