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

mysql中DEFAULT的用法
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'这样的字符串么?

------解决方案--------------------
CREATE TABLE `max`(
friend_max int NOT NULL DEFAULT 0,
user_max int NOT NULL DEFAULT 0
);
------解决方案--------------------
保留字加``
`max`
------解决方案--------------------
是1左边的那个符号 不是单引号