-
Notifications
You must be signed in to change notification settings - Fork 5
/
triggers.sql
executable file
·37 lines (34 loc) · 1.04 KB
/
triggers.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
-- Usuarios
-- begin
CREATE TRIGGER agregar_usuario_docente
AFTER INSERT ON docente
FOR EACH ROW
INSERT INTO users(email,password,tipoUsuario,nroId,estado,created_at)
values (NEW.email,NEW.password,'Docente',NEW.id,NEW.estado,NOW());
CREATE TRIGGER agregar_usuario_personal
AFTER INSERT ON personal
FOR EACH ROW
INSERT INTO users(email,password,tipoUsuario,nroId,estado,created_at)
values (NEW.email,NEW.password,'Personal',NEW.id,NEW.estado,NOW());
CREATE TRIGGER agregar_usuario_alumno
AFTER INSERT ON alumno
FOR EACH ROW
INSERT INTO users(email,password,tipoUsuario,nroId,estado,created_at)
values (NEW.email,NEW.password,'Alumno',NEW.id,NEW.estado,NOW());
-- end
-- Nota Matricula Curso de Carrera tecnica
-- begin
CREATE TRIGGER agregar_notas_ct
AFTER INSERT ON matricula_ct
FOR EACH ROW
INSERT INTO nota_ct(codMatricula_ct,notaa,notab,notac)
values (NEW.id,0,0,0);
-- end
-- Nota Matricula Curso Libre
-- begin
CREATE TRIGGER agregar_notas_cl
AFTER INSERT ON matricula_cl
FOR EACH ROW
INSERT INTO nota_cl(codMatricula_cl,nota)
values (NEW.id,0);
-- end