mysql Navicat Lite触发器 有两个表 一个为temp 一个为 date 我想要在temp中按id删除一条记录时把 这条记录插入到date表中 在Navicat Lite中定义触发器 希望大虾指教一下不胜感激 在线等 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 mysql> create table `temp` ( -> id int primary key, -> col int -> );Query OK, 0 rows affected (0.27 sec)mysql> create table `date` -> ( -> id int, -> col int -> );Query OK, 0 rows affected (0.13 sec)mysql> delimiter //mysql>mysql> create trigger trg_temp_bd before delete ON `temp` -> FOR EACH ROW BEGIN -> INSERT INTO `date` values(old.id,old.col); -> END; -> -> //Query OK, 0 rows affected (0.11 sec)mysql> delimiter ;mysql> insert into `temp` values -> (1,100), -> (2,200), -> (3,300), -> (4,400);Query OK, 4 rows affected (0.16 sec)Records: 4 Duplicates: 0 Warnings: 0mysql> select * from `temp` ;+----+------+| id | col |+----+------+| 1 | 100 || 2 | 200 || 3 | 300 || 4 | 400 |+----+------+4 rows in set (0.00 sec)mysql> select * from `date`;Empty set (0.03 sec)mysql>mysql> delete from `temp` where id=2 or id=3;Query OK, 2 rows affected (0.11 sec)mysql> select * from `temp` ;+----+------+| id | col |+----+------+| 1 | 100 || 4 | 400 |+----+------+2 rows in set (0.00 sec)mysql> select * from `date`;+------+------+| id | col |+------+------+| 2 | 200 || 3 | 300 |+------+------+2 rows in set (0.00 sec)mysql> 断网的情况下怎么访问本机的mysql 谁帮我写个查询语句,有一点点难度,急急急 个位高手 请教一个ADO调用mySQL存储过程的问题 关于mysql的last_insert_id()并发问题,可以放心使用。 mysql中用什么分隔多个批呢?mssql中是用 go 命令,但是发现在mysql中不认呀? 急!就一个修改语句 mysql清空日志文件 mysql命令行下怎样实现数据的回滚操作? 如何将mysql数据库导为sqlserver2000数据库!! 崩溃啦!mysql字符集问题,疯了!求帮助 mysql Navicat Lite触发器 mysql Navicat Lite触发器
-> id int primary key,
-> col int
-> );
Query OK, 0 rows affected (0.27 sec)mysql> create table `date`
-> (
-> id int,
-> col int
-> );
Query OK, 0 rows affected (0.13 sec)mysql> delimiter //
mysql>
mysql> create trigger trg_temp_bd before delete ON `temp`
-> FOR EACH ROW BEGIN
-> INSERT INTO `date` values(old.id,old.col);
-> END;
->
-> //
Query OK, 0 rows affected (0.11 sec)mysql> delimiter ;
mysql> insert into `temp` values
-> (1,100),
-> (2,200),
-> (3,300),
-> (4,400);
Query OK, 4 rows affected (0.16 sec)
Records: 4 Duplicates: 0 Warnings: 0mysql> select * from `temp` ;
+----+------+
| id | col |
+----+------+
| 1 | 100 |
| 2 | 200 |
| 3 | 300 |
| 4 | 400 |
+----+------+
4 rows in set (0.00 sec)mysql> select * from `date`;
Empty set (0.03 sec)mysql>
mysql> delete from `temp` where id=2 or id=3;
Query OK, 2 rows affected (0.11 sec)mysql> select * from `temp` ;
+----+------+
| id | col |
+----+------+
| 1 | 100 |
| 4 | 400 |
+----+------+
2 rows in set (0.00 sec)mysql> select * from `date`;
+------+------+
| id | col |
+------+------+
| 2 | 200 |
| 3 | 300 |
+------+------+
2 rows in set (0.00 sec)mysql>