Auto-update updated_at column
SQL
Easy
0 views
Problem Description
On update of Orders, set updated_at to current timestamp automatically.
Output Format
Trigger created
Sample Test Case
Input:
Orders(updated_at)
Constraints
Assume updated_at exists
Official Solution
CREATE TRIGGER trg_orders_updated_at BEFORE UPDATE ON Orders FOR EACH ROW SET NEW.updated_at = CURRENT_TIMESTAMP;
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!