Professional Documents
Culture Documents
Bank Management System Queries:: 1. Please Follow Instructions Given Below
Bank Management System Queries:: 1. Please Follow Instructions Given Below
Bank Management System Queries:: 1. Please Follow Instructions Given Below
Queries:
1. Please follow instructions given below.
SELECT account_number,am.customer_number,firstname,lastname,account_opening_date
ON cm.customer_number=am.customer_number
ORDER BY account_number;
2.Please follow instructions given below.
Write a query to display the number of customer’s from Delhi. Give the count an alias name
of Cust_Count.
SELECT count(customer_number)Cust_Count
FROM customer_master
WHERE CUSTOMER_CITY='Delhi'
Display the records sorted in ascending order based on customer number and then by account
number.
SELECT am.cutomer_number,firstname,account_number
ON cm.customer_number=am.customer_number
WHERE day(account_opening_date)>15
ORDER BY cm.customer_number,account_number
4.Please follow instructions given below.
Write a query to display customer number, customer's first name, account number where the
account status is terminated.
Display the records sorted in ascending order based on customer number and then by account
number.
SELECT am.customer_number,firstname,account_number
ON cm.customer_number=am.customer_number
WHERE account_status='Terminated'
ORDER BY am.customer_number,account_number
SELECT transaction_type,count(transaction_number)Trans_Count
ON am.account_number=td.account_number
GROUP BY transaction_type
ORDER BY transaction_type
6.Please follow instructions given below.
Write a query to display the number of customers who have registration but no account in the
bank.
SELECT count(customer_number)Count_Customer
FROM customer_master
SELECT td.account_number,opening_balance+sum(transaction_amount)Deposit_Amount
ON am.account_number=td.account_number
WHERE transaction_type='deposit'
GROUP BY account_number
ORDER BY account_number
8.Please follow instructions given below.
Write a query to display the number of accounts opened in each city .The Query should display
Branch City and number of accounts as No_of_Accounts.For the branch city where we don’t have
any accounts opened display 0.
ON account_master.branch_id=branch_master.branch_id
GROUP BY branch_master.branch_city
ORDER BY branch_city;
SELECT firstname
GROUP BY firstname
HAVING count(account_number)>1
ORDER BY firstname;
ON cm.customer_number=id.customer_number
GROUP BY customer_number
HAVING count(branch_id)>1
ORDER BY customer_number
SELECT customer_master.customer_number,firstname,customer_city,branch_city
ON account_master.customer_number = customer_master.customer_number
ORDER BY customer_master.customer_number;
ON cm.customer_number=id.customer_number
For example the account A00023 has done 5 transactions i.e. suppose 3 withdrawal and 2
deposits. Whereas the account A00024 has done 3 transactions i.e. suppose 2 withdrawals and 1
deposit. So account number of A00023 should be displayed.
In case of multiple records, display the records sorted in ascending order based on account
number.
SELECT td.account_number
ON am.account_number=td.account_number
group by td.account_number
having count(td.transaction_number)>=ALL
(SELECT count(td.transaction_number)
ON am.account_number=td.account_number
For example the branch B00019 has 3 customers, B00020 has 7 and B00021 has 10. So branch id
B00021 is having maximum customers. If B00021 is Koramangla branch
Bangalore, Koramangla branch should be displayed along with city name Bangalore.
In case of multiple records, display the records sorted in ascending order based on branch name.
SELECT branch_name,branch_city
ON branch_master.branch_id=account_master.branch_id
group by branch_name
having count(customer_number)>=ALL
(select count(customer_number)
ON branch_master.branch_id=account_master.branch_id
For example A00011 account opened with Opening Balance 1000 and A00011 deposited 2000
rupees on 2012-12-01 and 3000 rupees on 2012-12-02. The same account i.e A00011 withdrawn
3000 rupees on 2013-01-01 and 7000 rupees on 2013-01-03. So the total deposited amount is 6000
and total withdrawal amount is 10000. So withdrawal amount is more than deposited amount for
account number A00011.
ON am.account_number=td.account_number
GROUP BY td.account_number
ORDER BY am.account_number