Is that all you want? Or does your homework assignment require that you do the update with
a single update statement? If you you need to look at the case statement.
In the future you should really specify more detail when posting to the forum, or any forum.
Also don't include the png file that your teacher sent you, actually type the data.
Code:
UPDATE emp
SET salary = 7782
WHERE emp_id = 7839;
UPDATE emp
SET emp_id = 5000
WHERE salary = 7782;
COMMIT;
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
UPDATE mubas_emo_table
SET salary = CASE emp_id
WHEN 7839 THEN 7782
ELSE salary
END,
emp_id = CASE emp_id
WHEN 7782 THEN 5000
ELSE salary
WHERE emp_id IN ( 7782, 7839 );
Last edited by gandolf989; 01-06-2014 at 10:24 AM.