Microsoft Windows XP [版本 5.1.2600] (C) 版权所有 1985-2001 Microsoft Corp.C:\Documents and Settings\acer>d:D:\>cd mysql\binD:\mysql\bin>mysql -h localhost -u root -p Enter password: *** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 to server version: 5.1.6-alpha-nt-maxType 'help;' or '\h' for help. Type '\c' to clear the buffer.mysql> create database dkqnew; -> // Query OK, 1 row affected (0.00 sec)mysql> use dkqnew// Database changed mysql> create table userinfo(userid int,username varchar(10),userbirthday date); -> // Query OK, 0 rows affected (0.09 sec)mysql> create table userinfolog(logtime datetime,loginfo varchar(100)) // Query OK, 0 rows affected (0.06 sec)mysql> describe userinfo // +--------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------+-------------+------+-----+---------+-------+ | userid | int(11) | YES | | NULL | | | username | varchar(10) | YES | | NULL | | | userbirthday | date | YES | | NULL | | +--------------+-------------+------+-----+---------+-------+ 3 rows in set (0.02 sec)mysql> create trigger beforinsertuserinfo -> befor insert on userinfo -> for each row begin -> insert into userinfolog values(now(),CONCAT(new.userid,new username)); -> end; -> // ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'befor insert on userinfo for each row begin insert into userinfolog values(now()' at line 2 mysql> 创建触发器出错,不知为什么????
(C) 版权所有 1985-2001 Microsoft Corp.C:\Documents and Settings\acer>d:D:\>cd mysql\binD:\mysql\bin>mysql -h localhost -u root -p
Enter password: ***
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 5.1.6-alpha-nt-maxType 'help;' or '\h' for help. Type '\c' to clear the buffer.mysql> create database dkqnew;
-> //
Query OK, 1 row affected (0.00 sec)mysql> use dkqnew//
Database changed
mysql> create table userinfo(userid int,username varchar(10),userbirthday date); -> //
Query OK, 0 rows affected (0.09 sec)mysql> create table userinfolog(logtime datetime,loginfo varchar(100)) //
Query OK, 0 rows affected (0.06 sec)mysql> describe userinfo //
+--------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------+-------------+------+-----+---------+-------+
| userid | int(11) | YES | | NULL | |
| username | varchar(10) | YES | | NULL | |
| userbirthday | date | YES | | NULL | |
+--------------+-------------+------+-----+---------+-------+
3 rows in set (0.02 sec)mysql> create trigger beforinsertuserinfo
-> befor insert on userinfo
-> for each row begin
-> insert into userinfolog values(now(),CONCAT(new.userid,new username));
-> end;
-> //
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'befor
insert on userinfo
for each row begin
insert into userinfolog values(now()' at line 2
mysql>
创建触发器出错,不知为什么????