实训建表插入数据

数据库productorder。

1、数据添加

1)为顾客表:customer添加以下数据:

2)为产品表:product添加以下数据:

3)订单表:order添加以下数据:

 

4)供应商表:vendor添加以下数据:

 

5)库存表:recruit添加以下数据:

 

 

建表

CREATE TABLE customer
(
cid int  auto_increment PRIMARY key,
cname  VARCHAR(10) not null,
caddress VARCHAR(10) not null,
ccity VARCHAR(10) not null,
cstate VARCHAR(10) not null,
czip VARCHAR(10) not null,
ccounty VARCHAR(10) not null,
ccontact VARCHAR(10) not null,
cemail VARCHAR(100) not null
);
CREATE TABLE product
(
pid int  auto_increment PRIMARY key,
pcname  VARCHAR(10) not null,
pprice int,
pdesc VARCHAR(100) not null,
pcount int
);
CREATE TABLE ordera
(
oid int  auto_increment PRIMARY key,
pid int ,
cid int ,
ocount int,
oprice int,
odate date
);
CREATE TABLE vendor
(
vid int  auto_increment PRIMARY key,
vname  VARCHAR(10) not null,
vcity VARCHAR(10) not null,
vstate VARCHAR(10) not null,
vzip VARCHAR(10) not null,
vcounty VARCHAR(10) not null,
vaddress VARCHAR(10) not null
);
CREATE TABLE recruit
(
rid int  auto_increment PRIMARY key,
pid int ,
vid int ,
rprice int not null,
rcount int not null,
returncount int not null,
rdecp VARCHAR(100) not null,
rdate date
);

插数据

insert customer(cname,caddress,ccity,cstate,czip,ccounty,ccontact,cemail)
VALUES('马云','大马路一号','杭州','浙江','100000','中国','马云','[email protected]'),
('刘强东','中关村上地一街2号','北京','北京','100000','中国','奶茶妹妹','[email protected]'),
('马化腾','你懂得','东湾','广东','300000','中国','马化腾','[email protected]');


insert  ordera(oid,pid,cid,ocount,oprice,odate)
       VALUES ('1', '1', '1', '1', '2999.00', '2016-12-02 15:41:39'),
							('2', '3', '2', '2', '5888.00', '2016-12-01 15:42:42'),
							('3', '4', '3', '100', '4888.00', '2016-12-06 15:43:26'),
							('4', '1', '1', '2', '2999.00', '2016-12-31 15:43:26'),
							('11', '1', '1', '2', '2999.00', '2017-01-01 01:59:59')


insert  product(pcname,pprice,pdesc,pcount) 
       VALUES ('小米Note2', '2799.00', '小米Note 2 双曲面商务旗舰', '100'),
							('小米Mix', '3499.00', '4GB+128GB', '100'),
							('iPhone 7', '5388.00', '4.7屏+玫瑰金色', '100'),
							('iPhone 6s', '4588.00', '分期每月最低约 RMB 382', '100')


insert  vendor(vid,vname,vcity,vstate,vzip,vcounty,vaddress)
       VALUES ('1', '雷军', '仙桃', '湖北', '4000000', '中国', '蟠桃园'),
              ('2', '库克', '库比蒂诺', '加利福尼亚州', '8000000', '美国', 'Apple 1 Infinite Loop Cupertino')



insert  recruit(rid,pid,vid,rprice,rcount,returncount,rdecp,rdate) 
       VALUES ('1', '4', '2', '4588', '50', '0', '来50个iPhone6s', '2016-12-01 16:07:57'),
						('2', '4', '2', '4388', '200', '0', '200个iPhone 6s', '2016-12-04 16:08:41'),
						('3', '3', '2', '5388', '100', '0', '100台iPhone 7', '2016-12-06 16:09:40'),
						('4', '3', '1', '5288', '50', '0', '从雷军手里弄来50台iPhone 7', '2016-11-15 16:10:20'),
						('5', '2', '1', '3000', '50', '1', '小米MIX来50个', '2016-11-16 16:10:45'),
						('6', '2', '1', '2800', '150', '2', '小米MIX再来150个', '2016-11-30 16:11:01'),
						('7', '1', '1', '2500', '10', '5', '小米Note2来10个', '2016-11-21 16:11:17'),
						('8', '1', '1', '2399', '20', '15', '小米Note2再来20个', '2016-12-13 16:11:35')


猜你喜欢

转载自blog.csdn.net/aoutlaw/article/details/81213307