0% found this document useful (0 votes)
52 views

Bank Database

The document contains the SQL commands to create 6 database tables to store data about bank branches, accounts, customers, account holders, loans, and borrowers. The tables are linked together using foreign keys to represent the relationships between entities.

Uploaded by

asha
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views

Bank Database

The document contains the SQL commands to create 6 database tables to store data about bank branches, accounts, customers, account holders, loans, and borrowers. The tables are linked together using foreign keys to represent the relationships between entities.

Uploaded by

asha
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

CREATE TABLE branch ( branch_name varchar2(30) constraint pk_bname primary key, branch_city

varchar2(30), assets number(10,2) );

CREATE TABLE account ( accno number(10) constraint pk_ano primary key, branch_name
varchar2(30) constraint fk_bname references branch (branch_name), balance number(10,2) );

CREATE TABLE customer ( customer_name varchar2(30) constraint pk_cname primary key,


customer_street varchar2(30), customer_city varchar2(30) );

CREATE TABLE depositor ( customer_name varchar2(30) constraint fk_cusname references


customer(customer_name), accno number(10) constraint fk_anum references account(accno),
constraint pk_depo primary key(customer_name, accno) );

CREATE TABLE loan ( loan_num number(10) constraint pk_lno primary key, branch_name
varchar2(30) constraint fk_bnm references branch(branch_name), amount number(10,2) );

CREATE TABLE borrower ( customer_name varchar2(30) constraint fk_cnm references


customer(customer_name), loan_num number(10) constraint fk_lnum references
loan(loan_num),constraint pk_brw primary key (customer_name, loan_num) );
1. Find all the customers who have at least two accounts at the ‘main’ branch.
2. Find all the customers who have an account at all the branches located in a specific city.
3. Demonstrate how you delete all account tuples at every branch located in a specific city

You might also like