mysql 查看删除触发器等操作 平时很少操作触发器,源于昨晚的一次故障,使用pt-online-change-schema修改大表过程中出现异常,再次执行时,提示已经存在触发器,导致失败. 这里推荐第三种方式: 1..查看所有触发器 select * from information_schema.triggers\G; 2.根据触发器名称看下相关触发器信息 mysql> select * from information_schema.triggers where trigger_name=
CREATE TABLE STUDENT( --创建学生表 ID NUMBER(10) PRIMARY KEY, --主键ID SNAME VARCHAR2(20), CLASSNAME VARCHAR2(20) --班级ID ); INSERT INTO STUDENT VALUES(1,'Tom',1);INSERT INTO STUDENT VALUES(2,'Jack',1);INSERT INTO STUDENT VALUES(3,'Bay',2);INSERT INTO S
1.新建主键table create table demo1_zhujian ( id int primary key auto_increment, name )); 2.新建外键table create table demo2_waijian ( id int primary key auto_increment, _id , name ), index (_id), FOREIGN KEY (_id) REFERENCES demo1_zhujian(id) ON DELETE CASCA
Messages表: mysql>create table Messages( ->message_id int auto_increment primary key, ->user_name varchar(50) not null, ->author_id int not null, ->body text, ->forum_id int not null); Forums表: mysql>create table Forums( ->forum_id
create trigger t_table_a on table_a for update,dalete begin if exists(select 1 from inserted) update table_b set 字段 =(select 字段 from innserted) where 字段=(select 字段 from delated) else delete table_b where 字段=(select 字段 from delated) go 级联删除还可以通过,可视化界面