您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

求大神找一下错误

2024/5/11 10:49:03发布27次查看
create database if not exists `shopimooc1`;use `shopimooc1`;drop table if exists `imooc_admin`;create table `imooc_admin` ( `id` int(10) auto_increment key, `username` varchar(20) not null unique, `password` char(32) not null, `email` varchar(50));drop table if exists `imooc_cate`;create table `imooc_cate` ( `id` smallint(10) auto_increment key, `cname` varchar(20) unique);drop table if exists `imooc_pro`;create table `imooc_pro` ( `id` int(10) unique auto_increment key, `pnmae` varchar(50) not null unique, `psn` varchar(50) not null, `cprice` decimal(10,2) not null, `iprice` decimal(10,2) not null, `pdesc` text, `pimg` varchar(50) not null, `pubimg` int not null, `isshows` tinyint(1) default 1, `ishot` tinyint(1) default 0, `cid` smallint not null);drop table if exists `imooc_user`;create table `imooc_user` ( `id` int(10) auto_increment key, `username` varchar(20) not null unique, `password` varchar(32) not null, `face` varchar(50) not null, `regtime` int not null);drop table if exists `imooc_album`;create table `imooc_album` ( `id` int(10) auto_increment key, `pid` not null);

运行之后出现错误
[err] 1064 - 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 'not null,)' at line 3[err] create database if not exists `shopimooc1`;use `shopimooc1`;drop table if exists `imooc_admin`;create table `imooc_admin` ( `id` int(10) auto_increment key, `username` varchar(20) not null unique, `password` char(32) not null, `email` varchar(50));drop table if exists `imooc_cate`;create table `imooc_cate` ( `id` smallint(10) auto_increment key, `cname` varchar(20) unique);drop table if exists `imooc_pro`;create table `imooc_pro` ( `id` int(10) unique auto_increment key, `pnmae` varchar(50) not null unique, `psn` varchar(50) not null, `cprice` decimal(10,2) not null, `iprice` decimal(10,2) not null, `pdesc` text, `pimg` varchar(50) not null, `pubimg` int not null, `isshows` tinyint(1) default 1, `ishot` tinyint(1) default 0, `cid` smallint not null);drop table if exists `imooc_user`;create table `imooc_user` ( `id` int(10) auto_increment key, `username` varchar(20) not null unique, `password` varchar(32) not null, `face` varchar(50) not null, `regtime` int not null);drop table if exists `imooc_album`;create table `imooc_album` ( `id` int(10) auto_increment key, `pid` not null,);[msg] finished - unsuccessfully--------------------------------------------------

找了大半天都没找到哪里的错误 求大神指点
回复内容: create database if not exists `shopimooc1`;use `shopimooc1`;drop table if exists `imooc_admin`;create table `imooc_admin` ( `id` int(10) auto_increment key, `username` varchar(20) not null unique, `password` char(32) not null, `email` varchar(50));drop table if exists `imooc_cate`;create table `imooc_cate` ( `id` smallint(10) auto_increment key, `cname` varchar(20) unique);drop table if exists `imooc_pro`;create table `imooc_pro` ( `id` int(10) unique auto_increment key, `pnmae` varchar(50) not null unique, `psn` varchar(50) not null, `cprice` decimal(10,2) not null, `iprice` decimal(10,2) not null, `pdesc` text, `pimg` varchar(50) not null, `pubimg` int not null, `isshows` tinyint(1) default 1, `ishot` tinyint(1) default 0, `cid` smallint not null);drop table if exists `imooc_user`;create table `imooc_user` ( `id` int(10) auto_increment key, `username` varchar(20) not null unique, `password` varchar(32) not null, `face` varchar(50) not null, `regtime` int not null);drop table if exists `imooc_album`;create table `imooc_album` ( `id` int(10) auto_increment key, `pid` not null);

运行之后出现错误
[err] 1064 - 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 'not null,)' at line 3[err] create database if not exists `shopimooc1`;use `shopimooc1`;drop table if exists `imooc_admin`;create table `imooc_admin` ( `id` int(10) auto_increment key, `username` varchar(20) not null unique, `password` char(32) not null, `email` varchar(50));drop table if exists `imooc_cate`;create table `imooc_cate` ( `id` smallint(10) auto_increment key, `cname` varchar(20) unique);drop table if exists `imooc_pro`;create table `imooc_pro` ( `id` int(10) unique auto_increment key, `pnmae` varchar(50) not null unique, `psn` varchar(50) not null, `cprice` decimal(10,2) not null, `iprice` decimal(10,2) not null, `pdesc` text, `pimg` varchar(50) not null, `pubimg` int not null, `isshows` tinyint(1) default 1, `ishot` tinyint(1) default 0, `cid` smallint not null);drop table if exists `imooc_user`;create table `imooc_user` ( `id` int(10) auto_increment key, `username` varchar(20) not null unique, `password` varchar(32) not null, `face` varchar(50) not null, `regtime` int not null);drop table if exists `imooc_album`;create table `imooc_album` ( `id` int(10) auto_increment key, `pid` not null,);[msg] finished - unsuccessfully--------------------------------------------------

找了大半天都没找到哪里的错误 求大神指点
最后一个创建表的语句有问题:
create table `imooc_album` ( `id` int(10) auto_increment key, `pid` not null);
问题在于,没有指定pid的数据类型,改成下面这样就没问题了:
drop table if exists `imooc_album`;create table `imooc_album` ( `id` int(10) auto_increment key, `pid` int(10) not null);
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product