Professional Documents
Culture Documents
. ,
. , .
, .
, .
; , ,
, .
.
, . ,
. , .
,
.
. . .
. . !
. .
. ,
, ,
.
.
, 2001
7
...
. 2 2007 . 4
1981, 6 1986 25 2000.
19 1991,
13 1991 27 1997. 3 2000
"The living years" Mike and the
mechanics, "Id love to change the world"
Ten years after. : 4 , 6 , 170 ,
1100 200 , 11 /,
60 10 .
. .
21 1971 ( !).
..
(1994) ... (2000). 2003
... .
,
projects . "Master
of puppets" Metallica, "Hunting high and low" Stratovarius, "Tears of
the dragon" Bruce Dickinson " " .
2 , 2 , 7 , 23 200
. :
, ,
.
9
,
.
. ,
. ,
,
. ,
.
.
Microsoft SQL Server 2000, .
, Microsoft SQL Server 2000.
,
.
. ,
.
,
.
.
. ,
11
12
.
.
1 .
2.
3 ,
4 -,
.
5 Microsoft SQL Server
2000
.
,
, 6.
.
7.
,
. ,
, 8.
9 SQL
.
, 10
Microsoft SQL Server 2000.
. . 11, 12 13
13
,
.
SQL.
,
, . 14.
.
.
.
(.., ).
15.
, ,
.
. ,
,
, . 16
.
17 SQL Server 2000
11 16.
IV ,
. -
14
, .
18 ,
. ,
/ .
. -
,
. - 19.
20
.
, ,
.
, 21
Microsoft SQL Server 2000.
( ) . ,
,
( ). ,
.
Microsoft SQL Server 2000,
. Microsoft SQL
Server 2000
. ,
15
,
.
.
,
.
o http://delab.csd.auth.gr/dbbook ,
dbbook@delab.csd.auth.gr
.
. Microsoft Hellas .
,
,
. : , ,
. , .
. ,
, .
,
2006
.
11
26
33
35
1
1.1 . . .
1.2
1.3 . . . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
37
40
44
48
48
2
2.1 . . . . . . . . . . .
2.2 . . . . . . . . . . .
2.3 . . . . . . . . . . . . .
2.4 . . . . . . . . . .
2.5 . . . . . . .
2.6
2.7 . . . . . . . . . . . . . . . . .
. .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
51
54
58
62
65
69
72
73
74
3
3.1 ANSI-SPARC . . .
3.2 . . . . .
3.2.1 .
3.2.2
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
79
80
85
86
87
17
18
3.2.3 . . . . . .
3.3 . . . . . . . . . . . . .
3.3.1 . .
3.3.2
3.3.3 . . . . .
3.4 . . . . . . . . . . . . . .
3.5 . . . . . . . . . . . . . . . . . . . .
. . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
4 -
4.1 - . . . . . . . .
4.2 . . . . . . . . . . . . . . . . . .
4.2.1 . . . . . . . . . . .
4.2.2 . . . . . . . . . . . . . . . . . . . . .
4.3 . . . . . . . . . . . . . . . . .
4.3.1 . . . . . . . . . . . . . .
4.3.2 . . .
4.3.3
4.3.4 . . . . . . . . . . . . .
4.3.5 . . . . . . . . .
4.4 . . . . . .
4.4.1 . . . . . . . . . .
4.4.2 . . . . .
4.4.3 . . . . . . . . . . . . . . . . .
4.5 . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
99
. 99
. 101
. 101
. 103
. 104
. 105
. 107
. 108
. 109
. 110
. 111
. 111
. 113
. 113
. 115
. 115
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
119
. 120
. 121
. 121
. 122
. 123
. 123
. 123
. 124
. 125
. 126
. 126
.
.
.
.
.
.
.
.
.
.
.
88
89
90
91
93
93
96
97
19
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 126
. 126
. 127
. 129
. 130
. 131
II
133
6
6.1 . . . . . . . . . . . . . . . . . . . . . .
6.2 . . . . . . . . . . . . . . . . . . . . . .
6.3 . . . . . . . . . . .
6.3.1 . . . . . . . . . . . . . . . . . . . . .
6.3.2 . . . . . . . . . . . . . .
6.3.3 . . . . . . . . . . . . . .
6.3.4 . . . . . . . . . . . . . . . . .
6.4 . . . . . . .
6.4.1
6.4.2 . . . . . . . . .
6.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.6 . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
135
. 137
. 139
. 141
. 141
. 142
. 142
. 143
. 143
. 143
. 147
. 150
. 153
. 153
7
7.1 . . . . . . . . . . . .
7.1.1 . . . . . . .
7.1.2 . . . . . . . . . . .
7.2 . . . . . . . . . . .
7.2.1 .
7.2.2 . . .
7.2.3 . . . . . . .
7.3 . . . . . . . . . . . . . . . . . .
. . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
157
. 157
. 158
. 164
. 169
. 169
. 171
. 174
. 174
. 175
8
8.1 . . . . . . . . . . . . . . . . . . . . . . .
8.1.1 . . . . . .
8.1.2 . . . . . . . . . . . .
179
. 181
. 182
. 184
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
20
8.1.3
8.2 . . . . . . . . . . . . . . . . . . .
8.2.1 (1NF) . . . . . . . . .
8.2.2 (2NF) . . . . . . . .
8.2.3 (3NF) . . . . . . . . . .
8.2.4 Boyce-Codd (BCNF) . . . . .
8.2.5 . . . . . . . . . . . .
8.3 . . . . . . . . . . . . . .
8.3.1 . . . . . . . . . . . . .
8.3.2 (4NF) . . . . . . . .
8.3.3 (5NF) . . . . . . . . .
8.4 . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . .
9 SQL
9.1 SQL . . . . .
9.2 . . . . . . . . .
9.2.1 . .
9.2.2 . . . . . . . .
9.2.3 . .
9.3 . . . . . . . .
9.3.1 . . .
9.3.2 . . . . .
9.3.3 . . . .
9.3.4 . . . . .
9.4
9.5 . . . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
10 MSSQLS-2000
10.1 . . . . . . . .
10.2 . . . . . . . . . . . . .
10.3 ,
10.4 - . . . . . . .
10.5 . . . . . . . . . . . . . . .
10.6 . . . . . . . . . . . . . . . . . . . . . . . . .
10.7 . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 186
. 186
. 188
. 189
. 190
. 191
. 192
. 195
. 195
. 196
. 198
. 200
. 201
.
.
.
.
.
.
.
.
.
.
.
.
.
205
. 206
. 210
. 210
. 211
. 213
. 215
. 215
. 229
. 230
. 231
. 232
. 233
. 233
.
.
.
.
.
.
.
.
237
. 238
. 241
. 243
. 244
. 246
. 252
. 254
. 254
21
III
11
11.1 . . . . . . . . . .
11.2 . . . . . . . . . . .
11.3 . . . . .
11.4 . . . .
11.5
11.5.1
11.5.2 . . .
11.6 . . . . . . . . . . . . . . .
257
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
259
. 262
. 265
. 267
. 270
. 273
. 278
. 280
. 282
. 283
12
12.1 - . . . . . . . . . . . . . . . . .
12.1.1 E - . . . . . .
12.1.2 - . . . . . .
12.2 - . . . . . . . . . . . . . . . .
12.3 + - . . . . . . . . . . . . . . . .
12.3.1 . . . . . .
12.3.2 .
12.3.3
12.3.4 . . . . . . .
12.3.5 E . . . . . . .
12.4 - . . .
12.5 . . . . . . . . . . . . . . . . . .
. . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
287
. 290
. 293
. 295
. 301
. 305
. 308
. 309
. 309
. 310
. 313
. 316
. 319
. 319
13
13.1 . . . . . . . . . . . . . . .
13.2 . . . . . . . . . . . . . . . .
13.3 . . . . . . . . . . . . . . . .
13.4
13.5 . . . . . . . . . . . . . . . .
13.5.1 . . . . . . . . . . . . . . . .
13.5.2 . . . . . . . . . . . . . . . . .
13.5.3 . . . . . . . . . . . . . . . . .
13.5.4 . . . . . . . . . . .
13.5.5 . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
323
. 325
. 330
. 333
. 338
. 342
. 343
. 344
. 346
. 348
. 348
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
22
13.6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
. . . . . . . . . . . . . . . . . . . . 349
14
14.1 . . . . . . . . . . .
14.2 . . . . . . . . . . . . .
14.3 . .
14.3.1 . . . . . . . . . . . . . . . . . . .
14.3.2 . . . . . . . . . . . . . . . . . . .
14.3.3 . . . . . . . . . . . . . . . . . . .
14.3.4 , . . . . . . . .
14.3.5 . . . . . . . . . . . . . . . . .
14.4 . . . . . . . . . . . . .
14.4.1
14.4.2 . . . . . . . .
14.5 . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . .
15
15.1 . . . . . . . . . . . . . . . . .
15.1.1 . . . . .
15.1.2 . . . . . . .
15.2 . . . . . . . . .
15.2.1 . . . . .
15.2.2 . . . . .
15.2.3 . . . . . . .
15.2.4
15.3 . . . . . . . . . .
15.3.1 . . . . . .
15.3.2 . . . . . . .
15.4 . . . . . . . . . . . . . . . . . . .
. . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
353
. 356
. 358
. 362
. 363
. 367
. 367
. 372
. 373
. 375
. 375
. 376
. 376
. 377
.
.
.
.
.
.
.
.
.
.
.
.
.
379
. 380
. 380
. 382
. 382
. 385
. 388
. 394
. 397
. 400
. 400
. 402
. 408
. 408
16
411
16.1
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412
16.2
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413
16.3 . . . . . . . . . . . . . . . . . . . . . . . . . . 414
23
16.3.1 . . . . . .
16.3.2 . . . .
16.3.3 .
16.4 . . . . . . . . . .
16.5 . . . . .
16.6 . . . . .
16.7 SQL . . . .
16.8 . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . .
17 MSSQLS-2000
17.1 . . . . . .
17.1.1 . . . . . . . . . . . . .
17.1.2 . . . . . . . .
17.2 . . . . . . . . . . . . . . . . . . . . .
17.2.1 . . . . . . . .
17.2.2 - . . . . .
17.2.3 . . . . . . . . . . .
17.3 .
17.4 . . . . . . . . . . . . . .
17.4.1
17.4.2 . . . . . . . . . . . . . . . . . . .
17.4.3 . . . . . . . . . .
17.5 . . . . . . . . . . . . . . .
17.5.1 . . . .
17.5.2 . .
17.5.3 . . . . . . . .
17.6 . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 414
. 419
. 420
. 422
. 423
. 425
. 429
. 432
. 434
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
437
. 437
. 438
. 440
. 442
. 442
. 443
. 444
. 446
. 448
. 450
. 453
. 453
. 455
. 455
. 460
. 461
. 462
. 463
IV
18
18.1
18.1.1 , . . . . .
18.1.2 . . . . . . . . . . . . . . .
18.1.3 . . . . . . . . . . . . .
18.2 . . . . . .
18.3 . . . . . . . .
465
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
467
. 469
. 469
. 470
. 472
. 473
. 480
24
18.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
. . . . . . . . . . . . . . . . . . . . 481
19 -
19.1 . . . . . . . . . . . . . . . . . . . . . . .
19.2 SQL:1999 (SQL3) . . . . . . . . . . . . . . . . . . .
19.2.1 . . . . . . . . . . . . . . . . .
19.2.2 . . . . . . . . . . . . . .
19.2.3 .
19.2.4 . . . . . . .
19.2.5 . . . . . . . . . . . . . . . . . . . . .
19.2.6 . . . . . . . . . . . . . . . .
19.2.7 . . . . . . . . . . . . . . . . . . . . . . . . .
19.2.8 . . . . . . . . .
19.3 . . . . . . . . . . . . . . . . . . . . . . . .
19.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
483
. 484
. 485
. 486
. 487
. 489
. 490
. 491
. 492
. 492
. 493
. 494
. 495
. 496
20
20.1 - . . . . . . . .
20.1.1
20.1.2 . . . . . . . . . . . . . . . . . . . . . .
20.1.3 . . . . . . . . . . . . . . .
20.2 . . . . . . . . . . . . . . . . . .
20.3 . .
20.3.1 . . . . . . .
20.3.2 . . . . . . . .
20.3.3 OLAP . . . . . . . . . . . . . . . . .
20.4 . . . . . . . . . . . . . . . . . . . .
20.4.1 . . . . . . . . . . . . . . . . . . . .
20.4.2 . . . . . . . . . . . . . . . .
20.5 . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
499
. 500
. 501
. 501
. 502
. 506
. 508
. 510
. 510
. 512
. 515
. 516
. 519
. 521
. 522
21 MSSQLS-2000
21.1 . . . . . . .
21.2
21.3 . . . . . . . . . . . . . . . .
21.4 . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
525
. 525
. 529
. 530
. 531
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
21.5 . . .
21.5.1 . . . . . . . . . . . .
21.5.2 MAS . . . .
21.5.3 OLAP . . . . . . . . .
21.5.4 .
21.6 . . . . . . . . . . . . . . . . . . .
. . . .
25
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 532
. 533
. 534
. 535
. 536
. 537
. 538
541
551
1.1
. . . . . . . . . . . . . . . 41
2.1
2.2
2.3
2.4
2.5
. . . .
RAID. . . . . . . . . . . . . . .
WORM.
. . .
DAS, NAS SAN. . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
55
60
63
67
73
3.1
3.2
3.3
3.4
ANSI-SPARC.
. . . . . . . . . . . . . . . .
-. . . . . .
. . . . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
81
91
92
94
4.1
4.2
4.3
4.4
4.5
4.6
4.7
4.8
4.9
4.10
4.11
4.12
4.13
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
, . . . . . 103
. . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
. . . . . . . . . . . . . . . . . . . . . . . . . . 105
. . . . . . . . . . . . . . . . . . . . . . . 106
. . . 107
. . . . . . . . . . . . . 108
. . . . . . 109
. . . . . . 109
. . . . . . . . . . . . . . . . 111
. . . . 112
.113
. . . . . . . . . . . . . 114
5.1
5.2
.
.
.
.
.
.
.
.
.
.
28
5.3
5.4
5.5
5.6
6.1
6.2
6.3
6.4
6.5
6.6
6.7
6.8
7.1
7.2
7.3
7.4
7.5
7.6
7.7
7.8
8.1
8.2
8.3
Enterprise
Manager. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
Enterprise Manager. . . . 129
. . . . . . . . . . . . . . . . . . . . . . 130
Enterprise Manager. . . . . 131
. . . . . . . . . . . . . . . . . . . . . 137
, . . . . . . . . 140
NULL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
. . . . . . . . . . . . . . . . 145
4.1 . . . . . 147
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
. . . . . . . . . . . . . . . . . . . . 151
. . . . . . . . . . . . 152
, . . . . . . . . 158
, ( >20 ()). 161
. . . . . . . . . . . . . . . . . . . . . 162
. . . . . . . . . . . . . . . . . . . . . . 165
-. . . . . . . . . . . . . . . . . . . . . . . . . . 166
, . . 166
. . . . . . . . . . . . . 167
. . . . . . . . . . . . . . . . . . . . . . . . . . 168
. . . . . . . . . . . . . . . . . . . . . . 180
. . . . . . . . . . . . . 180
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
8.4 . . . . . . . . . . . . . . . . . 184
8.5
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
8.6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
8.7 . . . . . . . . . . . . . . . . . . . 193
8.8 . . . . . . . 193
8.9 . . . . . . . . . . . . . . . . . . 194
8.10 . . . . . . 197
29
8.11 . . . . . . . . . . . . . . . . 198
8.12 . . . . . . . . . . . . . . . . . . . . 199
8.13 . . . . . . . . . . . . . . . . . . . 199
9.1
9.2
4.1 . . . . . 207
. . . 223
10.1
10.2
10.3
10.4
10.5
10.6
10.7
. . 238
Enterprise Manager. . . . . . . . . . . 239
T-SQL Query Analyzer. . 240
Enterprise Manager.243
movies-db. . . . . . . . . . . 245
movies-db. . . . . . . . . . . . . . . 245
Enterprise Manager. . . . . . . . . . . 252
11.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
11.2 . . . . . . . . . . . . . . . . 262
11.3 . . . . . . . . . . . . . . . . . . . . . . . . 262
11.4 . . . . . . . . . . . . . . . . . . . . . . 263
11.5 . . . . . . . . . . . . . . . . 264
11.6 . . . . . . . . . . . . . . . . . . . . . . 264
11.7 . . . . . . . . . . . . . . . . . . . . . . . 265
11.8 . . . . . . . . . . . 266
11.9 . . . . . . . . . . . . . . . . . . . . . . . . . . 268
11.10 . . . . . . . . . . . . . . . . 271
11.11 . . . . . . . 274
11.12 . . . . . . . . 277
11.13 . O
CPU /. . . . . . . . . . . . . . . . . . 278
11.14 FIFO LRU. . . . . . . . . . . . . . . . . . . . 281
12.1
12.2
12.3
12.4
12.5
12.6
.
. . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . .
- 3. . . . . . . . . . . . . .
- . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 288
. 288
. 289
. 289
. 291
. 294
30
12.7 - . . . . . . . . . .
12.7 - (). . . .
12.8 (3,5). . . . . . . . . . . . . . . . . . . . . .
12.9 (3,15). . . . . . . . . . . . . . . . . . . . .
12.10 -. . . . . . . . . .
12.11 -. . . . . . . . . .
12.12 + -. . . . . . . . . . . .
12.13 + - .
12.14 + - d=2 Bkf r=4. . . .
12.15 + - d=2 Bkf r=4. . . .
12.16 + - d=2 Bkf r=4. . . .
12.17 . . . . . . . . . . . . . . . . .
12.18 + -. . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 295
. 296
. 299
. 300
. 302
. 303
. 305
. 307
. 311
. 314
. 315
. 318
. 318
13.1 . . . . . . . . . . . .
13.2 . . . . . . . . . . . . . . . . .
13.3 . . . .
13.4 3 . . . . . . . . . . . . .
13.5 . . . . . . . . . . . .
13.6 . . . . . . . . . . . . . . . . . . . . . . .
13.7 . . . . . . . . .
13.8 . . . . . .
13.9 bits. . . . . . . . . .
13.10 bits. .
13.11 . . . . . . . . . .
13.12 . . . . . . . . . . . . . . . . . . . . . .
13.13 . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
. 326
. 332
. 333
. 334
. 335
. 336
. 336
. 340
. 342
. 343
. 344
. 345
. 347
14.1 . . . . . . . . . . . . . . . . 354
14.2 . . . . . . . . . . . . . . . . . 358
14.3 . . . . . . 359
14.4 1 (X 1 Y ). . . . . . . 361
14.5 . 370
14.6 -. . . . . . . 370
14.7 . . . . . . . . . . 371
14.8 . . . . . . . . . . 374
14.9 . . . . . . . . . . . . . . . . 374
14.10 . . . . . . . . . 375
31
15.1
15.2
15.3
15.4
15.5
15.6
15.7
15.8
. . . . . . . . . . . . . . . . . . . . . . . . . 381
. . . . . 384
1 2. 385
. . . . . 387
. . . . . . . . . . . . . . . . 388
. . . . . . . . . . . 389
. . . . . 391
15.2 15.2. . . . . . . . . . . . . . . . . . . 392
15.9 . . . . . . . . . . . . 393
15.10 () (). . . . . . . . . . 396
15.11 Thomas. . . . . . . . . . . . . . . . . . . . . . . . 399
15.12 . . . . . . . . . . . 404
15.13 5 . . . . . . 406
15.14 (
4 5). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407
16.1
16.2
16.3
16.4
. 413
REVOKE. . . . . . . . . . . . . . . . . 418
. . . . . . . . . . . . . . 423
A1 AND NOT A2 , = 1 AND
A2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429
16.5 ASP
. . . . . . . . . . . . . . . 430
16.6
. . . . . . . . . . . 432
17.1
17.2
17.3
17.4
MSSQLS-2000. . . . . . . . . . . . . . . . . . . . 438
. . . . . . . . . . 440
. . . . . . . . . . . . . . . . . . . . . 441
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443
17.5 Enterprise Manager. . . . . . . . . . . . 444
17.6 . . . . . . . . . . . . . . 448
17.7 . . . . . . . . . . . . . . . . 449
17.8 Permissions Properties . . . . 456
17.9 Object Properties. . . . . . . . . . . . . . . . . . 459
17.10 Column Properties. . . . . . . . . . . . . . . . . 459
17.11 Database User Properties. . . . . . . . . . . . . 460
32
18.1
18.2
18.3
18.4
18.5
18.6
18.7
18.8
. . . . . . . . . . . . . . . 470
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471
. . . . . . . . . . . . . . . . . . . . 472
. . . . . . . . . . . . . . . . . . . 473
ODMG ODL. . . . . . . . . . . . . . . 475
[Connolly 2002]. . . . . . . . . . . . 477
ODMG C++ ODL. . . . . . . . . . . 478
ODMG C++ OML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479
19.1 . . . . . . . . . . . . . . . . . . . . . . . . . . 485
19.2 . . . . . . . . . . . . . . . . 495
20.1 . . . . . . . . . .
20.2 GIS .
20.3 . . . . . . . . . . . . . . . . . . . . . . . .
20.4 R-. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20.5 . . . . . . . . . .
20.6 ( ). . .
20.7 . . . . . .
20.8 OLAP. . . . . . . .
20.9 . . . . . . . . . . . . . . .
20.10 . . . . . . . . . . . . . . . . . . . .
20.11 . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 502
. 503
. 505
. 506
. 510
. 511
. 511
. 514
. 515
. 516
. 519
2.1
2.2
2.3
2.5
. . . . . . . . . . . . . . . . .
. . . . . . . . . . . .
WORM. (:
www.asus.com, www.plextor.com, www.teac.com) . . . . . . . . . . .
. (:
www.hp.com, www.dell.com, www.ibm.com) . . . . . . . . . . . . . .
. . . . .
3.1
. . . . . 84
7.1
7.2
. . . . . . . . . . . . . . . . . . . . . . . 159
. . . . . . . . . . . . . . . . . . . . . . . . 160
9.1
9.2
SQL-92. . . . . . . . . . . . . . . . . . . . . . . 207
LIKE. . . . . . . . . . . . . . . . . . . . . 225
10.1
10.2
10.3
10.4
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . .
2.4
MSSQLS-2000.
. . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
.
.
.
.
.
.
.
.
54
57
65
68
72
. 239
. 249
. 249
. 250
34
14.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362
16.1
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420
16.2 . . 421
16.3 . . . . . . . . . . . . . . . . . . . 426
19.1 . . . . . . . . . . . . . . . . 496
20.1
20.2
20.3
20.4
OLTP OLAP .
. . . . . . . . . . . . . . . . . .
. . . . . . . .
. . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 509
. 520
. 520
. 521
. , . , 1,
, .
, . ,
. 2
,
() . ,
,
. 3 -,
.
, -
. , 5
Microsoft SQL Server
2000, .
. , , (file system) ,
. ,
,
. ,
,
, (..,
, , ) .
,
, , ,
- (keywords) .
37
38
1.
:
,
.
,
,
.
. ,
.
,
.
,
.
.
, .
, . , 1
(.., , ),
2 .
1 , 2 . ,
,
,
39
.
.
.
.
. ,
1 (citations) .
1, ,
,
.
.
,
( C, C++,
Java, Visual Basic).
( Linux, Windows, MacOS). (binary)
(alphanumeric, text) .
.
,
. , . "" ,
.
(). : ) ) .
, .
40
1.
(.., ).
, . ,
,
.
( , ),
, . ,
.
,
.
.
,
(versions)
.
1.1
, .
,
. (database system) , ,
, .
:
(database),
, ,
41
1.1: .
1.1 . .
. ,
.
(end-users).
42
1.
.
.
. ,
,
. ,
.
.
,
. ,
. ,
, . , ,
(format) , . ,
,
. , ,
.
.
.
. ,
,
.
.
43
. .
(username)
(password), .
,
, . ,
.
,
.
. .
,
. ,
.
.
(locking)
( ) .
.
.
,
. ,
.
,
.
44
1.
.
. ,
.
1.2
60 . .
(On-Line Transaction
Processing, OLTP). : )
, ) ) . :
. ,
,
,
.
.
.
. , , ,
, , , .
. .
.
,
45
, .
( , ,
, ...).
, , , , .
(.., ).
,
. . .
.
.
.
(). , , video.
. (multimedia databases)
. , : "
" "
", .
. , ( , , , ...),
(spatial) . ,
( )
46
1.
(..,
-, - ...). ( -, -, -, , ...). , ,
(Geographical Inforation System, GIS),
,
(Computational Geometry).
.
(decision support systems).
, , marketing ...,
.
,
, .
,
. (data warehouses),
(On-Line
Analytical Processing, OLAP)
, .
. (data mining)
,
( ),
, ,
.
, , ""
, ,
47
48
1.
.
,
, .
1.3
, . ,
. ,
.
.
.
. , .
.
1.1.
;
.
1.2.
.
1.3.
.
. ;
49
1.4. ,
.
1.5. .
;
1.6. ;
1.7. ;
1.8. .
,
;
1.9.
;
1.10.
;
.
(physical storage media).
.
(capacity) (access time) .
, , .
(reliability) ,
.
(storage hierarchy). ,
.
(registers).
(CPU) 51
52
2.
. , (bytes),
CPU .
CPU. ,
(machine code) (assembly).
(cache memory). , , (Random Access Memory, RAM). ,
CPU.
CPU,
, CPU
.
(main memory). (DRAM).
GBytes, .
(PC) 512 MBytes
2 GBytes, (servers)
.
.
Flash (flash memory). ,
flash
. flash EEPROM
(Electrically Erasable Programmable Read-Only Memory), .
flash
. BIOS (basic input-output system) PCs EEPROM. ,
flash USB (universal serial bus)
.
53
(magnetic disk). ,
0 1. PC 80 GBytes 200 GBytes.
. ,
.
: )
( floppy disk) ) (hard disk).
.
.
(optical disk). laser.
. :
) (Compact Disk - CD) )
(Digital Versatile/video Disk - DVD).
: )
CD-ROM ( CD-R),
( Write-Once ReadMany, WORM) ) CD-RW, ( rewritable)
PC.
CD-ROM 650-700 MBytes. , DVD-ROM DVD-R
4.7 GBytes 27 GBytes. , ,
. CD DVD
,
(backup).
(magnetic tapes).
, , . ,
54
2.
.
.
. .
,
(primary storage), on-line (secondary storage)
off-line (tertiary storage).
,
.
, , . 2.1
1956
2003.
1956
1971
1976
1980
1981
1985
1987
1991
1994
1997
2003
IBM RAMAC
5 MBytes.
IBM floppy.
Wang Laboratories floppy 5 1/2 .
Philips
60 5 1/4.
Sony floppy 3 1/2 .
Philips CD-ROM.
RAID Berkeley.
Yamaha CD-R.
SanDisk flash.
Philips CD-RW Hitatchi
DVD-ROM.
iSCSI.
2.1: .
2.1
[Harker 1981, Ruemmler 1994]
-
55
. 2.1 .
(platters) (Constant
Angular Velocity, CLV) (spindle).
(tracks).
2.1: .
(cylinder). , (sectors)1
(interblock gap) . /. PC (..,
MS-Windows MS-DOS) 512 bytes, (.., UNIX)
4-8 kbytes.
, (recording
density) . , (, ) (, )
.
(head), (arm).
,
1
(page) block.
56
2.
, (access comb).
CPU (hard disk
controller). CPU
, CPU.
(bad sector)
. CPU, (interface)
(.., USB, IDE, SCSI). CPU ( )
:
.
( ) . ,
, .
(seek time, Tseek ).
.
.
,
. (latency time)
(rotational delay, Trot ).
.
,
CPU , .
(transfer time, Ttrans ), bytes
(data transfer rate).
(Taccess )
:
Taccess = Tseek + Trot + Ttrans
57
. 2.2
.
ytes
( )
( )
( )
Seagate
Barracuda 7200.8
400 GBytes
7.200 rpm
8
16
16383
512
8 MBytes
8 msec
4.16 msec
95 MBytes/sec
Western Digital
Caviar RE2
400 GBytes
7.200 rpm
4
8
16383
512
16 MBytes
8.7 msec
4.20 msec
150 MBytes/sec
Maxtor
DiamondMax 16
300 GBytes
5.400 rpm
8
16
16383
512
8 MBytes
< 12 msec
5.6 msec
133 MBytes/sec
2.2: .
(buffer cache).
.
RAM .
,
. , .
.
11.
, (Mean Time
Between Failures, MTBF),
.
300.000
1.500.000 .
(Mean Time to Repair, MTTR),
.
, ,
58
2.
.
1956 IBM RAMAC
5 MBytes. RAMAC
.
. , ,
,
RAMAC.
2.2
, .
, - (I/O). , .
(
),
.
.
(disk array) [Patterson 1988, Chen 1990, Chen 1994].
. RAID (redundant array of inexpensive/independent disks). RAID,
.
(RAID controllers), . RAID 2.2.
RAID .
RAID 0. . blocks, .
59
block .
, .
,
. .
RAID 1. (mirroring) (shadowing).
A A0
. , A (, A0 ) A0 (,
A). ,
.
RAID 2.
,
(error-correcting codes) Hamming. : ) )
(parity). bits byte , data stripping ( ,
). , Hamming
stripping . (
) bit , bits
bits .
RAID 2
. , .
RAID 3. data stripping
.
RAID 2 : ) data stripping byte bit )
.
. ,
.
60
2.
A
E
B
F
C
G
D
H
I
M
J
N
K
O
L
P
A
E
A
E
B
F
B
F
C
G
C
G
D
H
D
H
I
M
I
M
J
N
J
N
K
O
K
O
L
P
L
P
A0
B0
A1
B1
A2
B2
A3
B3
ECC/Ax
ECC/Bx
ECC/Ay
ECC/By
ECC/Az
ECC/Bz
C0
D0
C1
D1
C2
D2
C3
D3
ECC/Cx
ECC/Dx
ECC/Cy
ECC/Dy
ECC/Cz
ECC/Dz
A0
B0
A1
B1
A2
B2
A3
B3
RAID 3
C0
D0
C1
D1
C2
D2
C3
D3
C
D
A0
B0
C0
D0
A1
B1
C1
D1
A2
B2
C2
D2
A3
B3
C3
D3
C
D
A0
A1
A2
A3
4
B0
B1
B2
3
B4
A0
A1
A2
A3
4
9
B0
B1
B2
3
8
B4
C0
C1
2
C3
C4
D0
1
D2
D3
D4
RAID 0
0
E1
E2
E3
E4
2
7
C3
D0
1
6
D2
D3
0
5
E1
C4
D4
E4
C0
C1
RAID 1
RAID 2
RAID 4
RAID 5
RAID 6
E2
E3
2.2: RAID.
.
RAID 4. RAID 3
61
62
2.
,
(. 2.2).
RAID.
. , RAID
0 RAID 1 (RAID 01 RAID 10),
. ,
RAID 0 RAID 3 RAID 03.
2.3
[Kenville 1982, Fujitani 1984, OLeary 1985]
, , ,
. , .
. ,
. ,
,
.
(WORM). . , (rewritable)
- , . (CD)
650-700 MBytes, (.., over-burn). DVD
27 GBytes (blue-ray DVD)
63
(multimedia) .
WORM ( CD-R)
12cm, (.
2.3). .
(label).
1.2mm.
2.3: WORM.
. laser,
.
.
laser . ,
. , . ,
bits
. (CD-RW) -
.
. :
(Constant Linear Velocity, CLV),
.
64
2.
CLV
.
, . ,
,
,
. ,
,
CLV
CAV.
CLV
CAV, .
,
. ,
(zone). (multizone) (
MCLV).
,
. , ,
. ,
. (proximal window). ,
,
.
.
.
, 52x,
52 1x. 2.3
.
Asus CD-S520
Plextor PX-54TA
Teac CD-552E
52x
54x
52x
3.30-7.80 MBytes/sec
3.46-7.91 MBytes/sec
3.45-7.80 MBytes/sec
85 msec
95 msec
120 msec
65
128 KBytes
128 KBytes
128 KBytes
2.3: WORM.
(: www.asus.com, www.plextor.com, www.teac.com)
,
( ).
jukeboxes ( jukebox)
. ,
, .
2.4
1950
mainframes. 1960
,
.
.
. ,
.
,
.
bits (Den) 1600
6250 bits (bpi). ,
/ (read/write
speed).
(record) -
66
2.
.
. ,
, 25g. ,
,
. (interrecord
gaps, IRG). / (start/stop time)
Ts/s . 0.75 0.60 7
9 , . (storage utilization factor, U )
.
, ,
(logical record) (length, R).
(physical record)
B. , (IRG) .
(blocking factor, Bf r).
,
,
.
byte. byte bits
(weight) Hamming.
bit . (even parity) bit
, Hamming . ,
(odd parity) bit ,
Hamming . bit
(vertical) bits
byte. , ,
. ,
.
.
67
, bytes
(longitudinal) bytes.
,
. ,
.
.
(linear) (longitudinal). ,
:
(serpentine recording), .
,
. , /
,
, 2.4. ,
.
()
()
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
()
2.4: .
(helical scan),
VCR.
10o -20o ,
2.4, .
/
68
2.
,
(, forward rewind )
50-75 .
, .
, 1500 ,
500.000 , 3,5 . ,
20-50 .
(transverse recording),
,
2.4. , . ,
.
2.4 .
HP DDS-4
HP AIT-100
DELL 110T DLT
IBM 7206 VX2
20/40 GBytes
100/200 GBytes
40/80 GBytes
80/160 GBytes
2.4/4.8 MBytes/sec
12/24 MBytes/sec
3/6 MBytes/sec
3/6 MBytes/sec
150m
230m
230m
2.4: . (:
www.hp.com, www.dell.com, www.ibm.com)
,
, jukeboxes,
. ,
,
(..,
). terabytes. ,
69
2.5
.
(punched card), (paper tape)
(magnetic drum), .
,
.
.
. ,
.
, PCs
3,5 ( 5,25) .
. Mylar,
.
(soft sectoring), (format) .
,
. , . /
( ), ,
.
(fixed-head disks) . ,
/ ,
70
2.
. (multiple disk
arms), /
. ,
.
mainframe.
(content addressable filestores) ,
( . 4). . ( ) CAFS-ISP ICL
900 GBytes .
(mass storage)
. , Control Data 3850 IBM 3850
1.000 472 GBytes, (, ).
.
(magnetic bubble memories)
(< 7 ms), .
.
,
, .
(semiconductor disks) 1978 ,
. (<0,5 ms),
, .
,
.
,
,
/ .
71
(optical tape) . ,
1/2 , ,
4/5 . ,
,
25
, 75 .
, :
,
,
.
,
,
WORM.
(holography)
,
. ,
1000 -
1 cm, 10
TBytes 1 cm3 . , ,
.
, (electron trapping).
, ,
. ,
.
, ,
. bit . ,
.
- . 2.5
.
72
2.
/MByte
5 GBytes
15 cm
200 GBytes
3480 ft
1 GBytes
30x30 mm
10 GBytes
13 cm
RAID
2.5: .
2.6
.
, (dedicated servers)
(LAN).
: ) DAS, ) NAS ) SAN,
2.5 :
DAS (direct attached storage). (.., SCSI).
(.., NFS).
. DAS
.
NAS (network attached storage). NAS
,
73
LAN
IDC
IDC
IDC
IDC
IDC
IDC
IDC
LAN
IDC
LAN
SCSI
RAID
DAS
NAS
SAN
2.7
.
74
2.
.
.
. ,
, . ,
.
.
. ,
.
. ,
.
.
.
2.1.
.
;
2.2. 11 ,
200 , 20 ,
512 bytes, 128 bytes.
bytes ;
,
120 bytes 10 ; 7200 rpm,
;
2.3. C ,
75
.
.
,
;
2.4. , .
, .
.
.
.
;
2.5.
RAID. RAID 0, RAID 1 RAID 5.
2.6. 1000 GBytes
. 80 GBytes. RAID 0 RAID 1.
2.7. RAID
block 4 . , block Pi block B4i3
B4i . RAID ; / ;
1
B1
P1
B8
..
.
2
B2
B5
P2
..
.
3
B3
B6
B9
..
.
4
B4
B7
B10
..
.
2.8. / .
76
2.
2.9. .
;
2.10. : ,
.
2.11. 2.400 , 1.600 bpi /
50 /sec. 0,5 ,
/ 0,01 sec.
200 bytes, X%
; Y B bytes;
2.12. . 512 bytes,
1.600 bpi, 0,5
20 / . 2400 ;
2.13. 150.000
. , . , ,
20% .
,
/ 50 /sec /
0,02 sec. ,
.
2.14.
.
30.000 500 .
.
7 ms, 8,3 ms,
.
.
77
2.15. .
.
:
(naive users).
.
,
. ,
TAXIS, ,
.
.
(casual users).
.
(SQL) , .
79
80
3.
(application programmers). ,
.
API (Application Programming Interface)
.
(.., C++, Java)
,
.
(database designers).
.
. ,
.
,
.
.
(database administrators, DBA). ,
,
.
.
3.1 ANSI-SPARC
(Data Base Task Group) CODASYL (Conference on Data Systems
and Languages) 1971 [DBTG 1971].
. , .
81
(1975) ANSI-SPARC (American National Standards Institute - Standards Planning and Requirements Committee) , ANSI-SPARC [Jardine 1977,
Tsichritzis 1978]. ANSI-SPARC ,
.
3.1: ANSI-SPARC.
ANSI-SPARC 3.1.
: (external), (internal) (conceptual).
. .
.
""
.
:
82
3.
, .
.
.
.
(..,
).
.
, ANSISPARC :
.
.
,
.
()
. ,
.
. .
12 (.., 2:00 ), 24
(.., 14:00).
.
.
. , (.., ) .
,
.
83
. .
(.., ,
...) .
.
(schema).
, .
,
.
,
.
.
,
.
(instance). . ,
.
(data independence),
. :
(logical) ,
,
(physical) ,
( ) .
. ,
.
84
3.
.
(.., PDF). ,
.
, .
X1 , X2 X3 . X1
, X2
, X3 .
3.1.
1001
1002
2099
2100
3000
399
30
1001.pdf
3000
600
100
1002.pdf
8000
500
44
2099.pdf
5000
400
60
2100.pdf
2000
500
70
3000.pdf
10000
3.1: .
, :
.
. , ,
.
PDF
. , X1
1001
1002. X2
85
3.2
. (Data Definition Language, DDL)
86
3.
.
(.., ,
). (Data Manipulation Language, DML) , , .
. ,
. ,
(declarative).
, . ,
.
3.2.1
. ,
. , .
.
,
,
. .
(data dictionary)
(data directory) (system catalog). - (metadata),
. (, , )
. ,
,
.
, . , .
: ,
, , .
87
:
CREATE TABLE
( INTEGER,
CHAR(20),
CHAR(20),
INTEGER,
INTEGER);
: )
() , )
)
.
3.2.2
.
. )
, ) , )
) ( ).
. ()
(query language).
(procedural) - (non-procedural).
, . ,
, (, ifthen-else, ...) ( for, while, repeat)
. -
(.., > 110). ,
,
.
88
3.
115 . :
SELECT *
FROM
WHERE > 115;
"106
Rallye", "Saxo VTS" "S 2000" .
3.2.3
- (4th generation languages, 4GL),
. , -
89
,
.
:
(form generation).
.
, , .
.
.
(report generation). .
.
,
.
(graph generation).
. ,
,
(x y)
.
(application generation).
, . (demo), . ,
.
3.3
, . , ,
90
3.
. (data models), (
).
.
. .
ANSI-SPARC,
: , . ,
: (record-based models), (object-based
models) (physical data models).
3.3.1
.
(records) (layout).
(fields)
(attributes). ,
.
, . ,
.
: (relational model),
(network model) (hierarchical model).
. (columns).
.
(video club) 3.2 ,
: , -.
-
.
,
1
2
3
4
5
The others
Armagedon
Contact
Midnight run
Fifth element
DVD
3
2
6
2
7
1
1
Nicole Kidman
2
2
Jodie Foster
3
3
Bruce Willis
3
4
Robert de Niro
4
5
Charles Grodin
5
91
VHS
3
1
5
1
7
1
3
2
5
4
4
-
3.2: .
(links, pointers). (graph).
.
. ,
,
( ).
3.3.2
(object). ,
.
: (entity-relationship), (object-oriented), (semantic) (functional).
.
92
3.
ANSISPARC.
- ,
. ,
, , .
, .
.
.
- (E-R diagram).
3.3. .
3.3: -.
, (properties) (methods)
.
.
.
.
(object classes), (.., C++, Java).
(. 18).
93
3.3.3
(physical data models)
. , .
(unifying model)
- (frame-memory model).
.
3.4
. ,
.
.
.
,
.
3.4 ,
. ,
.
.
DML (DML query compiler).
.
.
.
DDL (DDL compiler).
.
.
,
() .
.
(execution engine). .
94
3.
3.4: .
,
. ,
.
95
96
3.
(storage manager).
.
(blocks).
H
:
.
. .
. .
(. 12) (. 13).
.
.
. ,
.
-,
.
, .
3.5
ANSI-SPARC .
: , .
.
: )
97
, ) ,
, ,
.
.
: ) )
.
, -
.
. .
3.1. .
3.2. .
3.3.
. .
3.4. ANSI-SPARC. ;
3.5. .
;
3.6. . ;
3.7. . .
98
3.
3.8.
.
3.9. , .
3.10. ;
3.11. ;
.
3.12. ;
.
3.13.
.
. ,
.
3.14. , , .
3.15. ,
.
o- () ,
.
.
Chen [Chen 1976]
. .
.
. (semantic)
,
, .
4.1 -
- (ER diagrams).
99
100
4. -
,
, . 4.1
.
4.1: .
:
, , , 1 . ,
,
.
,
1
, ,
, .
101
. 4.1
:
: , , , , , , .
: , , , , , , .
4.2
,
. "", ,
,
. (entity set)
. ,
.
.
,
, ISBN, ...
. , ISBN
,
ISBN.
4.2.1
. ,
:
. (simple) (atomic)
. (composite) .
,
102
4. -
. , o
.
, .
. (singlevalued) . , . .
(multi-valued). ,
. .
,
. ,
(..,
).
. (null)
. , , .
. (,
) (
). ,
, ,
.
. (derived)
, . , ,
.
(-) .
.
103
4.2
.
4.2: , .
4.2.2
(key)
(domain).
. ,
. (candidate).
(primary) ,
(alternative) .
.
,
, . , ,
( )
.
(composite) . ,
.
,
.
104
4. -
ID . 4.1
.
4.3
. , " " " ".
" " " ".
(relationship set)
. ,
. , E1 , E2 , ..., En ,
R {(e1 , e2 , ..., en ) |
(e1 E1 , e2 E2 , ..., en En )}, (e1 , e2 , ..., en ) . ,
. .
(participation),
E1 , E2 , ..., En R.
(binary)
, (,
). .
, (ternary) ...
. , , ,
. 4.3 .
4.3: .
105
(degree) .
(role). ,
.
,
. ,
: , 4.4.
: , , ...
(recursive).
, ,
.
4.4: .
4.3.1
A B R
.
(cardinality ratio)
. :
-- (one-to-one). a A
b B b B
a A. "1:1".
106
4. -
-- (one-to-many). a A b B, b B
a A.
"1:".
-- (many-to-one). a A
b B, b B
a A.
":1".
-- (many-to-many). a A b B b B
a A.
":".
A
--
--
--
--
4.5: .
4.5.
.
,
( 1, )
.
107
,
.
4.5,
:, 1: :1 (
). , ,
:1, 2 ,
.
4.3.2
. , 4.6
, .
,
.
. ,
,
.
4.6: .
2
:,
:1.
108
4. -
. :1 1:
, .
1:1
. ,
.
4.3.3
.
, .
0
1 . ,
(total), (partial).
4.7: .
, , ,
4.7.
. ,
. , .
.
.
. 4.8.
109
4.8: .
. . ,
.
4.9: .
, . , 4.9
,
. ,
3 .
4.3.4
(existence dependency). , A
B, A
B. B,
3
,
,
.
110
4. -
A. B
(dominant) A (subordinate). , ,
. 1000,
" ". " ", 1000.
4.3.5
(weak)
. ,
, (strong). ,
:
( , 1, 2, ...), . ,
, (,
...).
:, . ,
, .
4.10 ,
4 ,
(identifying). , , , , (discriminator)
(partial key),
. ,
.
4.10
, . ,
.
,
, 4
111
4.10: .
. , .
4.4
, , . ,
[Codd 1979].
.
4.4.1
, .
, (specialization),
. ,
.
(generalization). .
,
.
, ,
.
112
4. -
ISA (is a),
(superclass) (subclasses). 4.11
, .
, .
ISA
4.11: .
ISA .
(overlapping). ,
,
. ,
,
(, ).
,
.
(covering) (completeness).
. ,
. , Formula1,
.
113
4.4.2
/ (inheritance) .
ISA. , 4.11 , ,
.
. , ,
(. 18).
4.4.3
,
. , . ,
(aggregation).
4.12: .
114
4. -
4.6 . , ,
.
, , 4.12.
, .
. ,
,
.
.
4.13: .
, 4.13.
,
, ,
. , .
115
4.5
- () .
.
.
, ( ).
. ,
. ( ) .
.
, : 1:1, 1:, :1 :.
.
.
.
.
.
.
/.
. ,
, .
[Batini 1991] [Thalheim 2000].
4.1. , , ,
.
4.2. ;
116
4. -
.
4.3. ;
4.4.
; .
4.5. 1:1, 1: :.
.
4.6. .
4.7. .
4.8.
; .
4.9. .
, .
4.10.
. .
4.11. .
4.12. 4.1
.
4.13. ,
R A, B, C. , R, a1, a2 A,
b1, b2 B, c1, c2 C.
117
(), () ()
. .
A, B C 100, 1000
10 ,
R;
M
a1
a2
b1 c1
b1 c2
()
a1
a2
b1 c1
b2 c1
()
a1
a1
b1
b1
()
c1
c2
4.14.
. :
IP (.., 155.207.113.100),
(.., skyblue.csd.auth.gr) (..,
Windows 2000 Advanced Server).
(directories).
. ,
.
.
, .
IP
.
.
.
118
4. -
4.15.
,
:
.
,
DVD. .
, ,
, ...
,
.
.
.
Microsoft
SQL Server 2000
. Microsoft SQL Server 2000 (MSSQLS-2000)1 ,
. (SQL Server 2005) .
, SQL Server 2000 . ,
,
. , ,
.
,
,
1
119
120
.
SQL Server, [Petkovic 2000, Riordan 2000, Sharma 2002, Rankins 2003,
Beauchemin 2004].
5.1 MSSQLS-2000
MSSQLS-2000 ,
. :
SQL Server 2000 Enterprise Edition.
.
MSSQLS-2000,
.
,
.
.
SQL Server 2000 Standard Edition. ,
.
SQL Server 2000 Personal Edition.
(mobile terminals), ,
, .
SQL Server 2000 Developer Edition. ,
. Enterprise,
,
(production database).
SQL Server 2000 Windows CE Edition.
Microsoft Windows CE.
121
5.2 MSSQLS-2000
MSSQLS-2000 .
,
. MSSQLS-2000,
.
, .
122
123
,
,
(error log)
124
125
126
127
5.3
MSSQLS-2000
,
. master, model, msdb
tempdb Enterprise Manager 5.3.
:
master: MSSQLS-2000,
.
.
model:
.
MSSQLS-2000
.
msdb: SQL Server Agent
,
.
128
5.3: Enterprise
Manager.
tempdb: ( tmp UNIX TEMP
Windows).
MSSQLS-2000. ,
,
.
MSSQLS-2000
, .
:
pubs: . 2MBytes .
northwind: MSSQLS-2000. 4MBytes.
. , ,
MSSQLS-2000.
129
5.4
Enterprise
Manager. e-library,
.
130
5.5: .
,
,
. ,
.
5.5
131
5.1. MSSQLS-2000
.
5.2. MSSQLS-2000;
5.3. Enterprise Manager -
132
MyFirstDB.
.
5.4. Enterprise Manager
pubs northwind SQL Server 2000.
5.5. northwind Query Analyzer SELECT * FROM orders.
.
5.6. SQL Server Agent;
5.7. MSSQLS-2000; .
5.8.
;
5.9. MSSQLS-2000 ;
.
5.10. Data Transformation Services;
II
. ,
. ,
.
. 6
.
7 .
.
8 . , 9,
SQL (structured query language),
. SQL . , 10
MSSQLS2000.
Codd http://www.acm.org/classics/nov95/toc.html
135
136
6.
,
,
.
,
. ,
1970, San Jose IBM Research Laboratory
System R ( "r"-elational),
. System
R
, ,
,
... System R :
SQL (structured query language),
.
1970 1980 , ,
DB2 SQL/DS IBM Oracle
Oracle.
INGRES (Interactive
Graphics Retrieval System) California Berkeley.
INGRES System R.
INGRES , INGRES
Relational Technologies Inc. IDM (Intelligent Database
Machine) Britton Lee Inc.
Peterlee IBM UK Scientific Centre. PRTV (Peterlee Relational Test Vehicle)
System R INGRES.
.
137
,
. ,
, .
:
SQL Server 2000 Microsoft (http://www.microsoft.com),
Oracle 10g Oracle (http://www.oracle.com),
DB2 Informix IBM (http://www.ibm.com),
Teradata Teradata (http://www.teradata.com),
6.1
( ).
.
(tuple). (attributes) . 6.1
. :
, , , ( ).
. (degree),
(cardinality).
6.1 5 3.
12
44
55
6977333222
6945123456
6937222999
. 12
. 13
.
12345
54321
11111
6.1: .
,
(domain) .
138
6.
.
,
, -10 . D1 , D2 , D3 , D4 D5
.
D1 x D2 x D3 x D4 x D5 . , N D1 x D2 x . . . x DN .
.
(data type)
(format). ,
, .
"6973755667" "6973-755667".
R, .
, . ,
,
,
.
, ( ).
-
. , ,
- .
(database schema),
, (database instance), .
(relation schema)
. , R N
A1 , A2 , ..., AN R(A1 , A2 , ..., AN ). ,
: (, , , ,
). R ( I(R))
-
139
, .
,
.
.
:
.
.
.
.
.
.
.
.
,
.
6.2
( )
.
, . , , .
. ,
, (candidate) (alternate) .
(secondary) .
140
6.
, (composite).
6.2 , .
.
.
.
(
, ).
, . ,
,
.
12
44
55
100
101
103
6977333222
6945123456
6937222999
12
44
44
55
55
100
101
103
101
103
. 12
. 13
.
12345
54321
11111
1
2
2
1/1/2003
21/9/2002
21/9/2002
30/9/2002
1/1/1999
31/12/2003
30/6/2003
30/6/2003
5/2/2003
31/12/2003
6.2: , .
141
6.3
(integrity constraints)
. (,
, ).
(valid instance)
.
. ,
,
. : )
, ) , ) , ) .
6.3.1
. , (NULL).
, ,
6.3. xxxx
NULL. "Kluwer Academic Publishers"
NULL.
,
.
"ACM Press".
1
2
3
4
5
xxxx
NULL
xxxx
xxxx
xxxx
NULL
xxxx
xxxx
xxxx
xxxx
6.3: NULL .
.
NULL ,
142
6.
.
.
6.3.2
(entity integrity) . . ,
,
.
6.3.3
k A B, k (foreign key)
B. 6.2. ,
,
. ,
. (referential integrity)
. , 12, 44 55
. ,
.
, .
: =23,
=100, =1/1/2002, =5/5/2003.
23,
.
.
,
.
.
,
.
143
6.3.4
,
(semantics)
.
. , ,
. ,
. , .
,
, .
6.4
. ,
.
. ,
.
. ,
.
. ,
.
6.4.1
,
(, 1:1, 1:, :)
.
1:1. 1:1,
, .
144
6.
, . ,
.
( ). ,
. (NULL) .
1:1, ,
. ,
. ,
- . ,
,
. ,
, .
,
1:1,
.
, ( ).
.
1:. 1: :1, ,
. ,
, . ,
1 , (
) ( ).
1: :1,
, .
, , -
145
. ,
( ).
,
,
.
4.1 , :1.
. ,
. ,
. ,
.
:1. ,
. 6.4.
,
, , ,
,
.
<
<
>
>
6.4: .
:. :, . ,
146
6.
,
( ).
, ,
.
, 4.1
, :
.
6.2.
, .
, (. 6.4)
. ,
. ,
. ,
.
,
.
:
1. ,
( ) . 1:1 ,
.
2.
1:1 1: :1,
.
1
( ).
147
3.
:,
.
.
, 6.5
4.1.
(, , , , , , , )
( , )
(, , )
( , , , )
(, , , , , , , )
( , )
(, , PDF, , ,
, , ,
, , , )
( , )
(, , , , , , )
( , )
(, , )
(, , , , ,
)
6.5: 4.1 .
6.4.2
. ,
.
.
.
, .
148
6.
, , ( ).
, ( ) ...
. ,
1,
.
6.6:
.
6.6, ,
, .
149
,
, 1 .
6.6. 1. ,
.
.
, 4.1. ,
,
( ). , .
.
() .
(;).
(.
6.5).
. . ,
(
) ,
. ,
.
/. /. 4.11
( )
( ). .
150
6.
- ,
.
. , ,
. ,
"" .
,
.
. , .
4.12. . ,
,
( ).
6.5
(ANSI-SPARC)
.
. (view) .
. (virtual)
(derived) . (base relation) ,
(. 6.7). .
. , ,
. ,
, (read only).
:
,
151
6.7: .
, ,
,
(. 9).
. , 6.8.
PDF ( PDF).
. , 6.8
PDF 1. 6.8
, . ,
6.8
PDF .
SQL.
.
(materialized). -
152
6.
1
2
3
1
2
3
1
2
3
1
1
2
1
1
2
1
1
2
PDF
NULL
NULL
NULL
PDF
1.pdf
2.pdf
NULL
PDF
1.pdf
2.pdf
3.pdf
6.8: .
.
.
.
. ,
(, , )
, ,
. ,
.
153
6.6
Codd 1970 [Codd 1970]
.
. ( ) .
( ).
. .
.
, . : ,
.
.
, .
6.1. .
.
6.2. ;
.
6.3.
. .
6.4. . (NULL)
.
6.5. (NULL)
.
154
6.
6.6. , .
6.7. ,
.
(,
, )
. .
6.8. ,
.
.
.
6.9. /
. .
6.10. ,
.
; .
6.11. .
.
6.12. .
R(A,B,C).
.
6.13. ,
. -
:
A
a1
a2
B
b
b
B
b
b
155
C
c1
c2
.
6.14. ,
video club.
.
6.15.
() () . :
.
;
7.1
.
157
158
7.
(unary), (binary).
,
.
,
.
4.1,
7.1. ,
.
7.1 ,
.
12
44
55
100
101
103
6977333222
6945123456
6937222999
12
44
44
55
55
100
101
103
101
103
. 12
. 13
.
12345
54321
11111
1
2
2
1/1/2003
21/9/2002
21/9/2002
30/9/2002
1/1/1999
31/12/2003
30/6/2003
30/6/2003
5/2/2003
31/12/2003
7.1: , .
7.1.1
.
. ,
.
159
(R)
,, (R)
R1 R2
R1 R2
R1 R2
R1 R2
R1 1 R2
R1 R2
R1 1 R2
R1 o R2
R1 n R2
R1 R2
R1 R2
XA
7.1: .
.
(select)
. "",
, . ,
= 12.
:
=12 ()
,
7.2.
.
( ), ( )
. , . ,
160
7.
=
<
>
6=
7.2: .
5 50, :
<5 >50 ( )
,
. ,
. ,
"1/1/2000"
.
. .
( ) :
>1/1/2000 = ( )
:
>1/1/2000 ( = ( ))
,
.
161
(project)
. "". ,
.
, ()
,
.
20 (.
7.2).
, ( > 20 ())
6945123456
6937222999
162
7.
, (
).
, R.
R.
. . ,
,
.
(. 7.3):
., ., , ( )
.
12
44
55
12
44
55
12
44
55
100
100
100
101
101
101
103
103
103
7.3: .
,
.
. (rename) ""
.
163
:
1. (E), E ,
2. (,,) (E), E , ( ).
(union) .
.
:
1. ,
2. .
,
5 50. :
<5 >50 ( )
:
<5 ( )
>50 ( )
.
:
( ) ()
164
7.
(set difference) , .
.
.
7.1.2
(expressive power).
, , .
(intersection)
.
, .
,
, . :
() ()
:
R1 R2 = R1 (R1 R2 )
R1 R2
.
,
.
(natural join), 1.
R1 (a, b, c) R2 (a, d). a . 7.4
:
a
1
2
3
4
b
10
20
30
40
c
100
200
300
400
R1
a
1
2
3
5
d
123
321
111
222
R2
a
1
2
3
b
10
20
30
165
c
100
200
300
d
123
321
111
R1 1 R2
7.4: .
, .
,
. ,
a,
a R1 a R2 .
a, b d :
a,b,d (R1 1 R2 )
, :
a,b,d (
R1 .a=R2 .a
(R1 R2 ))
,
:
R1 1 R2 = R1 R2 .
-
. - (-Join) ( 1 ) , ()
. 7.5 , : R1 .a < R2 .x.
166
7.
a
1
2
3
4
b
10
20
30
40
c
100
200
300
400
x
1
2
3
5
a
1
1
1
2
2
3
4
y
123
321
111
222
R1
R2
b
10
10
10
20
20
30
40
c
100
100
100
200
200
300
400
x
2
3
5
3
5
5
5
y
321
111
222
111
222
222
222
R1 1R1 .a<R2 .x R2
7.5: -.
.
(outer join)
,
. ,
(left outer join) (right outer join).
o n.
7.6 R1
R2 7.4.
a
1
2
3
4
5
b
10
20
30
40
c
100
200
300
400
NULL
NULL
NULL
222
d
123
321
111
a
1
2
3
4
b
10
20
30
40
c
100
200
300
400
d
123
321
111
NULL
a
1
2
3
5
b
10
20
30
c
100
200
300
NULL
NULL
d
123
321
111
222
7.6: , .
(
) , . ,
, -
167
NULL.
,
(full outer join)
.
, , NULL.
,
.
(semijoin) -,
.
(left semijoin) (right semijoin), , . R1 R2
, : R1 R2
R1 R2 , . 7.7
, - R1 .a = R2 .a, R1 , R2
7.4.
a
1
2
3
b
10
20
30
c
100
200
300
a
1
2
3
d
123
321
111
7.7: .
, . , .
(assignment)
. .
, : =
168
7.
>1/1/2000.
:
>1/1/2000 ( = ( ))
, :
X = ( )
>1/1/2000 (X)
(division)
" " " ".
R S, R
X, S Y ,
Y X. Z
Z = X Y (, Z X Y ). R S
C :
T 1 Z (R)
T 2 Z ((S T 1) R)
R S T1 T2
, R S 7.8,
X A1, A2, A3, A4, A5
Y A1, A2, A3. , C = {A4, A5}.
R S 7.8.
A1
1
2
4
4
A2
1
2
2
2
A3
2
2
8
8
A4
3
2
8
3
A5
3
2
8
3
A1
1
4
A2
1
2
A3
2
8
R
7.8: .
A4
3
A5
3
RS
169
7.2
(relational calculus) .
, .
: (tuple relational calculus)
(domain relational calculus).
.
7.2.1
:
{t | E(t)}
t E(t)
(true) (false). :
t[x] x t,
t R t () R.
E(t)
. .
. (formula)
(atoms), :
t R, t R .
/ .
s[x] ~ t[y], s t , x y ~
7.2.
t[x] ~ C, C
x.
:
170
7.
.
E , : E (E).
E1 , E2 , : E1 E2 , E1
E2 , E1 E2 .
E(t) t ,
: s R(E(s)) s R(E(s)).
s R(E(s)) : " s R
E(s) ". , s R(E(s))
: " s R E(s)".
:
E1 E2 = (E1 E2 )
s r(P (s)) = s r(P (s))
E1 E2 = E1 E2
:
1: " ".
t .
:
{t | t t [ ] 1}
. , :
{t | s (t[] = s[] s[ ]
1)}
: " t
s
171
t s s 1."
2: " 1 2".
t .
:
{t | t (t[ ]=1 t[ ]=2) }
3: "
".
,
(NULL). .
, . :
{t | t (t[ ] 6= NULL t[ ] 6= NULL)
}
4: " ".
t, s, u ,
. :
{t | s (s[]= s[]=
) u (t[]=u[ ]
u[ ] = s[] )}
7.2.2
(domain variables),
172
7.
. :
{hx1 , x2 , . . . , xn i | E(x1 , x2 , . . . , xn )}
xi ( 1 i n) E .
,
. :
hx1 , x2 , . . . , xn i R, R n
xi ( 1 i n)
.
x~y, x, y ~
7.2.
x ~ C, C x.
:
.
E , : E (E).
E1 , E2 , : E1 E2 , E1
E2 , E1 E2 .
E(x) x , : x r(E(x)) x r(E(x)).
.
,
.
1: " ".
a, b, c , , , .
173
:
{ha, b, ci | ha, b, ci c 1}
, :
{hbi | ha, b, ci(ha, b, ci c 1) }
2: " 1 2".
x1 , . . . , x12 ,
(x1 = , x2 = , ...). :
{hx1 , . . . , x12 i | hx1 , . . . , x12 i (x1 = 1 x2 = 2)}
3: "
".
x1 , . . . , x12
(x1 = , x2 = , ..).
:
{hx1 , . . . , x12 i | hx1 , . . . , x12 i (x5 6= NULL x6 6= NULL) }
4: " ".
, ,
. hx1 , . . . , x8 i , hy1 , y2 , y3 i , hz1 , z2 , z3 , z4 i
. , -
174
7.
:
{hx1 , . . . , x8 i | hy1 , y2 , y3 i (y2 = y2 =
) hz1 , z2 , z3 , z4 i (x1 = z1 z2 = y1 )}
7.2.3
,
. , : {t | t
(t )}. . - (unsafe)
.
(safe).
- .
.
.
E , domain(E)
. , {t | t(t
)}
.
,
.
-.
- , .
7.3
.
.
: , , , , .
, . : ,
175
, -, , , , .
. ,
, . :
.
7.1. ;
7.2. ;
7.3. .
,
.
7.4. : , -, .
7.5. R1 , R2 N1 , N 2 , N1 >
N2 > 0. , ,
.
.
7.6. R(A1, A2, A3)
S(A4, A5, A6) :
R 1R.A1=S.A4 S
R 1R.A2=S.A5 S
R 1R.A2=S.A5AN DR.A3=S.A6 S
RS
7.7.
.
176
7.
A1
1
2
3
A2
10
20
10
A3
100
200
300
A4
1
3
1
A5
20
30
20
A6
300
400
100
7.8. .
, .
7.9. :
( , , )
( , , )
( , )
( , )
:
"COMPANY S.A."
"COMPANY S.A."
, "COMPANY S.A.",
1000 .
.
7.10.
.
7.11. , ,
, .
177
(normalization)
.
. ,
.
, , , .
[Dutka 1989]
.
8.1
8.2 .
,
.
179
180
8.
, .
. ,
.
8.1: .
044231211
044231211
044231211
.
.
.
. 12
. 12
. 12
2310888888
6977111222
2310888999
8.2: .
. ;
:
.
, . ,
.
, ,
.
.
.
, : 1) NULL ,
181
, 2) ,
.
.
, ,
.
.
8.3.
,
. , .
044231211
. 12
044231211
044231211
044231211
2310888888
6977111222
2310888999
8.3: .
.
.
(functional dependencies).
8.1
R A1 , A2 , . . . , An . X Y .
X Y X Y
. t1 t2
R. X Y
182
8.
t1 t2 X,
Y .
Y
(functionally dependent) X. Y
X
X 9 Y . , 8.3
: , : 9 .
(trivial)
.
,
: , .
(semantics) .
(constraints).
.
8.1.1
F
. ,
, . F .
F (closure)
F + . G
(is covered by) F
G F + .
F G (equivalent) F + = G+ .
.
Armstrong
[Armstrong 1974]:
1. (reflexive rule): Y X X Y .
2. (augmentation rule): X Y XZ Y Z.
3. (transitive rule): X Y Y Z X Z.
.
183
.
,
.
"",
.
(sound and complete) ()
, () F + . F +
Armstrong ,
F + .
1. (decomposition rule): X Y Z X Y
X Z.
2. (union rule): X Y X Z X Y Z.
3. - (pseudotransitive rule): X Y W Y
Z W X Z.
4. (accumulation rule): X Y Z Z BW
X Y ZB.
5. (general unification rule): X Y
Z W X (Z Y ) Y W .
Armstrong. .
. X A1 A2 ...An
{X A1 , X A2 , . . . , X An },
. - ,
. , ,
( )
.
, F W, U, V, X, Y, Z
: W U V, U Y, V X Y Z.
,
F + .
184
8.
F + W X Z
. , ,
W U V . W V ,
W X V X. ,
V X Y Z W X Y Z,
W X Z.
8.1.2
F +
F . , () F + .
, A B F + ,
.
X (attribute closure),
F ,
X
X + . A B,
A,
8.4.
1.
2.
3.
4.
X = A.
F
C D, C X. ,
D X.
2
X.
B X, A B
F + .
8.4: .
. F :
V Y Z, V Z W, W Y, V Y W
:
V Y, V Z, V Z W, W Y, V Y W
185
. ,
F ,
F .
V Y . :
1: X = V .
2: X = V Z V Z.
3: X = V ZW V Z W .
3: X = V ZW Y W Y .
3: .
4: Y V ZW Y , V Y (F {V Y })+
.
V Z :
1: X = V .
2: X = V Y V Y .
3: X = V Y W V Y W .
3: .
4: Z * V Y W , V Z 6 (F {V Z})+
.
V Z W ,
W Y , V Y W .
. ,
.
,
F 0 ( V Z W Y ),
F .
,
,
F
. , ,
F V Y V Z W ,
V Y W . , F
: V Z, W Y V Y W .
186
8.
8.1.3
(extraneous) . ,
X Y F A :
A X F (F {X Y })
{(X A) Y },
A Y (F {X Y }) {X (Y A)}
F .
F (minimal) (irreducible) :
F
.
X Y
Z Y Z X ( X Z ).
F
F .
Fmin
(minimal cover) (canonical cover) F Fmin
F .
F . 8.5
Fmin
F.
8.2
. (normal forms)
. ,
,
.
:
1.
2.
3.
4.
187
Fmin = F .
X {A1 , A2 , . . . , An } Fmin
{X A1 , X A2 , . . . , X An }.
X Y Fmin
B X,
(Fmin {X Y }) ({X B} Y )
Fmin , X Y {X B} Y
X Y Fmin ,
Fmin {X Y }, Fmin ,
X Y Fmin .
8.5:
.
, . 8.6 .
,
.
'
'
'
'
'
1NF
2NF
&
&
&
&
&
$
$
$
$
$
%
%
%
%
%
8.6: .
[Codd 1970],
Boyce-Codd [Codd 1972]. [Zaniolo 1976, Fagin 1977, Fagin 1979,
Fagin 1981]. Maier [Maier 1983] .
188
8.
8.2.1 (1NF)
. , .
.
,
.
. ,
. , ,
. ,
,
. 8.2
8.3
, .
. .
:
(, , , , ,
)
(
) .
. :
9
9
9
,
.
189
, :
.
.
.
8.2.2 (2NF)
. X Y A X
. , X Y
X, , .
. .
, ,
.
:
1. .
2. .
3.
.
, :
190
8.
(, )
( , , , )
(, )
.
,
.
:
.
.
.
.
, .
.
.
8.2.3 (3NF)
.
(transitive dependencies). X Y Y Z, Y
. Z X,
.
191
.
:
. .
. ,
:
(, )
( , , )
( , )
(, )
192
8.
Boyce-Codd. , , :
R( , , )
,
,
.
,
, .
, ( ).
, Boyce-Codd . ,
. ,
,
. , ,
. , R . R :
R1( , )
R1( , )
R1(, )
R2( , )
R2( , )
R2(, )
,
, .
.
8.2.5
.
. , R(X, Y, Z) 8.7, R1(X, Y )
R2(Y, Z).
:
X
x1
x2
x3
Y
y1
y1
y1
Z
z1
z1
z2
X
x1
x2
x3
Y
y1
y1
y1
Y
y1
y1
193
Z
z1
z2
8.7: .
R1 R2,
( 8.8).
.
.
(lossless
schemas) (losslessjoin decomposition).
X
x1
x2
x3
x1
x2
x3
Y
y1
y1
y1
y1
y1
y1
Z
z1
z1
z2
z2
z2
z1
8.8: .
R R1 R2,
F
.
F + :
R1 R2 R1 R2
R1 R2 R2 R1
F : X Y , :
194
8.
XY Y Z XY Y Z Y X
XY Y Z Y Z XY Y Z
, F +
.
: R1(X, Y ) R2(X, Z).
R, F ,
k > 2 , R1 , R2 , . . . , Rk ,
tableau
[Aho 1979b]. (),
A1 , A2 , . . . , An
R, R1 , R2 , . . . , Rk . H (i, j)
aj Aj Ri ,
bij . --
. X Y ,
X,
Y . bij
ai .
aj ( 1 j n), .
, R(X, Y, Z, W ) F : X Z, Y Z, Z W . R :
R1(X, Y ), R2(Y, W ), R3(X, Y, Z).
R1(X, Y )
R2(Y, W )
R3(X, Y, Z)
X
a1
b21
a1
()
Y
a2
a2
a2
Z
b13
b23
a3
W
b14
a4
b34
R1(X, Y )
R2(Y, W )
R3(X, Y, Z)
X
a1
b21
a1
()
Y
a2
a2
a2
Z
a3
a3
a3
W
b14
a4
b34
R1(X, Y )
R2(Y, W )
R3(X, Y, Z)
X
a1
b21
a1
()
Y
a2
a2
a2
Z
a3
b23
a3
W
b14
a4
b34
R1(X, Y )
R2(Y, W )
R3(X, Y, Z)
X
a1
b21
a1
()
Y
a2
a2
a2
Z
a3
a3
a3
W
a4
a4
a4
8.9: .
195
8.9. X Z. X
,
Y . 8.9.
Y Z.
Y ,
Z. 8.9. ,
Z W .
Z,
W , 8.9. aj ,
.
8.3
Boyce-Codd
, , .
[Teorey 1994].
8.3.1
. ( ) .
, .
, (multivalued) , . ,
R A, B, C ( R), A B
B A C.
A C [Fagin 1977].
, ,
( ).
,
. ,
196
8.
. , :
1. (reflexive rule): X X.
2. (augmentation rule): X Y Z W
W X Y Z.
3. (transitive rule): X Y Y Z X
Z Y.
4. (decomposition rule): X Y X Z
X Y Z X Y Z X Z Y .
5. (union rule): X Y X Z X Y Z.
6. - (pseudotransitive rule): X Y W Y
Z W X Z (Y W ).
7. (complementation rule): X Y X
R (XY ).
8. (coalescence rule): X Y , Z Y
W W Y = W Z,
X Z.
9. (replication rule): X Y X Y .
. , . , ,
.
8.3.2 (4NF)
8.10, ,
.
--,
( ),
( ).
1
1
1
1
2
2
3
3
3
3
C
C++
C
C++
Pascal
Fortran
Ada
Java
Cobol
C++
197
8.10: .
, .
.
Boyce-Codd .
.
8.11
.
,
, .
, ,
F + :
R1 R2 R1 R2
R1 R2 R2 R1
.
198
8.
1
1
2
2
3
3
3
3
C
C++
Pascal
Fortran
Ada
Java
Cobol
C++
1
1
1
2
3
8.11: .
8.3.3 (5NF)
,
, . ,
, . ,
. ,
,
(join dependencies).
R R1 , R2 , . . . , Rn
R, R = R1 R2 . . . Rn . R
R1 , R2 , . . . , Rn . , . ,
R :
R = R1 (R) 1 R2 (R) 1 . . . 1 Rn (R)
- (project-join normal form, PJNF)
. .
.
8.12 R -
199
8.12: .
.
. ,
. ,
.
8.13: .
8.13 R1(, ), R2(-
200
8.
, ) R3(, ), .
:
R = , (R) 1 , (R) 1 , (R)
8.4
.
,
, . , .
.
X Y Y
X. X,
Y .
.
F , , F +
.
. ,
.
.
(1NF), (5NF) .
,
Boyce-Codd (BCNF), ( X Y ) .
. ,
.
. , -
201
8.1. .
XY Z, Z X Z Y
X Y, Y Z X Y Z
F = {X Y, Y Z, XY Z, X Y Z}
G = {X Y, Y Z} {G F }
8.2. : X Y, XY V, XY Z W .
: Y Z W, X W .
8.3. F : X Y Z, Y
U V, XY W, V XY . V W
F .
8.4. : X Z, Y V W, Y
V, Y W, Z XV .
. .
8.5. ; BCNF
.
8.6. :
:
:
:
:
:
:
, ,
202
8.
:
R1(, , , )
R2(, , , )
:
;
,
.
8.7. R(X, Y ) X Y
Y X. :
X ;
Y ;
R ;
8.8. R(X, Y, Z, W ) Y Z W .
; .
8.9. R(X, Y , Z, W ) ZW Y .
; .
8.10. R(X, Y, Z, W ) Y Z.
:
X
1
2
3
4
5
6
Y
1
1
2
3
4
4
Z
1
1
2
2
3
3
W
1
1
2
3
3
4
203
;
;
Boyce-Codd;
8.11. R(X, Y, Z, U, V, W ) F :
X Y, X Z, Z W, XY Z U, U V .
, , BCNF, .
8.12. R(X, Y, Z) XY Z
Z X.
R R1(X, Y ) R2(X, Z).
8.13. R(X, Y, Z, U, V, W )
X Y W V . R R1(X, Y, U, V ), R2(X, Z, U, W ) R3(Y, Z, V, W ).
8.14. R(X, Y, Z, U, V ) .
X Y Z ZU Y V .
X
a1
a1
a2
Y
b1
b2
b1
Z
c1
c1
c1
U
d1
d2
d1
V
e1
e1
e2
8.15. 8.11.
8.10.
, .
.
SQL
206
9. SQL
. SQL3
19.
SQL ,
:
SQL, .
.
, SQL.
SQL
.
SQL .
(. 7). (. 3), SQL : )
(DDL), )
(DML). ,
, , . SQL
DDL SQL DML SQL-92.
SQL (table), (row),
(column), , , . SQL
, .
,
, .
,
4 6. , 9.1.
9.1 SQL
, . SQL-92
207
(, , , , , , , )
( , )
(, , )
( , , , )
(, , , , , , , )
( , )
(, , PDF, , ,
, , ,
, , , )
( , )
(, , , , , , )
( , )
(, , )
(, , , , ,
)
9.1: 4.1 .
, 9.1 .
BOOLEAN
CHARACTER, CHARACTER VARYING
BIT, BIT VARYING
NUMERIC, DECIMAL, INTEGER, SMALLINT
FLOAT, REAL, DOUBLE PRECISION
DATE, TIME, TIMESTAMP
INTERVAL
9.1: SQL-92.
(BOOLEAN) (TRUE)
(FALSE). TRUE
FALSE, BOOLEAN
.
(character data) (string).
. ASCII EBCDIC.
208
9. SQL
:
CHARACTER [VARYING] []
CHARACTER CHAR,
CHARACTER VARYING VARCHAR.
.
(
VARYING)
, .
,
, .
BIT BIT VARYING ( VARBIT)
(bits).
1 0. :
BIT [VARYING] []
,
.
.
.
( ).
.
. :
NUMERIC NUMERIC() NUMERIC(,)
DECIMAL DECIMAL() DECIMAL(,)
INTEGER INT
SMALLINT
209
,
.
.
INTEGER ( ), SMALLINT
( 32.767).
( )
.
, (mantissa)
(exponent) (.., 0.22 , 0.31416 ).
. REAL DOUBLE
PRECISION .
:
FLOAT [()]
REAL
DOUBLE PRECISION
DATE
(YEAR), (MONTH) (DAY).
0001 9999. 01 12. ,
01 31.
TIME
(HOUR), (MINUTE) (SECOND).
00 23. , 00 59. ,
00 59. TIME
.
TIMESTAMP, . TIME TIMESTAMP WITH TIME ZONE,
TIMEZONE HOUR TIMEZONE MINUTE
UTC (coordinated universal time).
DATE, TIME TIMESTAMP :
DATE
TIME [()] [WITH TIME ZONE]
TIMESTAMP [()] [WITH TIME ZONE]
210
9. SQL
. YEAR, MONTH,
DAY, HOUR, MINUTE, SECOND. : )
- ) -.
, , ,
. ,
. :
INTERVAL {{ TO } }
= YEAR | MONTH | DAY | HOUR
| MINUTE [(-)]
= YEAR | MONTH | DAY | HOUR
| MINUTE | SECOND [(-)]
= | SECONDS
[(-[, -])]
9.2
,
.
,
. SQL CREATE, ALTER
DROP,
.
9.2.1
SQL :
CREATE SCHEMA - AUTHORIZATION -;
AUTHORIZATION.
DROP SCHEMA . ,
.
211
9.2.2
CREATE TABLE,
:
CREATE TABLE -
(1 -,
2 -,
...
N -,
--1,
--2,
...
--);
.
, . ,
,
6.
DROP TABLE .
.
CREATE TABLE _
( INTEGER NOT NULL,
CHAR(50) NOT NULL,
_ INTEGER DEFAULT 0,
PRIMARY KEY (),
UNIQUE (),
CHECK (_>=0));
NOT NULL , . .
, PRIMARY KEY (),
, CHECK ( >=0). UNIQUE
. , UNIQUE
()
. DEFAULT , .
212
9. SQL
, .
CREATE TABLE _
( INTEGER NOT NULL,
VARCHAR(100) NOT NULL,
DATE NOT NULL,
CHAR(20),
__ INTEGER NOT NULL,
PRIMARY KEY (),
FOREIGN KEY (__)
REFERENCES _ ()
ON DELETE CASCADE
ON UPDATE CASCADE);
, -
. .
FOREIGN KEY ( ) REFERENCES
(). ON DELETE CASCADE ON UPDATE
CASCADE -
.
,
CASCADE.
, SQL ON DELETE ON UPDATE.
ON DELETE ON UPDATE
.
,
. SQL ALTER TABLE, :
,
,
,
,
213
,
(default) ,
.
,
/ . ALTER TABLE
:
ALTER TABLE
ADD COLUMN /_ DATE NOT NULL;
/ :
ALTER TABLE
DROP COLUMN /_;
DROP TABLE. :
DROP TABLE RESTRICT;
DROP TABLE CASCADE;
(..,
). ,
.
9.2.3
SQL
. :
CREATE DOMAIN --
[AS] -
[DEFAULT ]
[CHECK ()];
, ,
"" () "" ().
214
9. SQL
,
.
;
,
CREATE TABLE.
.
CREATE DOMAIN AS CHAR (20)
DEFAULT
CHECK (VALUE IN (, , ));
,
,
.
,
,
.
:
CREATE TABLE
( INTEGER NOT NULL,
,
PRIMARY KEY ());
DROP DOMAIN :
DROP DOMAIN RESTRICT;
DROP DOMAIN CASCADE;
,
, . ,
CHAR(20).
215
9.3
SQL ,
.
SQL (data manipulation). SQL :
SELECT, ,
INSERT, ,
UPDATE, ,
DELETE, ,
9.3.1
SELECT, :
SELECT [DISTINCT] < >
FROM < >
[WHERE ]
[GROUP BY < >]
[HAVING ]
[ORDER BY < > [ASCENDING | DESCENDING]];
SELECT ,
1 . DISTINCT
SELECT
. FROM
. WHERE. GROUP BY
(grouping) .
HAVING. , SQL
,
.
ORDER BY,
1
216
9. SQL
SELECT , ,
FROM ;
"*" ALL
. ,
.
2: " ."
SELECT
FROM ;
3: " ."
217
SELECT DISTINCT
FROM ;
4: " ,
,
,
."
SELECT ,,
FROM
WHERE =
ORDER BY , ;
5: " ."
SELECT ,
FROM
WHERE _ IS NOT NULL AND
__ IS NOT NULL;
IS NOT NULL.
NULL
.
NULL (.., x = NULL, x <> NULL).
(. 7),
. ,
(. 5) (.
8), .
WHERE2 ,
.
6: "
."
2
FROM SQL.
218
9. SQL
SELECT .,,
FROM ,_,
WHERE .=_ AND
__=_.;
.
, . ,
. ,
.
.
7: "
.
"
SELECT .,.
FROM , , _
WHERE .=_._ AND
_._=.
ORDER BY .;
8: "
."
SQL
. ,
. SQL
:
SELECT .,_.
FROM ,_
WHERE _.=__;
SELECT .,_.
FROM JOIN _
ON _.=__;
219
,
.
UNION .
10: " ( )
."
SELECT
FROM
INTERSECT
SELECT
FROM ;
220
9. SQL
, .
INTERSECT,
.
11: "
."
SELECT ,
FROM
EXCEPT
SELECT ,
FROM
WHERE _ IS NOT NULL;
,
.
.
EXCEPT,
:
SELECT ,
FROM
WHERE _ IS NULL;
SQL ( ).
SELECT .
:
12: "
."
SELECT SUM( )
FROM ;
SUM( ).
221
.
. AS SELECT :
SELECT SUM( ) AS
FROM ;
AS FROM SELECT.
.
. (A, B),
A .
13: "
."
SELECT A. AS , B. AS
FROM _ AS A, _ AS B
WHERE A._ < B._;
(aggregate functions) . SQL
:
,
MAX ,
AVG ,
SUM, ,
COUNT, .
SQL.
14: " ."
222
9. SQL
SELECT COUNT(.)
FROM ;
15: "
1."
SELECT COUNT( . )
FROM
WHERE . =1;
. ,
.
.
,
( ).
,
GROUP BY ( HAVING
).
16: " ."
SELECT , COUNT(_) AS _
FROM ,_
WHERE =_
GROUP BY ;
GROUP BY WHERE.
GROUP BY
.
.
.,
.
SQL GROUP BY .
SELECT
. 9.2
223
1
1
2
2
3
4
4
2
3
3
2
2
2
1
2
3
4
6
7
9
10
12
14
13
5
4
1
2
3
4
A. Guttman
D. Knuth
J. Gray
A. Corral
...
...
...
...
...
A. Guttman
D. Knuth
J. Gray
A. Corral
2
6
3
2
9.2: .
HAVING,
GROUP BY. HAVING
. ,
,
, WHERE SQL.
17: " ."
SELECT ,COUNT(_) AS _
FROM , _
WHERE =_
GROUP BY
HAVING _>3;
224
9. SQL
SQL .
. ,
(.., ).
LIKE NOT LIKE.
18: "
."
SELECT *
FROM
WHERE LIKE \%;
"%" .
"%" ,
. ,
"".
" " .
,
. NOT LIKE ,
.
9.2 LIKE.
SQL
. .
WHERE HAVING SQL3 .
19: "
."
SELECT
FROM _
WHERE _ >
3
INSERT, UPDATE
DELETE.
%
%
%%
225
,
,
,
9.2: LIKE.
(SELECT AVG(_)
FROM _);
. ,
, , .
20: "
."
SELECT
FROM _
WHERE NOT IN
(SELECT __
FROM );
,
. ,
, . ,
.
226
9. SQL
IN NOT IN.
SQL.
EXISTS
.
EXISTS
. .
21: "
."
SELECT _
FROM _ AS
WHERE EXISTS
(SELECT *
FROM
WHERE =._ AND
_ IS NOT NULL AND
_ IS NOT NULL);
23: "
."
SELECT
FROM _
227
WHERE _>ALL
(SELECT _
FROM _);
HAVING, :
24: "
,
."
SELECT _,
COUNT (_) AS _
FROM _
GROUP BY _
HAVING _ >
(SELECT COUNT(*)/10
FROM _);
H SQL
, . ORDER BY .
25: "
."
SELECT ,_
FROM _
WHERE _ > 100
ORDER BY ASC;
ASC .
DESC.
26: "
."
228
9. SQL
SELECT ,_
FROM _
WHERE _ > 100
ORDER BY DESC;
.
,
.
27: "
.
."
SELECT ,_
FROM _
WHERE _>100
ORDER BY _,;
SQL WHERE .
BETWEEN ( NOT BETWEEN)
. BETWEEN.
28: "
10
20."
SELECT
FROM _
WHERE _>=10 AND
_<=20;
:
SELECT
FROM _
WHERE _ BETWEEN 10 AND 20;
229
OVERLAPS .
( , ) ( , ).
TRUE,
FALSE. ,
WHERE
:
(TIME 10:43:00, TIME 11:43:00)
OVERLAPS
(TIME 10:50:00, TIME 11:10:00)
, ,
. TIME DATE
TIMESTAMP.
9.3.2
, . , , .
SQL .
INSERT,
:
INSERT INTO - [(1,2,...,)]
VALUES (1, 2, ..., N);
-- VALUES.
.
.
, (NULL).
INSERT ,
. ,
. :
INSERT INTO _
VALUES (10, , 0);
230
9. SQL
.
10, "
" 0.
,
:
INSERT INTO _ (,)
VALUES ( , 10);
.
,
, . , (NULL).
. ,
--
INSERT, ,
. , SQL SELECT .
(, )
. INSERT
:
INSERT INTO _
AS
SELECT ,
FROM
WHERE _ IS NOT NULL AND
_ IS NULL;
9.3.3
. ,
.
,
. SQL UPDATE :
UPDATE -
SET (1=1,2=2, ...,N=N)
WHERE ;
231
WHERE .
,
. , . ,
0
!
UPDATE _
SET (_=0);
9.3.4
.
, .
:
DELETE FROM -
WHERE ;
WHERE,
. ,
.
:
DELETE FROM ;
DELETE FROM _
WHERE _=0 AND NOT IN
(SELECT DISTINCT __
FROM );
.
.
232
9. SQL
9.4
5,
, .
SQL CREATE VIEW
:
CREATE VIEW -
AS
( SQL);
,
SELECT SQL.
.
:
CREATE VIEW __
AS
(SELECT FROM
UNION
SELECT FROM _);
. , INSERT, UPDATE DELETE
. ,
,
.
,
.
, . ,
.
INSERT,
UPDATE DELETE,
.
DROP VIEW:
DROP VIEW ;
233
SQL .
, ,
WHERE.
CREATE INDEX DROP INDEX .
9.5
SQL (structured query language) 1986
. SQL
.
:
SQL, .
(
, , ,
...)
, SQL.
SQL
.
,
SQL SQL:1999 (
SQL3). , SQL:1999 .
9.1. SQL.
9.2. SQL
CHAR VARCHAR.
9.3. R(, , ).
234
9. SQL
SQL ,
.
SQL : (1, "", ""), (2, "", "") (3, "", "").
SQL :
.
SQL
R.
235
SQL
.
9.6. , SQL
,
1000 .
9.7. SQL
.
9.8.
.
9.9.
:
,
.
9.10. .
INSERT
.
10
MSSQLS-2000
MSSQLS-2000 .
SQL
Query Analyzer. MSSQLS-2000 T-SQL
(Transact-SQL) SQL-92.
MSSQLS-2000
.
, (video club). ,
5.
movies-db.
10.1.
, ,
. DVD VHS
.
237
238
10. MSSQLS-2000
1
2
3
4
5
6
7
The others
Armagedon
Contact
Midnight run
Fifth element
DVD
3
2
6
2
7
0
0
VHS
3
1
5
1
7
4
5
1
2
3
4
5
6
7
Nicole Kidman
Jodie Foster
Bruce Willis
Robert de Niro
Charles Grodin
1
2
3
3
4
5
6
7
1
3
2
5
4
4
7
6
10.1: .
10.1
MSSQLS-2000
Enterprise Manager T-SQL.
, ,
.
Enterpsise Manager
. 10.2
Enterprise
Manager. .
.
MSSQLS-2000 SQL-92. -
239
unicode
oolean
CHAR[(n)], VARCHAR[(n)], TEXT
NCHAR[(n)], NVARCHAR[(n)], NTEXT
BINARY[(n)], VARBINARY[(n)], IMAGE
DATETIME, SMALLDATETIME
INT, BIGINT, SMALLINT, TINYINT
DECIMAL[(p[,s])], NUMERIC[(p[,s])]
FLOAT[(n)], REAL
MONEY, SMALLMONEY
10.1: MSSQLS-2000.
T-SQL.
MSSQLS-2000 SQL Query An-
240
10. MSSQLS-2000
10.3 -
241
Query Analyzer.
"The command(s) completed successfully".
.
";" .
,
, .
Enterprise Manager,
T-SQL Query Analyzer.
ALTER TABLE,
9.
10.2
. MSSQLS2000
6. :
PRIMARY KEY (1,..., ): .
NOT NULL: .
FOREIGN KEY:
.
UNIQUE:
.
DEFAULT: .
CHECK:
.
, .
, ,
.
, ALTER
242
10. MSSQLS-2000
Manager.
:
CREATE TABLE
( INT NOT NULL,
VARCHAR(100) NOT NULL,
VARCHAR(20) DEFAULT ,
DVD INT DEFAULT 0,
VHS INT DEFAULT 0,
PRIMARY KEY (),
UNIQUE (),
CHECK (DVD>=0),
CHECK (VHS>=0));
, DVD
:
ALTER TABLE
ADD CONSTRAINT CHECK (DVD<20);
. .
.
, ,
6. T-SQL:
CREATE TABLE
(_ INT NOT NULL,
_ INT NOT NULL,
PRIMARY KEY (_,_),
FOREIGN KEY (_)
REFERENCES ()
ON DELETE CASCADE
ON UPDATE CASCADE,
FOREIGN KEY (_)
REFERENCES ()
ON DELETE CASCADE
ON UPDATE CASCADE);
243
10.3 ,
,
Enterprise Manager Query Analyzer.
Enterprise Manager
,
.
. moviesdb "Open Table" "Return all
Rows" ( ) . 10.4
.
Nicole Kidman
Jodie Foster
Bruce Willis
Robert DeNiro
Charles Grodin
244
10. MSSQLS-2000
INTO
(1, Nicole Kidman);
INTO
(2, Jodie Foster);
INTO
(3, Bruce Willis);
1 :
DELETE FROM
WHERE =1;
, 1 :
UPDATE
SET =Tom Cruse WHERE =1;
,
WHERE ,
.
10.4 -
MSSQLS-2000
. Enterprise Manager, "Diagrams".
10.5 movies-db. ,
.
. 10.6
.
, ,
245
10.5: movies-db.
10.6: movies-db.
.
246
10. MSSQLS-2000
.
.
10.5
T-SQL SELECT ... FROM ... WHERE
.
:
SELECT [DISTINCT] < >
FROM < >
[WHERE ]
[GROUP BY < >]
[HAVING ]
[ORDER BY < >[ASCENDING | DESCENDING]];
Query Analyzer.
.
Query Analyzer.
1. :
3 DVD.
T-SQL:
SELECT *
FROM
WHERE DVD>3;
2. :
2 DVD 3 VHS.
T-SQL:
247
SELECT ,
FROM
WHERE DVD>=2 AND VHS<=3;
3. : .
T-SQL:
SELECT
FROM ;
4. : , .
T-SQL:
SELECT ,
FROM ,,
WHERE .=._ AND
.=._;
248
10. MSSQLS-2000
SELECT. WHERE
, .
:
5. : DVD VHS
.
T-SQL:
SELECT SUM(DVD) AS total_DVD, SUM(VHS) AS total_VHS
FROM ;
SELECT
.
WHERE.
SUM.
MSSQLS-2000,
.
10.2. 10.3 ,
10.4 .
MSSQLS-2000.
AVG
MAX
MIN
SUM
COUNT
10.2: .
ABS(n)
ACOS(n)
ASIN(n)
ATAN(n)
ATAN2(n,m)
CEILING(n)
COS(n)
COT(n)
DEGREES(n)
EXP(n)
FLOOR(n)
LOG(n)
LOG10(n)
PI()
POWER(x,y)
RADIAN(n)
RAND
ROUND(n,p)
ROWCOUNT
SIGN(n)
SIN(n)
SQRT(n)
TAN(n)
n
n
n
n
n/m
n
n
n
n
en
n
n
10 n
(3.14...)
xy
n (RAD)
0 1
n p
T-SQL
n :
-1 , +1 0
n
n
n
10.3: .
249
250
10. MSSQLS-2000
ASCII(c)
CAST(a AS [()])
CHAR(n)
CONVERT([()],a)
CHARINDEX(s1,s2)
DIFFERENCE(s1,s2)
LOWER(s)
LTRIM(s)
NEWID()
PATINDEX(s,)
REPLICATE(s,i)
REVERSE(s)
RIGHT(s,)
RTRIM(s)
SOUNDEX(a)
SPACE()
STR(f,[[,d]])
STUFF(s1,a,,s2)
SUBSTRING(a,s,)
UPPER(s)
c
ASCII
a
ASCII n
CAST
s1 s2
SOUNDEX
s1 s2
s
s
16 bytes
UNIQUEIDENTIFIER
s
s i
s
s
s
SOUNDEX
f
d
s1 s2
a
s
a
s
10.4: .
251
SOUNDEX. SOUNDEX
.
.
.
.
26 73 = 8918 .
SOUNDEX
. SOUNDEX
.
,
. SOUNDEX
:
.
.
.
A,E,I,O,U,Y H,W.
B,F,P,V 1.
C,G,J,K,Q,S,X,Z 2.
D,T 3.
L 4.
M,N 5.
R 6.
.
.
, "MacCloud"
"M243" "Smith" "S53". ,
SOUNDEX DIFFERENCE,
.
252
10. MSSQLS-2000
10.6
MSSQLS-2000 Enterprise Manager T-SQL
Query Analyzer.
, DVD VHS
.
(Views) movies-db
Enterprise Manager. ,
.
. , . .
SQL,
.
10.7.
253
T-SQL
CREATE VIEW, :
CREATE VIEW -} [< >]
[WITH{ENCRYPTION|SCHEMABINDING|VIEW_METADATA}[,...n]]
AS
SELECT
[WITH CHECK OPTION];
WITH ENCRYPTION, WITH SCHEMABINDING WITH VIEW METADATA.
.
. WITH ENCRYPTION,
,
.
.
WITH SCHEMABINDING , .
. , , . WITH SCHEMABINDING
, .
WITH VIEW METADATA
.
ODBC, JDBC, OLE DB.
CREATE VIEW
WITH CHECK OPTION .
,
WHERE ( ).
,
DVD
2. :
CREATE VIEW _
AS
254
10. MSSQLS-2000
SELECT *
FROM
WHERE DVD>2
WITH CHECK OPTION;
DVD,
.
. SELECT
T-SQL. , MSSQLS-2000
,
.
(materialized view) (indexed view).
,
SELECT (.
6).
10.7
MSSQLS-2000 .
SQL
Query Analyzer. MSSQLS-2000 T-SQL
(Transact-SQL), SQL-92.
MSSQLS-2000 (movies-db) .
T-SQL SQL Query
Analyzer. , Enterprise Manager
-.
, Enterprise Manager
SQL Query Analyzer.
10.1. MSSQLS-2000.
255
10.2. MSSQLS2000; .
10.3. Enterprise Manager movies-db. , Query Analyzer
T-SQL movies-db, , .
10.4. . ,
UPDATE
.
10.5. T-SQL Query Analyzer
VHS DVD
.
10.6 T-SQL Query Analyzer .
10.7 T-SQL Query Analyzer .
10.8. movies-db ( , ),
.
10.9. MSSQLS-2000;
.
10.10. MSSQL-2000
4.1.
III
.
. . 11
,
.
.
12
13. 12 , B- . 13
.
. 14
. ,
. 15
, . 16
. , 17 MSSQLS-2000.
11
,
, .
,
.
. .
:
32 bit,
4 GBytes. .
, .
259
260
11.
.
,
.
. 3 . 11.1
:
(disk space manager disk storage
manager),
,
.
11.1: .
. ,
261
,
,
( ).
. ,
.
/
.
.
(CPU)
/ .
(interface),
:
(channel),
(I/O processor),
(data bus).
. , ,
. bytes,
bytes
.
.
(selector) ,
.
(multiplexor channel) .
/ ,
262
11.
CPU-
CPU
E/E
E/E
E/E
E/E
11.2: .
. 11.2
. ,
/.
11.1
.
(layout).
. 11.3
.
30 bytes
40 bytes
4 bytes
3 bytes
4 bytes
11.3: .
(fixed length records). .
, -
263
(arrays).
,
(variable length records). , .
,
, :
,
,
,
.
:
(variable length fields).
,
.
,
,
.
, , ...
(variable format records). ,
,
, . 11.4
.
, . ,
=
11.4: .
264
11.
. ,
.
.
.
(repeating groups).
. , .
. 11.5
. ,
(. 8).
11.5: .
. ,
,
.
, :
(delimiters) (separator marker) ,
11.6.
.
$ $
11.6: .
265
,
(offset) .
11.7 .
.
"
!
&%
11.7: .
NULL,
. ,
NULL ,
.
. :
(shifting) ,
.
, .
, ,
.
11.2
(page header), , ,
... , ,
(slots)
. ,
266
11.
m
1
101...01
1
11.8: .
11.8 . ,
. ,
, ,
.
, . ,
, . ,
,
.
(directory of slots), (position table)
267
, . ,
< ,
> (<record offset, record length>). ,
,
.
O
.
.
.
, < , > <
>, (length indicator)
. , .
11.3
,
. , ,
. ,
. (blocking factor,
Bf r) .
, :
B
Bf r =
R
, R , Bf r
R .
, R .
, R/2, :
Bf r =
B R/2
R
268
11.
n ,
:
n
b =
Bf r
, :
B
btt =
t
t bytes/ms.
T , 2r
( r ). :
btt =
T
2r
,
.
:
,
(interleaving) .
,
. ,
.
1
1
2
8
3
5
4
2
5
9
6
6
7
3
8
10
9
7
10
4
11.9: .
11.9 .
10 10
269
. ,
. , R1
S1, S4
R2. .
, . .
1:1,
.
. ( ) ,
btt , ebt, (effective block transfer time)
:
B
ebt = 0
t
0
t
bytes/ms. 11.1
3380.
.
-
,
, btt
, C
, ebt
, N
, r
, s
, t
, t0
2400 bytes
0,8 ms
600
0,84 ms
885
8,3 ms
16 ms
3000 bytes/ms
2857 bytes/ms
11.1: 3380.
, , b ,
270
11.
:
b ebt
:
b (s + r + ebt)
s ms, r ms.
(header) (control block)
.
, .
11.4
.
,
.
,
.
(
), (bucket)
.
, EDS8 ICL
1 , 2, 4 8 ,
Vax 1
65.535 512 bytes, default 3 .
,
8 512 bytes.
. 160 bytes,
256 bytes. : ,
, ,
,
(internal fragmentation).
11.2 , 1 8.
1
2
3
4
5
6
7
8
160
320
480
640
800
960
1120
1280
1
2
2
3
4
4
5
5
256
512
512
768
1024
1024
1280
1280
271
63%
63%
94%
83%
78%
94%
88%
100%
11.2: .
63% 100%, .
11.10
8.
11.10: .
:
U =
R Bf r
S P pb
P pb :
R Bf r
P pb =
S
S bytes.
,
:
bk dtt
b dtt
(data transfer data) ,
:
bk (s + r + dtt)
272
11.
. ,
, . ,
:
n (s + r + dtt)
,
,
.
,
. , ,
.
, .
.
.
100%,
.
,
,
.
.
:
, (garbage collection)
,
, 1 0 , .
,
,
. (fragmentation) .
273
(extents), , ,
. ,
. .
,
:
.
.
(spanning).
( ).
. ,
.
11.5
. PC 512 MBytes ,
.
, .
,
. ,
,
.
,
.
(buffer memories)
,
:
(hardware buffers), ,
274
11.
(software buffers), .
, ,
.
, , .
. 11.11
, .
.
@
I
@
@
@
@
R
11.11: .
,
1.000.000 (, 4 GBytes
4 Kb). .
,
.
, ,
(frames),
,
(buffer pool).
:
, ,
,
275
,
,
,
.
,
(dirty), . (pin count) bit,
010 02 .
pin count ( "" - pinning),
( "" - unpinning).
, , (victim),
.
pin count (page replacement) ( ). ,
dirty bit.
bit 0,
, 1
.
pin count. ,
.
(virtual memory)
. , ,
(page
reference patterns), , (join) ...
:
,
276
11.
,
- (prefetching)
.
/ . ,
- ,
. (locality), (hit
ratio), .
, -
,
.
-
, ,
.
,
single buffering, .
. ,
.
(user program area),
11.11.
.
.
.
"" .
277
, ,
.
double buffering.
,
.
.
,
. ,
. ,
,
.
(buffer swapping).
( CPU)
( /),
. 11.12 /
.
.
I/O
..
.
CPU
A
B
C
D
A
B
C
..
.
A
A/C
C
..
.
B
B/D
..
.
11.12: .
,
. 11.13 , CPU
/. ,
278
11.
I/O
A
B
..
.
CPU
..
.
A
A
A
B
B
B
A
A
A
A/C
C
C
..
.
B
B
B
B
B
..
.
11.13: . O
CPU /.
:
dte b ebt
t CPU /.
(multiple buffering). , /,
double buffering .
11.5.1
. , .
, single buffering double
buffering . ,
,
.
,
.
(hit ratio) . ,
. ,
279
.
,
.
.
(random)
. ,
:
, - FIFO (first-in first-out).
. ,
.
,
,
.
- LFU (least-frequently used). .
.
LFU FIFO,
.
, .
- LRU (least-recently used). .
. ,
,
.
,
pin count 0. .
- MRU
(most recently used) .
(clock). ,
(current),
280
11.
. current pin count
0, current ,
pin count 0.
, . ,
10 , 10
.
,
. 11 ,
, ...
, 0.
(sequential flooding).
.
1, 2, 3,
4.
:
1, 2, 3, 4, 2, 2, 1, 2, 1, 1
. FIFO LRU
. 11.14
.
. . LRU
FIFO .
.
11.5.2
, .
(service queue) ,
:
F
281
282
11.
,
. , .
- SCAN. ,
.
, .
C-SCAN SCAN.
.
.
LOOK C-LOOK. SCAN CSCAN, .
, .
.
11.6
. ,
.
.
. ,
,
.
.
. ,
.
,
.
283
11.1. n = 20.000
. : (30 bytes),
(4 bytes), (40 bytes), (8 bytes), (8
bytes), (1 byte), (8 bytes), (1 byte).
byte . :
, R.
, Bf r, , b,
Windows
.
.
11.2. ,
, . ;
11.3. 11.1,
() .
,
.
, , .
;
11.4. 90% , 60%
80% , . 11.1
.
;
284
11.
11.5.
256 bytes, 2560-3840 bytes
64, 72, 91, 240 400 bytes.
11.6. 30.000 100 bytes.
1000
.
,
;
10.000 .
11.7. 3380.
9600, 19.200 48.000 bytes.
11.8. 3380,
10.000 2.400 bytes,
1, 2 10
.
11.9. /
.
11.10. / /
single double buffering.
11.11.
; ;
11.12. .
11.13. CD
. CD
60 ,
99 . 500 /
100 bytes/ms. /
285
3
.
.
11.14. 4 (1, 2, 3 4).
3 .
1, 1, 2, 3, 4, 1, 2, 4, 4, 1, 4, 4,
3, 2, 1, 3, 4
LRU.
11.15. 11.14 ) FIFO ) MRU.
12
: ,
. , ( ) .
, ,
.
, ,
. ,
.
, . ,
.
( , ) . ,
/ . , ,
287
288
12.
. 12.1
.
1
12.1: .
(linear index),
. .
.
, .
, , .
(tree index) .
..., ( )
. ( ) : (heterogeneous)
(homogeneous) . ,
.
, (data pointers) (tree pointers).
,
.
12.2: .
289
12.2
, , . ,
,
.
,
.
. , ,
.
12
Q
? Q
Q
Q
52
?A
?A
10
19
56
12.3: .
12.3 12.4
, .
, .
,
.
.
"v
``
Z
"" Z `````
```
Z
"
``v
Zv
"
v
v
Z
Z
LZ
LZ
L
L
L Z
L Z
L Z
L Z
L Z
L Z
L Z
L Z
C S
C S
C S
C S
C S
C S
C S
C S
C S
C S
C CS S
C S
C CS
C S
S
12.4: .
12.4 (branching factor, fanout)
m=4, 3 64 .
290
12.
, , h, n
:
h logm n
3 4
63 . h (m 1)
, m(m 1) , m2 (m 1)
... , :
(m0 + m1 + m2 + ... + mh1 ) (m 1) = mh 1
:
n mh 1 h logm (n + 1)
. .
, -, .
, SQL Server
Microsoft, Oracle, DB2 , ...
.
12.1 -
Bayer McCreight 1972 [Bayer 1972].
, "",
Bayer, Boeing ayer,
balanced ().
binary ().
- m
(m-way search tree). , - m
:
,
( ) dm/2e
m ,
k k+1 ,
291
.
-
(degree) d . ,
, , d
2d . ,
. - 12.5 .
A
B
2
HH
H
D 1
AA
E
Z 8
11
AA
H 14 16
12.5: - 3.
(storage utilization factor), U ,
.
Umin =50% Umax =100%,
.
.
Leung [Leung 1984]. n nod
, - (
) :
n
U =
2d nod
n :
n
1
E[
]
2d
nod
nod :
n
n
nodmax =
nodmin =
2d Umin
2d
E[U ] =
[nodmin , nodmax ] :
Z nodmax
1
1
1
2d Umin
1
E[
] =
dnod =
ln
nod
nodmax nodmin nodmin nod
n (1 Umin )
Umin
292
12.
n+1
2
m .
-
: ,
(
). m (K + 2P )
bytes . :
s+r+m
K + 2P
t0
:
c log m + d
c d .
:
e
log n+1
2
log m
e .
:
!
)
s + r + d + m(K+2P
n+1
t0
e log
+c
2
log m
293
.
m.
,
m .
12.1.1 E -
12.5 .
10, .
,
12.6. 8, 9 10 ( 9)
, 8 -
10 .
6 12.6
. ,
7, 12.6.
10, ( 7)
. -.
. ,
( 9) .
15 12
12.6. , , 13,
. 12.6.
.
(, )
, h 1
(
h ). , p ,
p 2 . dm/2e 1 ,
. p
1 + (p 1) (dm/2e 1) .
:
p2
1 + (p 1) (dm/2e 1)
1 dm/2e1 . (, p) m=10 m=20
0.25 0.204, . , ,
.
294
12.
() 10
9 11
`
`
11 15
12 14
10
AA
8
16
XXX
X
HH
H
XX
13
AA
14 16
```
AA
4
`
`
11
10
```
HH
AA
```
() 13
AA
```
AA
(
((((
((((
(
14 16
10
HH
H
() 15,12
AA
HH
AA
() 6,7
10
HH
11
AA
12
15
14
AA
16
12.6: - .
. - .
(fringe analysis) Markov.
1982 [Eisenbarth 1982],
295
(n+1)- :
1
+ O(m2 )
(m 1) ln 2
12.1.2 -
-
. -
. , , - 5,
12.7.
. , 26.
, .
10
()
```
13 17 20 23
Q
Q
() 26,5
10
3
2
7 10
%%
ee
6
P
\\ HHHPPP
P
9 11 12 14 15 16 18 19 21 22 24 25
() 2
1 3 4
PP
P
13 17 20 23
aa
PP
@
@
aa
@
@
9 11 12 14 15 16 18 19 21 22 24 25 26
```
`
`
H
HH
13
PP
PP
P
17 20 23
H
@
@ HH
9 11 12 14 15 16 18 19 21 22 24 25
12.7: - .
296
12.
() 17
13
!!
!!
PP
PP
P
B 7 10
16 20 23
@
@
8
() 10
!!
13
!!
B 6 9
PP
!!
!!
16
XX
XXX
B 6 12
"
20 23
@
@
"
"
3
7 8
@
@
B 6 12 16 23
9 11 14 15 18 19 21 22 24 25
Z
I
K
() 20
1
@
@
7 8 11 12 14 15 18 19 21 22 24 25
Z
H
I
K
() 13
PP
P
@
@
"
"
3
@
@
16 20 23
"
9 11 12 14 15 18 19 21 22 24 25
I
K
7 8
XXX
HH
XXX
H
9 11 14 15 18 19 21 22 24 25
12.7: - ().
5.
5 ,
, dm/2e 1 = 2.
2 .
, . ,
(, ) 6
5.
5 7 ,
6 . 12.7.
297
2 ,
.
,
. ,
. ,
2.
. , 1 , 3
4 6
. ,
.
26. ,
(, o ) 2 .
, 13
,
7 (, 10) . 12.7
- 2.
. .
. .
, 12.7 17. , ,
2 . 16 ,
-.
"" ,
. 12.7.
10.
9 , ,
8. . ,
, .
2 . ,
6 7
12.7. ,
.
.
298
12.
13 .
12 13 , 11.
, ,
. ,
,
(, 9)
. ,
6.
, . 12 (
), 16
. , ,
.
12.7.
. , , 20.
19
.
18. , 19,
,
, .
23.
. ,
. , ,
.
12.7,
.
( ) 2h1
h+1 .
, . h+1+1/k - 4+2/k ,
k = dm/2e 1.
- ( )
. 12.8 - 3 5 .
299
@
@@
@
@@
Q
"
@
"
Q
@
"
Q
@
@
@@ @@ @
@@ @@ @
@
@
12.8: (3,5).
3 4 , 5/6 5/8 ,
9/5 8/5, .
3 5
.
(3,5). 12.9 (3,15)
10 .
3,27
2,60
2,40
2,53
2,53
2,60
2,47
2,47
2,47
2,27
15
9
12
10
10
9
11
11
11
11
12.1: (3,15).
12.1 , , .
:
- ,
- .
() (),
9 , 2,60
8,3% 2,40 .
300
12.
v
HH
HH
Hv
v
()
@
@
@
@
@v
v
@v
v
A
A
A
A
A
A
A
A
Av
Av
Av
Av
v
v
v
v
@ @ @ @ @ @ @ @
()
!
!!
PP
!v
!
P
PP
PP
Pv
!
v!
v
@
A
@
@
@
A
v
v @v
v
v @v
v Av
@ @ @ @ @ @ @ @
v
HH
HH
Hv
v
v
A
A
A
A
A
A
v Av
v Av
v Av
@ @ @ @ @ @
v
Q
Qv
v
@
@
@
@
v @v
v
v @v
@ @ @ @ @ @
v
()
HH
HH
Hv
v
v
A
A
A
A
A
A
Av
Av
Av
v
v
v
@ @ @ @ @ @
v
Q
()
()
v
aa
a
aa
aav
v
v
A
A
@
A
@
A
v Av
v Av
v
v @v
@ @ @ @ @ @ @
v
a
a
aa
()
aa
av
v
v
A
A
@
A
A
v Av
v Av
v
v @v
@ @ @ @ @ @ @
()
()
Q
Qv
v
@
@
@
v
v @v
v
v @v
@ @ @ @ @ @
v
aa
a
()
aa
aav
v
v
A
A
@
A
@
A
Av
Av
v
v
v @v
@ @ @ @ @ @ @
v
a
a
aa
()
aa
av
v
v
A
A
@
A
Av
Av
v
v
v @v
@ @ @ @ @ @ @
12.9: (3,15).
(), ,
12 33,3% 9 .
Rosenberg Snyder (1981) [Rosenberg 1981].
, -
. ,
-
301
/
. .
12.2 -
([U ]=69%) -
o .
, (
50%), 100% .
, (
) .
Umin =67%, Leung) [U ]=81%.
,
. -,
Bayer McCreight, -.
- m
m :
2d 2m2
3 e+1 ,
, , d 2m2
3 e+1
m ,
k k+1 ,
.
12.10 12.11, -
- 7. - 7 2 7 ,
4 7 .
- 7 : 2 9 ,
5 7 .
- 6
.
-. 12.10. , - 8
302
12.
()
10
()
19
12
12
10
19
()
52
10
19
52
()
12
10
19
52
!
!!!
!
!
5
10
19
52
56
90
Q
Q
90
71
HH
HH
90
56
12
56
56
71
12
()
52
71
142
PP
PP
PP
P
12.10: -.
. 12.11
-. -
,
67%.
. 10, 11 12 - 12.11 , . 8.11
- 13.
:
()
10
19
12
()
56
71
71
90
19
Q
Q
10
52
12
()
56
56
!!
aa
!
!!
!
4
10
19
12
()
aa
a
a
52
71
19
100
10
()
10
12
52
12
52
71
PP
P
56
71
19
142
56
90
PP
PP
52
303
90
90
XXX
XX
XXX
X
12.11: -.
. 12.10 -
. 4
3 -.
-
, .
(
) . ,
304
12.
1
+ O(m2 )
m1
-
- .
. ,
, .
, ...
75%, 80% ..., Leung.
.
305
12.3 + -
+ -. Knuth
[Knuth 1973] . + - d:
, ,
2d
d .
,
. + - , ,
, ,
k k+1 .
( -) + -
. , + - 100 .
-, + - . 12.12 + -,
, .
. , , , .
.
10
+
4
5 - 10
PP
PP
PP
q
90
19
56
Q
Q
s
12 - 19
113
+
s
Q
?
52 - 56 71 - 90 100 - 113 142
12.12: + -.
306
12.
- . ,
, -.
.
. ,
.
.
.
- -
+ -
. , d 2d , ( )
(bucket factor, Bkf r).
,
200 10 , .
,
. .
+ - . + (
).
+ -
+ -
, .
,
.
, (clustered). ,
( ) . ,
(sparse).
, + - . , 12.2 (
) , 12.13 + -,
. ,
, .
,
.
(A)
- (BH)
(B)
(G)
(C)
(CY)
(F)
(R)
- (SC)
(S)
3
4
8
10
5
1
2
23
10
2
307
29
51
110
132
56
9
25
237
102
20
12.2: .
-, .
, (dense).
,
. -
BH CY
aa
aa
S
HH
H
H
@
@
A B
3 8
29 110
BH C
4 5
51 56
CY F
1 2
9 25
G R
10 23
132 237
S SC
2 10
20 102
25 29
51 56
102 110
132 237
1
P
i
H
Y
PP
HH
Y
H
H
6PP
H
H
H
P
P
P HHHH
20
@
@
H
H
HH
102 132
25
aa
1
Y
H
Y
HH
HHH
6
HH
H
HH H
aa
51
12.13: + - .
308
12.
, .
,
,
.
.
,
,
.
+ - .
, 0 k
1 k.
, 0. ,
i- (i+1)- ,
i- .
. ,
+ - , +
.
12.3.1
+ - . , ,
. , .
. :
Taccess = (s + r + btt) + (s + r + dtt)
, , + - .
. ,
. ,
+ - .
309
12.3.2
d 2d ,
2d ln 2 . ,
+ - :
n
= bk
Bkf r ln 2
n .
+ -
:
Texhaustive (primary) = bk (s + r + dtt) =
n (s + r + dtt)
Bkf r ln 2
. ,
. , 100,
140. , 140
,
.
,
. ,
.
+ -
:
Texhaustive (secondary) = n (s + r + dtt) + n
s + r + btt
2d ln 2
,
+ -. .
12.3.3
+ -
.
310
12.
:
Tnext (primary) =
s + r + dtt
Bkf r ln 2
H 1/(Bkf rln 2)
.
+ - , .
. , ,
:
Tnext (secondary) = (s + r + dtt) +
s + r + btt
2d ln 2
O .
. ,
,
. ,
.
12.3.4
+ - .
,
. . ,
( ) . , ,
:
Tinsert = Taccess + 2r
,
. ,
+ - Bkf r+1 .
, . , Bkf r=5 . Bkf r=10,
5 6 , .
50%.
311
.
+ - , d 2d . ,
d d+1 , . ,
.
,
. , .
, d , d ,
. ,
, .
. 12.14
12 + - 2.
19
71 146 175
56
71
10
19
12
52
!
!!
19
10
12
100
```
```
``
`
71
A
A
19
!!
PPXXX
PP XX
@
PP XX
@
X
52
146 175
HH
H
56
71
@
@
312
12.
Tinsert
2
s + r + btt
= Taccess + 2r +
(s + r + dtt) + (s + r + btt) +
Bkf r
d
( d=100),
:
2
Tinsert = 1 +
Taccess + 2r
Bkf r
Bkf r=10 2400 bytes,
:
2
25, 1 + 16, 6 = 77 ms
Tinsert = 1 +
5
77 ms, 10 .
+ - ,
2/Bkf r 1/d. :
1
Tinsert (secondary) = 1 +
(s + r + btt) + 2r
d
+ -, , ,
:
Tinsert (secondary) = s + 3r + btt
, . ,
. ,
313
.
.
,
.
12.3.5 E
+ - . + -
50%. ,
d Bkf r/2 ,
. .
Bkf r/2 d .
,
, . 12.15
52.
Bkf r/2 ,
( )
. , ,
,
.
12.15 19.
90. 52. + -
12.15.
12.
. . , . , ,
. 12.15.
. , d ,
2d ln 2 .
d=100, 2d ln 2 = 140 , 40 . ,
314
12.
()
12 52
HH
H
H
10 12 19 52 56 71 90
() 52
12 52
10 12 19 56 71 90
() 19
10 52
10 12 56 71 90
() 90
10 52
@
@
10 12 56 71
() 12
52
@
@
10 56 71
315
d , .
12.16 + -
.
()
10
XX
19
12
52
71
56
!
!!
!!
19
""
10
"
52
!
!!
!!
10
12
aa
aa
a
113 146
l
l
19
12
90
19
@
@
56
() 71
X
X
() 4
XXX
90 113 146
@
@
10
56
19
71
56
19
90 113 146
P
@ HH PPP
HH
PP
@
52
@
@
56
316
12.
4
Tdelete (primary) = 1 +
Taccess + (s + r + btt)
Bkf r
+ - , 2/Bkf r
1/d. :
3
Tdelete (secondary) = 1 +
(s + r + btt) + 2r
d
d , :
Tdelete (secondary) = s + 3r + btt
12.4 -
- .
: (B-trees with variable length entries),
- , - (Binary B-trees),
- (Symmetric Binary B-trees) + -
(Prefix B+ -trees). -
Comer [Comer 1979], -
" ". + -,
.
( , ),
-
50% [McGreight 1977]. (,
), .
. ,
317
, .
.
- .
2-3 1-2 - 3 2 ,
1 2 0 1 . 2-3 (2-3
Brother trees) 2-3
.
1-2 . 2-3
(2-3 Son trees) 2-3
-,
. 1-2
(1-2 Son trees).
.
.
Gonnet [Gonnet 1984],
.
- 2-3
.
,
. ,
. -
[Bayer 1972b].
AVL -.
. , + -, Bayer Unteraurer [Bayer 1977],
+ -
. ,
, . (separators)
.
byte ,
. 12.17,
318
12.
byte.
base
bit
PP
PP
data
P
P
graph
file
tree
12.17: .
12.18 + .
, JUNG,
. ,
JOHNSON
, JOHNSON, . , GREGG, HILDRETH JOHNS,
JOHNSON ..., J.
. (split interval) ,
ex , , in , o bytes
(split point).
, . in ex ,
50%.
H
Johnson Jon
?
King
12.18: + -.
.
, . , ,
+ -
.
319
12.5
. , , .
.
.
. , ,
.
-
. + - .
.
.
12.1. - L .
12.2. - m=6 17 8, 13, 26, 28, 41, 49,
54, 67, 83, 84, 96, 107, 132, 146, 151, 154, 170 .
83, 67 26.
12.3. - m=6 25, 26, 24, 39, 32, 9, 28, 45, 13, 41,
5, 23, 19, 27, 6, 14, 34, 21, 31, 11 28.
26, 21, 11, 9, 45, 13, 39, 6
14.
12.4. - m=3 x
. P , Y , A, Q,
F , W , J, T , B, L, M , D U .
X, Q,
320
12.
M C.
@
!
!!
!
@
@
@
@
@
@
@
@ @
PP
PP
@
@
@
@
Q
@
@
@
@
@
12.5. , - m=3 25, 26, 24, 39, 32, 9, 28, 45, 13, 41, 5, 23, 19, 27,
6, 14, 34, 21, 31, 11 28.
26, 21, 11, 9, 45, 13, 39, 6 14.
12.6. (4,15) (4,16).
.
12.7. + - .
bk.
,
10 MBytes.
140,
2 /.
12.8. + - 6.000.000 400 bytes.
;
, - 12
bytes, 1 4 ;
;
12.9. 5000 .
2400 bytes.
;
12.10. + - + -.
5%
-
321
;
12.11. 100.000 400 bytes
+ - 2400 bytes.
.
25% ( 10% 5%) ,
.
12.12. + - d=1 Bkf r=2 4, 12, 6, 1, 3, 15, 5, 9, 7, 14, 16, 10
11. 1, 3
4. + - d=3 Bkf r=2.
12.13.
, + -. 10 200 . Bkf r=6.
12.14. 6.000.000 400 bytes
+ - 6.000.000
;
12.15. 20.000 9 bytes. 2000 , 4 bytes.
: 15 180 bytes. : ,
, - .
.
13
(random, direct)
,
. ,
on-line ,
( ).
.
,
.
: , .
,
.
(dense) .
.
, 1 5000
.
323
324
13.
5000 , i- (i1)- .
, , 10.001 15.000.
(
10.000), .
T (self-indexing)
.
,
.
,
.
(key-to-address transformation),
(hashing),
(hashed files).
,
(main area).
(overflow
area), ,
.
. (address factor)
.
, . ,
. , 1980
, , . ,
,
.
/
: (dynamic hashing), o (extendible hashing), (bounded index exponential hashing),
(linear hashing).
:
325
,
,
,
.
13.1
(hashing functions).
.
,
.
(scatter storage technique). , .
,
. ,
ASCII, EBCDIC ... , C1
6749 (67 ASCII C 49 1).
.
(collision),
(synonyms).
, (primary clustering). ,
,
.
.
.
31 (and, or, not, the, ...)
42 .
1050 , ( )
1043 . .
" ".
326
13.
23 .
23 50.83%.
. n m , mn . , n=4 m=5,
m!
625. , (mn)!
= 120,
.
,
(n+1)/2=2,5 . m=5. 500 :
,
.
m!
p0 = (mn)!
mn =0.192,
0 =0.
pmax = mmn = 0.008,
c=n1=3 omax =1+2+3 . 13.1 P
. p = c pc oc = 0, 3
.
P o = c pc c = 1, 05 ,
n o=2,95 . 12,95/5=0,41.
2,5
6-
1,75
1,5
1,25
0
0
100
200
300
400
500
600 625
13.1: .
327
m n .
m n .
.
(perfect)
, , , ...
, (minimal).
,
.
. (external perfect hashing)
. ,
.
(load factor, Lf ), :
Lf =
n
bkm Bkf r
bkm .
. ,
, .
.
. .
,
. , , . ,
.
. ,
328
13.
i n :
i
n!
1
1 ni
P (i) =
1
i! (n i)!
bk
bk
n bk
Poisson:
n i
en/bk bk
P (i) =
i!
:
nBkf
Xr
j P (Bkf r + j)
j=1
:
100
nBkf
Xr
bk
j P (Bkf r + j)
n
j=1
13.1 .
200 .
2
3
5
8
12
17
23
50%
10,3
5,9
2,4
0,8
0,2
0,1
0,0
55%
11,9
7,3
3,4
1,3
0,5
0,2
0,0
60%
13,6
8,8
4,5
2,0
0,8
0,3
0,1
65% 70% 75% 80%
15,3
16,9
18,7
20,5
10,3
11,9
13,6
15,3
5,7
7,1
8,6
10,2
2,9
3,9
5,2
6,7
1,4
2,1
3,1
4,3
0,6
1,1
1,9
2,8
0,3
0,6
1,1
1,9
85%
22,0
17,0
11,9
8,3
5,8
4,1
3,0
90%
23,7
18,8
13,7
10,0
7,5
5,7
3,0
95%
25,4
20,6
15,6
11,9
9,4
7,5
6,2
13.1: .
.
172.148 7000 .
:
329
330
13.
13.2
. , Larson [Larson 1978], .
:
.
.
.
, bk, .
h1 (key) = key mod bk , .
" ". .
, , ,
.
bk Bkf r ,
(Bkf r+1)- .
(Bkf r+1) .
h2 (key)
( )
(bitstring) , 0 1 .
bits,
. . ,
, bit 0 (, 1), (, ) .
, bits
Bkf r+1 .
bk
, .
,
. , ,
.
331
. ,
, .
. h1 , ,
h2 0
1.
. ,
: , ,
.
: , ,
.
0 1, .
.
4, 5, 10, 12,
19, 52, 56, 71 90. ,
h1 = key mod 3,
.
. , ,
key mod 10, 0 9.
,
R(), 0 1 (,
50%).
13.2. 13.2
.
R(0)
1011
R(1)
0000
R(2)
0100
R(3)
0110
R(4)
1111
R(5)
0101
R(6)
0001
R(7)
1110
R(8)
1001
R(9)
0011
13.2: .
. -
332
13.
0
r
0 Q 1
Q
Qr
r
?
?
12 71
90
r
0 Q 1
Q
Qr
r
?
?
4 10
19 52
r
?
5 56
13.2: .
.
.
,
,
.
.
69%.
-
.
Scholl [Scholl 1981]
.
, (Bkf r+1)-
.
Bkf r ,
1 2. (deferred splitting).
,
.
. , ,
.
de .
.
333
13.3
H Fagin et al. [Fagin 1979b]
.
13.3.
- H(key)
13.3: .
. o
.
, . ,
216 65521.
, bits.
bits , .
bits ,
. 2d
, d
(depth) (level)
.
. ,
. 13.4, ,
.
.
bit 0110100101100101.
bits . ,
334
13.
d=3
d0 =2
H(key)=00...
d0 =3
H(key)=010...
QQ
s
d0 =3
H(key)=011...
d0 =1
H(key)=1...
@
H@
R
H@
j
H
*
13.4: 3 .
3 (
) .
, d0 ,
(depth) (level) .
bits
d. ,
0
2dd .
,
. , .
, d bits. ,
. ,
. ,
.
H
.
100%,
, 50%.
, .
13.4
. ,
. ,
. , .
335
. ,
50%
. 13.5.
1...
10... 11... .
d=3
d0 =2
H(key)=00...
d0 =3
H(key)=010...
QQ
s
d0 =3
H(key)=011...
d0 =2
H(key)=10...
d0 =2
H(key)=11...
@
H@@
R
HH
j
@
H@
R
H@
j
H
13.5: .
.
, d=d0 ,
.
13.5 . .
, .
, .
d .
. , 13.5
, , , , , ,
.
, , , , , , , , , , , , , , .
. ,
,
336
13.
d=4
BXX
z
X
B B
1
B
XXX
z
BB1
B
BBN
d0 =2
H(key)=00...
d0 =3
H(key)=010...
d0 =4
H(key)=0110...
d0 =2
H(key)=10...
d0 =2
H(key)=11...
d0 =4
H(key)=0111...
13.6: .
. 13.6.
,
d=d0 , .
. ,
() 10, 142
d=1
- 10
XXX
z
142
() 12, 19
d0 =1
d0 =1
() 52, 56
d=3
* 10
52 56
H
HH
H
j
Hj
Q H
QQQ
s
PQ
qQ
s
XP
XX
z 142
d0 =3
d0 =3
d0 =2
d=4
10 12
Q
S QQ
s
19
@S
S@S
w
RS
@ S@
@ @S 52 56
@@@
w
RS
R
@
S@
R
S@
@
@ S
R
@
@
w
qX
P
XP
RS
@
X
z
- 142
d0 =4
d0 =4
d0 =3
d0 =2
d0 =1
d0 =1
13.7: .
337
13.7
, 10 (= 000010102 )
142 (= 100011102 ). 52 (=
001101002 ) 56 (= 001110002 ),
, 10, 52 56
bits.
12 (= 000011002 ) 19 (= 000100112 ).
24 =16 ,
.
. :
50%, ,
d0 ,
d0 1
.
,
d0 . ,
13.5.
, ,
. ,
.
,
. ,
, , , ,
, , , , , , , , , , ,
, , , , , , . ,
, , , , , , , , , , , , , ,
, .
. , d
d
, NULL.
338
13.
.
, .
, 50%,
. , 50%. , :
, n, ,
,
,
50% .
, .
, ,
100%, 50%.
69%,
n
Bkf rln
2 .
n
Bkf r(ln 2)2 .
, .
,
,
. .
. ,
+ -.
13.4
B .
,
. ,
339
. , Lomet [Lomet 1983],
.
,
. ,
2max
. ,
64, 128 ... .
. ,
.
,
. , .
,
:
exhash(k) = 2h(k) 1
k , h(k) ,
exhash(k) .
.
. 13.3 exhash(k)
h(k) . , h(k) 0,067,
exhash(k) 0,47,
exhash(k) 0,90.
h(k)
0,000
0,067
0,133
0,200
exhash(k)
0,000
0,047
0,097
0,149
h(k)
0,267
0,333
0,400
0,467
exhash(k)
0,203
0,260
0,320
0,382
h(k)
0,533
0,600
0,667
0,733
exhash(k)
0,447
0,516
0,662
0,662
h(k)
0,800
0,867
0,933
1,000
13.3: .
exhash(k)
0,741
0,823
0,910
1,000
340
13.
bits exhash(k) ,
. (
), ,
bits exhash(k).
,
- ( overflow).
.
, bits
exhash(k).
000
001
010
01
011
100
101
110
111
0-
0
1
0
1
? 0-
00
01
10
11
000
001
010
011
100
101
110
111
6
-
-?
1
01
00
01
??
13.8: .
13.8.
, max=3. .
,
.
204.
exhash(204) = .00110011002 . , bits ,
001. ,
. 1, . ,
341
13.8.
, 641.
, exhash(641) = .10001011002 . bits
100, ,
. 8,
bits ,
. bits 010
, . , -.
,
. bit 00 01,
, . ,
bit 1, . , 641 ,
, .
,
.
.
, 670.
, exhash(670) = .10010010112 . bits 100,
. bits
100
. ,
-.
, -. ,
670 .
, .
-
.
, .
:
,
.
342
13.
13.5
, Litwin [Litwin 1980]
.
,
.
( ) ( ) k bits
. , , bits
. 13.9 ,
.
000
56
001
113
193
5 = 0000 0101
010
10
146
10 = 0000 1010
011
19
19 = 0001 0011
100
56 = 0011 1000
101
4 = 0000 0100
110
111
13.9: bits.
,
k bits,
k+1 bits. 13.9
113 193 ,
001. 001,
113 193 bits, 0001.
010,
10 146,
. 13.10,
.
, k
bits, k+1 bits.
(boundary value) -
343
0000
0001
113
193
0010
90
146
* 011
19
100
101
12
52
- 100
12 = 0000 1100
110
111
71
52 = 0011 0100
1000
56
71 = 0100 0111
1001
1010
90 = 0101 1010
10
13.10: bits.
k bits. k.
13.10 011 3 .
13.5.1
k bits . k
bits , k+1 bits. ,
13.10
bits 1000 1101, 4 3 bits ,
.
.
Bkf r 50, Lf 75%,
1.05 1.27 , .
:
Taccess (success) = 1.05 (s + r + dtt)
Taccess (unsuccess) = 1.27 (s + r + dtt)
. ,
344
13.
, .
. k bits
k+1 bits. ,
. , .
.
13.5.2
.
. , , 70%.
, .
*000
001
010
011
100
101
110
111
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@@
@
@
@
@@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@@
@
@
@
0000
*001
010
011
100
101
110
111
1000
@
@
@
@
@
@
@
@
@
@
@
@
@
@@
@
@
@
@@
@
@
@
@
@
@
@
@
@
@@
@
@
@
@@
@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@@
@
@
13.11: .
13.11
56 . , -
345
70%. 7 ,
, 70%. , Lf Bkf r ,
. , 000
0000
1000. ,
k.
*00
01
10
10
11
19 71 175 - 215
12
()
000
56
000
56
001
113
*01
*10
10
10
10
11
19 71 175
- 215
11
19 71 175 - 215
100
- 100
100
101
12 52
() 52, 56
12 52
() 100, 113
13.12: .
.
. ,
,
.
13.12, .
67%, .
13.12, .
52 56
, 13.12. ,
346
13.
100 113 .
13.12,
.
.
Bkf r=50 Lf =75% 2,62
. .
. 1/Bkf r ( ) .
.
- . ,
, . ,
:
Tinsert = Taccess (success) + 2r +
1
2
1
Tinsert =
1.27 +
+
(s + r + dtt) + 1 +
2r
50 37
37
= 74ms = 2.34 31.8ms = 2.34 (s + r + dtt)
.
. ,
. , .
. , . , .
13.5.3
.
.
, .
347
Bkf r Lf
,
.
:
Tdelete = Taccess (unsuccess) + 2r
.
.
0000
*001
010
011
100
101
110
111
1000
@
@
@
@
@
@
@
@
@
@
@
@
@
@@
@
@
@
@@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@@
@
@
*000
001
010
011
100
101
110
111
@
@
@
@@
@
@
@
@
@@
@@
@
@
@@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@@
@@
@
@
@
@
@
@@
@
@
@
13.13: .
.
Bkf r Lf .
k bits. 13.13,
9 .
010, 011 1000, . 0000 1000
, 000 .
348
13.
13.5.4
,
. ,
, :
Texhaustive = n 1.05 (s + r + dtt)
,
. ,
,
.
,
(offset).
13.5.5
. .
(partial expansions),
Larson [Larson 1980],
,
.
Bkf r/2 , .
.
.
Tharp [Tharp 1987] (priority splitting).
, .
-
.
. , -
349
,
,
[Manolo 94].
,
. , ,
+ -.
13.6
,
.
.
.
, .
. .
.
,
.
, : )
, ) , )
) .
13.1.
Bkf r=2 10 , ;
13.2. Bkf r=2 42, 57, 16, 52, 66, 77, 12, 25, 21 33.
h1 (key), h2 (key)
13.2.
=1,5.
350
13.
351
33. .
. Bkf r=3 Lf =0.67.
13.9. ,
.
13.10. Bkf r=3, Lf =0.67 24
42, 57, 16, 52, 66, 77, 12, 25, 21, 33, 32, 14, 50, 49, 47, 7, 56, 13, 62, 27, 31,
41, 30, 4, 10 6. ;
;
;
13.11.
.
13.12.
.
13.13. , ,
()
, () .
13.14. 13.2
.
13.15. 13.9
.
14
( SQL).
.
.
(optimization) [Chaudhuri 1998]. , . , ,
, , .
(query execution plan)
. ,
. ,
353
354
14.
, .
(execution engine),
.
14.1.
14.1: .
, . ,
, . ,
.
:
.
.
10ms,
355
1000 .
.
.
CPU. ,
. , .
. ,
. , ,
.
.
,
. ,
.
, ,
. ,
" " ,
.
:
,
,
,
,
.
(dynamic) (static).
356
14.
.
.
. , ,
. , ,
, ,
. ,
,
,
.
.
14.1
,
, .
,
.
:
X, Y , Z ,
a, a1 , ..., aN , b, b1 , ..., bN , c, c1 , ..., cN
,
A, B, C ,
p, q, w .
,
.
[Aho 1979].
1. pqw (X) = p (q (w (X)))
2. p (q (X)) = q (p (X))
357
3. A B C (X) = A (X)
4. a1 ,...,aN (p (X)) = p (a1 ,...,aN (X))
5. X Y = Y X X 1 Y = Y 1 X
6. p (X Y ) = (p (X)) Y p (X 1q Y ) = (p (X)) 1q Y pq (X Y )
= (p (X) (q (Y )) pq (X 1w Y ) = (p (X) 1w (q (Y ))
7. AB (X 1p Y ) = (A (X)) 1p (B (Y )))
8. X Y = Y X X Y = Y X
9. p (X Y ) = p (X) p (Y ) p (X Y ) = p (X) p (Y ) p (X Y ) =
p (X) p (Y )
10. A (X Y ) = A (X) A (Y )
11. (X 1 Y ) Z = X 1 (Y Z) (X 1 Y ) 1 Z = X 1 (Y 1 Z)
(X 1p Y ) 1qw Z = X 1pw (Y 1q Z)
12. (X Y ) Z = X (Y Z) (X Y ) Z = X (Y Z)
(expression tree),
. ,
.
, () . "
". .
14.2 4 7,
.
SQL ,
100 :
SELECT ., _.
FROM , _
WHERE __=_.
AND _._>100;
358
14.
14.2: .
100.
. 14.3,
,
.
.
;
.
14.2
. ,
.
,
,
>
>
359
>
14.3: .
. ,
,
.
1: .
360
14.
,
. , 1
2, 4, 6 9
,
.
2: .
,
. 3
4, 7 10 ,
.
3:
, .
,
. , ,
, .
, : (X Y ) = X 1 Y .
4: ,
.
. ,
.
.
, .
5:
.
, ,
.
361
.
,
- .
.
. (X 1 Y ),
X, Y
Y . ,
. ,
6,
14.4.
14.4: 1 (X 1 Y ).
X Y
X Y , . ,
.
X Y --, .
.
.
362
14.
14.3
, , ,
.
(cost-based optimization), ,
. ,
.
,
. ,
.
,
.
14.1. f anI , heightI lI ,
.
nT
bT
bf rT
sT
d(T, a)
sc(T, a)
f anI
heightI
lI
T
T
T
T (bytes)
a T
a
(fanout) i
i
i
14.1: .
-
363
(, , )
.
. ,
, .
Si , Pi , Ji
, i .
14.3.1
,
. , ,
.
.
(S1 )
(linear scan) (full table scan) --
.
.
( )
.
, CS1 = bT . ,
.
. ,
:
CS1 = bT /2
364
14.
(S2 )
(binary search)
,
. :
CS2 = dlog2 (bT )e + d
sc(T, a)
e1
bf rT
.
. sc(T, a)
dsc(T, a)/bf rT e ,
.
, (1).
, d(T, a) = 1,
:
CS2 = dlog2 (bT )e
, sc(T, a) =
nT /d(T, a).
(S3 )
, ( )
,
.
,
:
CS3 = heightI + 1
(S4 )
(clustering index),
.
365
,
. sc(T, a)
a .
dsc(T, a)/bf rT e .
, :
CS4 = heightI + d
sc(T, a)
e
bf rT
( ),
X . ,
:
CS4 = heightI + sc(T, a)
(S5 )
, :
,
(>, <, , ). ,
. a v a < v ( a
v ) .
v.
, :
CS5 = heightI +
bT
2
(S6 )
B+ - ,
. , + . ,
, .
366
14.
+ -,
.
:
CS6 = heightI +
lI
nT
+
2
2
(range queries)
(.., 10 100).
.
;
(conjunctive selection), :
,
.
--
. ,
.
(composite index),
. ,
, -- .
,
(record pointers),
. , , . ,
.
367
, --
.
.
.
.
,
.
14.3.2
.
: )
) (
). , ,
.
(P1 )
,
. ,
, .
(P2 )
h(x1 , ..., xN ) .
, .
, . ,
,
.
14.3.3
368
14.
[Mishra 1992].
. ,
.
(J1 )
(nested-loop join) X Y .
x X y Y ,
.
,
. : ) )
.
,
.
,
:
CJ1 = bX + bY
nX nY X Y .
X Y .
, :
CJ1 = nX bY + bX
(J2 )
, (block nested-loop join).
,
.
.
, . , :
CJ2 = bX bY + bX
369
:
CJ2 = bX + bY
(J3 )
x X
y Y . Y
,
.
x X
Y .
, X
Y .
nX nY X Y .
X Y
. :
CJ3 = bX + nX C
C ,
.
(indexed loop join) (=). , ,
.
, B+ -
. 14.5
.
- (J4 )
- (sort-merge)
. X
Y . X Y
.
. ,
. ,
370
14.
14.5: .
.
, .
14.6 . ,
, ,
.
a
9
5
6
1
x1
2
1
2
1
x2
4
2
4
2
()
a
9
1
7
6
8
1
9
y1
11
3
7
5
9
1
13
y2
12
4
8
6
10
2
14
a
1
5
6
9
x1
1
1
2
2
x2
2
2
4
4
a
1
1
6
7
8
9
9
()
y1
1
3
5
7
9
11
13
y2
2
4
6
8
10
12
14
a
1
1
6
9
9
x1
1
1
2
2
2
x2
2
2
4
4
4
y1
1
3
5
11
13
y2
2
4
6
12
14
()
14.6: -.
371
, :
CJ4 = bX + bY
.
.
(J5 )
-
. .
.
,
. ,
.
-.
a
9
5
6
1
x1
2
1
2
1
x2
4
2
4
2
a
9
1
7
6
8
1
9
10
y1
11
3
7
5
9
1
13
1
y2
12
4
8
6
10
2
14
1
14.7: .
14.7
. h(x) =
x mod 9 a.
.
,
372
14.
. , 1 10 a .
.
. , : ) , )
, ) .
,
:
CJ5 = 3 (bX + bY )
(J6 )
.
.
(join index), a b.
a
b . .
.
,
.
. -
.
. ,
,
,
(
).
14.3.4 ,
: ) ) -
373
.
,
-. (X Y )
( ).
(X Y )
. , (X Y )
X Y .
,
, . X. ,
Y .
x X y Y ,
y .
y
. , y
x X. ,
x y,
.
14.3.5
(.., -) (.., ORDER BY SQL). ,
. ,
(external sorting).
(mergesort). N
n
. 14.8.
n
. .
m
m (m-way mergesort).
-
374
1.
2.
3.
4.
14.
M =dN/ne , n
.
M ,
(.., heapsort, quicksort).
M
M/2 .
3
N .
14.8: .
. , .
(.., ).
14.9 2
. , 14.9 12 ,
M =12/3=4,
14.9, 3 .
14.9 2, 6 . , 14.9 .
a.
a
9
5
6
1
1
2
3
4
8
7
9
5
x1
2
1
2
1
1
2
5
5
6
7
0
2
()
x2
4
2
4
2
1
5
5
5
7
7
0
2
5
6
9
1
2
2
2
4
4
1
1
2
1
1
2
2
1
5
3
4
8
5
5
6
5
5
7
5
7
9
2
7
0
2
7
0
()
1
1
2
5
6
9
1
1
2
1
2
2
2
1
5
2
4
4
3
4
5
7
8
9
5
5
2
7
6
0
5
5
2
7
7
0
a
1
1
2
3
4
5
5
6
7
8
9
9
()
14.9: .
x1
1
1
2
5
5
1
2
2
7
6
2
0
()
x2
2
1
5
5
5
2
2
4
7
7
4
0
375
14.4
.
. , .
.
. (materialized processing).
. , .
(pipeline processing).
,
.
14.4.1
14.10.
.
. ,
>
14.10: .
376
14.
T1 .
T1
T2 . ,
.
,
.
14.4.2
. (pipelining), .
,
. , 14.10, ,
.
.
14.5
.
. ,
, , ,
.
, ,
.
,
.
:
) ) .
,
.
.
377
14.1.
;
14.2.
.
14.3. ; .
14.4.
;
14.5. R1 (a,b,c) R2 (a,f,g).
.
14.6. R1 (a,b,c) R2 (c,d,e). R1 30000 R2 60000 . 20
R1 30 R2 .
)
, ) )
.
14.7. N ,
.
2(N 1))!
(N 1)!
14.8. : 10, 15, 5, 22, 25, 30, 20, 40, 35, 45, 42, 43, 44,
60, 50.
.
14.9. SQL:
SELECT ., .,
_.
FROM , , _
WHERE .=_ AND
__=_.;
378
14.
,
.
14.10.
.
15
(atomic execution)
. ,
.
(transaction).
, ,
. ,
(transaction manager).
. ,
, .
. ,
, ()
379
380
15.
[Bernstein 1987].
, .
(concurrency control) .
, ,
.
,
. (data recovery),
.
15.1
.
BEGIN TRANSACTION END TRANSACTION.
.
15.1.1
(committed)
(aborted)
.
. ,
.
15.1
:
(active).
.
(partially committed).
.
(failed).
.
381
15.1: .
(aborted).
, .
(committed).
.
, ) )
. .
.
, .
.
.
(rollback).
: )
) .
382
15.
,
.
. ,
.
15.1.2
, ACID ,
(atomicity), (consistency), (isolation)
(durability).
.
, .
.
. . .
.
.
,
( ).
.
.
. ,
.
15.2
. .
383
.
. .
:
(CPU) .
CPU
.
, CPU .
(throughput).
.
. (waiting time)
(mean response time).
, ,
.
. .
, (concurrency control) .
.
(lost update problem). .
384
15.
;
R
A
S
i
s
W
15.2: .
15.2 . 2
A 1,
A 1.
A 1 .
(dirty read), 15.2.
.
. ,
1 A .
, 2 A M
A. A 2
, 1 , A
( 1).
(.., , ) .
(incorrect summary)
15.2. 1
. , 2 1 ( X),
2 1 (
385
Y ). .
15.2.1
.
(schedule).
.
(serial schedule)
. 15.3
1 2.
15.3: 1 2.
n ,
n .
n! .
,
.
, (CPU,
) .
.
. -
386
15.
.
.
(serializability) : ) (conflict serializability) ) (view serializability). (read) (write).
.
S Ei Ej 1 2 , . Ei
Ej , .
D, .
:
1. Ei = read(D) Ej = read(D).
.
2. Ei = read(D) Ej = write(D). Ei Ej ,
Ej D Ei . Ej
Ei , Ei
Ej . ,
.
3. Ei = read(D) Ej = write(D).
.
4. Ei = write(D) Ej = write(D).
. , D
.
. ,
Ei Ej (conflict).
Ei Ej ,
387
S 0 . S 0 S
. S S 0
S S 0 (conflict equivalent). S
.
X
X
X
X
X
X
Y
Y
)
X
X
Y
Y
Y
Y
)
Y
Y
X
X
Y
Y
)
R
;
15.4: .
15.4.
Write(X) 2 Read(Y )
1, . 15.4.
,
15.4,
. ,
.
; 15.5
()
() ().
S S 0 . S S 0 (view equivalent)
:
D, i
388
15.
15.5: .
D S, i
D S 0 .
D, i
Read(D) S
j , i
j S 0 .
D,
Write(D) S,
Write(D) S 0 .
. , ,
. S
(view serializable)
. 15.6 .
15.6 , 15.6
.
15.2.2
(locks). -
389
15.6: .
.
:
(read lock) (shared lock)
,
(write lock) (exclusive
lock)
.
.
, . ,
,
. ,
. :
. , .
390
15.
,
.
,
. ,
.
.
.
.
. .
(upgrade)
. ,
,
(downgrade) .
. ,
15.7.
Lock Unlock 15.7.
X Y X=100 Y =400.
1 2
X=220 Y =330. 2
1 X=210 Y =340. X=220 Y =340.
.
.
.
. (locking protocol)
391
15.7: .
.
.
(2-phase locking protocol)
:
1. (growing phase) ,
2. (shrinking phase)
.
,
.
[Eswaran 1976].
: ) ,
392
15.
) ) . 15.2.
.
. 15.8
.
L
A
393
D : di dj
di dj di
dj . (directed acyclic graph).
, (tree protocol)
. :
,
dj di di dj ,
,
,
.
.
15.9
, 2
.
1
d5
d2
d3
d6
Lock-W(d5)
Read(d5)
Lock(d2);
d2 := d2 + d5;
Write(d2);
Unlock-W(d5);
Unlock-W(d2);
d4
d8
d9
2
Lock-W(d9);
Read(d9);
Lock-W(d6);
Read(d6);
d6 := d6 + d9;
Write(d6);
Unlock-W(d6);
Unlock-W(d9);
(d3)
.
d7
15.9: .
394
15.
15.2.3
(deadlock).
,
. ,
. ,
.
:
1. (deadlock prevention),
,
2. (deadlock detection and recovery)
.
.
. ,
.
.
,
.
.
(timestamps). [Rosenkrantz 1978]
:
Wait-Die. ( )
( ). ,
.
395
Wound-Wait.
.
,
.
. , .
.
(wait graph).
V E.
.
i j , i
j
i .
, .
, .
15.10. 15.10 , 15.10 2 , 3 , 8 , 9
10 .
,
.
;
.
.
.
(ROLLBACK1 ). :
1
ROLLBACK .
396
15.
10
()
( )
()
( )
15.10: () ().
1. ROLLBACK.
ROLLBACK. .
:
.
.
.
ROLLBACK.
2. ROLLBACK. ,
ROLLBACK.
, . ,
.
.
397
, ROLLBACK .
3. . (starvation)
ROLLBACK. .
,
.
15.2.4
.
(timespamps),
.
.
(timestamp) . (system clock)
. i TS(i ).
.
( ). .
. .
(read
timestamp) (write timestamp).
timestamp-W timestamp-R .
.
.
D,
398
15.
timestamp-W(D) timestamp-R(D).
.
,
.
:
i D. :
1. TS(i ) < timestamp-W(D), i
D . .
2. TS(i ) timestamp-W(D), timestamp-R(D)
: timestamp-R(D) = max{timestamp-R(D),TS(i )}.
i
D. :
1. TS(i ) < timestamp-W(D), .
ROLLBACK i .
2. TS(i ) < timestamp-R(D), D
. , ROLLBACK.
3. ,
i : timestamp-W(D) = TS(i ).
ROLLBACK , .
Thomas
,
(TS(i ) < timestamp-W(D)),
399
ROLLBACK. ,
, .
. 15.11.
1
2 TS(1 ) < TS(2 ). , write(X) 2
. , write(X) 1
ROLLBACK 1 , TS(1 ) < timestamp-W(X).
15.11: Thomas.
Thomas .
.
. :
1. TS(i ) < timestamp-W(D),
.
.
2. TS(i ) < timestamp-R(D), D
. ,
ROLLBACK.
3. ,
i : timestamp-W(D) = TS(i ).
400
15.
15.3
(data recovery)
. ,
. ,
,
. :
, ,
, , ,
,
(run-time error)
,
, , ...
,
,
.
15.3.1
,
:
(backup)
,
(log)
,
(checkpoints),
,
401
, , , .
,
.
. (..,
, ).
.
,
.
(incremental) .
.
. ,
.
(.., )
(.., 10 GBytes).
.
:
,
, ,
.
.
402
15.
ROLLBACK (
UNDO, ) ROLLFORWARD
( REDO, ).
. ,
.
.
15.3.2
. :
1. ,
.
.
ROLLFORWARD
.
.
2.
.
ROLLBACK ROLLFORWARD .
.
.
.
(deferred update)
(commit). ,
ROLLBACK. ,
403
ROLLFORWARD ,
. :
1. (transaction
start).
2. (write)
.
3. , .
, .
4.
.
.
.
( ) . [tc , tf ]
. :
[tc , tf ]
(transaction start)
(transaction commit),
ROLLFORWARD. ROLLFORWARD .
.
[tc , tf ]
(transaction start)
404
15.
(transaction abort),
.
[tc , tf ] ,
( ) .
1
C
6
A
tc
tf
15.12: .
, (immediate update)
,
(commit). ,
405
ROLLBACK.
:
1. (transaction start).
2.
.
3.
.
.
4. (transaction commit) .
. ,
,
.
.
, tc
tf .
:
[tc , tf ]
(transaction start)
(transaction commit),
ROLLFORWARD. ROLLFORWARD .
.
[tc , tf ]
(transaction start) (transaction commit),
406
15.
ROLLBACK. ROLLBACK
.
ROLLBACK,
ROLLBACK ROLLFORWARD.
(shadow paging)
,
[Lorie 1977]. .
.
n 1 n.
(page table).
. 15.13
.
.
1
2
3
4
5
1
2
5
4
3
15.13: 5 .
. (current page table) (shadow
page table). .
, -
407
.
. D
p.
1. p , .
2. ,
:
p0
,
p0 ,
p
p0 .
15.14 . 4 5.
.
.
1
2
3
4
5
1
2
5 ()
3
4 ()
5 ()
4 ()
1
2
3
4
5
15.14: (
4 5).
.
.
,
408
15.
. ,
.
15.4
. ,
, .
,
. : ) , )
, ) ) .
,
.
.
.
.
.
( ).
. (REDO ROLLFORWARD),
(UNDO ROLLBACK).
: ) , )
) .
15.1. .
15.2.
;
15.3.
.
409
15.4. (2PL).
;
15.5. A, B C ,
. ;
.
15.6. ;
;
15.7. :
T1:
read(X);
read(Y );
if (X == 0) Y = Y + 1;
write(Y );
T2:
read(Y );
read(X);
if (Y == 0) X = X + 1;
write(X);
(2PL)
. ;
15.8 .
15.9 .
15.10.
.
16
,
,
.
.
,
,
(confidentiality), (integrity) (availability) .
.
.
.
411
412
16.
, ,
. , ,
,
, .
.
(audit control) . (database security)
,
[Castano 1995, Clark 1991, Fernandez 1981, Natan 2005].
16.1
. . ,
. ,
, . ,
. ,
.
.
. ,
, ,
. ,
413
. 16.1,
.
16.1: .
16.2
(authorization)
. (subject)
, (object) , , , , ,
. ,
,
,
.
(authentication) ,
.
. ,
.
414
16.
,
.
(username)
(password) ,
. ,
.
,
. ,
. ,
.
16.3
(Discretional Access Control, DAC) (Mandatory Access Control, MAC)
.
, .
.
16.3.1
(privileges) SQL [Polk 1993]. ( ,
) . ,
.
.
SQL :
SELECT: ,
415
INSERT: ,
UPDATE: ,
DELETE: ,
REFERENCES:
,
USAGE: .
SELECT UPDATE , . , REFERENCES
,
,
.
SQL
GRANT REVOKE.
CREATE TABLE, (owner)
.
. ,
GRANT. ,
.
CREATE VIEW,
. ,
(SELECT) . , INSERT,
UPDATE DELETE
.
,
416
16.
GRANT. . -
:
GRANT <_> | ALL PRIVILEGES>
ON <_>
TO <_ | PUBLIC>
[WITH GRANT OPTION];
, :
SELECT [< >]
DELETE
INSERT
UPDATE [< >]
REFERENCES [< >]
USAGE
, , , ...,
. , GRANT ALL PRIVILEGES . GRANT PUBLIC
.
WITH GRANT OPTION
. WITH GRANT
OPTION, . WITH GRANT OPTION
GRANT,
.
,
.
417
REVOKE.
REVOKE
GRANT.
REVOKE :
REVOKE [GRANT OPTION FOR] <_>
| ALL PRIVILEGES
ON <_>
FROM <_> | PUBLIC
[RESTRICT | CASCADE];
ALL PRIVILEGES
. GRANT OPTION FOR WITH GRANT OPTION
GRANT .
RESTRICT, REVOKE
. RESTRICT . CASCADE REVOKE
.
REVOKE ,
. , C
, C
.
16.2
employee SELECT B C (
1 2, ) WITH GRANT OPTION.
C D
( 3 4, ). D
SELECT employee E ( 5). ,
SELECT CASCADE
( 6), ,
D D C.
C D,
418
16.
N
C
16.2: REVOKE.
SELECT ON employee
D E.
, ,
, - . ,
R
R. ,
S INSERT S
. , B
R
(.., )
R, , S
. , -
R
. ,
, (trojan horse)
, ,
.
.
.
419
16.3.2
. (security class)
(security clearance) .
.
.
SQL
.
Bell-LaPadula [Bell 1974]
, , .
L
class(L) class(), . , :
(top secret, TS), (secret, S), (confidential, C) (unclassified, U).
TS > S > C > U, A > B
.
Bell-LaPadula
:
( - no reads
up): L O
class(L) class(O). , S
, U
.
-* ( - no writes down): L class(L)
class(O). , S S .
, -
420
16.
.
,
, . ,
GRANT SQL
.
16.3.3
,
.
.
(multilevel relation), .
,
16.1.
4
2
4
3
2
C
C
C
S
TS
16.1: .
TS ,
S C
, U
.
U
< , 1, U>.
421
. U,
U.
Bell-LaPadula,
.
4
2
4
3
2
1
C
C
C
S
TS
U
16.2: .
.
,
U,
16.2. , U , C
, S TS
, .
,
.
.
(polyinstantiation) .
(trusted)
BellLaPadula. ,
422
16.
,
.
.
16.4
6.5,
.
, , .
.
, . ,
,
. ,
.
,
:
CREATE VIEW _
AS
SELECT _,
FROM
WHERE =current_user();
SELECT
,
. ,
,
.
423
16.5
(encryption)
(encryption key).
,
.
.
( )
.
(client)
(server) .
(irreversible) (reversible) . ,
. , .
.
-
(cryptosystem), 16.3 :
,
(plaintext)
16.3: .
424
16.
(cyphertext) ,
,
.
(symmetric encryption) . ,
.
DES (Data Encryption Standard [NBS 1977]), IBM.
, . 56 bits
64 bits. DES
,
. ,
PGP (Pretty Good Privacy)
128 bits .
64 bits
. ,
. 80 bits , 128 bits
.
[Ramakrisnan 2003],
DES , 149
128 bits.
,
(asymmetric encryption)).
, , (public key) (private key)
425
.
,
.
,
. (digital
signature)
. RSA (
[Rivest 1978]).
,
. ,
,
[Denning 1983].
16.6
(statistical) (
)
. , " ;" , " ;"
.
, .
(deduction of sensitive information by inference) [Adam 1989] .
.
,
.
426
16.
-40
3-14
-22
6-07
-10
1-10
3-31
4455
2138
4483
6320
7012
7025
2121
2000
1500
2300
2720
1250
1750
1800
16.3: .
.
, ,
16.3. ,
,
"". , ,
.
:
SELECT COUNT(*)
FROM
WHERE ((=) AND (=));
SELECT SUM()
FROM
WHERE (=) AND (=);
1 2000 . ""
,
. ,
,
.
c.
427
, :
SELECT COUNT(*)
FROM ;
SELECT COUNT(*)
FROM
WHERE (<>) AND (<>);
SELECT SUM()
FROM ;
SELECT SUM(*)
FROM ;
WHERE (<>) AND (<>);
428
16.
16.3
4 3, . ,
, ""
(
""). ""
:
SELECT SUM()
FROM
WHERE =;
SELECT SUM()
FROM
WHERE (=) AND NOT
(=);
8.820, 6.820.
, ""
, 8.820 6.820=2.000.
( = ) AND ( = ) (individual tracker) [Denning 1979a],
.
,
A
1 AND 2,
A1 AND NOT A2
, 1 A1 AND NOT A2
, [c, n c].
1
1 AND NOT A2:
{x : A} = {(x : A1) AND (x : A2)} = {x : A1} - {(x : A1) AND NOT (x : A2)}
Venn
16.4.
,
A1
A2
A1 AND A2
A1
A1 AND A2
A1 AND
NOT A2
A2
A1
429
A2
A1
(A1 AND
NOT A2)
16.7 SQL
(injection) SQL.
Rain Forest Puppy,
430
16.
.
[Spett 2002]. ,
, .
,
.
.
,
ASP (Active Server Page)
.
16.5 1 .
username=Request.form("username");
password=Request.form("password");
var con=Server.CreateObject(ADODB.Connection);
var rso=Server.CreateObject(ADODB.Recordset);
var sql="SELECT * FROM users WHERE username = "
+username +" AND password = "+password+" ";
rso.open(sql,con);
if not rs.eof() then
response.write("Welcome to the database");
16.5: ASP
.
, ,
SQL Users username password.
16.5 :
sql = "SELECT * FROM users WHERE username = "
+ username +" AND password = " + password + " ";
. 1
H
SQL ASP.
431
username password
. :
username: george
password: 45dc&vg3
:
SELECT *
FROM Users
WHERE username = george AND password = 45dc&vg3;
Users,
. ,
:
username: george
password: anything or 1 = 1 or =
:
SELECT *
FROM Users
WHERE username=george AND password=anything OR
1 = 1 or = ;
Users. , ,
anything .
Users,
.
SQL,
.
.
432
16.
16.6:
.
16.8
: ,
.
.
(backup)
(security patches).
.
(Denial of Service, DoS).
.
.
433
RAID.
.
.
, .
. ,
.
. ,
.
,
.
. .
(track what the user knows).
, ,
.
.
.
,
,
.
434
16.
16.1. , ;
16.2.
;
16.3. ;
16.4. ; .
16.5. -
; ;
;
16.6.
16.2. TS
(, 4) (, 5).
; C
TS;
16.7. , , C, D E
P
.
.
.
A
B
D
C
GRANT
GRANT
GRANT
GRANT
SELECT
SELECT
SELECT
SELECT
ON
ON
ON
ON
P
P
P
P
TO
TO
TO
TO
SELECT
P, .
435
(: .)
, REVOKE SELECT ON P FROM D CASCADE. .
16.8.
. , , ,
2.
1100
800
750
950
500
1850
890
1500
1160
:
Q1: SELECT SUM() FROM WHERE =
;
Q2: SELECT SUM() FROM WHERE ( =
) ND (=).
min|Qi | 2.
; .
16.9 ;
;
436
16.
16.10.
4.1.
17
MSSQLS-2000
MSSQLS-2000.
, ,
, MSSQLS2000 .
17.1
MSSQLS-2000
. ,
MSSQLS-2000 .
, (memory pools)
, . MSSQLS-2000 .
437
438
17. MSSQLS-2000
(buffer pool).
(page) 8KBytes.
,
(buffer manager) .
- .
() .
.
TEXT, NTEXT IMAGE
. 96 bytes,
,
.
8060
bytes,
(8192 bytes). 17.1
.
17.1: MSSQLS-2000.
17.1.1
(extent) 8 ( 64
KBytes). :
(.., ),
439
(.., ).
.
(log). ,
. :
(primary data file), .
. *.mdf.
(secondary data file), .
. *.ndf.
(log file),
.
, .
*.ldf.
,
.
FAT NTFS,
.
0. (file ID). ,
. ,
. , ,
. 17.2
2MBytes 512KBytes.
.
440
17. MSSQLS-2000
17.2: .
, .
, .
,
.
17.1.2
MSSQLS-2000 ,
. (clustered
index) (heap table).
. ,
.
Index Allocation Map (IAM).
IAM. IAM
FirstIAM sysindexes, indid 0.
sysindexes.
IAM (extents) . ,
. IAM
63903 . IAM
441
. ,
,
.
17.3.
sysindexes
id
indid
FirstISAM
root
17.3: .
(clustered table) . ,
. ,
(
).
.
MSSQLS-2000.
442
17. MSSQLS-2000
17.2
.
,
.
,
.
.
MSSQLS-2000 B-
. B+ -,
. B+ - ,
. B+ - (clustered index) -
(non-clustered index).
17.2.1
,
.
.
, .
. sysindexes
root indid=1
.
(index pages).
.
. (data
pages) .
17.4.
id
indid
0
sysindexes
... FirstISAM ...
443
root
17.4: .
17.2.2 -
, - (non-clustered indexes). -
. MSSQLS-2000
249 - .
-
( ).
. , -
,
.
444
17. MSSQLS-2000
17.2.3
Enterprise
Manager, Tools, Wizards, Create Index Wizard.
. Manage Indexes
. 17.5
Enterprise Manager1 .
() Manage Indexes
CLUSTERED,
. ,
-
:
1
(table designer).
445
CREATE INDEX _
ON ();
. MSSQLS-2000
.
,
:
CREATE INDEX _DVD_VHS
ON (DVD,VHS);
.
.
WHERE
, .
:
(joins).
, 14.
(selectivity). ,
,
. , ,
,
.
,
, .
WHERE .
: ) ORDER BY , ) (..,
a > 10 AND a < 100), ) ( ) (join).
446
17. MSSQLS-2000
- : )
, )
WHERE ORDER BY .
17.3
MSSQLS-2000 . 14
, ,
, ,
.
MSSQLS-2000 (cost-based optimization).
,
.
(logical I/O) .
(physical I/O), .
, .
MSSQLS-2000 :
.
447
.
WHERE (.., a = 1, a 10).
WHERE
.
.
.
MSSQLS-2000.
.
.
.
.
,
.
MSSQLS-2000
, 14: ) (nested-loop join), )
(merge join) ) (hash join). .
Query Analyzer
.
,
. . Query Analyzer.
2 DVD:
SELECT
FROM
WHERE DVD>=2;
17.6.
448
17. MSSQLS-2000
17.6: .
.
,
DVD 2.
:
SELECT ,
FROM ,,
WHERE .=._ AND
.=._;
17.7.
,
.
, (..,
CPU I/O).
.
17.4
15 , .
449
17.7: .
MSSQLS-2000
.
MSSQLS-2000 (transaction log)
.
.
.
MSSQLS-2000:
(AutoCommit). T-SQL
. COMMIT.
, MSSQLS-2000
AutoCommit.
, ,
SQL, .
(explicit transactions). -
450
17. MSSQLS-2000
BEGIN TRANSACTION
COMMIT/ROLLBACK TRANSACTION.
. T-SQL
.
: CREATE DATABASE, ALTER DATABASE, DROP DATABASE,
BACKUP DATABASE, RESTORE DATABASE, RECONFIGURE, BACKUP LOG,
RESTORE LOG, UPDATE STATISTICS.
(implicit transactions).
, .
T-SQL: ALTER TABLE, CREATE, DELETE, DROP, FETCH, GRANT,
INSERT, OPEN, REVOKE, SELECT, TRUNCATE TABLE, UPDATE.
, ,
COMMIT TRANSACTION ROLLBACK TRANSACTION.
SET IMPLICIT TRANSACTIONS ON (OFF
).
17.4.1
MSSQLS-2000 (locking)
. MSSQLS-2000
SQL Server Lock Manager. MSSQLS-2000
,
. :
(shared locks). .
. T-SQL ,
.
,
.
(update locks).
. ,
451
,
. ,
. .
.
. , .
(exclusive locks).
, .
, .
(schema locks). . :
1. (schema stability locks).
,
.
(.., / ,
) ,
.
2. (schema modification locks).
,
.
,
.
(bulk update locks). .
,
.
452
17. MSSQLS-2000
,
. ,
.
T-SQL,
. MSSQLS-2000
:
. , . ,
(offline) .
master tempdb (. 5) ,
.
. (allocation) (deallocation). ,
.
.
.
.
.
, (pointers) .
.
,
.
.
, .
. MSSQLS-2000
,
,
.
453
17.4.2
(deadlock), . 15
: ) )
, .
MSSQLS-2000 .
. ,
. SET
LOCKTIMEOUT.
, .
MSSQLS-2000 LOCK MONITOR.
.
CPU
.
CPU .
17.4.3
(. 15). (transaction log)
, .
MSSQLS-2000 write-ahead
.
.
:
1.
(BEGIN TRANSACTION)
.
2. .
454
17. MSSQLS-2000
3.
.
4. , (COMMIT
TRANSACTION) .
5. .
.
. ,
.
(lazy writer process)
(checkpoint process).
.
, . MSSQLS-2000
(checkpoints) .
(checkpoint process) .
,
,
.
MSSQLS-2000 (. 15). MSSQLS-2000
(commit).
. , MSSQLS-2000 ROLLBACK
( UNDO) ROLLFORWARD ( REDO).
455
17.5
.
, ,
. ,
,
.
17.5.1
.
SQL Server : (system privileges) (object privileges).
. ,
.
.
: CREATE TABLE, CREATE VIEW, CREATE PROCEDURE, CREATE DEFAULT, CREATE FUNCTION, CREATE RULE, BACKUP DATABASE, BACKUP
LOG.
Enterprise Manager,
Properties. Permissions Properties,
. 17.8,
.
(grant). (deny) , ,
(revoke).
(grant) (deny)
456
17. MSSQLS-2000
, .
, GRANT, REVOKE
DENY, , T-SQL.
:
GRANT
<_> | ALL [PRIVILEGES]
457
{
[<_>] ON <_> | <_>
| ON <_> | <_> [<_>]
| ON _ | _
| ON ___
}
TO <_>
[WITH GRANT OPTION];
.
, ON.
,
EXECUTE
SELECT, INSERT, DELETE, UPDATE REFERENCES. ALL
[PRIVILEGES] . ,
. TO
. WITH GRANT OPTION
.
:
GRANT SELECT
ON TABLE1
TO USER1
WITH GRANT OPTION;
458
17. MSSQLS-2000
DENY
<_> | ALL [PRIVILEGES]
{
[<_>] ON <_> | <_>
| ON <_> | <_> [<_>]
| ON _ | _
| ON ___
}
TO <_>
[CASCADE];
REVOKE GRANT
GRANT OPTION FOR CASCADE.
. CASCADE
DENY. ,
WITH GRANT OPTION, REVOKE
DENY CASCADE,
.
SQL Server Enterprise Manager. , Enterprise Manager WITH GRANT OPTION. ,
.
,
All Tasks Manage Permissions.
17.9 Object Properties
.
Columns Object Properties SELECT UPDATE
. 17.10 Column Properties .
Enterprise
Manager Database User Properties 17.11. ,
,
Properties.
459
460
17. MSSQLS-2000
17.5.2
.
.
.
,
SQL. , :
CREATE VIEW ___
AS
SELECT , COUNT(*)
FROM
WHERE =
GROUP BY ;
461
GRANT SELECT
ON ___
TO george;
(. george) ,
.
.
,
, .
17.5.3
SQL Server (hashing
function) pwdencrypt() [Andrews 2003] sysxlogins
master. , SQL Server
:
SELECT password
FROM MASTER.dbo.sysxlogins
WHERE name=sa;
:
0x01008D504D65431D6F8AA7AED333590D7DB1863CBFC
98186BFAE06EB6B327EFA5449E6F649BA954AFF4057056D9B
, :
SELECT pwdencrypt();
:
0x0100544115053E881CA272490C324ECE22BF17DAF2AB96
B1DC9A7EAB644BD218969D09FFB97F5035CF7142521576
462
17. MSSQLS-2000
SELECT pwdcompare
(_sa,
(SELECT password
FROM MASTER.dbo.sysxlogins
WHERE name = sa), 0 );
17.6
MSSQLS2000.
8 . 8 KBytes . .
.
: ) , )
) .
MSSQLS-2000 : )
) .
. ,
- . + -.
2
3
http: //www.appsecinc.com/products/dbencrypt/mssql
http://www.activecrypt.com/product.htm
463
.
SQL Query Analyzer
.
, : , , , , .
.
SQL Server
. ,
.
17.1.
MSSQLS-2000.
17.2.
;
17.3.
MSSQLS-2000.
17.4.
MSSQLS-2000 ;
17.5. MSSQLS2000 .
17.6. MSSQLS2000;
17.7.
MSSQLS-2000;
17.8. .
464
17. MSSQLS-2000
17.9.
SQL Server.
17.10. 16,
. , .
IV
.
,
.
. 18
(object-oriented) . 19 ,
.
- (object-relational) . 20
, 21
MSSQLS-2000.
18
( , , ..). , .
(computer-aided design - CAD),
.
:
,
(.., ),
,
467
468
18.
.
;.
:
.
() .
.
.
,
.
.
.
.
,
SQL.
. ,
GIS (..,
, , )
( , ...).
, .
. , , .
,
, .
.
.
469
. :
,
.
- , .
18.1
Smalltalk, C++ Java1 .
. , .
.
18.1.1 ,
(object) (
). (attributes). (state) .
.
(methods) . (behavior) . ,
.
(encapsulation).
.
(information hiding).
1
470
18.
(object class).
.
(object identifier) , .
CAD/VLSI
.
rectangle .
- -
, .
. , rectangle (
C++) 18.1. public,
.
class rectangle :
{
int x1;
int y1;
int x2;
int y2;
public:
setRectangle (int x1, int y1, int x2, int y2);
resizeRectangle (int dx, int dy);
moveRectangle (int newx1, int newy1);
};
y
y2
y1
x1
x2
18.1: .
18.1.2
. ,
. (inheritance) .
, A ( ).
471
, .
,
. (employee)
(salesperson) ,
2 .
18.2 . (name),
(address), (code) (phone)
. (region) . ,
(prog-language) .
.
class employee :
{
int code;
char[20] name;
char[20] phone;
char[100] address;
int salary;
public :
changeSalary ();
changePhone ();
changeAddress ();
};
public :
changeLocation ();
...
...
};
public :
changeLabguage ();
...
...
};
18.2: .
(specialization hierarchy),
. B 2
,
.
472
18.
ISA
ISA
ISA
ISA
ISA
()
ISA
ISA
ISA
ISA
ISA
ISA
ISA
()
18.3: .
. (multiple inheritance),
. 18.3.
.
,
.
18.1.3
(containment hierarchy),
. IS-PARTOF ISA.
(complex objects)
.
. 18.4 ,
, .
IS-PART-OF
IS-PART-OF
IS-PART-OF
473
...
IS-PART-OF
IS-PART-OF
...
18.4: .
18.2
(OODMBS)
.
.
.
: ) ) . ( ) [Atkinson 1989].
(object-oriented database system manifesto).
.
:
,
( ),
,
,
.
474
18.
(persistent) 3 . (object definition language)
(object query language, OQL) ODMG 3.0. (bindings)
C++.
ODMG (Object Data Management Group) .
ODMG
(portability). ODMG [Cattell 2000].
(persistence) .
.
, .
, .
H ODMG ODL
(object definition language, ODL)
ODMG.
.
(person) (employee)
(
). (branch)
-- ( ) 18.5
3
475
ODMG ODL.
[Eaglestone 1998, Cattell 2000].
class Person
{
attribute struct person_name {string first_name, string last_name} name;
};
Person
ISA
class Employee extends Person
(extent employee)
{
attribute string emp_no;
attribute enum sex_type {M, F} sex;
attribute enum pos_type {Manager, Supervisor, Assistant} position;
attribute date date_birth;
attribute float salary;
Employee
WorksAt
Has
Branch
relationship set<Employee> Has inverse Employee::WorksAt;
};
476
18.
.
OQL.
.
:
employee
,
:
branches
OQL SQL .
. :
SELECT b.name,b.address
FROM b IN branches
WHERE b.address.city=;
.
.
:
SELECT e.name.last-name
FROM b IN branches, e IN branches.WorksAt
WHERE b.address.city=
OQL
Connolly Begg [Connolly 2002].
ODMG C++
(bindings)
.
477
.
ODMG Smalltalk,
C++ Java. C++.
C++,
ODMG ODL.
.
C++ . ,
C++, (object manipulation
language, OML)
. 18.6
(executable) .
478
18.
. 18.7
(person), (account), (customer) (branch).
18.7.
Person
ISA
Account
M
Customer
1
Branch
()
class Branch : public d_Object
{
...
};
class Person : public d_Object
{
d_String name;
d_String address;
};
class Account : public d_Object
{
d_Float balance;
public :
d_Set<d_Ref<Customer> > owners;
479
(open (dbname)),
(set object name (object, name)),
(lookup object (name)),
(rename object (oldname, newname)),
(close (dbname)).
d Transaction. Trans d Transaction.
Trans.begin()
Trans.commit(). ,
, . insert element delete element, . 18.8 ODMG C++ OML,
(Branch).
d Database accountDB;
accountDB->open("ACCOUNT DATABASE");
d Transaction MyTransaction;
MyTransaction.begin();
d Ref<Branch>branch=new (accountDB,"Branch")Branch;
branch->name="New Branch";
branch->address.city="New City";
branch->address.street="New Street";
branch->address.postal code="54321";
MyTransaction.end();
480
18.
FROM b IN branches
WHERE b.address.city=");
18.3
. ,
. :
.
. .
.
.
.
.
.
.
(schema evolution) .
, .
.
.
.
:
481
.
.
ODMG de facto .
. ,
,
.
.
.
.
, .
.
, .
18.4
. ,
,
.
. ,
: , , ,
.
18.1.
;
482
18.
18.2. , , .
18.3. . ; .
18.4.
-.
18.5. .
. ;
.
18.6. , , 4x4.
.
18.7. ODMG ODL ODMG
OQL.
18.8. ODMG C++;
18.9.
.
18.10.
4.1.
19
.
.
,
.
- (object-relational DMBS)
. ,
. , SQL
. ,
483
484
19. -
,
.
[Stonebraker 1996]
- , [Devarakonda 2001] .
19.1
(. 5).
(1NF) 7.
.
(nested relations),
.
(non-first normal form, N1NF).
N1NF
(nested-relational model)
.
. 4 .
(. 5) . .
.
, , ,
.
19.1.
19.1
. 19.1.
, 19.1 . 19.1 19.1.
12
44
55
()
12
44
55
6977333222
6945123456
6937222999
485
12345
54321
11111
()
12
44
55
12345
54321
11111
6977333222
6945123456
6937222999
()
12
44
55
{6977333222
2310111111
2102444555}
6945123456
6937222999
12345
54321
11111
()
19.1: .
. ,
.
486
19. -
19.2.1
SQL3 .
. , ,
.
, .
, , , .
CREATE TABLE SQL3. ROW
:
CREATE TABLE
( INT,
CHAR (50),
ROW ( CHAR(30),
CHAR(4),
_ CHAR(6),
CHAR(30),
CHAR(30)));
. INSERT
:
487
INSERT INTO
VALUES
(1000, A. ,
(,13,56225,,));
19.2.2
. SQL3
CREATE
TYPE. (user-defined
types, UDT).
.
:
CREATE TYPE RectType AS
(x1 INT, x2 INT, y1 INT, y2 INT,
FUNCTION getArea(r RectType) RETURNS FLOAT
RETURN (x2-x1)*(y2-y1);
END,
FUNCTION getPerimeter(r RectType) RETURNS FLOAT
RETURN 2*(x2-x1)+ 2*(y2-y1);
END)
REF IS SYSTEM GENERATED
INSTANTIABLE
NOT FINAL;
INSTATIABLE .
, NOT INSTATIABLE.
NOT FINAL RectType .
REF IS SYSTEM GENERATED .
. . RectType
,
.
,
.
488
19. -
.
PointType :
CREATE TYPE PointType AS
(pointNo INT NOT NULL, x INT, y INT,
PRIMARY KEY (pointID),
FUNCTION ...,
FUNCTION ...,
...
);
GeneralRectType PointType:
CREATE TYPE GeneralRectType AS
(p1 PointType, p2 PointType, p3 PointType, p4 PointType,
FUNCTION ...,
FUNCTION ...,
...
);
:
CREATE TABLE VLSI
( INT, GeneralRectType);
SQL3
(
SQL3).
RGB.
ColoredGeneralRectType,
GeneralRectType:
CREATE TYPE ColoredGeneralRectType UNDER GeneralRectType
AS
(colorR INT, colorG INT, colorB INT,
FUNCTION ...,
...
);
489
19.2.3
- .
, ,
(.., C++), SQL3.
SQL3
.
:
CREATE FUNCTION MyFunction (IN MyParameter)
RETURNS FLOAT
EXTERNAL NAME MyFunctionFileName
LANGUAGE C
PARAMETER STYLE SQL
DETERMINISTIC
NO SQL;
EXTERNAL NAME
.
(LANGUAGE C).
SQL
490
19. -
19.2.4
. .
.
SQL3
. SQL3
(reference type) .
.
C/C++.
.
.
.
()
, .
( ).
.
. :
CREATE TABLE
( INT NOT NULL,
VARCHAR(100),
491
VARCHAR(15),
REF(PointType) SCOPE
REFERENCES ARE CHECKED
ON DELETE CASCADE,
PRIMARY KEY ());
SCOPE
. REFERENCES ARE CHECKED
.
REFERENCES ARE NOT CHECKED.
19.2.5
. . CHAR
VARCHAR
. , CHAR VARCHAR. SQL3
, (large objects, LOBs).
LOB .
CLOB (character LOB) NCLOB (national character LOB) , BLOB (binary LOB)
(.., , , video). :
CREATE TABLE
( INT NOT NULL,
VARCHAR(40),
BLOB(200K),
_} CLOB(20K),
PRIMARY KEY ());
SQL3,
BLOB.
BLOB ,
.
BLOB SQL3
BLOB, CLOB NCLOB,
, , ..
492
19. -
19.2.6
SQL3
(computationally complete).
.
[ISO 1999b].
SQL3,
C PASCAL:
.
DECLARE :
DECLARE x INT;
DECLARE p BLOB(100K);
DECLARE flag BOOLEAN;
19.2.7
(trigger)
.
, [Ceri 2000].
,
.
:
493
, ,
(logging),
,
.
CREATE TRIGGER :
CREATE TRIGGER -
BEFORE | AFTER - ON -
[REFERENCING < >]
[FOR EACH ROW | STATEMENT]
[WHEN (-)]
BEGIN
-
END;
, .
. BEFORE INSERT, BEFORE DELETE, BEFORE UPDATE
AFTER INSERT, AFTER DELETE, AFTER UPDATE. (FOR EACH ROW)
(FOR EACH STATEMENT). REFERENCES
. BEGIN END .
COMMIT ROLLBACK
.
19.2.8
SQL3 SQL2,
, SQL3 . , ,
, .
494
19. -
19.3
Stonebraker [Stonebraker 1996] , :
) )
. :
, .
.
,
,
.
.
CAD.
, , , - .
.
19.2. , - (
1996) .
, -
. IDC [IDC 2000],
-
11.1 ,
211 . . 2004, IDC
18.2% 12.5%
495
19.2: .
. 2000.
-
. 19.1
, - .
19.4
-
. - ,
.
,
. IBM,
Microsoft Oracle
-.
496
19. -
SQL2
ACID
ODMG
, ODMG
SQL3
, REF
, UDT
UDT
, UDT
, UDT
, REF
19.1: .
SQL.
SQL
.
SQL SQL3, SQL
: ) , )
, ) , ) , )
, ) , )
,
.
19.1.
- ;
497
19.2. SQL3.
19.3. .
19.4.
.
19.5. ;
19.6. ;
19.7. R1 (a, b, c) R2 (a, d, e), a
.
R1 R2 .
, SQL.
19.8.
.
(.., ).
SQL3 Time-Sequence,
1024.
, , , .
.
0 1023.
.
19.9. Polygon
, SQL3.
19.10. 19.2.
20
. ,
,
.
,
.
:
- .
(spatial data)
- (spatio-temporal data).
. -
. ,
,
,
.
499
500
20.
.
. (multimedia data) (GIF, JPG, TIFF),
(MPG, AVI), (MP3, WAV)
(TXT, DOC, RTF, PDF). (..,
, ).
.
, . .
.
(data warehouses)
(on-line analytical processing, OLAP) [Chaudhuri 1997].
. OLAP
(.., ,
).
. (data mining)
(knowledge discovery) .
. ,
.
20.1 -
.
-
(GIS). GIS , ,
501
, ,
[Laurini 1993, Rigaux 2002].
20.1.1
GIS
(thematic layer). ,
,
. (geographic objects). ,
, .
:
1. ,
. , .
2. , . ,
,
, , ...
, , ,
. 20.1
. 20.1 , .
20.1 ,
( ),
( ).
(.
).
20.1.2
. -
502
20.
()
()
20.1: .
, , .
:
(spatial range query), R , R
,
(nearest-neighbor query),
x k
k X,
(spatial join), x,y
x X y Y (..,
).
.
20.1.3
, ,
503
GIS,
. GIS ,
20.2 :
1. ,
2. ( -),
.
&
&
20.2: GIS .
GIS
, ( ). ,
-
.
:
CREATE TABLE
( INT NOT NULL,
504
20.
VARCHAR(30),
INT,
- VARCHAR(20),
VARCHAR (30),
PolygonType,
PRIMARY KEY ());
PolygonType .
.
GIS
:
1. .
2. .
3. .
,
.
4.
(.., -)
.
. ,
R (. 20.3).
{, }.
; ( ).
.
.
.
505
20.3: .
506
20.
R1
R2
R ( )
R1
R2
R3
R()
R()
R()
R3
R(A)
R()
R()
R()
R()
R()
()
() R-
20.4: R-.
. . E.
R(E) .
R- MBR , .
, R-
. (computational geometry). [Manolopoulos 1999, Manolopoulos 2003] , -
.
20.2
( , video,
animation) ( ).
. :
, ,
.
507
.
:
(text), (image), (audio), (video).
GIS,
(.., ) (content).
.
(..,
).
BLOB (. 18) ,
SQL3. ,
BLOB,
BLOB. ,
BLOB video MPEG,
BLOB
MPEG . , SQL3
,
. ,
. ,
:
. , ,
, (image retrieval by content).
. .
.
508
20.
.
video ,
video .
,
. ,
,
. ,
.
IBM QBIC, Virage Excalibur,
(query by image content).
[Khoshafian 1996, Subrahmanian 1998].
20.3
(data warehouse)
.
,
.
[Inmon 1996]:
, , , ...
.
. , .
,
(.., 30 ).
.
509
. , .
( , )
.
. .
OLTP (on-line transaction processing).
(decision making).
OLAP (on-line
analytical processing). OLTP
OLAP 20.1 [Han 2001, Dunham 2003].
OLTP
//
()
(GBytes)
, ,
-
OLAP
()
(TBytes)
, ,
510
20.
20.3.1
20.5.
,
. (data cleaning) ,
. (data transformation)
.
.
.
(..,
).
20.5: .
20.3.2
, .
(multidimensional data model).
(cube) .
. , ,
. (, , ) 2002.
, -
50
100
100 100 100
300
100 100 100 100
100 100100100100100100
1 200 200100300100 0 100 100
100 100100100100100100
2 200 100100100100100100 100
100 100100100100100100
3 100
0 100100100100100 100
100 100 100 100
4 300 200 100 100
511
100
100
100
100
20.6: ( ).
, . 20.6
. . ,
, 1 2002.
20.7: .
20.7 :
1. (star schema).
512
20.
(fact table)
(dimension tables).
2. (snowflake schema). . . .
3. (constellation schema). , , , . .
. ,
.
(measures)
(aggregation)
(summary data).
.
20.3.3 OLAP
. (concept
hierarchy) .
. 20.6.
, , ,
, , .
,
. .
OLAP :
513
ROLL-UP.
, . , ,
ROLL-UP
, ,
.
DRILL-DOWN. ROLL-UP. DRILL-DOWN . ,
, DRILL-DOWN
.
SLICE DICE. . SLICE
, DICE .
. .
PIVOT. pivot
, .
20.8
OLAP.
,
DRILL-DOWN ROLLUP.
.
,
.
OLAP (OLAP servers)
. OLAP
. :
MOLAP (multidimensional OLAP). OLAP
. ( -
514
20.
50
100
100 100 100
300
100 100 100 100
100 100100100100100100
1 200 200100300100250100 100
100 100100100100100100
2 200 100100100100100100 100
100 100100100100100100
3 100
0 100100100100100 100
100 100 100 100
4 300 200 100 100
200
500
100 100 100 100
700
100 100 100 100
100
100
100
100
D
C
1
1
100 100
1 300 250
100
2 100 100
200
200
300
250
20
50
100 100 100
200
100 100 100 100
100 100100100100100100
50 100100 50 100 50 100 100
100 100100100100100100
50 100100150100120100 100
100 100100100100100100
100
0 100100100 80 100 100
100 100 100 100
100
10
50
30
10
100
100
70
40
20
20
100
100
50
70
120 10
100
100
50
0
10
40
100
100
0
10
20
30
100
100
20
0
80
60
100
100
10
100 100 20
100
100
70
20
10
50
100
150 30
60
80
100
100
100
100
100
100
100
100
100
100
100
100
20.8: OLAP.
)
MOLAP .
ROLAP (relational OLAP).
,
. OLAP
(multidimensional views) .
HOLAP (hybrid OLAP). MOLAP ROLAP. ,
(detailed data)
(summary data) .
515
20.4
OLAP,
.
.
OLAP
, .
80% .
.
(data mining). " " " "
,
.
.
: ) (predictive) )
(descriptive).
20.9.
20.9: .
. [Han 2001, Dunham 2003] .
, -
516
20.
:
(clustering),
(association rules).
20.4.1
X = {x1 , x2 , ..., xn } n . k Y1 , ..., Yk
X.
(similar) .
.
,
, , .
, , , .
.
, ,
(web servers)
(log) .
20.10
.
()
()
20.10: .
517
, 20.10. O
,
. ,
.
.
:
. , 20.10
. (outliers)
.
.
(, , ),
.
, (incremental)
.
(domain expert).
,
.
[Han 2001]:
. k
.
: ) , ) .
k
518
20.
. .
. k-means [MacQueen 1967]
k-medoids [Kaufman 1990].
.
.
. .
.
. , n , n .
. ,
. top-down divisive bottom-up agglomerative .
(
bottom-up),
( ).
.
CURE [Guha 1998], BIRCH [Zhang 1996] C2P
[Nanopoulos 2001].
. .
.
.
20.11.
,
. DBSCAN [Ester 1996] OPTICS [Ankerst 1999].
.
(cells)
519
20.11: .
(grid).
, . CLIQUE [Agrawal 1998], Wave-Cluster [Sheikholeslami 1998]
STING [Wang 1997].
.
,
.
20.4.2
(association rule mining) ,
. ,
.
supermarket, . ,
.
barcode
.
20.2 [Dunham 2003].
, (support)
. .
20.2
520
20.
a1
a2
a3
a4
a5
, ,
,
, ,
,
,
20.2: .
20.3. ,
25 1 = 31.
{}
{}
{}
{}
{}
{,}
{,}
{,}
{,}
{,}
{,}
{,}
{,}
{,}
{,}
{,,}
40
80
20
40
60
20
0
20
0
20
20
60
0
20
20
0
{,,}
{,,}
{,,}
{,,}
{,,}
{,,}
{,,}
{,,}
{,,}
{,,,}
{,,,}
{,,,}
{,,,}
{,,,}
{,,,,}
0
0
0
0
0
0
20
20
0
0
0
0
0
0
0
20.3: .
(transaction).
14. D={d1 , d2 , ..., dn } T ={t1 , t2 , ..., tm }.
X D, Y D X Y 6= D,
X Y X = Y .
H X = Y X Y . H (confidence)
X Y
521
X. .
20.4
.
{} = {}
{} = {}
{} = {}
{} = {}
{} = {}
60
60
20
20
0
75
100
50
100
0
20.4: .
{} = {}.
20.2, . , 60%.
100%, X ({})
X Y ({,}). ,
, .
,
.
. Apriori [Agrawal 1994, Mannila 1994]
.
20.5
. ,
. :
522
20.
- ,
,
, , video,
, ROLL-UP, DRILL-DOWN, SLICE, DICE,
,
.
20.1. (.., GIS).
20.2. R- .
R-
.
20.3. B R-.
20.4.
B- . .
20.5. ,
.
20.6. ;
OLTP OLAP.
20.7. OLAP
. .
523
20.8. : ) ) .
20.9. .
20.10. , .
21
MSSQLS-2000
MSSQLS-2000 - (object-relational)
,
. , ,
.
MSSQLS-2000.
, , , .
21.1
MSSQLS-2000 (stored procedures).
, :
525
526
21. MSSQLS-2000
. ,
, .
, .
, .
,
.
.
.
DROP.
.
(default value)
. OUTPUT .
, T-SQL.
527
RECOMPILE
.
. RECOMPILE MSSQLS-2000
.
. ENCRYPTION
,
.
FOR REPLICATION (replicated
data). WITH RECOMPILE.
,
T-SQL . T-SQL,
,
. , , ,
.
T-SQL ,
C++ Java.
, .
.
. ,
. :
CREATE PROCEDURE _} (@ INT=5)
AS
UPDATE
SET = + *@/100;
@ INT=5
5. EXECUTE.
528
21. MSSQLS-2000
10%.
:
EXECUTE 10;
movies-db. T-SQL
Query Analyzer.
,
.
:
CREATE PROCEDURE __
AS
SELECT * FROM WHERE =.;
Query Analyzer
EXECUTE:
EXECUTE ;
.
DVD .
:
CREATE PROCEDURE _DVD (@ INT,
@_DVD INT)
AS
UPDATE
SET DVD=DVD+_DVD;
DVD 1:
EXECUTE DVD @=1, @ DVD=5;
ALTER PROCEDURE,
DROP PROCEDURE.
529
21.2
MSSQLS-2000 .
(user-defined function) T-SQL, .
T-SQL
.
MSSQLS-2000.
T-SQL CREATE FUNCTION
. :
CREATE FUNCTION _
([{@ _ [=_]}
[, ...n]])
RETURNS _
[WITH {ENCRYPTION
| SCHEMABINDING
| ENCRYPTION, SCHEMABINDING}]
AS
BEGIN
T-SQL
RETURN
END;
. , .
RETURNS. , TSQL, BEGIN END. ENCRYPTION (
). ,
SCHEMABINDING,
.
DVD:
CREATE FUNCTION _ (@ _DVD INT)
RETURNS INT
AS
BEGIN
530
21. MSSQLS-2000
RETURN
(SELECT COUNT(*)
FROM
WHERE DVD>=@_DVD)
END;
,
TABLE. ,
DVD DVD:
CREATE FUNCTION (@ _DVD INT)
RETURNS TABLE
AS
BEGIN
RETURN
(SELECT *
FROM
WHERE DVD>=@_DVD)
END;
ALTER FUNCTION,
DROP FUNCTION.
21.3
MSSQLS-2000
18 SQL3. :
// ,
,
(logging),
, .
531
AFTER ,
. INSTEAD OF
,
. AFTER ,
INSTEAD OF .
IF UPDATE
. IF UPDATE
AND OR. WITH ENCRYPTION
.
.
inserted
deleted. deleted
. , inserted
. UPDATE, deleted
, inserted
.
21.4
MSSQLS-2000
. T-SQL (.., INT, CHAR). :
532
21. MSSQLS-2000
TEXT: 231 -1 ,
NTEXT: 230 -1 unicode,
IMAGE: ,
, video, 231 -1 .
.
, (..,
DVD ) trailer video.
,
ALTER TABLE :
ALTER TABLE
ADD
( TEXT,
IMAGE,
video IMAGE);
,
TEXT IMAGE.
MSSQLS-2000
TEXT, NTEXT IMAGE,
.
MSSQLS-2000
.
21.5
MSSQLS-2000 (data warehouses) Microsoft Analysis Services
(MAS ). MAS
. , Cube Wizard , Dimension Wizard
.
533
21.5.1
MAS / (client/server) . 21.1 /
MAS. MAS Analysis Server PivotTable.
Analysis Server
OLAP. ,
PivotTable
(clients) ADO Multidimensional (ADO MD)
OLE DB.
MOLAP
OLE DB
ROLAP
HOLAP
DSS
Analysis Server
ADO
Pivot Table
21.1: / MAS.
Analysis Server
MOLAP, ROLAP HOLAP 19. MOLAP , ROLAP , HOLAP .
MAS
:
(database) - (logical container)
.
(cube) - .
(datasource) -
.
(measure) -
OLAP (.., , ).
1034 .
534
21. MSSQLS-2000
(dimension) - .
(aggregation)
. , ( ) ( ),
( ) (
).
(cell) -
. .
() 2000 ( 1)
( 2) (
3).
(partition) -
(partitions).
,
.
.
(hierarchy) - (members) .
(balanced) - (unbalanced).
,
- .
21.5.2 MAS
MAS ,
.
:
(regular cube) -
.
(datasource) ,
.
(virtual cube) -
.
535
.
(linked cube) -
MAS.
(local cube) -
(portable files)
Analysis Server.
(real-time cube) -
OLAP (real-time OLAP).
.
(write-enabled cube) -
,
.
21.5.3 OLAP
MAS Analysis Manager
.
, ,
, ,
. , Analysis Manager
OLAP . MAS FoodMart2000.
21.2 Budget Analysis Manager.
Analysis Manager .
; MAS MDX (multidimensional expressions)
. MDX
SQL.
536
21. MSSQLS-2000
21.5.4
MAS .
Microsoft (Microsoft Research).
MAS : )
(decision trees) ) .
(classification)
537
21.3: MDX.
. (nearest neighbors). (
) .
MAS
.
21.6
MSSQLS-2000 . .
, .
TEXT, NTEXT IMAGE
538
21. MSSQLS-2000
, (.., ).
Microsoft Analysis Services
OLAP . ,
.
21.1. .
21.2. movies-db , .
VHS
DVD 0. VHS DVD
0. ,
.
21.3. MSSQLS-2000 ;
21.4.
MAS (Microsoft Analysis Services).
21.5. , , .
21.6. MDX; .
21.7. MSSQLS2000;
21.8. MSSQLS-2000.
21.9. MSSQLS-
539
2000.
21.10. MSSQLS2000.
[Adam 1989] N. Adam and J. Worthmann: "Security-control Methods for Statistical Databases: a Comparative Study", ACM Computing Surveys, Vol.21 No.4,
pp.515-556, 1989.
[Agrawal 1994] R. Agrawal and R. Srikant: "Fast Algorithms for Mining Association Rules", Proceedings 20th International Conference on Very Large Data
Bases, pp.487-499, 1994.
[Agrawal 1998] R. Agrawal, J. Gehrke, D. Gunopoulos and P. Raghavan: "Automatic Subspace Clustering of High-Dimensional Data for Data Mining Applications", Proceedings ACM SIGMOD Conference, pp.94-105, 1998.
[Aho 1979] A. Aho, Y. Sagiv and J. D. Ullman: "Equivalence Among Relational
Expressions", SIAM Journal of Computing, Vol.8, No.2, pp.218-246, 1979.
[Aho 1979b] A. Aho, C. Beeri and J. D. Ullman: "The Theory of Joins in Relational Databases", ACM Transactions on Database Systems, Vol.4, No.3,
pp.297-314, 1979.
[Andrews 2003] C. Andrews, D. Litchfield, B. Grindlay and NGS Software: "SQL
Server Security", McGraw-Hill/Osborne, 2003.
[Ankerst 1999] M. Ankerst, C. Elsen, M. Ester and H.-P. Kriegel: "Visual Classification: an Interactive Approach to Decision Tree Construction", Proceedings
International Conference on Knowledge Discovery and Data Mining, pp.392-396,
1999.
[ANSI 1986] ANSI: "American National Standards for Information Systems:
Database Language SQL", FDT, ANSI X3,135-1986, ANSI, New York, 1986.
[ANSI 1989] ANSI: "Database Language SQL with Integrity Enhancement", ANSI
X3,135-1989, ANSI, New York, 1989. Also as ISO/IEC Document 9075:1989.
541
542
[ANSI 1992] ANSI: "Database Language SQL", ANSI X3,135-1992, ANSI, New
York, 1992. Also as ISO/IEC Document 9075:1992.
[Atkinson 1989] M. Atkinson, F. Banchilhon, D. DeWitt, K. Dittrich, D. Maier
and S. Zdonik: "Object-Oriented Database System Manifesto", Proceedings 1st
International Conference on Deductive and Object-Oriented Databases, pp.4057, 1989.
[Armstrong 1974] W. Armstrong: Dependency Structures of Data Base Relationships, Proceedings of the IFIP Congress, pp.580-583, 1974.
[Baeza-Yates 1989] R. A. Baeza-Yates: "Expected Behavior of B+ -trees", Acta
Informatica, Vol.26, No.5, pp.439-471, 1989.
[Batini 1991] C. Batini, S. Ceri, S. B. Navathe: "Conceptual Database Design: an
Entity/Relationship Approach", Addison-Wesley, 1991.
[Bayer 1972] R. Bayer and E. M. McCreight: "Organization and Maintenance of
Large Ordered Indices", Acta Informatica, Vol.1, No.3, pp.173-189, 1972.
[Bayer 1972b] R. Bayer and E. M. McGreight: "Symmetric Binary B-trees Data Structures and Maintenance Algorithms", Acta Informatica, Vol.1, No.4,
pp.209-306, 1972.
[Bayer 1977] R. Bayer and K. Unteraurer: "Prefix B-trees", ACM Transactions on
Database Systems, Vol.2, No.1, pp.1-21, 1977.
[Beauchemin 2004] B. Beauchemin, N. Berglund and D. Sullivan: A First Look
at SQL Server 2005 for Developers, Addison-Wesley, 2004.
[Bell 1974] D.E. Bell and L.J. La Padulla: "Secure Computer Systems: Mathematical Foundations and Model", MITRE Technical Report M74-244, 1974.
[Bernstein 1987] P.A. Bernstein, V. Hadzilakos and N. Goodman: "Concurrency
Control and Recovery in Database Systems", Addison-Wesley, 1987.
[Castano 1995] S. Castano, M.-G. Fugini, G. Martella and P. Samarati: "Database
Security", Addison-Wesley, 1995.
[Cattell 2000] R.G.G. Cattell (ed.): "The Object Database Standard: ODMG Release 3.0", Morgan Kaufmann, 2000.
543
544
[DBTG 1971] DBTG: "Report of the CODASYL Database Task Group", ACM,
April 1971.
[Denning 1979a] D. Denning, P. Denning, and M. Schwartz: "The Tracker: A
Threat to Statistical Database Security", ACM Transactions on Database Systems, Vol.4, No.1, pp.76-96, 1979.
[Denning 1979b] D. Denning and P. Denning: "Data Security", Computing Surveys,
Vol.11, No.3, pp.227-249, 1979.
[Denning 1983] D.E. Denning: "Cryptography and Data Security", Addison-Wesley,
1983.
[Devarakonda 2001] R.S. Devarakonda: "Object-Relational Database Systems the Road Ahead", ACM Crossroads Student Magazine, Vol.7, No.3, 2001.
[Dunham 2003] M.H. Dunham: "Data Mining, Introductory and Advanced Topics",
Prentice Hall, 2003.
[Dutka 1989] A.F. Dutka and H.H. Hanson: "Fundamentals of Data Normalization", Addison-Wesley, 1989.
[Eaglestone 1998] B. Eaglestone and M. Ridley: "Object Databases: an Introduction ", McGraw-Hill, 1998.
[Eisenbarth 1982] B. Eisenbarth, N. Ziviani, G.H. Gonnet, K. Melhorn and D.
Wood: "The Theory of Fringe Analysis and its Applications to 2-3 trees and
B-trees", Information and Control, Vol.55, pp.125-174, 1982.
[Eisenberg 1999] A. Eisenberg and J. Melton: "SQL:1999, Formerly Known as
SQL3", ACM SIGMOD Record, Vol.28, No.1, pp.131-138, 1999.
[Eisenberg 2001] A. Eisenberg and J. Melton: "SQL Multimedia and Application
Packages (SQL/MM)", ACM SIGMOD Record, Vol.30, No.4, pp.97-102, 2001.
[Elmasri 2000] R. Elmasri and S.B. Navathe: "Fundamentals of Database Systems",
3rd edition, Benjamin/Cummings, 1994.
[Ester 1996] M. Ester, H.-P. Kriegel, J. Sander and X. Xu: "A Density-Based
Algorithm for Discovering Clusters in Large Spatial Databases", Proceedings
International Conference on Knowledge Discovery and Data Mining, pp.226-231,
1996.
545
[Eswaran 1976] K.P. Eswaran, J.N. Gray, R.A. Lorie and I.L. Traiger: "The Notion
of Consistency and Predicate Locks in Database Systems", Communications
of the ACM, Vol.19, No.11, pp.624-633, 1976.
[Fagin 1977] R. Fagin: "Multivalued Dependencies and a New Normal Form for
Relational Databases", ACM Transactions on Database Systems, Vol.2, No.3,
pp.262-278, 1977.
[Fagin 1979] R. Fagin: "Normal Forms and Relational Database Operators", Proceedings ACM SIGMOD Conference, pp.153-160, 1979.
[Fagin 1979b] R. Fagin, J. Nievergelt, N. Pippenger and H. R. Strong: "Extendible
Hashing - a Fast Method for Dynamic Files", ACM Transactions on Database
Systems, Vol.4, No.3, pp.315-344, 1979.
[Fagin 1981] R. Fagin: "A Normal Form for Relational Databases that is Based
on Domains and Keys", ACM Transactions on Database Systems, Vol.6, No.3,
pp.387-415, 1981.
[Fernandez 1981] E.B. Fernandez, R.C. Summers and C. Wood: "Database Security and Integrity", Addison-Wesley, 1981.
[Fujitani 1984] L. Fujitani: "Laser Optical Disk: The Coming Revolution in OnLine Storage", Communications of the ACM, Vol.27, No.6, pp.546-554, 1984.
[Gonnet 1984] G.H. Gonnet: "Handbook of Algorithms and Data Structures",
Addison-Wesley, 1984.
[Graefe 1993] G. Graefe: "Query Evaluation Techniques for Large Databases",
ACM Computing Surveys, Vol.25, No.2, pp.73-170, 1993.
[Guha 1998] S. Guha, R. Rastogi and K. Shim: "A Robust Clustering Algorithm
for Categorical Attributes", Proceedings IEEE International Conference on Data
Engineering, pp.512-521, 1990.
[Gulutzan 1999] P. Gulutzan, T. Pelzer: "SQL-99 Complete, Really", CMP Books,
1999.
[Guttman 1984] A. Guttman: "R-trees: a Dynamic Index Structure for Spatial
Searching", Proceedings ACM SIGMOD Conference, pp.45-57, 1984.
[Han 2001] J. Han and M. Kamber: "Data Mining, Concepts and Techniques", Morgan Kaufmann, 2001.
546
[Knuth 1973] D.E. Knuth: "The Art of Computer Programming: Sorting and Searching", Addison-Wesley, 1973.
[Larson 1978] P.A. Larson: "Dynamic Hashing", BIT, Vol.18, No.2, pp.184-201,
1978.
[Larson 1980] P. A. Larson: "Linear Hashing with Partial Extensions", Proceedings
6th International Conference on Very Large Data Bases, pp.224-232, 1980.
[Laurini 1993] R. Laurini and D. Thompson: "Fundamentals of Spatial Information
Systems", Academic Press, 1993.
547
[Leung 1984] C.H.C. Leung: "Approximate Storage Utilization of B-trees - A Simple Derivation and Generalizations", Information Processing Letters, Vol.19,
No.4, pp.199-201, 1984.
[Litwin 1980] W. Litwin: "Linear Hashing - A New Tool for File and Table Addressing", Proceedings 6th International Conference on Very Large Data Bases,
pp.212-223, 1980.
[Lomet 1983] D. Lomet: "Bounded Index Exponential Hashing", ACM Transactions on Database Systems, Vol.8, No.1, pp.136-165, 1983.
[Lorie 1977] R. Lorie: "Physical Integrity in a Large Segmented Database", ACM
Transactions on Database Systems, Vol.2, No.1, pp.91-104, 1977.
[Mannila 1994] H. Mannila, H. Toivonen and A.I. Verkamo: "Efficient Algorithms
for Discovering Association Rules", Proceedings AAAI Workshop Knowledge
Discovery in Databases, pp.181-192, 1994.
[Manolo 94] Y. Manolopoulos and N. Lorentzos: "Performance of Linear Hashing Schemes for Primary Key Retrieval", Information Systems, Vol.19, No.5,
pp.433-446, 1994.
[Manolopoulos 1999] Y. Manolopoulos, Y. Theodoridis and V. Tsotras: "Advanced Database Indexing", Kluwer Academic Publishers, 1999.
[Manolopoulos 2003] Y. Manolopoulos, A. Nanopoulos and E. Tousidou: "Advanced Signature Indexing for Multimedia and Web Applications", Kluwer Academic Publishers, 2003.
[Manolopoulos 2005] Y. Manolopoulos, A. Nanopoulos, A.N. Papadopoulos and
Y. Theodoridis: R-trees: Theory and Applications, Springer, 2005.
[MacQueen 1967] J. MacQueen: "Some Methods for Classification and Analysis
of Multivariate Observations", Proceedings 5th Berkeley Symposium on Mathematics and Statistics, pp.281-297, 1967.
[Maier 1983] D. Maier: "The Theory of Relational Databases", Computer Science
Press, 1983.
[McGreight 1977] E.M. McGreight: "Pagination of B -trees with Variable Length
Records", Communications of the ACM, Vol.20, No.9, pp.670-674, 1977.
548
549
[Rivest 1978] Rivest R., Shamir A. and Adleman L.: "A Method for Obtaining Digital Signatures and Public-Key Cryptosystems", Communications of the ACM,
Vol.21, No.2, pp.120-126, 1978.
[Rosenberg 1981] A.L. Rosenberg and L. Snyder: "Time and Space Optimality
in B-trees", ACM Transactions on Database Systems, Vol.6, No.1, pp.174-183,
1981.
[Rosenkrantz 1978] D.J. Rosenkrantz, R.E. Streams and P.M. Lewis II: "System
Level Concurrency Control for Distributed Database Systems", ACM Transactions on Database Systems, Vol.3, No.2, pp.178-198, 1978.
[Ruemmler 1994] C. Ruemmler and J. Wilkes: "An Introduction to Disk Drive
Modeling", IEEE Computer, Vol.27, No.3, pp.144-172, 1994.
[Salzberg 1988] B. Saltzberg: "File Structures", Prentice Hall, 1988.
[Scholl 1981] M. Scholl: "New File Organizations Based on Dynamic Hashing",
ACM Transactions on Database Systems, Vol.6, No.1, pp.194-211, 1981.
[Sharma 2002] R. Sharma: "Microsoft SQL Server 2000, A Guide to Enhancements
and New Features", Addison-Wesley, 2002.
[Sheikholeslami 1998] G. Sheikholeslami, S. Chatterjee and A. Zhang:
"WaveCluster: A Multiresolution Clustering Approach for Very Large
Spatial Databases", Proceedings 24th International Conference on Very Large
Data Bases, pp.428-439, 1998.
[Silberschatz 2002] A. Silberschatz, H.F. Korth and S. Sudarshan: "Database System Concepts", 4th edition, McGraw-Hill, 2002.
[Spett 2002] K. Spett: "SQL Injection: Is Your Web Applications Vulnerable?",
Technical Report, SPI Dynamics, 2002.
[Stonebraker 1996] M. Stonebraker: "Object-Relational DBMSs: the Next Great
Wave", Morgan Kaufmann, 1996.
[Subrahmanian 1998] V.S. Subrahmanian: "Principles of Multimedia Database Systems", Morgan Kaufmann, 1998.
[Teorey 1994] T.J. Teorey: "Database Modeling and Design: the Fundamental Principles", 2nd edition, Morgan Kaufmann, 1994.
550
[Tharp 1987] A.L. Tharp: "File Organization and Processing", John Wiley, 1988.
[Thalheim 2000] B. Thalheim: "Fundamentals of Entity-Relationship Modeling",
Springer-Verlag, 2000.
[Tsichritzis 1978] D. Tsichritzis and A. Klug (eds.): "The ANSI/X3/SPARC DBMS
Framework", AFIPS Press, 1978.
[Wang 1997] W. Wang, J. Yang and R. Muntz: "STING: a Statistical Information Grid Approach to Spatial Data Mining", Proceedings 23rd International
Conference on Very Large Data Bases, pp.186-195, 1997.
[Wiederhold 1983] G. Wiederhold: "Database Design", McGraw-Hill, 2nd edition,
1983.
[Wiederhold 1987] Wiederhold G.:
McGraw-Hill, 1987.
[Wong 1983] C.K. Wong: "Algorithmic Studies in Mass Storage Systems", Springer
Verlag, 1983.
[Zaniolo 1976] C. Zaniolo: "Analysis and Design of Relation Schemata for Database
Systems", Ph.D. Thesis, Department of Computer Science, University of California, Los Angeles, 1976.
[Zhang 1996] T. Zhang, R. Ramakrishnan and M. Livny: "BIRCH: an Efficient
Data Clustering Algorithm for Very Large Databases", Proceedings ACM SIGMOD Conference, pp.103-114, 1996.
Enterprise Manager, 122--124, 129,
131, 238, 240, 242, 244, 252,
444, 455, 458
Full Text, 126
Profiler, 123
Query Analyzer, 123, 237, 241,
242, 252, 447
Service Manager, 126
Transact-SQL, 237
Armstrong, 182
Bayer, 290, 317
Bell-LaPadula, 419
Boyce, 187
Chen, 99
Codd, 135, 153, 187
Fagin, 333
Gonnet, 317
Hamming, 59, 66
Knuth, 305
Scholl, 332
Snyder, 300
Stonebraker, 494
Tharp, 348
Thomas, 398
Maier, 187
McCreight, 290
Microsoft SQL Server, 119, 237, 437,
525
Agent, 123
Analysis Services, 125
Data Transformation Services, 124
Database Engine, 121
Distributed Transaction Coordinator, 126
English Query, 126
Unteraurer, 317
, 432
, 429
, 412
, 414
, 414
, 419
551
552
, 421
, 394
, 395
, 394
, 395
Thomas,
398
,
397
, 398
, 394, 397
, 509
, 294
, 500
, 83
, 83
, 83
, 413
, 161
, 508
ANSI-SPARC, 81
, 82
, 82
, 83
, 411, 412
, 411
, 411
, 411
, 379
, 413
, 40
, 419
, 94, 353,
446, 481
, 362
, 355
, 358
, 356
SQL, 205
ALL, 226
ALTER TABLE, 212
BETWEEN, 228
CASCADE, 212
CHECK, 211
CREATE DOMAIN, 213
CREATE FUNCTION, 489
CREATE INDEX, 233, 444
CREATE PROCEDURE, 526
CREATE SCHEMA, 210
CREATE TABLE, 87, 211, 415
CREATE TRIGGER, 531
CREATE VIEW, 232, 253, 415,
422, 460
DEFAULT, 211
DISTINCT, 215
DROP DOMAIN, 214
DROP INDEX, 233
DROP TABLE, 211, 213
DROP VIEW, 232
EXCEPT, 220
EXISTS, 226
FOREIGN KEY, 212
GRANT, 415, 416
GROUP BY, 215, 222
HAVING, 215, 223, 227
INSERT, 88
INTERSECT, 220
IS NOT NULL, 217
IS NULL, 217
JOIN, 219
LIKE, 224
NOT BETWEEN, 228
NOT LIKE, 224
ON DELETE, 212
ON UPDATE, 212
ORDER BY, 215, 227
OVERLAPS, 229
PRIMARY KEY, 211
REFERENCES, 212
REVOKE, 415, 417
SELECT, 88, 215
SOME, 226
UNION, 219
UNIQUE, 211
SQL-86, 205
SQL-89, 205
SQL-92, 205
SQL:1999, 205, 485
, 221
, 206
, 85
, 85
, 86
, 88
, 357
, 261
, 288
1-2, 317
2-3, 317
B, 290
R, 505
, 301
+ , 305
, 288
, 288
-, 317
-, 99
,
72
DAS, 72
NAS, 72
553
SAN, 73
, 273
/, 261
, 418
, 65, 90, 137, 262
, 262
, 263
, 262
, 66
, 66
, 275
, 195
, 181
, 186
, 186
, 182
, 186
Armstrong, 182
, 182
, 184
, 186
, 198
, 109
, 110
, 110
, 413
, 500
, 519
, 516
, 400
, 404
, 402
, 406
, 111
, 376
554
, 375
, 445
, 270
, 506
, 69
, 70
, 415
ACID, 382
, 51
, 59, 66
, 179
, 189
, 186
Boyce-Codd, 191
, 198
, 188
, 196
, 190
, 233, 287
, 323
, 324
, 342
, 330
, 338
, 333
, 324
, 324
, 327
, 324
, 325
, 325
, 325
, 51
(NULL), 102
, 103, 287
, 103
, 103
, 110
, 142
, 103, 139
, 103, 140
, 388
, 389
, 390
, 389
, 390
, 392
, 391
, 390
, 423
, 423
, 424
, 424
, 424
, 423
, 423
-, 423
, 424
, 52
, 414
, 52
, 93
, 86
, 289
, 53, 65
, 67
, 68
, 67
, 67
, 68
/,
65
/, 66
, 53, 54
, 55
, 55
, 57
RAMAC, 58
, 56
, 55
, 56
, 55
, 55
,
57
, 57
, 55
, 55
, 56
, 56
, 56
-, 86
, 354
, 388
, 70
flash, 52
, 90
o-, 99
-, 91
, 71
, 71
, 53, 62
, 63
, 62
, 64
, 63
, 65
555
, 406
,
66
, 137
, 141, 143,
211, 212, 215, 241, 242, 379,
493
, 142
, 142
, 141
, 419
, 419
-*, 419
, 353
, 135
, 105
, 510
, 420
, 421
, 269
, 414
, 428
, 280
, 425
, 138
, 108
, 379
ROLLBACK, 395, 402
ROLLFORWARD, 402
, 382
, 382
, 380
, 382
, 385
, 385
, 386
, 386, 387
556
, 382
, 386
,
69
, 58
0, 58
1, 59
2, 59
3, 59
4, 60
5, 61
6, 61
, 62
, 83, 138
, 83
, 83
, 83
, 157
, 163
, 168
, 164
, 167
, 166
, 159
, 167
, 161
, 162
, 161
-, 165
, 164
, 164
, 135
, 169
, 171
, 169
, 101
, 104
, 40
, 37
, 41
, 382
, 383
, 105
, 413
, 51
, 93
, 259
, 101
, 102
, 101
, 102
, 102
, 102
, 101
, 79
, 79
,
80
, 80
, 79
, 80
, 400
, 192
, 425
, 414
, 150