Questions tagged as 'trigger'

2
answers

Trigger that accumulates the MySQL result

Given the following tables: Player ( id; name number; ) j team_ficticia ( id; userId; name; puntuacao_ficticia; ) ef team_fiction_player ( id; teamFicticiaId; pilotId; ) efj step ( id; local; year; state; ) and puntuacao_ficticia_...
asked by 31.07.2016 / 16:13
1
answer

Delete record when the date of a column is reached

I have the tables: In%with%Ihavecolumnanunciosthatreceivesthenumberofdaysthatthatadisvalid,Iwanteverydaythatpassesthedatabasetoautomaticallydecreaseexpiracaointhatcolumn,inacountdowntodeactivatetheannouncement.Andwhenitreaches0,itcreatesarec...
asked by 12.05.2016 / 19:06
1
answer

Trigger prevents table change

I need to make a trigger that will prevent the same employee from joining more than one crew on the same day. The crew table is as follows: Tripulação = {id_Voo, data, id_Funcionário } The 3 attributes are together the primary key. Wh...
asked by 21.01.2016 / 13:07
1
answer

Choose second lowest occurrence in a trigger

Trigger that prevents a candidate who has stayed in the penultimate place during the last two months you can apply for a new job So what I need to do is to insert the data into the table ficha_inscricao check if this candidate was not...
asked by 27.11.2015 / 16:40
1
answer

Create trigger MySql increment / decrement attribute

I have the following tables -> app(id_app, nome_app) -> category(id_category, nome_category, total_apps) -> app_category(id_app_fk, id_category_fk) What I want to do is that whenever I add data to the table "app_category" it checks...
asked by 05.08.2015 / 02:49
1
answer

Error Running a Firebird Trigger

I have the following Trigger generated in my database: SET TERM ^ ; CREATE OR ALTER TRIGGER ATUALIZA_CODNCM FOR EST_ADICIONAIS ACTIVE BEFORE INSERT OR UPDATE POSITION 0 AS begin UPDATE est_adicionais set id_ncm = (select ncm.id from est_ad...
asked by 04.11.2014 / 17:04
1
answer

Update on another line on the same table by Trigger

Is there any way to do an update in the same table, in another line, by after insert or before insert ?     
asked by 10.10.2014 / 15:06
1
answer

Creating Trigger to change status as soon as deleting employee

I'm creating a trigger that when I delete an employee, it changes the status from 1 (active) to 0 (inactive), then save this change to a table (public employees) to access if need be, however, I'm having problems. As soon as I try to create the...
asked by 25.05.2014 / 20:00
2
answers

How do I create a function that returns the lowest expiration date between batches of a given product?

How do I create a function that returns the lowest expiration date between batches of a given product? Dry my SQL code: create database Exemplo; use Exemplo; create table produto (codProduto integer not null, nomeProduto varchar(50) not n...
asked by 26.11.2014 / 18:21
0
answers

Refresh field after insert

I'm trying to create a trigger to update a value after insertion, or before it works. I have the following table: test Remembering that the date field type is timestamp and the default value is CURRENT_TIMESTAMP id | da...
asked by 22.10.2018 / 20:57