分类: Mysql/postgreSQL
2008-12-31 15:21:37
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