Langkah buat store
procedure
1.
Masuk cmd
2.
C:>cd
C:\xampp\mysql\bin
3.
Masuq sql
C:\xampp\mysql\bin>mysql –u root
4.
Aktifkan database
:db_kampus
5.
Mysql>use db_kampus
6.
Menambahkan data
a.
Insert into mahasiswa
values (’12.5.00001’,’Kiranti’);
b.
Insert into mahasiswa values
(’12.5.00071’,’Susanto’);
c.
Insert into mahasiswa
values (’12.5.00171’,’Agatha Good);
7.
Melihat hasil
Mysql>select * from mahasiswa;
8.
Membuat store procedure
masukan data
Mysql>create procedure isi(vnim varchar(10), vnama
varchar(30));
è Begin
è Insert into mahasiswa values(vnim,vnama);
è End;
è //
mysql>delimiter;
mysql>delimiter;
9.
Cara isi
Call isi(’12.5.00007’,’butho cakil’);
Show * from mahasiswa;
10.Membuat
trigger
Mysql>delimiter //
Mysql>create trigger in_mahasiswa after insert on
mahasiswa
è For each row insert into log_mhs values(‘tambah
mahasiswa’,now())
è //
11. Pengujian trigger
Show * from log_mhs;
Call isi(’12.5.00176’,’Rizki N urrohim’);
Show * from log_mhs;
12. Di PHPMYADMIN
Create view lihat
As
Select * from mahasiswa
13. Menjalankan view
Select *
from lihat;
0 Comments