DBMS Solution
DBMS Solution
*********************************************************9 10 11
12*******************************************************************
mysql> use bank;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables;
+----------------+
| Tables_in_bank |
+----------------+
| borrow |
| branch |
| customer |
| deposit |
+----------------+
4 rows in set (0.00 sec)
mysql> #3 show acc no, amt of customers who have opened acc between 1-12-96 and 1-
5-97
mysql> select actno, amount
-> from deposit
-> where adate between '1-12-1996' and '1-5-1997';
Empty set, 30 warnings (0.00 sec)
mysql> #3 show acc no, amt of customers who have opened acc between 1-12-96 and 1-
5-97
mysql> select actno, amount
-> from deposit
-> where adate between '1996-12-1' and '1997-5-1';
+-------+--------+
| actno | amount |
+-------+--------+
| 1002 | 4000 |
| 1003 | 4000 |
| 1006 | 7000 |
| 1007 | 17000 |
| 1012 | 500 |
| 1013 | 500 |
| 1015 | 15000 |
+-------+--------+
7 rows in set (0.00 sec)
IMP
mysql> #5 names of all branches where avg of amount > 1200
mysql> select bname
-> from deposit
-> group by bname
-> having avg(amount)>1200;
+--------------+
| bname |
+--------------+
| bank of maha |
| peryridge |
| union |
| maha |
| karolbag |
+--------------+
5 rows in set (0.00 sec)
##################################### 10 ########################################
mysql> ##10
mysql> #1 all branches in city bombay
mysql> select bname
-> from branch
-> where city='bombay';
+--------+
| bname |
+--------+
| aandra |
+--------+
1 row in set (0.00 sec)
##################################### 11 ########################################
mysql> #1 display acc date of amil
mysql> select adate
-> from deposit
-> where cname='anil';
+------------+
| adate |
+------------+
| 2002-10-11 |
+------------+
1 row in set (0.00 sec)
mysql>
#########################################################12########################
##########################
mysql> #1 display customer name living in city bombay & branch city nagpur
mysql> select cname
-> from deposit d, branch b, customer c
-> where b.city='nagpur' and c.city='bombay' and d.bname=b.bname and
c.cname=d.cname;
ERROR 1052 (23000): Column 'cname' in field list is ambiguous
mysql>
mysql>
mysql> select c.cname
-> from deposit d, branch b, customer c
-> where b.city='nagpur' and c.city='bombay' and d.bname=b.bname and
c.cname=d.cname;
+--------+
| cname |
+--------+
| avanti |
+--------+
1 row in set (0.00 sec)
##