create or alter trigger CAD_TERCEIROS_BI0_CPF_CNPJ for CAD_TERCEIROS -- cria a Trigger
active before insert position 0 -- Posição que a trigger vai ser executada
as
begin
if (exists(select -- faz a verificação se já existe
1...
Function in the controller for voting projects has two foreign keys, user_id and projeto_idProjeto , follows function:
public function votar($id){
$usuario = Auth::user()->id;
$votoss = Votos::where('projeto...
I'm using a command that runs every second on node.js. It has the function of excluding any duplicate records for a given item, which is specified as in the example by AND t1.auction_id = 1335 .
DELETE FROM bid_account t1
WHERE t1.id <...
I have to query more than 400 thousand records in the IN clause. It turns out that I can not do everything at once because I can crash the system of my company. So I have to run at a specific time and every 5,000 at a time. But I do n...
I have a users table and a friends table, every friend is also a user,
I would like to know how to insert items (add a friend) and how to check (list friends)?
CREATE TABLE IF NOT EXISTS usuarios(
id INT NOT NULL AUTO_INCR...
I need to make a trigger in mysql, but I need it to run only when there is an update in the auctions that change the status to 3 or 4.
It is of type AFTER UPDATE
BEGIN
IF (NEW.status IN ('3','4')) THEN
QUERY_AQUI
END IF;
END
Personal the question is this:
Develop 4 screens of cadastros , Usuários , Cidades , UF and Produtos . For each screen you should have the procedures of insert , updade and delete . You shoul...
I need to create a code where I do the UPDATE of a field always adding a value to what already exists.
Example table assuming it is already population
CAMPOS: ID | EMAIL | QUEMCURTIU
1 |[email protected]| 3, 46, 81,
// below the user ID...
Where is the Error?
DELETE FROM postagens WHERE id='$p_id' AND u_id='$u_id' SET FOREIGN_KEY_CHECKS = 0;
Clarifications:
p_id = post id (primary key)
u_id = user id (foreign key)