Please note, this is a STATIC archive of website www.w3resource.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
w3resource

MySQL Update Table Statement Exercises: Change the email and commission_pct column of employees table with 'not available' and 0.10 for all employees

MySQL Update Table Statement: Exercise-2 with Solution

Write a SQL statement to change the email and commission_pct column of employees table with 'not available' and 0.10 for all employees.

Here is the sample table employees.


UPDATE employees SET email='not available',
commission_pct=0.10;

Let execute the above code in MySQL 5.6 command prompt

See the result. Only two rows have been displayed.

mysql> SELECT * FROM employees LIMIT 2;
+-------------+------------+-----------+---------------+--------------+------------+---------+----------+----------------+------------+---------------+
| EMPLOYEE_ID | FIRST_NAME | LAST_NAME | EMAIL         | PHONE_NUMBER | HIRE_DATE  | JOB_ID  | SALARY   | COMMISSION_PCT | MANAGER_ID | DEPARTMENT_ID |
+-------------+------------+-----------+---------------+--------------+------------+---------+----------+----------------+------------+---------------+
|         100 | Steven     | King      | not available | 515.123.4567 | 1987-06-17 | AD_PRES | 24000.00 |           0.10 |          0 |            90 |
|         101 | Neena      | Kochhar   | not available | 515.123.4568 | 1987-06-18 | AD_VP   | 17000.00 |           0.10 |        100 |            90 |
+-------------+------------+-----------+---------------+--------------+------------+---------+----------+----------------+------------+---------------+
2 rows in set (0.00 sec)


Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Write a SQL statement to change the email column of employees table with 'not available' for all employees.
Next: Write a SQL statement to change the email and commission_pct column of employees table with 'not available' and 0.10 for those employees whose department_id is 110.

What is the difficulty level of this exercise?