You are on page 1of 6

BANKING DATABASE

BANKING DATABASE

DATA BANK

In telecommunications, computing, and information architecture, a data bank


or databank is a repository of information on one or more subjects – a
database – that is organized in a way that facilitates local or remote
information retrieval and is able to process a large number of continual
queries over a long period of time. A data bank may be either centralized or
decentralized, though most usage of this term refers to centralized storage
and retrieval of information, by way of analogy to a monetary bank. The data
in a data bank can be anything from scientific information like global
temperature readings, and governmental information like census statistics, to
financial-system records like credit card transactions, or the inventory
available from various suppliers.

Data bank may also refer to an organization primarily concerned with the
construction and maintenance of such a database. The term databank is also
obsolete (1960s through 1970s) computer jargon for database itself, and is
frequently used in that sense in materials written in that period

Banking example (primary key is underlined)


Branch (branch-name, branch-city, assets)
Customer (customer-name, customer-street, customer-city)
Account (account-number, branch-name, and balance)
Loan (loan-number, branch-name, and amount)
Depositor (customer-name, account-number)
Borrower (customer-name, loan-number)
COMPUTER SCIENCE AND ENGG 2019-20 Page 1
BANKING DATABASE

Employee (employee-name, branch-name, salary)

Create above tables in database ‘bank’

ACCOUNT
SQL>Create table account
(Account_ number char (5) not null primary key,
Branch_ name varchar (15),
Balance double
);

BRANCH
SQL> create table if not exists branch
(Branch_ name varchar (10) not null primary key,
Branch-city varchar (10),
Assets double
);

CUSTOMER
SQL> create table if not exists customer
(Customer _ name varchar (20) not null primary key,
Customer_ street varchar (20),
Customer_ city varchar (10)
);

LOAN

COMPUTER SCIENCE AND ENGG 2019-20 Page 2


BANKING DATABASE

SQL>create table if not exists loan


(Loan_ number varchar (5) not null primary key,
Branch_ name varchar (10),
Amount double
);

BORROWER
SQL>create table if not exists borrower
(Customer_ name varchar (20) not null,
Loan_ number varchar (5) not null,
Primary key (customer_ name, loan_ number)
);

DEPOSITE
SQL> create table if not exists depositor
(Customer_ name varchar (20) not null,
Account_ number char (5) not null,
Primary key (customer_ name, account_ number)
);

EMPLOYEE
SQL>create table if not exists employee
(Employee_ name varchar (20) not null,
Branch_ name varchar (10) not null,
Salary double, primary key (employee_ name, branch_ name)
);

COMPUTER SCIENCE AND ENGG 2019-20 Page 3


BANKING DATABASE

Insert data into t hose tables


SQL:
Use bank;

ACCOUNT
Insert into account values ('A-101', 'Downtown', 500);
Insert into account values ('A-102', 'Perry ridge', 400);
Insert into account values ('A-201', 'Brighton', 900);
Insert into account values ('A-215', 'Mianus', 700);
Insert into account values ('A-217', 'Brighton', 750);
Insert into account values ('A-222', 'Redwood', 700);
Insert into account values ('A-305', 'Round Hill', 350);

BRANCH
Insert into branch values ('Brighton', 'Brooklyn', 7100000);
Insert into branch values ('Downtown', 'Brooklyn', 9000000);
Insert into branch values ('Mianus', 'Horse neck', 400000);
Insert into branch values ('North Town', 'Rye', 3700000);
Insert into branch values ('Perry ridge', 'Horse neck', 1700000);
Insert into branch values ('Pownal', 'Bennington', 300000);
Insert into branch values ('Redwood', 'Palo Alto', 2100000);
Insert into branch values ('Round Hill', 'Horse neck', 8000000);

CUSTOMER
Insert into customer values ('Adams', ‘spring', 'Pittsfield');
Insert into customer values ('Brooks', 'Senator', 'and Brooklyn’);

COMPUTER SCIENCE AND ENGG 2019-20 Page 4


BANKING DATABASE

Insert into customer values ('Curry', 'North', 'and Rye’);


Insert into customer values ('Glenn', 'Sand Hill', 'and Woodside’);
Insert into customer values ('Green', 'Walnut', 'and Stamford’);
Insert into customer values ('Hayes', 'Main', 'and Harrison’);
Insert into customer values ('Johnson', 'Alma', 'and Palo Alto');
Insert into customer values ('Jones', 'Main', 'and Harrison’);
Insert into customer values ('Lindsay', 'Park ', 'and Pittsfield’);
Insert into customer values ('Smith', 'North', 'and Rye’);
Insert into customer values ('Turner', 'Putnam', 'and Stamford’);
Insert into customer values ('Williams', 'Nassau', 'and Princeton’);

DEPOSITE
Insert into depositor values ('Hayes', 'A-102');
Insert into depositor values ('Johnson', 'A-102');
Insert into depositor values ('Johnson', 'A-201');
Insert into depositor values ('Jones', 'A-217');
Insert into depositor values ('Lindsay', 'A-222');
Insert into depositor values ('Smith', 'A-215');
Insert into depositor values ('Turner', 'A-305');

LOAN
Insert into loan values ('L-11', 'Round Hill', 900);
Insert into loan values ('L-14', 'Downtown', 1500);
Insert into loan values ('L-15', 'Perry ridge', 1500);
Insert into loan values ('L-16', 'Perry ridge', 1300);
Insert into loan values ('L-17', 'Downtown', 1000);
Insert into loan values ('L-23', 'Redwood', 2000);
COMPUTER SCIENCE AND ENGG 2019-20 Page 5
BANKING DATABASE

Insert into loan values ('l-93', 'Mianus', 500);

BORROWER
Insert into borrower values ('Adams', 'L-16 ');
Insert into borrower values ('Curry', 'L-93');
Insert into borrower values ('Hayes', 'L-15');
Insert into borrower values ('Jackson', 'L-14 ');
Insert into borrower values ('Jones', 'L-17');

Insert into borrower values ('Smith', 'L-11');

Insert into borrower values ('Smith', 'L-23');

Insert into borrower values ('Williams', 'L-17');

EMPLOYEE

Insert into employee values ('Adams', 'Perry ridge', 1500);

Insert into employee values ('Brown', 'Perry ridge', 1300);

Insert into employee values ('Gopal', 'Perry ridge', 5300);

Insert into employee values ('Johnson', 'Downtown', 1500);

Insert into employee values ('Loreena', 'Downtown', 1300);

Insert into employee values ('Peterson', 'Downtown', 2500);

Insert into employee values ('Rao', 'Austin', 1500);

Insert into employee values ('Sato', 'Austin', 1600);

COMPUTER SCIENCE AND ENGG 2019-20 Page 6

You might also like