写给zty的傻瓜式教程

首先打开介个软件

jadf
找到别人连接好的数据库 (没连接就自己连不会就退学把),右击找到命令行界面点他点他
然后把下面这些代码复制进去按回车就行了,再问头给你剁下来。

1
2
3
4
5
6
7
8
9
10
11
CREATE DATABASE 网上书店;
use 网上书店;
-- 会员表
create table user
(
uid char(4) primary key not null,
uname varchar(20),
email varchar(20),
tnum varchar(15),
score int
)ENGINE=MyISAM DEFAULT CHARSET=gb2312;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
-- 类别表
create table category
(
cid int primary key not null,
cname varchar(16)
)ENGINE=MyISAM DEFAULT CHARSET=gb2312;
-- 图书表
create table book
(
bid int not null primary key,
bname varchar(50) not null,
author char(8),
price float,
publisher varchar(50),
discount float,
cid int,
constraint fk_book_category foreign key (cid) references category(cid)
)ENGINE=MyISAM DEFAULT CHARSET=gb2312;

-- 订购表
create table b_order
(
uid int not null,
bid char(4) not null,
ordernum int default '1',
orderdate datetime,
deliverydate datetime
)ENGINE=MyISAM DEFAULT CHARSET=gb2312;
-- 录入数据
insert into user
values
('1001','何仙姑','Hxg18@163.com','13320101991','20'),
('1002','平平人生','Lp011@126.com','13545158219','300'),
('1003','四十不惑','12345@qq.com','18688268828','1000'),
('1004','桃花岛主','810124@qq.com','1306811234','600'),
('1005','水灵','Hxg18@371.cn','15838182503','150'),
('1006','感动心灵','gandong@tom.com','13641161234','500');

insert into book (bid,bname,author,price,publisher,discount,cid)
values
('1','中国时代','师永刚','39.0','作家出版社','27.8','1'),
('2','中国历史的屈辱','王重旭','26.0','华夏出版社','18.2','2'),
('3','就业要乘早','海文','28.0','海天出版社','19.3','3'),
('4','房间','艾玛','37.6','人民文学出版社','26.3','4'),
('5','平凡的世界','路遥','37.6','北京出版社','63.3','4'),
('6','心灵鸡汤','管然','27.0','大与出版社','20.0','3'),
('7','蜕','赵婷','32.0','上海出版社','28.5','3');

insert into category(cid,cname)
values
('1','历史'),
('2','家教'),
('3','文化'),
('4','小说');


insert into b_order(uid,bid,ordernum, orderdate)
values
('1001','1','2','2016-03-12'),
('1001','3','1','2016-04-15'),
('1001','1','1','2016-09-15'),
('1003','7','1','2016-12-14'),
('1003','3','1','2016-10-10'),
('1005','5','1','2016-08-17'),
('1005','7','3','2016-11-12'),
('1006','5','1','2016-09-18'),
('1006','1','2','2016-10-21'),
('1006','7','2','2016-11-21');