Bank Database

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 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