2
2
1 | Karan
| Bank of Baroda
| 15000 | 1998-01-12 |
10 |
| 25000 | 1997-02-01 |
9 |
| 17000 | 1999-07-15 |
5 |
4 | Yatin
11 |
5 | Sunny
| State Bank
| 47000 | 1998-02-06 |
15 |
| 34000 | 1998-08-10 |
7 |
| 56000 | 1999-01-02 |
12 |
8 | Tarun
| Oriental Bank
| 22000 | 1999-04-04 |
8 |
9 | Jisha
| UCO Bank
| 34500 | 1998-01-05 |
11 |
+--------+---------+--------------------+--------+------------+----------------+
9 rows in set (0.11 sec)
A)
mysql> select * from bank
-> where t_transactions between 8 and 11;
+--------+--------+--------------------+--------+------------+----------------+
| Acc_no | CName | BName
| Amount | DateofOpen | T_Transactions |
+--------+--------+--------------------+--------+------------+----------------+
|
1 | Karan | Bank of Baroda
| 15000 | 1998-01-12 |
10 |
|
| 25000 | 1997-02-01 |
9 |
11 |
| 22000 | 1999-04-04 |
8 |
| 34500 | 1998-01-05 |
11 |
+--------+--------+--------------------+--------+------------+----------------+
5 rows in set (0.28 sec)
B)
mysql> select * from bank
-> order by dateofopen;
+--------+---------+--------------------+--------+------------+----------------+
| Acc_no | CName | BName
| Amount | DateofOpen | T_Transactions |
+--------+---------+--------------------+--------+------------+----------------+
|
| 25000 | 1997-02-01 |
9 |
9 | Jisha
| UCO Bank
| 34500 | 1998-01-05 |
11 |
1 | Karan
| Bank of Baroda
| 15000 | 1998-01-12 |
10 |
5 | Sunny
| State Bank
| 47000 | 1998-02-06 |
15 |
| 34000 | 1998-08-10 |
7 |
| 56000 | 1999-01-02 |
12 |
4 | Yatin
11 |
8 | Tarun
| Oriental Bank
| 22000 | 1999-04-04 |
8 |
| 17000 | 1999-07-15 |
5 |
+--------+---------+--------------------+--------+------------+----------------+
9 rows in set (0.06 sec)
C)
mysql> select count(cname) from bank
-> where amount<30000;
+--------------+
| count(cname) |
+--------------+
|
4 |
+--------------+
1 row in set (0.37 sec)
D)
mysql> select max(amount),min(amount) from bank;
+-------------+-------------+
| max(amount) | min(amount) |
+-------------+-------------+
|
56000 |
15000 |
+-------------+-------------+
1 row in set (0.00 sec)
E)
mysql> select cname,bname,amount from bank
-> where amount <20000;
+---------+----------------+--------+
| cname | bname
| amount |
+---------+----------------+--------+
| Karan | Bank of Baroda | 15000 |
| Anirban | Oriental Bank | 17000 |
+---------+----------------+--------+
2 rows in set (0.00 sec)
F)
mysql> select acc_no,cname,bname,t_transactions from bank
-> order by amount desc;
+--------+---------+--------------------+----------------+
| acc_no | cname | bname
| t_transactions |
+--------+---------+--------------------+----------------+
|
7 | Nikhil | Bank of Baroda
|
12 |
|
5 | Sunny | State Bank
|
15 |
|
4 | Yatin | Standard Chartered |
11 |
|
9 | Jisha | UCO Bank
|
11 |
|
6 | Jayant | UCO Bank
|
7 |
|
2 | Puneet | State Bank
|
9 |
|
8 | Tarun | Oriental Bank
|
8 |
|
3 | Anirban | Oriental Bank
|
5 |
|
1 | Karan | Bank of Baroda
|
10 |
+--------+---------+--------------------+----------------+
9 rows in set (0.00 sec)
G)
mysql> select avg(amount) from bank where amount<23000;
+-------------+
| avg(amount) |
+-------------+
| 18000.0000 |
+-------------+
1 row in set (0.08 sec)
mysql> select max(amount) from bank where amount>30000;
+-------------+
| max(amount) |
+-------------+
|
56000 |
+-------------+
1 row in set (0.00 sec)
mysql> select sum(t_transactions) from bank;
+---------------------+
| sum(t_transactions) |
+---------------------+
|
88 |
+---------------------+
1 row in set (0.00 sec)
mysql> select count(distinct bname) from bank;
+-----------------------+
| count(distinct bname) |
+-----------------------+
|
5 |
+-----------------------+
1 row in set (0.05 sec)