Chinaunix首页 | 论坛 | 博客
  • 博客访问: 579447
  • 博文数量: 107
  • 博客积分: 5065
  • 博客等级: 大校
  • 技术积分: 1362
  • 用 户 组: 普通用户
  • 注册时间: 2008-12-29 16:01
文章存档

2009年(84)

2008年(23)

我的朋友

分类: Mysql/postgreSQL

2008-12-31 15:21:37

不管是在mysql-front还是在phpmyadmin中执行下面的sql语句都报以下错误:
(版本说明:Apache/2.0.63 (Win32) PHP/5.2.6、MYSQL5.1)
SQL 查询:
DROP DATABASE IF EXISTS 'db_shop';


MySQL 返回:
#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 ''db_shop'' at line 1
sql语句如下:
SQL code
DROP DATABASE IF EXISTS 'db_shop'; CREATE DATABASE 'db_shop'; USE 'db_shop'; CREATE TABLE admin( ID int(4) NOT NULL AUTO_INCREMENT, AdminType int(4) DEFAULT NULL, AdminName char(12) DEFAULT null, LoginName char(12) DEFAULT NULL, LoginPwd char(12) DEFAULT NULL , PRIMARY KEY (ID) ) ENGINE =InnoDB DEFAULT CHARSET=gb2312; INSERT into admin(ID,AdminType,AdminName,LoginName,LoginPwd) VALUES (1,1,'商品管理','Admin1','Admin1'); INSERT into admin(ID,AdminType,AdminName,LoginName,LoginPwd) VALUES (2,2,'订单管理','Admin2','Admin2'); INSERT into admin(ID,AdminType,AdminName,LoginName,LoginPwd) VALUES (3,3,'会员管理','Admin3','Admin3'); INSERT into admin(ID,AdminType,AdminName,LoginName,LoginPwd) VALUES (4,4,'系统管理','Admin4','Admin4'); CREATE TABLE cart( ID int(4) NOT NULL AUTO_INCREMENT, Member int(4) NOT NULL, Money decimal(9,2) DEFAULT NULL , CartStatus int(4) DEFAULT NULL , PRIMARY KEY (ID) ) ENGINE =InnoDB DEFAULT CHARSET=gb2312; CREATE TABLE cartselectedmer( ID int(4) NOT NULL AUTO_INCREMENT, Cart int(4) NOT NULL, Merchandise int(4) NOT NULL, Number int(4) NOT NULL DEFAULT 1, Price decimal(8,2) NOT NULL DEFAULT 0.00, Money decimal(9,2) NOT NULL DEFAULT 0.00, PRIMARY KEY (ID) ) ENGINE =InnoDB DEFAULT CHARSET=gb2312; CACHE TABLE category( ID int(4) NOT NULL AUTO_INCREMENT, CateName char(40) DEFAULT NULL , CateDesc text , PRIMARY KEY (ID) ) ENGINE =InnoDB DEFAULT CHARSET=gb2312; CACHE TABLE leaveword( ID int(4) NOT NULL AUTO_INCREMENT, Menber int(4) NOT NULL , Admin int(4) DEFAULT NULL, Title char(60) DEFAULT NULL, Content text, LeaveDate datetime DEFAULT NULL , AnswerContent text, AnswerDate datetime DEFAULT NULL, PRIMARY KEY (ID) ) ENGINE =InnoDB DEFAULT CHARSET=gb2312; CACHE TABLE member( ID int(4) NOT NULL AUTO_INCREMENT, memberlevel int(4) NOT NULL , LoginName char(12) DEFAULT NULL, LoginPwd char(12) DEFAULT NULL , MemberName char(20) DEFAULT NULL, Phone char(15) DEFAULT NULL , Address char(100) DEFAULT NULL, Zip char(10) DEFAULT NULL , RegDate datetime DEFAULT NULL, LastDate datetime DEFAULT NULL, LoginTime int(4) DEFAULT NULL, Email varchar(100) DEFAULT NULL, PRIMARY KEY (ID) ) ENGINE =InnoDB DEFAULT CHARSET=gb2312; CACHE TABLE memberlevel( ID int(4) NOT NULL AUTO_INCREMENT, LevelName char(20) DEFAULT NULL , Favourable int(4) DEFAULT NULL , PRIMARY KEY (ID) ) ENGINE =InnoDB DEFAULT CHARSET=gb2312; CACHE TABLE merchandise( ID int(4) NOT NULL AUTO_INCREMENT, Category int(4) NOT NULL, MerName char(40) DEFAULT NULL , Price decimal(8,2) DEFAULT NULL , Sprice decimal(8,2) DEFAULT NULL , MerModel char(40) DEFAULT NULL , Pictrue varchar(100) DEFAULT NULL , MerDesc text , Manufacturer char(60) DEFAULT NULL , LeaveFactoryDate datetime DEFAULT NULL , Special int(4) DEFAULT NULL , PRIMARY KEY (ID) ) ENGINE =InnoDB DEFAULT CHARSET=gb2312; CACHE TABLE orders( ID int(4) NOT NULL AUTO_INCREMENT, Member int(4) NOT NULL , Cart int(4) NOT NULL, OrderNo char(20) DEFAULT NULL, OrderDate datetime DEFAULT NULL, OrderStatus int(4) DEFAULT NULL, PRIMARY KEY (ID) ) ENGINE =InnoDB DEFAULT CHARSET=gb2312; INSERT into memberlevel(ID,LevelName,Favourable) VALUES (1,'普通会员',90); INSERT into memberlevel(ID,LevelName,Favourable) VALUES (2,'黄金会员',88); INSERT into memberlevel(ID,LevelName,Favourable) VALUES (3,'白金会员',87); INSERT into memberlevel(ID,LevelName,Favourable) VALUES (4,'钻石会员',86),
 
DROP DATABASE IF EXISTS 'db_shop'; 
CREATE DATABASE 'db_shop';
USE 'db_shop';

把单引号改成1楼的,或者干脆去掉。
'db_shop'-> `db_shop` 
或者'db_shop'-> db_shop
 
阅读(2890) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~