Skip to content
Advertisement

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 Answer Change the second Select to āœ“ āœ“ id | selection1 | selection2 | results -: | :——— | :——— | :—— 1

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 this in another table. example : So, I used

How can I make my sql trigger about inappropiate words work

I have a database with different tables in order to store photos, users, reviews, ratings… I wanna validate that no one uses “bad words” (insults) in their photos’ title or description. So I decided to create a table called ‘inappropiatewords’ where all of these bad words will be stored and then I made the following trigger: But when I try

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 table. In this case,

Advertisement