drop trigger if exists back_usertbl_update_trg;
delimiter //
create trigger back_usertbl_update_trg
after update on usertbl for each row
begin
insert into backup_userTBL values(old.userid,old.username,
old.birthyear,old.addr,old.mobile,old.height,old.joindate,
'수정',curdate(),current_user());
end //
drop trigger if exists back_usertbl_delete_trg;
delimiter //
create trigger back_usertbl_delete_trg
after delete on usertbl for each row
begin
insert into backup_userTBL values(old.userid,old.username,
old.birthyear,old.addr,old.mobile,old.height,old.joindate,
'삭제',curdate(),current_user());
end //
update usertbl set addr='제주' where userid='kjd';
delete from usertbl where height>=180;
update usertbl set addr='제주' where userid='kjd';
delete from usertbl where height>=180;
drop trigger if exists usertbl_insert_trg;
delimiter //
create trigger usertbl_insert_trg
before insert on usertbl for each row
begin
signal sqlstate '45000'
set message_text='입력을 시도했습니다. 입력 불가 테이블입니다.';
end //
insert into usertbl values('abc','에비씨',1977,'서울',
'01011111111',181,'2019-12-25');