1649. Audit update — Real Estate — implementation variant 49

DBMS Published Updated 0 Views Verified
In a Real Estate application, implement this production problem: Record an employee salary change in an audit table in the same transaction. 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

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 1
Verified Correct Answer

Option B

START TRANSACTION; UPDATE employees SET salary=:new_salary WHERE id=:employee_id; INSERT INTO employee_salary_audit(employee_id,old_salary,new_salary,changed_at) VALUES(:employee_id,:old_salary,:new_salary,NOW()); COMMIT;
Additional Explanation
The update and audit insert should commit together. Obtain the old value safely from a locked row or a trigger.
Sarkari Resultess
Editorial Answer 2
Verified

Option C

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

Option D

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 4