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

Department of Computer Engineering

The document contains 26 questions related to querying a database with tables for customers, branches, deposits, and loans. The questions involve selecting, aggregating, and calculating fields from the tables to return information such as deposit amounts by city, branch cities for specific customers, total and average loans, and minimum and maximum deposits. The final questions involve updating records by changing deposit amounts and branch names.

Uploaded by

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

Department of Computer Engineering

The document contains 26 questions related to querying a database with tables for customers, branches, deposits, and loans. The questions involve selecting, aggregating, and calculating fields from the tables to return information such as deposit amounts by city, branch cities for specific customers, total and average loans, and minimum and maximum deposits. The final questions involve updating records by changing deposit amounts and branch names.

Uploaded by

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

Department of Computer Engineering

Subject: CO 71003 (Database Engineering)

Assignment –1
Deposit (Actno, Cname, Bname, Amount, Adate)
Branch(Bname, City)
Customer(Cname, City)
Borrow(Loan_no, Cname, Bname, Amount)

1. List all the depositors along with their branch name and amount living in city
Nagpur.
Query:- select bname,amount from deposit where bname=(select bname from branch where

city='bhopal';

Output:-

2.List the branch cities of Aditya and Shivani who are depositors.

Query:-select city from branch where bname IN (select bname from deposit where
cname='Aditya' or cname='Shivani';

Output:-

3.List the customer having deposit greater than 1000 and loan less than 10000.
Query:- select cname from deposit where amount >1000 and bname IN (select bname from
borrow where amount <10000);

Output:-

4. List city of depositors having branch SGSITS

Query:- select city from branch where bname=(select bname from deposit where

bname='SGSITS';

Output:-

5. List total and average loan.

Query:-select sum(amount)total,avg(amount)avg from borrow;

Output:-

6. List minimum and maximum deposit.

Query:- select min(amount)min,max(amount)max from deposit;


Output:-

7. List total number of branch citywise.

Query:-select count(bname)total,city from branch Group by(city);

Output:-

8. List total loan taken from abc branch.

Query:-select sum(amount ) As 'total 'from borrow where bname='indore';

Output:-

9. List city in which only one branch exist.

Query:- select city from branch Group by city having (count(distinct bname)=1);

Output:-
10.List maximum deposit of customer living in Bhopal.

Query:- select max(amount) from deposit where cname IN (select cname from
customer where city='bhopal');

Output:-

11. Count total number of branch cities.

Query:-select count(bname)total,city from branch Group by (city);

Output:-

12. Give branch name and branchwise deposit.

Query:-select count(cname)totalno,bname from deposit Group by(bname);

Output:-
13. Give city name and citywise deposit.

Query:- select count(cname)total,bname from borrow Group by (bname);

Output:-

14.Count total number of depositors branchwise.

Query:- select count(cname)total from deposit Group by (bname);

Output:-

15.List the branches having a sum of deposit more than 1000.

Query:- select bname from deposit Group by bname having sum(amount)>1000;

Output:-
16.List branch name having no. of customers who are taking loan is greater than
two.

Query:-select bname from borrow Group by bname having count(Distinct(cname))>2;

Output:-

17.List the names of customers having deposit in the branches where the
average deposit is more than 5000.

Query:-select cname,bname from deposit Group by bname having


Avg(amount)>5000;

Output:-

18.Count total number of borrower branchwise.

Query:- select count(cname)total from borrow Group by (bname);

Output:-
19.List branchname having total number of borrower greater than 4.

Query:-select bname from borrow Group by count(Distinct cname)>4;

Output:-

20. Give 10% interest to all depositors.


Query:-select 1.1*amount as new_amount from deposit;

Output:-

21. Give 10% interest to all depositors living in Gwalior and branch city is Pune.

Query:-select 1.1*amount AS new amount from deposit where bname IN (select bname
from branch where city IN('gwalior','pune');

Output:-

22.List total deposit of customer having account date later than 1-jan-2014.
Query:-select cname,amount from deposit where adate>'2014-01-01';

Output:

24.List all depositors having deposit in all the branches where avinash is having
account.

Query:- select cname from deposit where bname IN (select bname from deposit where
cname='avinash';

Output:-

25.Change the deposit of “ABC” branch to 1000 and change the branch as
“XYZ”.

Query:-update deposit set amount=1000,bname='Sgsits' where bname='mp nagar';


Qutput:-

26.List the customer name having 'a' as the second letter.


Query:-select cname from customer where cname like '_a%';

Output:- cname

You might also like