-
mysql> update employee_data SET
-> l_name = 'Sharma'
-> WHERE l_name = 'Pandit';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
Note: If there were other employees with 'Pandit' as last name, their entries would be updated too!. This is where our emp_id column comes is helpful since it contains unique values. It would have been better to use the value of emp_id instead of last names as in:
mysql> update employee_data SET
-> l_name = 'Sharma'
-> WHERE emp_id = 4;
-
mysql> update employee_data set
-> title = 'Multimedia Specialist'
-> where title = 'Multimedia Programmer';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
-
mysql> update employee_data set
-> salary = salary + 10000
-> where title != 'CEO';
Query OK, 20 rows affected (0.00 sec)
Rows matched: 20 Changed: 20 Warnings: 0