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 - Exercises, Practice, Solution

MySQL Update Table [ 9 exercises with solution]

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

Here is the sample table employees.

Click me to see the solution

2. 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.

Click me to see the solution

3. 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.

Click me to see the solution

4. 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%

Here is the sample table employees.

Click me to see the solution

5. Write a SQL statement to change the email column of employees table with 'not available' for those employees who belongs to the 'Accouning' department.

Here is the sample table employees.

Here is the sample table departments.

Click me to see the solution

6. Write a SQL statement to change salary of employee to 8000 whose ID is 105, if the existing salary is less than 5000.

Here is the sample table employees.

Click me to see the solution

7. Write a SQL statement to change job ID of employee which ID is 118, to SH_CLERK if the employee belongs to department, which ID is 30 and the existing job ID does not start with SH.

Here is the sample table employees.

Click me to see the solution

8. Write a SQL statement to increase the salary of employees under the department 40, 90 and 110 according to the company rules that, salary will be increased by 25% for the department 40, 15% for department 90 and 10% for the department 110 and the rest of the departments will remain same.

Here is the sample table employees.

Click me to see the solution

9. Write a SQL statement to increase the minimum and maximum salary of PU_CLERK by 2000 as well as the salary for those employees by 20% and commission percent by .10.

Here is the sample table employees.

Here is the sample table jobs.

Click me to see the solution

More to Come !

Do not submit any solution of the above exercises at here, if you want to contribute go to the appropriate exercise page.