小弟今天早上心血来潮想学学数据库,然后看了看mysql。现在的问题是我想给一个数据库里边加张表咋弄都成功不了。
比如这样:首先进去数据库。   然后 show databases;   有三个  然后  use test;显示Database changed   然后再   show tables;  显示   Empty set(0.00sec)   然后我就  create table (id int not null,name varchar not null);
它就显示错误!!!!!!     Why???????

解决方案 »

  1.   

    mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | mysql              |
    | test               |
    +--------------------+
    3 rows in set (0.02 sec)mysql> use test
    Database changed
    mysql> show tables;
    Empty set (0.00 sec)mysql> create table(id int not null, name varchar not null);
    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 '(id i
    nt not null, name varchar not null)' at line 1
    mysql>
      

  2.   

    mysql> create table use (id int not null, name varchar not null);
    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 'use (
    id int not null, name varchar not null)' at line 1
    mysql>
      

  3.   

    CREATE TABLE `use` (id INT NOT NULL, `name` VARCHAR(5) NOT NULL);
      

  4.   

    mysql> CREATE TABLE `use` (id INT NOT NULL, `name` VARCHAR(5) NOT NULL);
    Query OK, 0 rows affected (0.06 sec)但是能告诉我为什么你的就能成功吗    我这本破书上也没说有什么规则呀   
      

  5.   

    mysql> show tables;
    +----------------+
    | Tables_in_test |
    +----------------+
    | use            |
    +----------------+
    1 row in set (0.00 sec)mysql> drop table use;
    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 'use'
    at line 1
    mysql>
    又删除不成了??????