0% found this document useful (0 votes)
22 views

SQL Trigger

The document contains SQL statements to insert data into tables in a database. It inserts new programs of study into the 'prodi' table, assigns students to programs in the 'mahasiswa' table, alters the 'log_mhs' table, and creates a trigger to log inserts into the 'mahasiswa' table.

Uploaded by

sastra dipura
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

SQL Trigger

The document contains SQL statements to insert data into tables in a database. It inserts new programs of study into the 'prodi' table, assigns students to programs in the 'mahasiswa' table, alters the 'log_mhs' table, and creates a trigger to log inserts into the 'mahasiswa' table.

Uploaded by

sastra dipura
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

INSERT INTO `kg_akademik`.

`prodi` (`kode_prodi`, `nama_prodi`, `jurusan`) VALUES ('P03', 'D3


Komsi', 'Matematika');# 1 baris
terpengaruh. INSERT INTO `kg_akademik`.`prodi`(`kode_prodi`, `nama_prodi`, `jurusan`) VALUES ('P0
4', 'D3 Rekmed', 'Matematika');# 1 baris
terpengaruh. INSERT INTO `kg_akademik`.`prodi` (`kode_prodi`, `nama_prodi`, `jurusan`)VALUES ('P0
5', 'D3 Ellins', 'Fisika');# 1 baris terpengaruh.

INSERT INTO `kg_akademik`.`mahasiswa` (`nim`, `nama`, `alamat`, `kode_prodi`) VALUES ('10045', 'S
ugiharti', 'Karang Anyar A-25', 'P02');# 1 baris
terpengaruh. INSERT INTO`kg_akademik`.`mahasiswa` (`nim`, `nama`, `alamat`, `kode_prodi`) VALUES
('02045', 'Cinta', 'Cigasong B-50', 'P03');# 1 baris terpengaruh.

ALTER TABLE `log_mhs` CHANGE `tanggal` `tanggal` DATETIME NULL DEFAULT NULL;

DROP TRIGGER IF EXISTS `in_mhs`;CREATE DEFINER=`erik`@`localhost` TRIGGER `in_mhs` AFTER INSERT


ON `mahasiswa` FOR EACH ROW insert into log_in_mhs values('Tambah Data',now())

You might also like