Please find the error

Source: Internet
Author: User
{Code...} encountered an error after running {code ...}.
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);

An error occurs after running.

[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--------------------------------------------------

I haven't found any mistakes for most of the day. Please give me some advice.

Reply content:
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);

An error occurs after running.

[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--------------------------------------------------

I haven't found any mistakes for most of the day. Please give me some advice.

The statement for creating the last table has the following problems:

CREATE TABLE `imooc_album` (    `id` int(10) auto_increment key,    `pId` not null);

The problem is that nopIdTo change the data type to the following:

DROP TABLE IF EXISTS `imooc_album`;CREATE TABLE `imooc_album` (    `id` int(10) auto_increment key,    `pId` int(10) not null);

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.