0% found this document useful (0 votes)
33 views14 pages

Bank

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

Bank

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

Bank

• Create database bank


Syntax:-
create database bank;
use bank;
• Create table Account:-
Syntax:-
create table ACCOUNT(acc_no varchar(5) primary key
check (acc_no like 'A%'),name varchar(30),city
varchar(20),balance int,loan_taken varchar(30));
Bank
1. Insert the following records
Syntax:-
insert into ACCOUNT values
('A001','PatelJigar ','Mehsana',50000,'YES'),
('A002','PatelRamesh','Mehsana',50000,'YES'),
('A003','DaveHardik','Ahmedabad',75000,'NO'),
('A004','SoniHetal','Ahmedabad',100000,'NO'),
('A005','Soni Atul','Vadodara',100000,'YES');
Bank
2. Create table Loan
Syntax:-
create table LOAN(loan_no varchar(5) primary
key check(loan_no like 'L%'),Acc_no
varchar(5),loan_amt int,Interest_rate integer
not null,Loan_date date,Remaining_loan
integer,constraint check
(Remaining_loan<Loan_amt), foreign
key(Acc_no) REFERENCES ACCOUNT(Acc_no));
Bank
2 insert the records in loan table
Syntax:-
Insert into LOAN values
('L001','A001',100000,7,"01-01-04",75000),
('L002','A002',300000,9,"18-05-04",150000),
('L003','A005',500000,11,"15-06-04",300000);
Bank
3. Create table INSTALLMENT
Syntax:-
create table INSTALLMENT(Loan_no
varchar(5),Inst_no varchar(5) primary key
check(Inst_no like 'I%'),idate date not
null,amount int not null, foreign
key(Loan_no) references LOAN(Loan_no));
Bank
2 insert the records in instament table
Syntax:-
insert into INSTALLMENT values('L001','I001','2-
02-04',15000),
('L002','I002','18-06-04',20000),
('L003','I003','15-07-04',20000);
Bank
4. Create table TRANSACTION
Syntax:-
create table TRANSACTIONS(Acc_no
varchar(5),Trans_Date date not null,amt int
not null,Type_of_tr varchar(5)
check(Type_of_tr in('D','W')),Mode_of_pay
varchar(5) check(Mode_of_pay in
('cash','check')), foreign key(Acc_no)
references ACCOUNT (Acc_no));
Bank
2. Insert the following:-
insert into TRANSACTIONS values
('A001','3-05-04',10000,'D','Cash'),
('A002','5-07-04',5000,'W','Check'),
('A003','12-08-04',25000,'D','Check'),
('A004','15-05-04',30000,'D','Check'),
('A005', '22-10-04',15000,'W', 'Cash');
Using Operator: NOT,BETWEEN,NOT
BETWEEN,IN,NOT IN Bank
1. Retrieve specified information for the
account holder who are not in ‘Ahmedabad’.
Query : select * from ACCOUNT where city not
in ('Ahmedabad');
2. Retrieve specified information for the account
holder who are not in ‘Ahmedabad’ or
‘Vadodara’.
Query : select * from account where city not in
('Ahmedabad','Vadodara');
Using Operator: NOT,BETWEEN,NOT
BETWEEN,IN,NOT IN Bank
3. Retrieve those records of Account holder whose
balance between is 50000 and 100000.
Query : select * from account where balance
between 50000 and 100000;
4. Retrieve those records of Account holder whose
balance not between is 50000 and 100000.
Query : select * from account where balance not
between 50000 and 100000;
Using Operator: NOT,BETWEEN,NOT
BETWEEN,IN,NOT IN Bank
5. Display only those records whose amount is
5000, 25000, 30000.
Query : select * from account where balance
in(5000,25000,30000);
6. Display only those records whose amount not
in 5000, 25000, 30000.
Query : select * from account where balance not
in(5000,25000,30000);
Using Operator: NOT,BETWEEN,NOT
BETWEEN,IN,NOT IN Bank
7. Find the total transaction amount of account
holder from transaction table.
Query : select sum(amt)"Total Trasactions
Amount" from transactions;
8. Find minimum amount of transaction.
Query : select min(amt)"Minimum Amount"
from transactions;
Using Operator: NOT,BETWEEN,NOT
BETWEEN,IN,NOT IN Bank
9. Find maximum amount of transaction.
Query : select max(amt)"Maximum Amount"
from transactions;
10. Count the total account holders.
Query : select count(Acc_no)"Total Account
Holder" from transactions;
Using Operator: NOT,BETWEEN,NOT
BETWEEN,IN,NOT IN Bank
11. Count only those records whose made of
payment is ‘cash’.
Query :select count(Acc_no)"Mode of Pay" from
transactions where Mode_of_pay='Cash';
12. Find the average value of transaction.
Query :select avg(amt)"Average Tansaction"
from transactions;

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy