mysql数据库建表语句错误
老是提示我第二行有错误我总觉得好像错在第一行不知道哪错了mysql5.5.36CREATETABLEIFNOTEXISTSgoods('goods_id'int(10)u...
老是提示我第二行有错误 我总觉得好像错在第一行 不知道哪错了 mysql 5.5.36
CREATE TABLE IF NOT EXISTS goods(
'goods_id' int(10) unsigned NOT NULL AUTO_INCREMENT,
'goods_sn' char(15) not null default '',
'cat_id' smallint(6) not null default '0',
'brand_id' smallint(6) not nul default '0',
'goods_name' varchar(30) not null default '',
'shop_price' decimal(9,2) not null default '0.00',
'market_price' decimal(9,2) not null default '0.00',
'goods_number' smallint(6) not null default '1',
'click_count' mediumint(9) not null default '0',
'goods_weight' decimal(6,3) not null default '0.000',
'goods_brief' varchar(100) not null default '',
'goods_desc' text not null,
'thumb_img' varchar(30) not null default '',
'goods_img' varchar(30) not null default '',
'ori_img' varchar(30) not null default '',
'is_on_sale' tinyint(4) not null default '1',
'is_delete' tinyint(4) not null default '0',
'is_best' tinyint(4) not null default '0',
'is_new' tinyint(4) not null default '0',
'is_hot' tinyint(4) not null default '0',
'add_time' int(10) unsigned not null default '0',
'last_updata' int(10) unsigned not null default '0',
parimary key ('goods_id'),
unique key 'goods_sn' ('goods_sn')
) engine=mysiam default charset=utf8; 展开
CREATE TABLE IF NOT EXISTS goods(
'goods_id' int(10) unsigned NOT NULL AUTO_INCREMENT,
'goods_sn' char(15) not null default '',
'cat_id' smallint(6) not null default '0',
'brand_id' smallint(6) not nul default '0',
'goods_name' varchar(30) not null default '',
'shop_price' decimal(9,2) not null default '0.00',
'market_price' decimal(9,2) not null default '0.00',
'goods_number' smallint(6) not null default '1',
'click_count' mediumint(9) not null default '0',
'goods_weight' decimal(6,3) not null default '0.000',
'goods_brief' varchar(100) not null default '',
'goods_desc' text not null,
'thumb_img' varchar(30) not null default '',
'goods_img' varchar(30) not null default '',
'ori_img' varchar(30) not null default '',
'is_on_sale' tinyint(4) not null default '1',
'is_delete' tinyint(4) not null default '0',
'is_best' tinyint(4) not null default '0',
'is_new' tinyint(4) not null default '0',
'is_hot' tinyint(4) not null default '0',
'add_time' int(10) unsigned not null default '0',
'last_updata' int(10) unsigned not null default '0',
parimary key ('goods_id'),
unique key 'goods_sn' ('goods_sn')
) engine=mysiam default charset=utf8; 展开
展开全部
--已自测成功
-- 修改处:SQL第二行 将倒数第二行提到正数第二行
-- 字段 加不是单引号,是MySQL的特殊字符
-- SQL第五行 null 缺少一个字母l
CREATE TABLE IF NOT EXISTS goods(
`goods_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`goods_sn` CHAR(15) NOT NULL DEFAULT '',
`cat_id` SMALLINT(6) NOT NULL DEFAULT '0',
`brand_id` SMALLINT(6) NOT NULL DEFAULT '0',
`goods_name` VARCHAR(30) NOT NULL DEFAULT '',
`shop_price` DECIMAL(9,2) NOT NULL DEFAULT '0.00',
`market_price` DECIMAL(9,2) NOT NULL DEFAULT '0.00',
`goods_number` SMALLINT(6) NOT NULL DEFAULT '1',
`click_count` MEDIUMINT(9) NOT NULL DEFAULT '0',
`goods_weight` DECIMAL(6,3) NOT NULL DEFAULT '0.000',
`goods_brief` VARCHAR(100) NOT NULL DEFAULT '',
`goods_desc` TEXT NOT NULL,
`thumb_img` VARCHAR(30) NOT NULL DEFAULT '',
`goods_img` VARCHAR(30) NOT NULL DEFAULT '',
`ori_img` VARCHAR(30) NOT NULL DEFAULT '',
`is_on_sale` TINYINT(4) NOT NULL DEFAULT '1',
`is_delete` TINYINT(4) NOT NULL DEFAULT '0',
`is_best` TINYINT(4) NOT NULL DEFAULT '0',
`is_new` TINYINT(4) NOT NULL DEFAULT '0',
`is_hot` TINYINT(4) NOT NULL DEFAULT '0',
`add_time` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`last_updata` INT(10) UNSIGNED NOT NULL DEFAULT '0',
UNIQUE KEY `goods_sn` (`goods_sn`)
) ENGINE=INNODB DEFAULT CHARSET=utf8;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |