1680. Update using another table — Inventory — implementation variant 30

DBMS Published Updated 0 Views Verified
In a Inventory application, implement this production problem: Move employees into a target department based on a department mapping table. The API/service receives user input and must return or modify data safely. Give the SQL solution, explain why it works, and show how the same operation is called from the selected stack.
Looking for the latest Sarkari Result 2026 updates? Check the latest government exam results, merit lists and result updates on Sarkari Resultess.
Sarkari Resultess
Questions & Answers

Answer & Explanation

4 Answers
Verified

Option A

DELETE FROM the_table;
Additional Explanation
Incorrect: it does not implement the stated business rule and may modify/fetch the wrong rows.
Sarkari Resultess
Editorial Answer 1
Verified

Option B

SELECT * FROM the_table;
Additional Explanation
Incorrect: it does not implement the stated business rule and may modify/fetch the wrong rows.
Sarkari Resultess
Editorial Answer 2
Verified Correct Answer

Option C

UPDATE employees e JOIN department_mapping m ON m.employee_id=e.id SET e.dept_id=m.new_dept_id WHERE e.status='active';
Additional Explanation
MySQL supports UPDATE JOIN. Preview the same JOIN with SELECT before executing a large update.
Sarkari Resultess
Editorial Answer 3
Verified

Option D

UPDATE the_table SET status='active';
Additional Explanation
Incorrect: it does not implement the stated business rule and may modify/fetch the wrong rows.
Sarkari Resultess
Editorial Answer 4