CREATE TABLE `jwiki_subject` (
  `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
  `title` char(25) NOT NULL DEFAULT '',
  `type` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `uid` mediumint(8) unsigned NOT NULL '0',
  `lastupdate` int(10) unsigned NOT NULL DEFAULT '0',
  `posttime` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `title` (`title`),
  KEY `type` (`type`),
  KEY `uid` (`uid`)
) ENGINE=MyISAM DEFAULT CHARACTER SET gbk DEFAULT COLLATE gbk_chinese_ci;
错误提示如下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 ''0',
  `lastupdate` int(10) unsigned NOT NULL DEFAULT '0',
  `posttime` int(10' at line 5

解决方案 »

  1.   

    额。。自己发现。漏了一个 DEFAULT顺便散分
      

  2.   

    其实MYSQL会告诉你错在哪儿!mysql> CREATE TABLE `jwiki_subject` (
        ->   `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
        ->   `title` char(25) NOT NULL DEFAULT '',
        ->   `type` mediumint(8) unsigned NOT NULL DEFAULT '0',
        ->   `uid` mediumint(8) unsigned NOT NULL '0',
        ->   `lastupdate` int(10) unsigned NOT NULL DEFAULT '0',
        ->   `posttime` int(10) unsigned NOT NULL DEFAULT '0',
        ->   PRIMARY KEY (`id`),
        ->   KEY `title` (`title`),
        ->   KEY `type` (`type`),
        ->   KEY `uid` (`uid`)
        -> ) ENGINE=MyISAM DEFAULT CHARACTER SET gbk DEFAULT COLLATE gbk_chinese_ci;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 ''0',
      `lastupdate` int(10) unsigned NOT NULL DEFAULT '0',
      `posttime` int(10) ' at line 5
    mysql>