我初学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 6mysql> 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 'BEGINEND' at line 2

解决方案 »

  1.   

    仔细看看手册!!!!!
    create table dept(deptno int primary key,dname varchar(14), loc varchar(13)); 
      

  2.   

    得先建数据库。
    例如:
    create database test1;
    成功后,再使用该数据库才能进以下操作
    语句为:
    use test1;
    再建表:如:
    create table (name char(10),age int);
    就可以了,
    记着每次使用前都要
    use test1; 哦!!
      

  3.   

    最后一列结束不再需要"," [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]
      

  4.   

    这UBB咋用的?[code={0}]{1}[/code]??
      

  5.   

    loc varchar(13), 去掉逗号