MySQL Update Table Statement Exercises: Change the email column of employees table with 'not available' for all employees
MySQL Update Table Statement: Exercise-3 with Solution
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.
Here is the sample table employees.
UPDATE employees
SET email='not available',
commission_pct=0.10
WHERE department_id=110;
Let execute the above code in MySQL 5.6 command prompt
See the result. Only two rows have been displayed.
+-------------+------------+-----------+---------------+--------------+------------+------------+----------+----------------+------------+---------------+ | EMPLOYEE_ID | FIRST_NAME | LAST_NAME | EMAIL | PHONE_NUMBER | HIRE_DATE | JOB_ID | SALARY | COMMISSION_PCT | MANAGER_ID | DEPARTMENT_ID | +-------------+------------+-----------+---------------+--------------+------------+------------+----------+----------------+------------+---------------+ | 205 | Shelley | Higgins | not available | 515.123.8080 | 1987-09-30 | AC_MGR | 12000.00 | 0.10 | 101 | 110 | | 206 | William | Gietz | not available | 515.123.8181 | 1987-10-01 | AC_ACCOUNT | 8300.00 | 0.10 | 205 | 110 | +-------------+------------+-----------+---------------+--------------+------------+------------+----------+----------------+------------+---------------+ 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 and commission_pct column of employees table with 'not available' and 0.10 for all employees.
Next: Write a SQL statement to change the email column of employees table with 'not available' for those employees whose department_id is 80 and gets a commission is less than .20%.
What is the difficulty level of this exercise?
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework