Skip to content

Tag: triggers

MySQL Trigger Nested Group_Concat Duplicates

I have a trigger to conditionally GROUP_CONCAT a few columns. I can remove duplicates from within a single column, but I’m struggling to remove duplicates between two or more columns. Current trigger (two column example): Fiddle: https://dbfiddle.uk/?rdbms=mysql_8.0&fiddle=46a6bb915fa7e2e9106b073677eee6cd…

How can I make the trigger return a value?

I have a ‘roomstate’ table that represents states that I keep updated. This is what happens when the employee assigns room 2 to customer 1 whose booking_id is 2. As the table above is continuously updated, the existing contents may become NULL again. I’d like to have a record of updating thi…

identifier ‘NEW.CITY_POPULATION’ must be declared

I am trying to declare a oracle trigger that will update the city name when the city population reaches 0 but I am getting this error. Answer If you’re going to reference the :new pseudo-record in a trigger body, it needs to be prefixed with a colon. A trigger on cities generally cannot query the cities…