0% found this document useful (0 votes)
18 views5 pages

DBMS Unit 1

The document describes the creation of tables for a banking account management system including tables for customers, branches, loans, accounts, and transactions. It then provides 10 requirements involving writing SQL queries to retrieve and aggregate data from the tables, such as updating account balances, selecting customer details by date of birth, counting accounts by city, joining tables to view customer names and loan amounts, and more.

Uploaded by

Harsh Ojha
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)
18 views5 pages

DBMS Unit 1

The document describes the creation of tables for a banking account management system including tables for customers, branches, loans, accounts, and transactions. It then provides 10 requirements involving writing SQL queries to retrieve and aggregate data from the tables, such as updating account balances, selecting customer details by date of birth, counting accounts by city, joining tables to view customer names and loan amounts, and more.

Uploaded by

Harsh Ojha
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/ 5

BANK ACCOUNT MANAGEMENT SYSTEM assessment solution

Create table customer


(cust_id number(10) primary key,
First_name varchar2(20) not null,
Mid_name varchar2(10),
Last_name varchar2(20),
City varchar2(30),
Mobile_no number(10),
Occupation varchar2(20),
DOB date
);

Create table branch


( branch_id number(5) primary key,
Branch_name varchar2(20) not null,
Branch_city varchar2(20)
);

Create table loan


(cust_id number(10) references customer(cust_id),
branch_id number(5) references branch(branch_id),
loan_amount number(10,2)
);

Create table account


(ac_number number(16) primary key,
cust_id number(10) references customer(cust_id),
branch_id number(5) references branch(branch_id),
open_balance number(10,2),
acc_open_date date,
acc_type varchar2(20),
acc_status varchar2(30)
);

Create table trans_details


( tran_number number(10) primary key,
ac_number number(16) references account(ac_number),
tran_date date,
medium_of_trans varchar2(20),
trans_type varchar2(10),
trans_amount number(10,2)
);
Insert command for all the tables as follows
 insert into customer
values(11012,'aarya',null,'choudhary','ghaziabad',7309755555,'prof'
,'04/05/1978');
 insert into branch values(10,'alph','ghaziabad');

 insert into loan values(11111,11,20000);
 insert into account
values(101,11111,10,1000,sysdate,'saving','active');
 insert into trans_details values(10001,101,sysdate,'atm','dr','2000');
Requirement 1:

 update account set open_balance=open_balance+500 where


acc_type=’saving’;
Requirement 2:

 select first_name,to_char(to_date(dob,'dd-mm-yyyy'),'month')
as dob from customer where dob like '09%' or dob like ‘11%;
Requirement 3:

 select city,count(*) from customer


where city like ‘p%’ or
city like ‘c%’
group by city;

Requirement 4:

 Select first_name||nvl(mid_name, _’)||last_name,loan_amount


as “loan amout” from customer,loan
Where customer.cust_id=loan.cust_id ;
Requirement 5:
 Select first_name,ac_type,count(ac_number) as “number of accounts”
from customer,account
Where customer.cust_id=account.cust_id
Group by ac_number;
Requirement 6:

 Select branch_name as “branch name”,count(ac_number) as “number of


accounts” from branch,account
Where branch.branch_id=account.branch_id
Group by ac_number;

Requirement 7:

 Select first_name,mid_name,last_name
,to_char(mobileno,’999,999,9999’) from customer;

Requirement 8:

Select c.* ,count(cust_id) from customer c,loan


Where c.cust_id=loan.cust_id
Group by cust_id
Having count(cust_id)>1 ;
Requirement 9:

Select cust_id,branch_name,loan_amount from branch,loan


Where branch.branch_id=loan.branch_id
Group by branch_name
Having max(loan_amount);
Requirement 10:
Select c.* from customer c,loan l,account a
Where c. cust_id=a. cust_id and
cust_id not in (l. cust_id);

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