日期:2014-05-16  浏览次数:20923 次

初学mysql, ERROR 1064 (42000)
我初学MYSQL, 在华军软件下的5.0.51a版本。装上后只有第一次成功创建一个tabel,之后的每一次都提示ERROR 1064 (42000)。重装后也从没创建成功。到底ERROR 1064 (42000)是什么?我哪里打错了?
 
mysql> create table dept
  -> (
  -> deptno int primary key,
  -> dname varchar(14),
  -> loc varchar(13),
  -> );
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 ')' at
 line 6

mysql> create table dept
  -> BEGIN
  -> 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 'BEGIN

END' at line 2

------解决方案--------------------
最后一列结束不再需要"," 

[code={0}]
mysql> create table dept
  -> (
  -> deptno int primary key,
  -> dname varchar(14),
  -> loc varchar(13),
  -> );
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 ')' a
line 6
mysql> create table dept
  -> (
  -> deptno int primary key,
  -> dname varchar(14),
  -> loc varchar(13)
  -> );
Query OK, 0 rows affected (0.53 sec)
[/code]