-
Notifications
You must be signed in to change notification settings - Fork 0
/
AddEmployeeGender.txt
37 lines (32 loc) · 1.47 KB
/
AddEmployeeGender.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
mysql> ALTER TABLE employee_payroll ADD gender char(1);
Query OK, 0 rows affected (0.56 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> SELECT * FROM employee_payroll;
+-----+---------+--------+------------+--------+
| id | name | salary | start | gender |
+-----+---------+--------+------------+--------+
| 100 | Rhushi | 10000 | 2022-07-05 | NULL |
| 101 | Anup | 35000 | 2018-05-31 | NULL |
| 103 | Vaibhav | 17000 | 2018-05-31 | NULL |
| 104 | Shital | 27000 | 2021-09-22 | NULL |
| 105 | Mohan | 17000 | 2019-05-05 | NULL |
+-----+---------+--------+------------+--------+
5 rows in set (0.00 sec)
mysql> UPDATE employee_payroll SET gender = 'M' WHERE name = 'Rhushi' OR name = 'Anup' OR name = 'Vaibhav' OR name = 'Mohan';
Query OK, 2 rows affected (0.11 sec)
Rows matched: 4 Changed: 2 Warnings: 0
mysql> UPDATE employee_payroll SET gender = 'F' WHERE name = 'Shital';
Query OK, 1 row affected (0.11 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> SELECT * FROM employee_payroll;
+-----+---------+--------+------------+--------+
| id | name | salary | start | gender |
+-----+---------+--------+------------+--------+
| 100 | Rhushi | 10000 | 2022-07-05 | M |
| 101 | Anup | 35000 | 2018-05-31 | M |
| 103 | Vaibhav | 17000 | 2018-05-31 | M |
| 104 | Shital | 27000 | 2021-09-22 | F |
| 105 | Mohan | 17000 | 2019-05-05 | M |
+-----+---------+--------+------------+--------+
5 rows in set (0.00 sec)
mysql>