Database Model

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 6

Entity-Relationship Model for A Bank

SS_No name
Cust_ID

address

customer

account

balance

branch

ha acc_No
s
Relation data model for a Bank
Relations:
• Custom (cust-id, ss#, name, address)
• Account (acc-no, brance, balance)
• Has (cust_id, acc_no)

Optimized relations
• Custom (cust-id, ss#, name, address)
• Account (acc-no,cust-id, brance, balance)
Tables in the logical model
Customer
cust-id Ss# name address
1000 123-45-6789 Joe Smith Xyx main street
2000 999-00-1111 Jane Doe 123 victory blvd

Account
Acc_no Cust-ID brach balance
21000 1000 Main street 23000
30000 1000 Main street 5000
41000 2000 Victory Blvd 51000
Logical Schema (data dictionary)
• Customer
1. Cust-Id char(4) eg. 1000
2. SS#char(9) eg. 123-45-6789
3. Name vchar(30) eg. Jane Doe
4. Address vchar(25) eg. Main Street

• Account
1. Acc_nochar(5) eg. 10001
2. Cust-id char(4) eg. 1000
3. Branch vchar(25) eg. Victory Blvd.
4. Balance float(.2) eg. 5200.56
Physical Database Design
• Physical Schema (SQL Script):
create table account
(account_number varchar(15) not null unique,
branch_name varchar(15) not null,
balance int not null,
primary key(account_number));

create table customer


(customer_name varchar(15) not null unique,
customer_street varchar(12) not null,
customer_city varchar(15) not null,
primary key(customer_name));
Entity-Relationship model for VCR Repair Shop

customer
ID address
Cust_Name

Phone_no
ssn
customer
Order#

date
payment

order Pickup
ha
s

date

item
model

S_no

You might also like