不知道哪里错,我照着老师的代码打的,然后在Navicat for MySQL这里面敲上,运行出错
错误:
DROP TABLE IF EXISTS imooc_admin;
[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 '--管理员表
DROP TABLE IF EXISTS imooc_admin' at line 1
—————————————————————————————————————————————————————
CREATE DATABASE IF NOT EXISTS shopImooc;
USE shopImooc;
--管理员表
DROP TABLE IF EXISTS imooc_admin;
CREATE TABLE imooc_admin(
id tinyint unsigned auto_increment key,
username varchar(20) NOT NULL UNIQUE,
password CHAR(32) NOT NULL,
email varchar(50) NOT NULL
);
--分类表
DROP TABLE IF EXISTS imooc_cate;
CREATE TABLE imooc_cate(
id smallint unsigned auto_increment key,
cName varchar(50) UNIQUE
);
--商品表
DROP TABLE IF EXISTS imooc_pro;
CREATE TABLE imooc_pro(
id int unsigned auto_increment key,
pName varchar(50) NOT NULL UNIQUE,
pSn varchar(50) NOT NULL,
pNum int unsigned DEFAULT 1,
mPrice DECIMAL(10,2) NOT NULL,
iPrice DECIMAL(10,2) NOT NULL,
pDesc text,
pImg varchar(50) NOT NULL,
pubTime int unsigned NOT NULL,
isShow TINYint(1) DEFAULT 1,
isHot TINYint(1) DEFAULT 0,
cId smallint unsigned NOT NULL
);
--用户表
DROP TABLE IF EXISTS imooc_user;
CREATE TABLE imoooc_user(
id int unsigned auto_increment key,
username varchar(20) NOT NULL UNIQUE,
password char(32) NOT NULL,
sex enum("男","女","保密") NOT NULL DEFAULT"保密",
face varchar(50) NOT NULL,
regTime int unsigned NOT NULL
);
--相册表
DROP TABLE IF EXISTS imooc_album;
CREATE TABLE imooc_album(
id int unsigned auto_increment key,
pidint unsigned NOT NULL,
albumPath varchar(50) NOT NULL
);