Creating a trigger to update one table’s row based on another update from a different table’s row

So, I have the following two tables:

CREATE TABLE IF NOT EXISTS `services` (   `services_id` INT NOT NULL AUTO_INCREMENT,   `staff_num` INT NOT NULL,   `health_and_wellness` INT NOT NULL,   `tutoring` INT NOT NULL,   PRIMARY KEY (`services_id`),   UNIQUE INDEX `services_id_UNIQUE` (`services_id` ASC) VISIBLE,   INDEX `fk_services_healthandwell_idx` (`health_and_wellness` ASC) VISIBLE,   INDEX `fk_services_tutoring_idx` (`tutoring` ASC) VISIBLE,   CONSTRAINT `fk_services_tutoring`     FOREIGN KEY (`tutoring`)     REFERENCES `tutoring` (`tutoring_id`)     ON DELETE CASCADE     ON UPDATE CASCADE,   CONSTRAINT `fk_services_healthandwell`     FOREIGN KEY (`health_and_wellness`)     REFERENCES `health and wellness` (`health_and_wellness_id`)     ON DELETE CASCADE     ON UPDATE CASCADE) ENGINE = InnoDB; 


CREATE TABLE IF NOT EXISTS `tutoring` (   `tutoring_id` INT NOT NULL AUTO_INCREMENT,   `subject` INT NOT NULL,   `staff_members` INT NOT NULL,   PRIMARY KEY (`tutoring_id`),   UNIQUE INDEX `tutoring_id_UNIQUE` (`tutoring_id` ASC) VISIBLE,   INDEX `fk_tutoring_subject_idx` (`subject` ASC) VISIBLE,   CONSTRAINT `fk_tutoring_subject`     FOREIGN KEY (`subject`)     REFERENCES `subjects` (`subject_id`)     ON DELETE NO ACTION     ON UPDATE NO ACTION) ENGINE = InnoDB; 

I want to create a trigger that updates services.staff_num whenever tutoring.staff_members is updated.. I’ve tried a couple different triggers, but each time nothing happens or I get an error.. My latest attempt was this:

DELIMITER $  $   CREATE TRIGGER UpdateStaffNum AFTER UPDATE ON collegedb.tutoring FOR EACH ROW     BEGIN         UPDATE services         SET services.staff_num = services.staff_num + tutoring.staff_members;  END; 

Which of course would be too simple too work, heh. Anyone have any suggestions on this? Thanks.

MS SQL Creating Tables and Adding Values by a Trigger

I have a table for products. They have product name, id, and quantity. By using a trigger whenever I insert a product to this table for example id =145, quantity= 10 I want that existing table get updated and the quantity of the item with an existing id will be decreased by one and autmatically by the trigger we will create a new table only 2 columns, id and quantity, and it will be id=145, quantity =10. How can I do this?

Delayed or Asynchronous DML Trigger Execution

I have created a DML trigger (AFTER INSERT, UPDATE, DELETE) on a table
Trigger’s logic takes about 30 seconds to execute

So if you change even 1 row, it takes about 30 seconds due to trigger execution
Developer asked me "Is there a chance that the trigger could be a fire & forget action?"

I said no, but is it really so ?


Can trigger be executed in "asynchronous" mode?
Application updates couple of rows in few ms, and thinks that transaction is completed, and then trigger is silently executed under the hood ?

I understand that this actually does not look good from consistency point of view, but still, is it possible ?

Does Heart of the Storm still trigger if the spell was countered?

The Storm Sorcerer has an ability called Heart of the Storm:

At 6th level, you gain resistance to lightning and thunder damage. In addition, whenever you start casting a spell of 1st level or higher that deals lightning or thunder damage, stormy magic erupts from you. This eruption causes creatures of your choice that you can see within 10 feet of you to take lightning or thunder damage (choose each time this ability activates) equal to half your sorcerer level.

Counterspell is an interrupt:

You attempt to interrupt a creature in the process of casting a spell. If the creature is casting a spell of 3rd level or lower, its spell fails and has no effect.

So I’d argue that the damage from the ability triggers before Counterspell can even be cast, and thus the (relatively small damage at lower levels) still happens. Am I correct?

Can you Ready an attack with the trigger ‘enemy enters my reach’? If so, will you interrupt their movement on a hit?

