为什么建表全部报错了!

 CREATE DATABASE IF NOT EXISIS 'shopImooc';

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 'EXISIS 'shopImooc'' at line 1

mysql> USE 'shopImooc';

ERROR 1049 (42000): Unknown database 'shopimooc'

mysql> --管理员表

    -> DROP TABLE IF EXISTS 'imooc_admin';

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 '--管 理员表

DROP TABLE IF EXISTS 'imooc_admin'' at line 1

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

    -> )charset=utf8;

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 ''imooc_admin'(

'id' tinyint unsigned auto_increment key,

'username' varchar(20) ' at line 1

mysql>

mysql> --分类表

    -> DROP TABLE IF EXISTS 'imooc_cate';

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 '--分 类表

DROP TABLE IF EXISTS 'imooc_cate'' at line 1

mysql> CREATE TABLE 'imooc_cate'(

    -> 'id' smallint unsigned auto_increment key,

    -> 'cName' varchar(50) unique

    -> )charset=utf8;

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 ''imooc_cate'(

'id' smallint unsigned auto_increment key,

'cName' varchar(50) uni' at line 1

mysql>

mysql> --产品表

    -> DROP TABLE IF EXISTS 'imooc_pro';

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 '--产 品表

DROP TABLE IF EXISTS 'imooc_pro'' at line 1

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

    -> )charset=utf8;

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 ''imooc_pro'(

'id' int unsigned auto_increment key,

'pName' varchar(50) not null ' at line 1

mysql>

mysql> --用户表

    -> DROP TABLE EXISTS 'imooc_user';

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 '--用 户表

DROP TABLE EXISTS 'imooc_user'' at line 1

mysql> CREATE TABLE 'imooc_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

    -> )charset=utf8;

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 ''imooc_user'(

'id' int unsigned auto_increment key,

'username' varchar(20) not n' at line 1

mysql>

mysql> --相册表

    -> DROP TABLE IF EXISTS 'imooc_album';

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 '--相 册表

DROP TABLE IF EXISTS 'imooc_album'' at line 1

mysql> CREATE TABLE 'imooc_album'(

    -> 'id' int unsigned auto_increment key,

    -> 'pid' int unsigned not null,

    -> 'albumPass' varchar(50) not null

    -> )charset=utf8;

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 ''imooc_album'(

'id' int unsigned auto_increment key,

'pid' int unsigned not null' at line 1


FanlyBaby
浏览 5430回答 3
3回答

慕粉3612410

应该是包裹数据库名和表名的两个引号写错了,是键盘左上角的那个顿号形式的,不是双引号那个。

leon0204

''     ``
打开App,查看更多内容
随时随地看视频慕课网APP