mysql> CREATE TABLE max(
    ->  friend_max int NOT NULL DEFAULT 0,
    ->  user_max   int NOT NULL DEFAULT 0
    -> );
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 'max(
        friend_max int NOT NULL DEFAULT 0,
        user_max   int NOT NULL DEFAULT 0
)' at line 1原因为何,DEFAULT后必须跟'0'这样的字符串么?

解决方案 »

  1.   

    max是关键字、请换个table  name
      

  2.   

    CREATE TABLE `max`(
      friend_max int NOT NULL DEFAULT 0,
      user_max int NOT NULL DEFAULT 0
      );
      

  3.   

    好像加‘’也不对啊mysql> CREATE TABLE 'max'(
        ->  friend_max INT NOT NULL DEFAULT 0,
        ->  user_max INT NOT NULL DEFAULT 0
        -> );
    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 ''max'
    (
            friend_max INT NOT NULL DEFAULT 0,
            a' at line 1
      

  4.   

    mysql> CREATE TABLE `max`(
        ->    friend_max int NOT NULL DEFAULT 0,
        ->    user_max int NOT NULL DEFAULT 0
        ->   );
    Query OK, 0 rows affected (0.00 sec)