Without using any feats, can a player with a reach weapon set that weapon to receive a ‘charge’ by the enemy, attacking them when they enter range? Or even a non-reach weapon? That is, can a player commit to using their attack action when an enemy crosses an arbitrary line with their movement? (Examples: Ready my glaive to attack when the orc gets 10′ away from me. Ready my shortbow to attack when the dragon enters 80′ from me. Ready my dagger in case the kobold comes adjacent.)

If this is possible, and the player’s attack hits, does it have any effect on the enemy’s remaining movement or other actions?

I think the answers are yes, and no, respectively.

Can an Unseen Servant trigger an Alarm spell, and can said Alarm be customized?

As an Unseen Servant is "shapeless", its size is not defined. The Alarm spell, however, relies on a creature’s size (Tiny or larger) to be activated. Therefore, I’m not sure if an Unseen Servant, when commanded to walk through a location containing an Alarm, would trigger said Alarm or not. I would think it does, but I might be wrong (maybe the Unseen Servant’s size value is "null"), hence the question.

Also, one of the two ways to receive an Alarm notification is mental. I’m wondering whether that notification can be customized, so that if the Unseen Servant crosses through Alarm #1, you can get a different "ping" than for Alarm #2. Again, I would think so, but it’s better to verify (maybe it’s always the same sound regardless).

Finally, I’m almost certain that if you go back and forth through an Alarm zone, you will repetitively get the "ping", but I just want to be 100% sure.

Can a Wildshaped Druid trigger Dive Attack twice in a turn?

So I have a lizardfolk moon druid and I was curious about the interaction between his bonus action Hungry Jaws ability and the Dive Attack ability of the Quetzalcoatlus.

"Dive Attack. If the quetzalcoatlus is flying and dives at least 30 feet toward a target and then hits with a bite attack, the attack deals an extra 10 (3d6) damage to the target."

"Hungry Jaws. In battle, you can throw yourself into a vicious feeding frenzy. As a bonus action, you can make a special attack with your bite. If the attack hits, it deals its normal damage, and you gain temporary hit points (minimum of 1) equal to your Constitution modifier, and you can’t use this trait again until you finish a short or long rest."

Now if I Dive Attack I can use my action to bite and receive the Dive Attack bonus damage.

My question is if I also use my bonus action Hungry Jaws to bite does it also benefit from the Dive Attack bonus damage?

Does fire shield damage trigger if cloud rune is used

If a wizard cast fire shield and is later hit by a melee attack, then a fighter uses cloud rune to switch targets. Would the fire shield still do damage?

Fire Shield Whenever a creature within 5 feet of you hits you with a melee attack, the shield erupts with flame. The attacker takes 2d8 fire damage from a warm shield, or 2d8 cold damage from a cold shield.

Cloud Rune When you or a creature you can see within 30 feet of you is hit by an attack roll, you can use your reaction to invoke the rune and choose a different creature within 30 feet of you, other than the attacker. The chosen creature becomes the target of the attack, using the same roll. This magic can transfer the attack’s effects regardless of the attack’s range.

Does Brace trigger when an enemy enters my echo’s reach?

The subclass feature Manifest Echo explicitly covers attacking from the Echo’s location when taking the Attack action or when taking a specific reaction:

  • When you take the Attack action on your turn, any attack you make with that action can originate from your space or the echo’s space. You make this choice for each attack.

  • When a creature that you can see within 5 feet of your echo moves at least 5 feet away from it, you can use your reaction to make an opportunity attack against that creature as if you were in the echo’s space.

My Echo Knight picked the fighting style Superior Technique with the Combat Maneuver Brace. This gives my fighter a new trigger for using a reaction:

When a creature you can see moves into the reach you have with the melee weapon you’re wielding, you can use your reaction to expend one superiority die and make one attack against the creature, using that weapon. […]

If I understand correctly, this would mean when an enemy enters my Echo’s reach, it does not trigger Brace, because it isn’t mentioned as possible scenario’s for attack from the Echo’s location. Is this interpretation correct?


  • Does an Echo Knight fighter's echo provoke an opportunity attack when it moves?
  • Does turning around count as moving for triggering Brace?

I want the game over screen on this super mario bros C++ remake to trigger arduino/batch file

I found a someone who has listed the source code in C++ for their remake of Super Mario and I would like to know how I could edit the code for the "Game over screen" to trigger my Arduino or batch file (which ever is easier). The link to this source code is below. I’m pretty new but am every interested in getting this done. Any information would help. Thank you so much!

Github project link