0% found this document useful (0 votes)
500 views9 pages

Bank Management System PDF

The document contains SQL statements that create tables for a banking database including tables for branches, customers, loans, accounts, employees, and relationships between the tables. Data is then inserted into the tables.

Uploaded by

Sukh Vir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
500 views9 pages

Bank Management System PDF

The document contains SQL statements that create tables for a banking database including tables for branches, customers, loans, accounts, employees, and relationships between the tables. Data is then inserted into the tables.

Uploaded by

Sukh Vir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

create table branch(

branch_ID varchar(5) not null,


branch_name varchar(25),
branch_city varchar(25),
assets varchar(10),
primary key(branch_ID)
);
describe branch;

create table customer(


customer_ID varchar(10) not null,
customer_name varchar(10),
customer_street varchar(20),
customer_city varchar(10),
primary key(customer_ID)
);
describe customer;

create table loan(


loan_number char(10) not null,
amount numeric(12,2),
primary key(loan_number)
);
describe loan;

create table account(


account_number char(10) not null,
balance numeric(10,2),
primary key(account_number)
);
describe account;

create table employee(


employee_ID varchar(10) not null,
employee_name varchar(10),
telephone_number integer,
start_date date,
primary key(employee_ID)
);
describe employee;

create table payment1(


loan_number char(10) not null,
payment_number char(10) not null,
payment_date date,
payment_amount numeric(10,2),
primary key(loan_number,payment_number),
foreign key(loan_number) references loan
);
describe payment1;

create table account_branch1(


account_number char(10) not null,
branch_ID varchar(10),
primary key(account_number),
foreign key(account_number) references account,
foreign key(branch_ID) references branch
);
describe account_branch1;

create table loan_branch1(


loan_number char(10) not null,
branch_ID varchar(10),
primary key(loan_number),
foreign key(loan_number) references loan,
foreign key(branch_ID) references branch
);

describe loan_branch1;

create table borrower(


customer_ID varchar(10) not null,
loan_number char(10) not null,
primary key(customer_ID,loan_number),
foreign key(customer_ID) references customer,
foreign key(loan_number) references loan
);
describe borrower;

create table depositor(


customer_ID varchar(10) not null,
account_number char(10)not null,
access_date date,
primary key(customer_ID,account_number),
foreign key(customer_ID) references customer,
foreign key(account_number) references account
);
describe depositor;

create table cust_banker(


customer_ID varchar(10) not null,
employee_ID varchar(10)not null,
type varchar(15),
primary key(customer_ID,employee_ID),
foreign key(customer_ID) references customer,
foreign key(employee_ID) references employee
);
describe cust_banker;

create table work_for(


worker_employee_ID varchar(10) not null,
manager_employee_ID varchar(10),
primary key(worker_employee_ID),
foreign key(worker_employee_ID) references employee,
foreign key(manager_employee_ID) references employee
);
describe work_for;

create table dependent_name(


employee_ID varchar(10),
d_name varchar(10),
primary key(employee_ID,d_name),
foreign key(employee_ID) references employee
);
describe dependent_name;

create table savingaccount(


account_number char(10) not null,
interest_rate numeric(10,2),
primary key(account_number),
foreign key(account_number) references account
);
describe savingaccount;

create table checking_account(


account_number char(10) not null,
overdraft_amount numeric(10,2),
primary key(account_number),
foreign key(account_number) references account
);
describe checking_account;

alter table customer


add cust_DOB date;
describe customer;

insert into branch


values('60517','Brighton','brookly','7100000');
insert into branch
values('60518','downtown','brooklyn','600000');
insert into branch
values('60519','perryridge','horseneek','110000');
select*
from branch;

insert into customer


values('12345','Adam','spring','ryn');
insert into customer
values('12389','smith','snorth','stamfort');
select*
from customer;

insert into loan


values('L-16','1550.36');
insert into loan
values('L-17','2000.89');
insert into loan
values('L-18','6540.00');
insert into loan
values('L-19','6750.00');

select*
from loan;

insert into account


values('fg156','25850.25');
insert into account
values('ab986','14568.25');
insert into account
values('th5921','91856.25');
select*
from account;

insert into employee


values('002','jon','68547','6/may/2001');
insert into employee
values('086','M fellaini','68587','9/june/2002');
insert into employee
values('086','W Rooney','98645','21/aug/2002');

select*
from employee;

You might also like