Professional Documents
Culture Documents
Save changes
2
mysql> commit;
Query OK, 0 rows affected (0.00 sec)
+--------+----------+--------------+-------+----------+----------++-------+------+
| rr_no | cus_name | Billing_date | units | bill_amt | due_date |
+--------+----------+--------------+-------+----------+----------++-------------+
| abc100 | tom
| 2012-03-14
| 98 |
NULL | NULL
| abc101 | bean
| 2022-03-14
| 70 |
NULL | NULL
| abc102 | jerry
| 2020-04-14
| 62 |
NULL | NULL
| abc102 | jerry
| 2012-06-14
| 72 |
NULL | NULL
| abc104 | ash
| 2012-06-14
| 72 |
NULL | NULL
| abc111 | sonia
| 2010-02-14 | 102 |
NULL | NULL
| abc176 | neha
| 2015-09-14
| 99 |
NULL | NULL
| 178
| neelam | 2019-10-14 | 98 |
NULL | NULL
| 178
| shri
| 2029-10-14 | 55 |
NULL | NULL
| 878
| ravi
| 2009-10-14 | 75 |
NULL | NULL
+--------+----------+--------------+-------+----------+----------++-------+++-------+
3
2. Student details
mysql> create table class
-> ( id_no int(4) primary key,
-> s_name varchar(25),
-> physics int(3),
-> chemistry int(3),
-> maths int(3),
-> computer_science int(3),
-> english int(3));
Query OK, 0 rows affected (0.05 sec)
1|
steve |
99 |
98 |
100 |
78 |
89 |
2|
gates |
67 |
78 |
87 |
99 |
78 |
3|
charles |
45 |
56 |
76 |
100 |
67 |
4|
ada
89 |
78 |
89 |
90 |
78 |
5|
indira |
67 |
78 |
89 |
99 |
99 |
6|
ajinkya |
90 |
87 |
67 |
45 |
67 |
7|
jayanti |
45 |
78 |
34 |
89 |
70 |
8|
ishika
35 |
78 |
34 |
34 |
70 |
9 | robin
35 |
48 |
34 |
34 |
50 |
| 10 | viren
100 |
99 |
98 |
99 |
90 |
| 11 | meera |
90 |
89 |
80 |
56 |
78 |
+-------+---------+---------+-----------+-------+------------------+---------+--+---------+-------+
11 rows in set (0.00 sec)
100 |
99 |
98 |
99 |
90 |
486 |
97.20 | pass |
1 | steve
99 |
98 |
100 |
78 |
89 |
464 |
92.80 | pass |
5 | indira
67 |
78 |
89 |
99 |
99 |
4 | ada
89 |
78 |
89 |
90 |
78 |
424 |
84.80 | pass |
2 | gates
67 |
78 |
87 |
99 |
78 |
409 |
81.80 | pass |
| 11 | meera
90 |
89 |
80 |
56 |
78 |
393 |
78.60 | pass |
6 | ajinkya
90 |
87 |
67 |
45 |
67 |
356 |
71.20 | pass |
3 | Charles
45 |
56 |
76 |
100 |
67 |
344 |
68.80 | pass |
7 | jayanti
45 |
78 |
34 |
89 |
70 |
316 |
63.20 | fail |
8 | ishika
35 |
78 |
34 |
34 |
70 |
251 |
50.20 | fail |
9 | robin
35 |
48 |
34 |
34 |
50 |
201 |
40.20 | fail |
+-------+---------+---------+-----------+-------+------------------+---------+-------+------------+--------+-------+-------+-------+
10
Insert 10 records
mysql> insert into employee values (201,'asha','IT','12/03/13',15000);
Query OK, 1 row affected (0.03 sec)
mysql> insert into employee values (202,'usha','Admin','12/01/12',10000);
Query OK, 1 row affected (0.01 sec)
mysql> insert into employee values (203,'Ram','IT','12/01/12',30000);
Query OK, 1 row affected (0.02 sec)
mysql> insert into employee values (204,'Lata','Finance','22/01/14',23000);
Query OK, 1 row affected (0.02 sec)
mysql> insert into employee values (205,'Geeta','Finance','11/11/11',13000);
Query OK, 1 row affected (0.02 sec)
mysql> insert into employee values (105,'Meeta','admin','11/11/11',33000);
Query OK, 1 row affected (0.02 sec)
mysql> insert into employee values (106,'Neeta','IT','12/12/12',50000);
Query OK, 1 row affected (0.01 sec)
mysql> insert into employee values (107,'Kripa','Hr','10/02/12',45000);
Query OK, 1 row affected (0.02 sec)
mysql> insert into employee values (108,'Reti','Hr','11/10/09',45000);
11
12
+-----------------+
| admin
|
| Finance
|
| Hr
|
| IT
|
+-----------------+
4 rows in set (0.00 sec)
| 205 | Geeta
| Finance
| 2011-11-11 | 13000 |
| 208 | Kriti
| Finance
| 2008-09-10 |
5000 |
+--------+----------+-----------+--------------+------------+------------+------------+
10 rows in set (0.02 sec)
Add new column to the table employee called incentive and compute 8% of salary
mysql> alter table employee add (incentive int(5));
Query OK, 10 rows affected (0.17 sec)
Records: 10 Duplicates: 0 Warnings: 0
mysql> update employee set incentive = (8 * emp_salary) /100;
Query OK, 10 rows affected (0.03 sec)
Rows matched: 10 Changed: 10 Warnings: 0
mysql> select * from employee;
+--------+----------+-----------+--------------+------------+-----------+
| emp_id | emp_name | dept_name | date_of_join | emp_salary | incentive |
+--------+----------+-----------+--------------+------------+-----------+
| 105 | Meeta | admin | 2011-11-11 | 33000 | 2640 |
| 106 | Neeta | IT
| 2012-12-12 | 50000 | 4000 |
| 107 | Kripa | Hr
| 2010-02-12 | 55000 | 4400 |
| 108 | Reti | Hr
| 2011-10-09 | 55000 | 4400 |
| 201 | asha | IT
| 2012-03-13 | 15000 | 1200 |
| 202 | usha | Admin | 2012-01-12 | 10000 |
800 |
| 203 | Ram | IT
| 2012-01-12 | 30000 | 2400 |
| 204 | Lata | Finance | 2022-01-14 | 23000 | 1840 |
| 205 | Geeta | Finance | 2011-11-11 | 13000 | 1040 |
| 208 | Kriti | Finance | 2008-09-10 |
5000 |
400 |
+--------+----------+-----------+--------------+------------+-----------+
10 rows in set (0.00 sec)
+--------+----------+-----------+--------------+------------+-----------+---------+---------+
| 106 | Neeta
| IT
| 2012-12-12 | 50000 | 4000 |
| 107 | Kripa
| Hr
| 2010-02-12 | 55000 | 4400 |
| 108 | Reti
| Hr
| 2011-10-09 | 55000 | 4400 |
| 201 | asha
| IT
| 2012-03-13 | 15000 | 1200 |
| 203 | Ram
| IT
| 2012-01-12 | 30000 | 2400 |
| 204 | Lata
| Finance | 2022-01-14 | 23000 | 1840 |
| 205 | Geeta
| Finance |2011-11-11 | 13000 | 1040 |
| 208 | Kriti
| Finance | 2008-09-10 |
5000 |
400 |
+--------+----------+-----------+--------------+------------+-----------+---------+---------+
8 rows in set (0.00 sec)
Insert 10 records
mysql> insert into bank_database values
(121,'meena','sb',34500,'12/08/14',300000);
Query OK, 1 row affected (0.03 sec)
mysql> insert into bank_database values
(122,'teena','ca',4500,'12/08/14',100000);
Query OK, 1 row affected (0.02 sec)
mysql> insert into bank_database values (123,'rita','ca',500,'02/09/13',200000);
Query OK, 1 row affected (0.05 sec)
mysql> insert into bank_database values
(143,'rita','sb',2000,'14/10/13',1500000);
Query OK, 1 row affected (0.03 sec)
16
|
500
| reema
| sb
| 60000 | 2030-05-13 | 500000.00 |
+------------+-----------+----------+--------------------+--------------------------+----------------+
1 row in set (0.00 sec)
+--------------+
1 row in set (0.00 sec)