+-------+------------+-----------+-----------+
| ID | name | dept_name | salary |
+-------+------------+-----------+-----------+
| 10101 | Srinivasan | 0 | 71500.00 |
| 12121 | Wu | 0 | 90000.00 |
| 15151 | Mozart | 0 | 40000.00 |
| 22222 | Einstein | 0 | 95000.00 |
| 32343 | El Said | 0 | 60000.00 |
| 33456 | Gold | 0 | 87000.00 |
| 45565 | Katz | 0 | 82500.00 |
| 58583 | Califieri | 0 | 62000.00 |
| 76543 | Singh | 0 | 80000.00 |
| 76766 | Crick | 0 | 72000.00 |
| 83821 | Brandt | 0 | 101200.00 |
| 98345 | Kim | 0 | 80000.00 |
+-------+------------+-----------+-----------+
我想将 dept_name 列中的值更改为值(全部不同),而不保存和重新创建表。有没有办法做到这一点?
期望的输出:
+-------+------------+-----------+-----------+
| ID | name | dept_name | salary |
+-------+------------+-----------+-----------+
| 10101 | Srinivasan | 1 | 71500.00 |
| 12121 | Wu | 2 | 90000.00 |
| 15151 | Mozart | 3 | 40000.00 |
| 22222 | Einstein | 2 | 95000.00 |
| 32343 | El Said | 2 | 60000.00 |
| 33456 | Gold | 3 | 87000.00 |
| 45565 | Katz | 1 | 82500.00 |
| 58583 | Califieri | 3 | 62000.00 |
| 76543 | Singh | 1 | 80000.00 |
| 76766 | Crick | 1 | 72000.00 |
| 83821 | Brandt | 2 | 101200.00 |
| 98345 | Kim | 2 | 80000.00 |
+-------+------------+-----------+-----------+