Está en la página 1de 4

BASE DE DATOS PARA APLICACIONES DOCENTE: M.A.

CAROLINA GORDILLO
ARELLANO

T.S.U en TECNOLOGÍAS DE LA
INFORMACIÓN Y COMUNICACIÓN ÁREA
SISTEMAS INFORMÁTICOS

BASE DE DATOS PARA


APLICACIONES
ACTIVIDAD 2-2

“PRACTICA TRIGGERS”

Elaborado por:

202004035 Flores Carmona Emma

Acapulco, Guerrero 22 junio


2021

TECNOLOGÍAS DE LA INFORMACIÓN 3° “A”


Y COMUNICACIÓN

1
BASE DE DATOS PARA APLICACIONES DOCENTE: M.A. CAROLINA GORDILLO
ARELLANO

ACTIVIDAD 2-2
Instrucciones de la práctica:
De acuerdo a lo visto en clases, realiza un disparador siguiendo la estructura explicada,
puedes utilizar variables o no.

Trabajo individual - Formato PDF.

Lo que yo realice en esta práctica, fue crear una nueva tabla para mi primer trigger, a
esta tabla le llame prueba 1, consta de solo 4 campos que son, matricula, nombre,
teléfono y apellidos.

Scrip:
create table Prueba1
(Matrícula int primary key not null,
Nombre varchar (15),
Apellidos Varchar (20),
telefono int (10));
show tables;
select*from Prueba1;

De ahí comencé a formar mi trigger, para eso solo puse la sintaxis que primero era delimitar
y poner un signo, yo puse el signo de peso. Por consiguiente, puse crear y el nombre que es
Trigger1 puse el momento insertado en la tabla (que recién cree) el for each row es para
cada línea (registro), se empiece a insertar a la tabla los campos, matricula, nombre

TECNOLOGÍAS DE LA INFORMACIÓN 3° “A”


Y COMUNICACIÓN

2
BASE DE DATOS PARA APLICACIONES DOCENTE: M.A. CAROLINA GORDILLO
ARELLANO

apellidos y teléfono. En valor, le puse new punto y los campos, para finalizar puse end y los
mismos signos que puse en el delimiter que fueron el signo de peso.

Scrip:

/*triggers*/
delimiter $$
create trigger Trigger1
after insert on Prueba1
for each row
begin
insert into
Prueba1 (Matrícula, nombre, Apellidos,telefono)
values
(new.Matrícula, new.nombre, new.Apellidos,new.telefono);
end $$

Imagen

TECNOLOGÍAS DE LA INFORMACIÓN 3° “A”


Y COMUNICACIÓN

3
BASE DE DATOS PARA APLICACIONES DOCENTE: M.A. CAROLINA GORDILLO
ARELLANO

Por último, puse el scrip para que me mostrara el resultado.


Scrip:
show triggers;

imagen

TECNOLOGÍAS DE LA INFORMACIÓN 3° “A”


Y COMUNICACIÓN

También podría gustarte