I have these tables and I want to write a trigger that, when I carry out an insert statement in "tache", given that datedif(datestart,dateend) > 30, I want to update table "employe" and set salaire = salaire*0.5 Table 1: employe (mle, ...
databaseanswers.net Latest Questions
I have a scenario, where a trigger function is activated before an update of some sort. And in order for the condition to be met one of the columns must be excluded from the "OLD" and "NEW" objects. CREATE FUNCTION example_function() ...
I do like to confirm if the below code is safe (correct). It’s a Trigger that logs into a log_table for a specific underlying table whatever crud it is (del, upd, ins). Or is there a better way to write it? CREATE ...
i can’t get this trigger to work only for newly added rows. Also if there are multiple rows in wp_wpforms_entries the query (not the trigger) will return ‘more than one row error’. What I want to do is use the ...
I am trying to automate continuous data copying from my data base to an s3 bucket following the tutorial "How to Automate Continuous Data Copying from MongoDB to S3". I created a federated data base called "FederatedAnalyticsInstance" using "analytics" data base ...
I have created two tables "post" and "node" and I want to assign the sum of the entities of the "node" table in the attribute "nb_noeud" of the "post" table by trigger. But, the code below does not work and ...
I’m working on a system for payments for a school and I need to automatically add a new monthly debt for students, related to the month price. I was thinking about using scheduled events but it hasn’t worked when I’m ...
I am trying to set age = 0 if the age is inserted as negative. I don’t know what is wrong with the code: CREATE TRIGGER verify_age BEFORE INSERT ON customers FOR EACH ROW WHEN (NEW.age < 0) BEGIN UPDATE customers SET age = 0 END;
I’m using Mysql 5.7 and I want to use triggers to set up some simple audit trail logging. The table name the entry comes from is relevant so we’d like to capture it. I know I can hard ...
I’d like to update a table and trigger the update of the another table and this execute one trigger to update another table more, but the update with trigger not trigger my trigger. Any suggestions?