Assignment No 2 Dbmsss
Assignment No 2 Dbmsss
Syrle22
SQL> create table branch_22 , branch varchar(25) primary key, branch_city varchar(15), assets
varchar(10));
1 Nigdi 12664
2 Akurdi 46532
3 ShivajiBank 79536
CUST_NAME ACC_NO
------------------------------ ----------
Ajinkya bharti 1
Ujwal Rajpoot 2
Pratikk 3
SQL> select * from loan_22;
CUST_NAME LOAN_NO
------------------------------ ---------------
Pratikk 685
BRANCH_NAME
-------------------------
Nigdi
Akurdi
ShivajiBank
Q.2 Find all loan numbers for loans made at Akurdi Branch with loan amount > 1200000
no rows selected
LOAN_NO
---------------
345
685
909
Q3. Find all customers who have a loan from bank. Find their names,loan_no and loan
amount.
SQL> select c.cust_name,b.loan_no,l.amount
2 from customer_22 c
2 from customer_22 c
6 order by c.cust_name;
Q6. Find all customers who have an account or loan or both at bank.
SQL> select distinct cust_name from depositor_22 union select distinct cust_name from
borrower_22;
CUST_NAME
------------------------------
Ajinkya Bharti
Ujwal Rajpoot
Pratikk
SQL> select d.cust_name
2 from depositor_22 d
CUST_NAME
------------------------------
Ajinkya bharti
Ujwal Rajpoot
Pratikk
Q7. Find all customer who have account but no loan at the bank.
2 from depositor_22 d
no rows selected
2 from account_22 a
AVG_BALANCE
-----------
45684
2 from account_22
3 group by branch_name;
BRANCH_NAME AVG_BALANCE
------------------------- -----------
Nigdi 24891
ShivajiBank 12836
Akurdi 45684
4 group by a.branch_name;
BRANCH_NAME NUM_DEPOSITORS
------------------------- --------------
Nigdi 2
ShivajiBank 2
Akurdi 2
Q11. Find the branches where average account balance > 12000.
2 from account_22
3 group by branch_name
4 having avg(balance)>12000;
BRANCH_NAME
-------------------------
Nigdi
ShivajiBank
Akurdi
NUM_TUPLES
----------
TOTAL_AMOUNT
------------
786250
Q14. Delete all loans with loan amount between 1300 and 1500.
SQL> delete from loan_22 where amount between 1300 and 1500;
0 rows deleted.
Q15. Delete all tuples at every branch located in Nigdi.
Synonym created.
Q.17. Create sequence roll_seq and use in student table for roll_no column.
Table created.
ROLL_NO NAME
---------- --------------------
1 Yash
2 Pranav
3 Aryan
4 Sanskruti
5 Riya
6 Pratik
6 rows selected.