Repository navigation
Expand file tree
/
Copy pathexperiment_one.sql
More file actions
106 lines (93 loc) · 2 KB
/
Copy pathexperiment_one.sql
File metadata and controls
106 lines (93 loc) · 2 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
--***********************实验一***********************--
create database XSCJ
on(
name='XSCJ_Data',
filename='F:\github\DataBase\XSCJ\XSCJ.mdf',
size=5MB,
maxsize=10MB,
filegrowth=10%
)
log on(
name='XSCJ_Log',
filename='F:\github\DataBase\XSCJ\XSCJ.ldf',
size=2MB,
maxsize=5MB,
filegrowth=1MB
)
go
create table Course(
Cno char(4) primary key,
Cname char(40) not NULL,
Cpno char(4),
Ccredit smallint,
foreign key(Cpno) references course(Cno)
);
alter table Course add Cterm char(4);
create unique index Cname_idx on Course(Cname);
alter table Course drop column Cterm;
drop index Course.Cname_idx;
create table Student(
Sno char(9) primary key,
Sname char(20) unique,
Ssex char(2),
Sage smallint,
Sdep char(20)
);
drop table Student;
--drop database XSCJ;
--drop database BSXT;
create database BSXT
on(
name='BSXT_Data',
filename='F:\github\DataBase\BSXT\BSXT.mdf',
size=5MB,
maxsize=10MB,
filegrowth=10%
)
log on(
name='BSXT_Log',
filename='F:\github\DataBase\BSXT\BSXT.ldf',
size=2MB,
maxsize=5MB,
filegrowth=1MB
)
go
alter database BSXT
modify file(
name='BSXT_Data',
maxsize=unlimited
)
go
create table Student(
Sno char(10) primary key,
Sname char(10) not null,
Ssex char(2) check(Ssex='男' or Ssex='女'),
Sclass char(10),
Stel char(11) not null,
Sgroup char(1) not null,
Spassword char(10) not null
);
create table Teacher(
Tno char(10) primary key,
Tname char(10) not null unique,
Tsex char(2) check(Tsex='男' or Tsex='女'),
Tdept char(20) not null default('计算机科学与技术系'),
Tdegree char(8),
Ttitle char(10),
Tright bit not null check(Tright='true' or Tright='false'),
Ttel char(11) not null,
Temail char(50),
Tgroup char(1) not null,
Tpassword char(10) not null
)
create table Desion(
Hoo char(4) primary key,
Hname char(50) not null,
Hstatus char(5) not null,
Hcontent char(200),
dircetion char(200),
Tno char(10),
Sno char(10),
foreign key (Tno) references Teacher(Tno),
foreign key (Sno) references Student(Sno)
)