Cross-Database MySQL Update Triggers
Budget: $30 – $250 USD
I have two databases that sit on the same MySQL server. When a new row is inserted into db1.tableA, I need a trigger to immediately update matching rows in db2.tableB. The match will rely on specific column values—no joins, no extra validation logic, just a straightforward WHERE colX = NEW.colX (plus one or two more columns I’ll specify once we start).
The job is to write and deliver two clean, well-commented CREATE TRIGGER statements—one for INSERT AFTER and, if needed, a companion trigger for UPDATE AFTER on the same source table. The code must execute reliably under typical transactional load, avoid recursion, and be easy for me to drop and re-create in staging and production.
Deliverables
• Two ready-to-run SQL scripts (or one script with both CREATE TRIGGER blocks)
• A short note explaining any session variables or delimiter changes required to run them
• Quick test query set I can use to confirm the updates fire as expected
Acceptance criteria
• Running the script in MySQL 8.0 creates the triggers without errors
• Inserting a sample row into db1.tableA updates only the intended rows in db2.tableB
• No unintended side-effects on other tables or databases
If you’ve built cross-database triggers before and can turn this around quickly, let’s get it done.
The job is to write and deliver two clean, well-commented CREATE TRIGGER statements—one for INSERT AFTER and, if needed, a companion trigger for UPDATE AFTER on the same source table. The code must execute reliably under typical transactional load, avoid recursion, and be easy for me to drop and re-create in staging and production.
Deliverables
• Two ready-to-run SQL scripts (or one script with both CREATE TRIGGER blocks)
• A short note explaining any session variables or delimiter changes required to run them
• Quick test query set I can use to confirm the updates fire as expected
Acceptance criteria
• Running the script in MySQL 8.0 creates the triggers without errors
• Inserting a sample row into db1.tableA updates only the intended rows in db2.tableB
• No unintended side-effects on other tables or databases
If you’ve built cross-database triggers before and can turn this around quickly, let’s get it done.
Related categories:
PHP
SQL
MySQL
Database Administration
Database Programming
Database Development
Database Design
Database Management