Professional Documents
Culture Documents
Third Edition
Thomas M. Connolly
Carolyn E. Begg
UNIVERSITY OF PAISLEY
A
TT
ADDISON-WESLEY
Boston San Francisco New York Toronto Montreal
London Munich Paris Madrid Capetown Sydney
Tokyo Singapore Mexico City
http://openlib.org.ua/
http://openlib.org.ua/
-
2003
http://openlib.org.ua/
32.973.26-018.2.75
64
681.3.07
""
. ..
.. , .
.
"" :
info@william8publishmg.com, http://www.wiHiamspubUshing.com
, , , .
64
. , .
. 3- . : . . . : "",
2003. 1440 . : . . . .
ISBN 5-8459-0527-3 (.)
, ,
. , .
Web
Web, JDBC, SQLJ, ASP, JSP PSP
Oracle.
, OLAP, , - - .
,
,
, ,
.
32.973.26-018.2.75
.
, , , Addi:;on-Wesley UK.
Authorized translation from the English language edition published by Addison-Wesley
Longman, Inc., Copyright Pearson Education Limited 1995, 2002
All rights reserved. No part of this book may be reproduced or transmitted in any form or
by any means, electronic or mechanical, including photocopying, recording or by any information
storage retrieval system, without permission from the Publisher.
Russian language edition published by Williams Publishing House according to the
Agreement with R&I Enterprises International, Copyright 2003
1BN 5-8459-0527-3 (.)
ISBN 0-201-70857-4 (.)
"", 2003
Pearson Education Limited, 1995, 2002
http://openlib.org.ua/
23
25
I.
41
1.
2.
43
77
.
3.
113
115
4.
5. SQL:
137
163
6. SQL:
7. QBE
8. : Access Oracle
211
255
283
III.
9. ,
10.
11. "-"
12. "-"
13.
329
IV.
14.
15,
16.
17.
331
367
397
429
447
495
497
525
569
603
V.
18.
19.
619
621
655
20.
21. SQL
723
777
VI.
22.
813
815
http://openlib.org.ua/
23.
24.
25. -
26. -
27. -
869
927
961
1005
1049
VII.
28. Web-
29. XML
30.
31.
32, OLAP
1105
1107
1173
1227
1263
1289
VIII.
.
DreamHome
.
.
.
.
ER-
.
.
3. Web-
1315
1317
1325
1339
1359
1365
1369
1377
1381
1395
1413
1427
http://openlib.org.ua/
UML ( )
I.
II.
III.
IV.
V.
VI.
VII.
23
25
25
26
27
28
29
30
30
31
31
31
32
33
33
34
35
36
38
38
40
40
I.
1.
1.1.
1.2.
1.2.1. ,
1.2.2. ,
1.3.
1.3.1.
1.3.2.
1.3.3.
1.3.4.
1.4.
1.4.1.
1.4.2.
1.4.3.
1.4.4.
1.5.
1.6.
41
43
44
46
47
52
55
55
56
60
62
63
63
64
65
65
65
68
http://openlib.org.ua/
2,
2.1. ANSI-SPARC
2.1.1.
2.1.2.
2.1.3.
2.1.4. ,
2.1.5.
2.2.
2.2.1. DDL
2.2.2. DML
2.2.3. 4GL
2.3.
2.3.1.
2.3.2.
2.3.3.
2.3.4.
2.4.
2.5.
2.6.
2.6.1.
2.6.2.
2.6.3. "/"
2.7.
2.7.1. IRDS
77
78
80
80
81
81
83
84
84
85
86
88
89
90
92
92
93
98
101
101
102
102
107
108
.
3.
113
115
3.1.
3.2.
3.2.1.
3.2.2.
3.2.3.
3.2.4.
3.2.5.
3.2.6.
3.3.
3.3.1.
3.3.2.
3.3.3.
3.3.4. ,
3.4.
3.4.1.
3.4.2.
3.4.3.
4.
4.1.
4.1.1.
4.1.2.
4.1.3.
4.1.4.
4.1.5.
4.2.
116
117
118
121
122
123
124
126
128
128
129
130
130
131
131
132
132
137
138
139
141
145
149
150
152
http://openlib.org.ua/
4.2.1.
4.2.2,
4.3.
5. SQL:
152
156
159
163
5.1. SQL
164
5.1.1. SQL
5.1.2. SQL
5.1.3, SQL
5.1.4,
5.2. SQL
5.3.
5.3.1.
5.3.2. ( ORDER BY)
164
166
167
168
168
169
170
179
5.3.3. SQL
182
184
187
190
191
198
5.3.9. (
199
202
211
212
6.1.1. SQL
6.1.2. SQL
212
213
6.2.1.
218
214
218
6.2.2.
6.2.3.
6.2.4.
6.2.5.
6.3.
6.3.1.
6.3.. ( CREATE TABLE)
219
220
221
222
223
223
224
6.5.
228
230
230
231
231
232
235
235
236
237
239
240
243
244
http://openlib.org.ua/
6.5.1.
6.6.
6.6.1.
( GRANT)
6.6.2.
( REVOKE)
7. QBE
7.1. Microsoft
Access
7.2. QBE
7.2.1.
7.2.2.
7.2.3.
7.3. QBE
7.3.1.
7.3.2.
7.3.3.
7.3.4. ,
7.3.5.
7.4.
7.4.1.
7.4.2.
7.4.3.
7.4.4.
8. : Access Oracle
Microsoft Access 2000
8.1.1.
8.1.2. Microsoft Access
8.1.3.
8.1.4.
8.1.5.
8.1.6.
8.1.7.
8.1.8.
8.2. Oracle 8/8i
8.2.1.
8.2.2. Oracle
8.2.3.
8.2.4.
8.2.5. PL/SQL
8.2.6. , ,
8.2.7.
III.
9. ,
9.1.
9.2.
9.3.
246
246
247
249
255
256
259
259
262
265
266
267
269
269
272
273
274
274
277
277
277
283
283
284
284
286
291
292
294
295
298
299
301
303
311
314
315
320
322
329
331
332
333
335
http://openlib.org.ua/
9.4.
9.4.1.
9.5.
9.5.1.
9.5.2.
9.6.
9.6.1.
9.6.2.
9.6.3.
9.7.
9.7.1.
9.8.
9.8.1.
9.8.2.
9.9.
9.10.
9.11.
9.12.
9.13.
9.14. CASE-
9.15.
9.15.1.
9.15.2.
9.15.3.
353
355
355
356
356
357
358
360
360
361
362
10.
10.1.
10.2.
10.3.
10.3-1.
10.3.2.
10.3.3.
10.3.4.
10.3.5.
10.4.
10.4.1. DreamHome
10.4.2. DreamHome
10.4.3. DreamHome
10.4.4. DreamHome
10.4.5. DreamHome
11. "-"
11.1.
11.2.
11.2.1.
11.2.2,
11.3.
11.3.1.
11.3.2.
336
337
337
339
339
340
341
342
343
346
347
351
351
367
368
368
370
370
370
371
372
373
373
374
379
388
395
397
398
401
403
404
405
407
11
http://openlib.org.ua/
11.3.3,
11.3.4.
11.4.
11.5.
11.6.
11.6.1. " "
11.6.2. " " (1:*)
11.6.3. " "
11.6.4.
11.6.5.
11.7. -
11.7.1. ""
11.7.2. ""
12. ""
12.1. /
12.1.1.
12.1.2. /
12.1.3.
12.1.4.
407
408
410
410
412
412
413
415
416
418
419
419
422
429
430
430
431
432
433
12.1.5.
12.1.6. /
12.1.7. /
Branch
DreamHome
12.2.
12.3.
13.
13.1.
13.2.
13.2.1.
13.2.2.
13.2.3.
433
436
437
441
443
447
448
449
450
450
451
13.3. .
13.3.1.
13.3.2.
13.3.3.
13.3.4.
451
451
455
456
458
13.4.
459
13.5. (1)
13.6. (2)
13.6.1.
13.6.2.
460
464
465
465
13.7. ()
13.7.1.
468
468
13.7.2.
13.8.
13.9. - ()
13.9.1. ' -
13.10. ( 1 )
13.11. (4)
468
472
472
473
476
483
http://openlib.org.ua/
13.11.1.
13.11.2.
13.12. (5)
13.12.1.
13.12.2. (5)
483
485
486
486
486
IV.
14.
14.1.
14.1.1.
14.1.2. ,
14.1.3.
14.2.
14.3.
1.
15.
15.1.
2.
3.
16.
16.1.
16.2.
16.3.
4.
5.
6.
7.
17.
, 8.
9.
V.
18.
18.1.
495
497
498
499
499
500
500
503
503
525
526
526
549
569
570
571
572
573
578
598
599
603
603
614
619
621
622
13
http://openlib.org.ua/
18.1.1.
18.2.
18.2.1.
18.2.2. ()
18.2.3.
18.2.4.
18.2.5.
18.2.6. RAID (
)
18.3. Microsoft Access
18.4. Oracle
18.5. Web
18.5.1. -
18.5.2.
18.5.3.
18.5.4.
18.5.5. Kerberos
18.5.6.
HTTP
18.5.7.
18.5.8. Java
18.5.9. ActiveX
19.
19.1.
19.1.1.
19.1.2.
19.2.
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.3.1.
19.3.2.
19.3.3.
19.3.4.
644
645
646
646
647
648
651
655
656
659
660
660
660
664
671
679
683
687
689
690
694
694
695
699
705
19.4.4.
19.4.5.
19.5.
Oracle
19.5.1. Oracle
14
633
635
638
640
643
643
702
19.4.
19.4.1.
19.4.2.
19.4.3.
623
625
627
630
631
631
632
706
709
710
711
712
713
714
http://openlib.org.ua/
19.5.2.
19.5.3.
19.5.4.
20.
20.1.
20.2.
20.3.
20.3.1.
20.3.2.
20.4.
20.4.1.
20.4.2. (S = a p (R))
20.4.3. (T=(R ><F S))
20.4.4. (S = 1',2',....m(R))
20.4.5.
(T-RuS, T=RnS, T=R-S)
20.5.
20.6. Oracle
20.6.1.
20.6.2.
20.6.3.
21. SQL
21.1. SQL
21.1.1. SQL
21.1.2. SQL (SQLCA)
21.1.3.
21.1.4.
SQL
21.1.5.
21.1.6. ISO SQL
21.2. SQL
21.2.1. EXECUTE IMMEDIATE
21.2.2. PREPARE EXECUTE
21.2.3. SQL (SQLDA)
21.2.4. DESCRIBE
21.2.5.
SQL
21.2.6.
21.2.7. SQL
ISO
21.3. ODBC (Open Database Connectivity)
21.3.1. ODBC
21.3.2. ODBC
VI.
22.
22.1.
22.1.1.
22.1.2.
22.1.3.
715
716
716
723
725
728
733
733
739
740
740
742
750
758
761
762
763
764
768
770
777
778
778
780
782
784
790
791
793
794
794
796
799
801
802
802
804
806
807
813
815
816
817
822
825
15
http://openlib.org.ua/
22.2.
22.3.
22.3.1.
22.3.2.
22.3.3.
22.3.4.
22.4.
22.4.1.
22.4.2.
22.5.
22.5.1.
22.5.2.
22.5.3.
i 22.5.4.
22.5.5.
22.6. ,
23.
23.1.
23.2.
23.2.1.
23.2.2.
23.2.3.
23.2.4.
23.3.
862
869
870
871
872
872
873
876
881
881
23.4.2.
23.4.3. (2)
23.4.4. ()
882
883
891
23.4.5.
23.5. /
23.6.
891
894
897
23.6.1.
898
23.6.2.
903
23.7.1.
23.7.2.
23.8.
23.8.1.
23.9. Oracle
23.9.1.
Oracle
23.9.2. Oracle
24.
24.1.
16
861
877
23.4.
23.4.1.
23.7.
828
833
833
833
835
835
838
839
840
851
851
854
857
861
907
907
911
912
914
914
915
919
927
928
http://openlib.org.ua/
24.2.
24.3. -
24.3.1. ,
24.3.2.
24.3.3.
24.3.4.
24.3.5.
24.3.6. ,
24.3.7.
24.3.8.
24.3.9.
24.4.
24.4.1.
24.4.2.
24.5.
25. -
25.1. -
25.1.1.
25.1.2,
934
939
940
940
942
944
945
946
948
950
951
952
953
954
955
961
963
964
966
25.2.
967
25.2.1.
25.2.2.
25.3.
969
972
973
25.3.1.
974
25.4.4.
983
25.3.2.
25.4.
25.4.1.
25.4.2.
25.4.3.
976
978
978
979
980
25.4.5.
25.5. " "
25.6.
2 5.6.1.
25.6.2. -
25.7. -
25.7.1. -
25.7.2.
25.7.3.
26, -
26.1. OMG
26.1.1. OMG
26.1.2. CORBA
26.2. ODMG 3.0
26.2.1. ODMG
26.2.2. ()
26.2.3. ODL
985
989
991
991
993
995
995
996
999
1005
1006
1006
1010
1012
1012
1014
1023
17
http://openlib.org.ua/
26.2.3. ODL
26.2.4. OQL
26.2.5. ODMG
26.3. - ObjectStore
26.3.1.
26.3.2. ObjectStore
26.3.3. ObjectStore
27. -
27.1. -
27.2.
27.2.1.
27.2.2. (Third Manifesto)
27.3. Postgres
27.3.1. Postgres
27.3.2.
27.3.3.
27.3.4.
27.4. SQL3
27.4.1.
27.4.2. ,
27.4.3.
27.4.4.
27.4.5.
27.4.6.
27.4.7.
27.4.8.
27.4.9.
27.4.10.
27.4.11.
27.4.12.
27.4.13.
27.4.14. SQL3 OQL
27.5.
27.5.1.
27.6. - Oracle
27.6.1. ,
27.6.2.
27.6.3.
27.6.4.
27.7.
1023
1026
1033
1036
1036
1039
1043
1049
1050
1054
1054
1055
1058
1059
1059
1060
1062
1062
1063
1064
1067
1068
1069
1069
1072
1074
1076
1078
1080
1083
1085
1085
1086
1089
1090
1090
1097
1098
1099
1100
VII.
1105
28. Web-
28.1. Internet Web
28.1.1.
28.1.2.
28.2. Web
28.2.1. HTTP
28.2.2. HTML
28.2.3. URL-
28.2.4. Web-
1107
1109
1110
1111
1113
1114
1119
1119
http://openlib.org.ua/
28.3. Web
28.3.1. ,
Web
28.3.2. Web
28.3.3.
Web
28.3.4. Web
28.4.
28.4.1. JavaScript JScript
28.4.2. VBScript
28.4.3. Perl
28.5. Common Gateway Interface (CGI)
28.5.1. CGI
28.5.2. CGI
1120
1120
1121
1124
1129
1131
1131
1132
1133
1135
1137
1138
1139
1141
1142
1143
1147
1152
1152
1153
1154
1155
1157
1161
1158
1160
29.3. XML
1188
1192
1192
1194
29.3.2. Namespaces
29.3.4. XPath (XML Path)
29.3.5. XPointer (XML Pointer)
29.3.6. XLink (XML Linking)
29.3.7. XHTML
1194
1195
1197
1197
1198
1198
19
http://openlib.org.ua/
29.3.9. (RDF)
1204
29.4. XML
1207
29.4.1. Lore Lorel
XML
1207
29.4.3. XML
1210
29.4.4. XML Query
1215
29.4.5. XML (XQuery)
1219
30.
1227
30.1.
1228
30.1.1.
1228
30.1.2.
1229
30.1.3.
1230
30.1.4. OLTP
1231
30.1.5. 1233
30.2.
1235
30.2.1.
1235
30.2.2.
1236
30.2.3.
30.2.4.
30.2.5.
30.2.6.
30.2.7.
30.2.8.
30.2.9.
30.2.10.
30.3.
1237
1237
1237
1238
1238
1238
1238
1239
1241
30.3.1.
30.3.2.
1242
1242
30.3.3.
1243
30.3.4.
30.3.5.
30.4.
30.4.1. ,
1245
30.4.2.
1246
30.5.1.
1252
30.4.3.
30.4.4.
30.5.
1249
1251
1252
30.5.2.
30.6.
Oracle
30.6.1. Oracle 9i
31. '
31.1.
31.2.
31.2.1. DM ER
31.3.
31.4.
20
1244
1244
1245
1254
1256
1256
1263
1264
1264
1268
1269
1276
http://openlib.org.ua/
31.5.
Oracle
31.5.1. Oracle Warehouse Builder
31.5.2 Oracle Warehouse Builder
32. OLAP
32.1. (OLAP)
32.1.1. OLAP
32.1.2. OLAP
32.1.3. OLAP
32.1.4.
32.1.5. OLAP
32.1.6. OLAP
32.1.7. SQL OLAP
32.2.
32.2.1.
32.2.2.
32.2.3.
32.2.4.
1310
32.2.5.
32.2.6.
1311
1311
32.2.7.
1311
32.2.8.
1312
VIII.
.
DreamHome
A.I. Branch DreamHome
.1.1.
.1.2. ()
.
.1. University Accommodation Office
.1.1.
.1.2. ()
.2. EasyDrive School of Motoring
.2.1.
.2.2. ()
.. Wellmeadows Hospital
,3.1.
,3.2. ()
8.1.
8.2.
8.3.
8.4.
8.4.1.
8.4.2. ,
.5.
1279
1279
1280
1289
1290
1291
1292
1294
1294
1297
1300
1302
1305
1305
1307
1308
1315
1317
1317
1317
1319
1320
1320
1322
1325
1325
1325
1327
1328
1329
1329
1330
1330
1336
1339
1340
1341
1342
1344
1347
1348
1349
21
http://openlib.org.ua/
8.5.1.
8.5.2. -
1349
1350
8.5.3.
8.5.4.
8.5.5.
.6.
8.6.1.
8.6.2.
.
.
ER-
.1. ER-
.2. ER-
" "
1351
1352
1353
1355
1357
1358
1359
1365
1365
1365
.
1369
1.
1369
2.
1370
3.
1373
4.
1374
5.
6.
7.
8.
9.
.
3. Web-
3.1. JavaScript
3.2. PostgreSQL
3.3. CGI Perl
3.4. Java JDBC
3.5. Java SQLJ
3.6. JSP
3.6. ASP ADO
3.8. PSP Oracle
22
1374
1375
1375
1375
1375
1377
1381
1381
1383
1384
1386
1387
1388
1389
1392
1395
1413
1427
http://openlib.org.ua/
, , , , .
, , .
, , , .
, , .
, ,
.
,
.
.
http://openlib.org.ua/
http://openlib.org.ua/
30
.
.
. ,
.
. , , , ,
, . "
", " ", .
, ( ), . , , ,
. , , ,
, .
( ), ,
, .
: , . ,
- . ,
, , .
,
. , ,
.
. , ,
25
http://openlib.org.ua/
.
, ., .
, , DreamHome. , ,
.
UML ( )
, .
, "-" (Entity-Relationship ER).
.
ER-. , , , , .
(Chen).
, ; .
" " (Crow's Foot).
,
. " " " "
" " .
(Computer-Aided
Software Engineering CASE).
, .
. , Pearson Education, ,
- UML (Unified Modeling Language ). UML ,
, -
: , (Rumbaugh),
- (Booch)
Objectory (Jacobson).
. -,
UML . , OMG
(Object Management Group
) UML
. -, UML, ,
. -, UML
, UML . UML. 26
http://openlib.org.ua/
. UML,
, UML
. Pearson Education Database Solutions: A Step-by-Step Guide to
Building Databases.
.
Microsoft Access,
Oracle.
, CD-ROM Rational Rose.
,
, . .
,
.
, : Microsoft Access Oracle.
, , , , , .
"-" (Entity-Relationship ER)
"-" (Enhanced Entity-Relationship EER)
UML.
.
,
DreamHome.
, SQL, :
, ,
SQL ODBC (Open Database Connectivity
).
,
Microsoft Access Oracle, Web.
Oracle.
Oracle.
,
Oracle.
- () .
,
.
27
http://openlib.org.ua/
-
, ,
, . , , :
, , .
, , , , , , , .
,
.
,
. 16, , 20, , , .
, .
, , 1.
,
, 21 SQL 26.3,
ObjectStore.
28
http://openlib.org.ua/
1. , "-", , . ,
.
2. , , , ,
. ,
.
3. , ,
.
4.
, .
.
, .
5.
( SQL Structured Query Language QBE Query-By-Example),
-
ODMG.
6. , SQL, SQL.
7. , : Microsoft Access Oracle.
Microsoft Access Oracle.
8. ,
.
9. -
( ), ODMG, , SQL (SQL3).
10. Web Web.
11. ,
XML XML.
12. ,
(OLAP) .
29
http://openlib.org.ua/
13. , . .
14. , , ,
.
, , . , , ,
, , , , . , .
.
,
.
, .
, .
,
.
, .
,
.
Instructor's Guide ( ).
Pearson
Education. Instructors Guide ( ) .
. , , ,
. , ,
,
.
30
http://openlib.org.ua/
.
.
.
( , ) .
. ,
, .
Instructor's Guide
Web- Pearson Education :
http://www.booksites.net/connolly.
I.
--
t,-.
I
.
1 ,
,
(.. ), , .
2 , ANSI-SPARC,
, ,
. ,
.
.
II ,
QBE (Query-By-Example ) SQL (Structured Query
Language ).
: Microsoft Access Oracle.
3 ,
, , .
, .
, 6.
4 ; .
. , 20, ,
31
http://openlib.org.ua/
22, . ,
SQL 5 6, .
5
SELECT, INSERT, UPDATE DELETE, SQL.
, ,
, .
6 SQL. .
SQL , (Integrity Enhancement
Feature IEF) ,
GRANT REVOKE. SQL.
7 ,
QBE (Query-ByExample ),
, . QBE
Microsoft Access.
8 .
: Microsoft Access Oracle. , .
III.
III .
9
. ,
, : , ,
, ( )
( ).
. . .
10 ,
.
. ,
DreamHome.
11 12 "-"
(Entity-Relationship ER) "-"
(Enhanced Entity-Relationship EER).
/ . EER-
-
32
http://openlib.org.ua/
.
UML ER-.
13 ,
.
, , ,
,
.
IV.
IV .
, ,
. DreamHome.
14 .
, , , , .
15 . ,
. ,
, .
16 17 . , .
,
, .
V.
V , .
18
, . , Microsoft Access Oracle.
,
Web, .
19 , : , . ,
33
http://openlib.org.ua/
. , ,
.
Oracle.
20 .
: , ,
,
, .
Oracle.
21 SQL
, . ODBC (Open Database Connectivity
), SQL .
VI.
VI . .
. , .
22 , , , .
23 , . , ,
, , .
(Distributed Transaction Processing DTP),
/Open,
. Oracle.
. ,
,
.
,
,
.
24-27.
24 .
, ,
, -
. . , ,
.
34
http://openlib.org.ua/
25 - ().
-
. , , , , ,
. ( )
. , , , .
,
IV - .
26 ,
ODMG (Object Data Management Group
),
. ObjectStore.
27 - , SQL (SQL3). , .
- Oracle.
VII.
, , :
Web, XML,
, (On-Line
Analytical Processing OLAP) .
28 Web.
Internet Web Web
. Web, , CGI, ,
Java, (Active Server Pages)
Oracle Internet Platform.
29 XML,
XML Web. , XML,
Namespaces, XSL, XPath, XPointer XLink. XML Schema XML (Resource Description Framework
RDF) .
XML.
30 .
, .
, , . ,
35
http://openlib.org.ua/
, . Oracle. '
31 / , . ,
, "-" (Entity-Relationship ER). , DreamHome,
Oracle Warehouse Builder,
32 (On-Line
Analytical Processing OLAP) .
OLAP,
OLAP (Multi-dimensional OLAP - MOLAP), OLAP
(Relational OLAP ROLAP) (Managed Query Environment MQE).
SQL , , Red Bricks Intelligent SQL (RISQL) SQL.
,
, , ,
.
DreamHome,
.
,
.
, , 16,
, 20.
12 (Codd) ,
.
, UML:
(Chen) " ".
,
14-17, ,
.
Oracle.
3 Web,
Web , 28.
. 1.
36
http://openlib.org.ua/
III
9 ,
10 1"
'"
11 ;
"-"
12
"-""
13
IV
141. ....;
' *.
' .
19
;
21
3QL
,
VI
25 - -
''
26 - -..
'3:
'
.;.^
23
' ":>
22
' '-?
'
.
29[:
^
28 Web-
. '
270
VII
30
32 OLAP ,
-:-;.
. 1.
http://openlib.org.ua/
, . , ,
. ,
.
. Web-, ,
, ,
, ,
.
, , .
.
E-mail: infowilliamspublishing.com
W W W http: / / w w w . w i l l i a m s p u b l i s h i n g . c o m
,
.
, . , , . ,
.
, ,
.
(Simon Plumtree) (Nicky
Jaeger) , ;
(Martin Tytler)
(Lionel Browne).
, . , X. (William H. Gwinn), (Texas Tech University);
(Adrian Larner) , (University De
Montfort, Leicester); - (Andrew McGettrick)
(University of Strathclyde);
- (Dennis McLeod)
(University of Southern California); - -
(Josepnine DeGuzman Mendoza)
(California State University); (Jeff Naughton) ..
(.. Schwarzkopf) (University of
Oklahoma); - (Junping Sun) (Nova Southeastern University); -
(Donovan Young)
(Georgia Tech); (Barry
Eaglestone) (University of Bradford);
38
http://openlib.org.ua/
39
http://openlib.org.ua/
, : McGraw-Hill Companies, Inc., New York,
. 18.9,
BYTE Magazine 1997 ; Oracle
; Microsoft.
.
ActivePerl ActiveState Corporation; ActiveX,
Authenticode, BizTalk, FoxPro, FrontPage, Microsoft, MS-DOS, Visual Basic, Visual
Studio, Windows Windows NT Microsoft Corporation;
ADABAS Software AG; Aix, CICS, DB2, DRDA, Encina,
IBM, IMS, Poet, SQL/DS, Systems Applications Architecture, TXSeries WebSphere International Business Machines Corporation; AltaVista
Forte Digital Equipment Corporation; AppleTalk
LocalTalk Apple Computer, Inc.; Archie
Bunyip Information Services; DBase IV Borland
International, Inc.; DECNet Compaq; Delphi, InterBase
VisiBroker Borland Software Corporation; Dreamweaver
Macromedia, Inc.; Enterprise JavaBeans, Java, Java Blend
JDBC Sun Microsystems, Inc.; Excite
Excite, Inc.; GemStone Gemstone Systems, Inc.;
HP Intelligent Warehouse Hewlett-Packard Company;
IDMS, IDMS/R IDMS/SQL Cullinet Corporation;
Informix Informix Corporation; INGRES
Computer Associates International, Inc.; Intersolv Merant Solutions, Inc.; ITASCA IBEX Knowledge
Systems SA; JRun Allaire Corporation; Linux
, (Linus Torvalds); LiveWire Pro
Netscape Netscape Communications Corporation; Lycos
Lycos, Inc.; Model 204 Computer
Corporation of America; Oa 02 Technology;
Objectivity/DB Objectivity, Inc.; ObjectStore
eXcelon Corporation; ObjectPAL Object
Design; ONTOS Ontologic, Inc.; Oracle Object SQL Oracle Corporation; Paradox Corel
Corporation; PowerBuilder Powersoft, Inc.; R:base R:BASE Technologies; ServletExec
New Atlanta Communications, LLC; Simula Simula AS;
Smalltalk Xerox Corporation; Sybase
Sybase, Inc.; Tandem Tandem Computers, Inc.;
TOPLink The Object People, Inc.; Tuxedo Systems, Inc.; UniSQL/M UniSQL, Inc.;
UNIX Open Group; Versant Versant Object Technologies; Yahoo Yahoo, Inc.
40
http://openlib.org.ua/
43
77
http://openlib.org.ua/
http://openlib.org.ua/
...
.
.
.
" ".
"".
.
.
, .
.
.
" , ,
, . 20
, ,
10 .
, , , , ,
.
".
([276], [277])
, , ,
. ,
.
, .
,
. , , , .
, , ,
. , -
http://openlib.org.ua/
, ,
, , , .
, , , .
.
1.1
,
. 1.2 1.3 . 1.4 , , ;
, , . 1.5
, 1.6 .
, DreatnHome,
.
10.4 . , . , .
1.1.
.
. , , (Database Management System DBMS), , .
1.3.
, , -. - , .
. ,
. , , .
44
1.
http://openlib.org.ua/
, . , , ,
. , , .
. , . .
,
. , , ,
.
, . -
.
,
. ,
, , . ,
, .
, ,
, , , , ..
,
, . ,
, , .
,
, . ,
,
. -, , . .
- (,
, , , ) , . , , 1.
45
http://openlib.org.ua/
, , , .
, .
Internet
Internet. , ,
Amazon.com. Web-
, , ,
. , Web , , , , , .
, ISBN, , , , ,
, .
, . ,
( ), , , . , Amazon
, , .
,
.
Amazon.com ,
, , , ,
.
, .
,
, , ,
. , , , .
1.2.
, (filebased system). . , ,
.
46
I.
http://openlib.org.ua/
, ,
. , . , ""
,
.
, ,
.
* ,
.
1.2.1. ,
. , '
1
; . - .'.
'.' .
. ( ) ,
- , , , .
, . . ,
, , , ,
, .. -
, ,
. ,
. ,
.
, .
,
. , . ,
, ,.
. ,
, .
?
?
?
?
?
?
1.
47
http://openlib.org.ua/
,
.
, , . , .
. - ,
()
. , Dreamffome.
. , , , . 1.1, ,
, , . ,
,
, . 1.1, .
() . . 1.1-1.3
(PropertyForRent;), (PrivateOwner)
(Client). ,
, ,
.
1.1. PropertyForRent
propertyNo
street
city
postcode
type
rooms
rent
ownerNo
14
16 Holhead
Aberdeen
AB7 5SU
House
650
C046
PL94
6 Argyll St
London
NW2
Flat
400
C087
PG4
6 Lawrence St
Glasgow
Gil 9QX
Flat
350
C040
PG36
2 Manor Rd
Glasgow
G324QX
Flat
375
C093
PG21
18 Dale Rd
Glasgow
G12
House
600
CO87
PG16
5 Novar Dr
Glasgow
G129AX
Flat
450
1.2. PrivateOwner
ownerNo
fName
IName
address
telNo
046
Joe
Keogh
01224-861212
087
Carol
Farrel
0141-357-7419
040
Tina
Murphy
0141-943-1728
Tony
Shaw
0141-225-7025
48
I.
http://openlib.org.ua/
DreamHome
Property for Rent Details
Property Number: PG21
DreamHome
Client Details
Client Number: CR74
First Name Mute
Allocated to Branch:
Address 18 Dale Rd
Address
Branch No B003
Rent 600
PA 1G 1YQ
Staff Responsible
No of Rooms 5
18 Tain St.
Ann Bench
Name CarolFarrel
Business Name
Address 6AcbraySi,
Address
Date 24-Mor-Ot
Branch No 8003
GlasgowG329DX
Tel No. 0141-357-
Tel No.
Owner No.
Contact Name
Business Type
. 1.1. : ) ; )
http://openlib.org.ua/
1.3. Client
dlentNo
fName
IName
address
telNo
prefType
maxRent
CR76
John
Kay
0207-774-5632
Flat
425
CR56
Aline
Stewart
Flat
350
CR74
Mike
Mary
Ritchie
ISTalnStPAlGlYQ 01475-392178
House
750
Tregear
STarbotRd,
Aberdeen AB9 3ST
Flat
600
CR62
01224-196720
.
, , . 1.2.
. , . . ,
. 1.4-1.6. (Lease),
(PropertyForRent) (Client),
.
1.4. Lease
clientNo rent
payment
Method
PA14
CR62
650
1300
PL94
CR76
400
Visa
Cash
PG21
CR74
600
Cheque
lease
property
No
No
10024
10075
10012
31-May-02
12
l-Jun-01
800
l-Aug-01 31-Jan-02
1200
l-Jul-01
12
30-Jun-02
1.5. PropertyForRent
propertyNo
street
city
postcode
PA14
16 Holhead
650
6 Argyll St
NW2
400
PG21
18 Dale Rd
Aberdeen
London
Glasgow
AB7 5SU
PL94
G12
600
rent
1.6. Client
clientNo
fName
IName
address
telNo
CR76
Kay
0171-774-5632
CR74
John
Mike
Ritchie
01475-392178
CR62
Mary
Tregear
01224-196720
GO
I.
http://openlib.org.ua/
DreamHome
Lease Details
Lease Number: 10012
Client No. CR74
Address
18 Dale Rd,
Glasgow G12
Payment Details
Duration
/ Year
. 1.3.
, .
,
.
,
.
. , , :
StaffSalary(staffNo,
fName,
IName,
sex,
salary, branchNo)
, :
S t a f f ( s t a f f N o , fName,
branchNo)
IName, position,
sex, dateOfBirth,
salary,
, , . ,
, . (record), . , PropertyForRent, . 1.1, , .
1.
51
http://openlib.org.ua/
^
- '
|.
.*
. 4'
!
* ~-:
";.;
PropertyForRent {propertyNo, street, city, postcode, type, rooms, rent, ownerNo)
PrlvateOwner (ownerNo, fName, IName, address, telNo)
Client (clientNo, fName, IName, address, telNo, prefType, maxRent)
Lease (leaseNo, propertyNo, clientNo, rent, paymentMethod, deposit, paid, rentStart, rentFinish, duration)
PropertyForRent (propertyNo, street, city, postcode, rent)
Client {clientNo, fName, IName, address, telNo)
. 1..
(field), . . 1.1 ,
PropertyForRent , , .
1.2.2. ,
, , . 1.7.
1.7. ,
, . , , , , "".
Proper ForRent ""
. . -
52
I.
http://openlib.org.ua/
. , .
- ,
, , , , . ,
. 1.3 ,
. .
, .
,
, . .
, . ,
. ,
.
,
, .. , .
, . , ,
, .
. ,
.
, , ,
. ,
.
, . ,
. , PropertyForRent 40 41 , , ,
(.. ,
), PropertyForRent . .. :
1,
53
http://openlib.org.ua/
Proper ForRent ;
;
,
.
;
PropertyForRent;
PropertyForRent.
, PropertyForRent
.
. ,
, , . , PropertyForRent,
. ,
.
(program-data dependence).
, . ,
, COBOL,
, . .
, , ,
. ,
, .
propertyNo ,
PropertyForRent .
ownerNo , PrivateOwner. , COBOL, .
propertyNo PropertyForRent
, . , .
.
.
, .
. -, , 54
!.
http://openlib.org.ua/
(ad hoc) , ,
.
-, . , .
, , ,
, . : ;
. , .. .
,
, .
1.3.
.
1. , .
2. .
,
(database) ,
(Database Management System DBMS).
, .
1.3.1.
. ]
;( ), .
,
. , , ,
. . -
, .
, .
. (system catalog), (data dictionary), (meta-data), .. " 1.
55
http://openlib.org.ua/
".
(program-data independence).
, , , ,
, .
, . , (data abstraction), ,
- , , . ,
.
, , . , . ,
.
, , , " ".
, . (entity) (, ,
), .
(attribute) ,
; (relationship) , . , . 1.4
"-", ER- (Entity-Relationship ER),
DreamHome. :
( ):
Branch
(), Staff (), PropertyForRent (
), Client (), PrivateOwner ( ) Lease ( );
( ): Has (), Offers
(), Oversees (), Views (), Owns (),
LeasedBy ( ) Holds ();
, : branchNo
( ), staffNo ( ), propertyNo
( ), clientNo ( ), ownerKo
( ) leaseNo ( ).
, . , .
"-" 11 12.
1.3.2.
. , , ,
^ . :
56
I.
http://openlib.org.ua/
Has
I. 1
Offers
A
Owns
0..1
. 1.4. "-"
,
.
,
(DDL Data Definition Language). DDL
, ,
.
, ,
,
(DML Data Manipulation Language).
DML ,,- (query language).
, ,
, .
(Structured Query Language SQL),
. (SQL "S-Q-L", "SeeQuel".) SQL : 5, 6 21.
:
,
;
1.
57
http://openlib.org.ua/
, ;
, ;
,
,
;
,
.
. 1.5
(. . 1.3). ,
. , .
.
.
, , , ,
, . . 1.5, , ,
, , . 1.3. ,
, . ""
PropertyForRent,
PrlvateOwner. Client, Lease
Property ForRent (propertyNo, street, city, postcode, type, rooms, rent, ownerNo)
PrivateOwner (ownerNo, fName, IName, address, telNo)
Client (clientNo, fName, IName, address, telNo, prefType, maxRent}
Lease (leaseNo, propertyNo, clientNo, paymemMethod, deposit, paid, rentStart, rentFinish)
. 1.5.
58
I.
http://openlib.org.ua/
(view), "" ( ). , ,
, .
, .
.
,
. , ,
, .
,
.
.
, Monthly
rent ( ),
rent.
,
, , ,
.
, ,
. , ,
.
. . ,
, ,
. . ,
.
, . ,
. , . ,
, , ..
, , , - , . .
1.
59
http://openlib.org.ua/
1.3.3.
. 1.6, : , , .
. 1.6.
. .
.
, .
,
.
. 1.7
DreamHome. - . (backend), . ,
. (frontend),
.
/ (client-server), , --
. 2.6.
, ,
, .
, , C++, Java, Visual Basic, COBOL, Fortran,
Ada Pascal, , SQL,
. ,
, , , ,
. . 2.2.3.
60
I.
http://openlib.org.ua/
. 1.7. DreamHome
, ( ) . . 1.6
.
, , .. " ".
(schema). . 1.5
., (table): PropertyForRent (
), PrivateOwner ( ), Client () Lease
( ). PropertyForRent , : propertyNo ( ), street (), city (), postcode
( ), type ( ), rooms ( ), rent
( ) ownerNo ( ). ownerNo
PropertyForRent PrivateOwner,
.. (Owns)
"-", . 1.4. , . 1.1 1.2 , 046, Joe Keogh,
14.
, 2.7.
1.
61
http://openlib.org.ua/
,
. , , .
.
.
.
.
, , (, ),
.
, ,
,
.
,
. 1.4.
1.3.4.
, . , . 1.5 :
PropertyForRent, PrivateOwner, Client Lease.
? : .
. ,
, ,
, , .
. .
,
.
, , . ,
, , .
,
. ( 14-17) ,
62
1.
http://openlib.org.ua/
. . , ER-, . 1.4, , .
,
, , .
,
. - .
.
;-
, . , .
1.4.
. : , , .
1.4.1.
, , .
. , {Data
Administrator DA), ,
, ,
,
.
, .
, (Database Administrator DBA), , , , , .
, .
, . 9.15.
1.
63
http://openlib.org.ua/
1.4.2.
:
. {.. ), ,
, .
.
.
DreamHome.
.
.
,
.
. .
, , ,
, .
- ,
: , , -.
, :
;
,
;
.
, . ,
.
. "?",
"?".
, . 14,
15, 16 17.
64
I.
http://openlib.org.ua/
1.4.3.
, . . ,
. , ,
, , , .
, .
1.4.4.
,
, .
.
.
.
, .
, .
,
. , , -.
-,
, ,
,
.
. , . , SQL.
.
1.5.
, .
. . ,
1960- , Apollo .
,
. ,
- , .
North American
Aviation (NAA) ( Rockwell International) GUAM (Generalized Update Access
Method). GUAM ,
1,
65
http://openlib.org.ua/
,
. , ,
(hierarchical structure). 1960- IBM
NAA GUAM,
IMS (Information Management System). ,
IBM IMS , ,
,
, .
. IMS , , .
1960- IDS (Integrated Data Store) General Electric.
(Charles Bachmann).
(network)
,
. , , , .
1965
CODASYL (Conference on Data Systems Languages),
,
List Processing Task Forte, 1967 Data
Base Task Group (DBTG). DBTG
, .
1969 , 1971 . DBTG
.
( ), ,
.
,
.
, .
DBTG .
(Data Definition Language DDL),
.
( DDL),
,
.
(Data Manipulation Language DML),
.
(American National Standards Institute ANSI),
DBTG. CODASYL, DBTG-. CODASYL- 66
I.
http://openlib.org.ua/
. ,
Web- (URL ).
.
.
.
,
1970 . . (. F. Codd), IBM, ,
.
, 1970-1980- . System R,
IBM, -, , 1970- [9].
, . .
SQL,
.
1980-
, DB2 SQL/DS IBM Oracle Oracle Corporation.
,
. INGRES II
Computer Associates Informix Informix Software, Inc. Access
FoxPro Microsoft, Paradox Corel Corporation, InterBase BDE
Borland, R:Base R:Base Technologies.
. 3.
, . . 1976
(Chen) "-" (Entity-Relationship model ER),
, 14 15. 1979
RM/T (1979), RM/V2 (1990).
, ,
(semantic data modeling).
: - , (ObjectOriented DBMS OODBMS), - ,
(Object-Relational DBMS ORDBMS). , , . ,
24-27.
1.
67
http://openlib.org.ua/
1.6.
,
, ,
. 1.8.
1.8.
1.2, ,
. , . 1.3
. , ,
,
.
, .
, . .
.
,
,
68
I.
http://openlib.org.ua/
.
,
, .
, .
. ,
. 1.3
. ,
.
, .
.
,
. . . ,
,
, , .
,
,
/, .
. ,
.. ,
.
. , , 40 000
,
, . , , .
. ,
.
, .
,
.
1.
69
http://openlib.org.ua/
(, , ). ,
, , ,
, , , .
.
, ,
, , ,
.
1
, , . ,
, ( ),
. ,
. ,
.
. ,
,
.
, .
, , .
, , , . ,
, ,
. ,
400 , SQL:
SELECT *
PROM PropertyForRent
WHERE type'Plat1 AND rent>400;
70
I.
http://openlib.org.ua/
,
,
.
, .
, , .
,
. ( ),
, .
(, 40 41 ) ,
. : , .
. 2.1.5.
, .
, .
,
.
19.
. ,
.
, , , , .
. 19.3.
, ,
. 1.9.
1.
71
http://openlib.org.ua/
1.9.
,
,
. ,
, , . , .
,
, .
. , 100 .
, , : 100 000 1 000 000 . ,
, .
,
,
. , , , , .
.
.
72
I.
http://openlib.org.ua/
, , .
,
.
, , .
, ,
. , -
.
, .
.
,
.
()
, . , .
, .. ,
, .
. ,
, .
, . ( ),
. , ,
, .
, (Data Definition Language DDL),
,
(Data Manipulation Language DML), , .
.
, , /, . , , .
1.
73
http://openlib.org.ua/
(), (, ), , . , ,
.
. CODASYL . IMS (Information Management
System), (CODASYL-) - IDS (Integrated Data
System). 1960- . ,
. . 1970 ,
. , 100 . - .
, , ,
, , . ,
,
.
1.1.
1.2.
1.3.
1.4.
1.5.
1.6.
1.7.
74
, ,
1,1.
:
) ;
) ;
) ;
) ;
) ;
) ;
) .
, . ?
,
, .
. ?
:
) ;
) ;
) ;
) ;
) ;
) .
?
I.
http://openlib.org.ua/
. |'|1111|1|'111||1'|111|111 ; t ^
1
1.8.
. ?
? ?
1.9. ( , ), ( , , , , ).
.
. ,
, .
, ?
1.10. DreamHome, 10.4 .
? , ,
? ? , , ?
1.11. Wellmeadows Hospital, .
? , ,
?
?
1.
75
http://openlib.org.ua/
http://openlib.org.ua/
...
.
, .
.
.
DDL DML.
.
.
.
.
"/"
.
(
Transaction Processing)
.
( )
,
, . , ,
.
"" ,
, . ,
DreamHome :
" ", staff (), PropertyForRent
( ), PrivateOwner ( )
Client ();
,
(, staff name (), position
() salary ());
(, Staff Manages PropertyForRent).
http://openlib.org.ua/
, ,
, , .
ANSISPARC.
.
2.1 ANSI-SPARC
, . 2.2 , , 2.3
, . 2.4 , , 2.5 2.6
. 2.7
, (.. , ).
DreamHome, 10.4 .
. , , . , , .
2.1. ANSI-SPARC
1971 DBTG.
CODASYL (Conference on Data Systems and Languages ), .
DBTG , , .. (schema),
, .. (subschema). 1975
SPARC (Standards Planning and Requirements Committee) (American National Standard
Institute ANSI), ANSI/X3/SPARC [5]. ANSI/SPARC .
, Guide and Share,
IBM, .
[144]. ANSI/SPARC ,
.
, .. . , , 78
I.
http://openlib.org.ua/
, . 2.1. , ,
(external level),
(internal level). ,
. (conceptual level)
.
.
, .
, .
,
.
, ( ). , .
()
, .
, .
- .
1
\11
. 2,1. ANSI-SPARC
2,
http://openlib.org.ua/
2.1.1.
' . .
, , .
.
. "
", .
, " ", . , , , , .
, -
. ,
(, , ), (, , ). , , . , DreamHome . ,
.
,
.
. 3.4 6.4.
2.1.2.
. ; ,1
, , , .
.
( ). , . :
, ;
;
;
.
,
, (
) . . , (, 80
I.
http://openlib.org.ua/
) ( ),
, .
2.1.3.
. .
5 , .
.
,
.
( ) , , ..
:
;
( );
;
.
(physical level), , .
. ,
.
(,
, ).
2.1.4. ,
.
,
, . 2.1.
,
. ,
. , , . ,
.
, ' , .
.
2.
81
http://openlib.org.ua/
,
. , , . .
. , , ,
, .
, , , .. ,
. .
. 2.2. : (sNo), (fName) (iName), (age),
(salary).
(staf fNo), (IMame) ,
(branchNo). . ,
(age) (DOB).
. , sNo
staf fNo .
,
. . (next), . , ,
. ,
.
1
struct STAFF {
intstaffNo,
int branchNo,
charfName [15],
float salary,
struct STAFF 'next,
/* Staff */
/* */
, 2.2.
82
I.
http://openlib.org.ua/
.
. , , .
,
. , ,
. , .
, ,
2.1.5.
, ,
. : .
.
^ , -1
.
,
, ,
. , ,
, , , .
.
*! ,
.
,
, , ,
.
. . . 2.3
.
ANSI-SPARC ,
. ANSISE'ARC , . ,
.
2.
83
http://openlib.org.ua/
. 2.3. ANSISPARC
2.2.
^: (Data Definition Language DDL) (Data Manipulation Language DML). DDL
, DML , . , , , .
, , COBOL, Fortran, Pascal, Ada, , C++, Java Visual Basic.
(host language).
,
, . , , . . ,
, .
*
2.2.1. DDL
DDL. , ,
^, , ,
, .
, DDL. DDL , .
.
!.
http://openlib.org.ua/
DDL- ,
, . .. , ,
. , , ,
.
.
, ( ) , .
2.7.
DDL, DDL
, DDL DDL .
DDL,
, , .
2.2.2. DML
DML. , one-j
; .
:
;
, ;
, ;
.
,
, .
, .
, .
, , , .
DML, ,
. ,
.
"" ,
. " " "
" ,
, .
DML . DML: .
, ,
DML,
, . , ,
.
2.
85
http://openlib.org.ua/
DML
DML. , ,
, , .
DML , ,
, .
,
( ),
.
DML , , , ,
, .. , . DML
,
.
DML
( 2.3).
DML
DML. , ,
, , .
DML . DML , , . DML
( ), . ,
.
. .
SQL (Structured Query Language)
QBE (Query-by-Example).
, . DML, , . SQL 5, 6 21, QBE 7.
2.2.3. 4GL
4GL (Fourth-Generation Language).
, , ,
. 86
I.
http://openlib.org.ua/
(3GL)
COBOL , 10-20 .
,
4GL , ,
, , . , , " ".
, ,
, . , , , .
:
, ;
,
;
,
, , ;
, .
SQL QBE.
.
, .
, . , ,
, ,
.. , .
. ,
, .
, ,
. ,
.
2.
87
http://openlib.org.ua/
: .
.
, .
, .
, , ,
..
, . ,
, . , , . , , ""
. ,
, , .
2.3.
,
. . ,
;
, . ,
, . .
.
, , .
" " , . , , . , ,
. , , .
.
88
I.
http://openlib.org.ua/
, .. ,
.
,
( , ).
() , .
. , . 2.1 ANSI-SPARC
:
, ,
(Universe of Discourse UoD);
, ( ) , ;
, , .
.
: (object-based) ,
(record-based) .
, .
2.3.1.
,
, .
( , , ), . , , .
.
"-", ER- (Entity-Relationship model).
.
.
- .
ER- ,
. -
, , ,
, .. . ,
. "-" 11 12, - 24-27.
2.
89
http://openlib.org.ua/
2.3.2.
, .
, .
: (relational data model), (network data model) (hierarchical
data model). ,
.
. ,
. . 2.1 2.2
DreamHome, . ,
. 2.2 , John White 30000 (branchNo)
005, , . 2.1, 22 Deer Rd,
London. , Staff Branch : .
; , , branchNo Staff branchNo Branch.
2.1. Branch
branchNo
street
city
postcode
005
22 Deer Rd
16ArgyllSt
London
Aberdeen
Glasgow
SW1 4EH
Bristol
London
BS99 1NZ
007
163 Main St
32 Manse Rd
56 Clover Dr
8003
004
002
AB23SU
Gil 9QX
NW10 6EU
2.2. Staff
staffNo
fName
IName
position
sex
DOB
salary
branchNo
SL21
John
Manager
Assistant
30000
12000
SG14
David
Mary
Supervisor
l-Oct-45
lO-Nov-60
24-Mar-58
BOOS
SG37
White
Beech
Ford
Howe
Ann
18000
B003
Assistant
Manager
Assistant
19-Feb-70
3-Jun-40
13-Jun-65
9000
B007
24000
9000
BOOS
SA9
SG5
SL41
90
Susan
Julie
Brand
Lee
F
F
i.
http://openlib.org.ua/
, ,
.
, .. ANSI/SPARC. , .
3.
, . ,
, .
. . 2.4
, . 2.1 2.2.
IDMS/R Computer Associates.
Web- (URL
).
005
22Deer.nd
BOQTJ?
16ArgyllSt<::j. Aberdeen!
su
i. '!!'::!
004
002
Julie
Assistant'
' Manager-:
Assi^lant^j
SG37 I
\1 SG14 j David |
SG5
Susan
Ford
Brand
As'slsta^t'" [; 1)
Puc. 2.4.
.
, . .
( )
. . 2.5 , . 2.1 2.2. IMS IBM,
.
Web (URL ).
() . ,
, .
2.
91
http://openlib.org.ua/
BOOS
\~~\1QQ4. L-.
3003 I
SL4i^ j Julie | __lje
;:
.:'J Gtasgw'l
j 007..
Puc. 2.5.
,
.
, .
,
, .
,
(.. , ),
(.. , ).
2.3.3.
, , , . , ,
(unifying model) (frame memory).
2.3.4.
,
"" . , .
. 1 .
,
.
92
I.
http://openlib.org.ua/
.
( )
. , , , .
.
.
.
,
. 14 15
, ,
, .
9.6.
2.4.
, .
,
[71]. .
1. ,
| , =
= .
. , 2.1, ,
(, ).
2. ,
, | .
ANSI-SPARC , , .. , ,
, ( ) , ( , "
", ). . :
, ;
;
2.
93
http://openlib.org.ua/
;
, ;
,
(. 2.1,4);
, .
, .
,
, .
, .
, .
, .
.
.
,
, , .
.
.
.
, ,
(data directory),
. " "
. 2.7.
3.
, ;;!:; , ,
,
. DreamHome
, .
.
. , - , ,
94
I.
http://openlib.org.ua/
, .
,
. 19.1.
4.
: , |: - i
. .'
,
.
, , .
,
, ,
. 2 , . 2.3.
2.3. " "
TI
balx
read (bal x )
100
t|
t3
read (bal x )
100
tj
bal x = bal x - 10
write (bal x )
200
write (balx)
-s
90
90
: 10 ,
1, 2 100 . , ..
, ,
190 ,
. . , 2
, 100 . 2
100 ( 200 )
. TI 10
( 90 )
,
"" 100 .
,
.
19.2.
2.
95
http://openlib.org.ua/
5.
- .
, . , , . ,
.
. 19.3.
6.
,
.
, &
. , , , .
, .
. , . 18.
7.
-'
.
. .
,
, . (communications messages)
. (DEM Data Exchange Manager).
, , , . ,
. ,
96
!,
http://openlib.org.ua/
, . . 22.1.1.
8.
: , .
. . , ,
,
. , . , ,
. , ,
.
, ,
, .
9.
,
.
2.1.5,
.
, , . .
, ,
, . .
10.
;''
'
.-"'":'
'.-
/"-
...
...;..-.
'.;,
| .
.
, , , ,
.
.
2.
97
http://openlib.org.ua/
,
, ,
.
,
.
, .
,
.
,
.
2.5.
, . ,
. .
, 8.2.2 Oracle.
(),
. , .
, .
, .
. 2.6.
, , , (.. ,
). .
[302], [325], [404] [585].
. 2.6 .
. ,
. 20.
.
.
,
. .
. 2.7.
98
I.
http://openlib.org.ua/
. 2.6.
. . , . ,
.
, ,
( ).
DML. DML- .
DML .
DDL. DDL DDL , . , .
.
. .
,
.
2.
99
http://openlib.org.ua/
. 2.7.
.
.
. .
. , , ,
(, , ).
.
. 20.
.
, .
100
I.
http://openlib.org.ua/
. . , .
.
. , .
. ,
. ( ) ,
.
19.
, , . DAFTG (Database Architecture
Framework Task Group)
1986 .
,
2.6.
, ,
,
"/".
2.6.1.
, , ,
. 2.8. ,
"" , . ,
( ). , . . ,
, ,
(, , ).
.
(downsizing), .. , , , , , . :
"/".
2.
101
http://openlib.org.ua/
. 2.8.
2.6.2.
, (). , .
, , . 2.9. ,
.
, .
,
. , , ,
, 163 Main St.
SQL ( 5):
SELECT fName, IName
FROM Branch b, Staff s
WHERE b.branchNo = s.branchNo AND b . s t r e e t =
163 Main St
SQL,
,
Branch () S t a f f (), .
,
.
1. .
2. .
3. , , .
2.6.3. "/"
"/" , . , -
102
!.
http://openlib.org.ua/
. , , , ,
. , .
, . . 2.10 "/", . 2.11
"/".
Hlfllilll
1
I MMI '\
Ni.nir
""1"
. 2.9.
2
~^
SUlJJl !
1
!-^-.
""
()
. 2.10.
"/"
2.
103
http://openlib.org.ua/
2
)
. 2.11. ^
"/":
) ; ) ; &J
, , . ,
SQL , .
, . ,
. ,
, ,
. , . . 2,4.
104
I.
http://openlib.org.ua/
2.4. ,
"/"
.
.
.
, .
, .
. .
.
, .
. , .
.
.
, .. ,
. , , "/"
,
. 22 23.
28.3.2 "/", , .
"/" 2.
105
http://openlib.org.ua/
,
. . , Internet ,
Web-. , .
(). ,
, , ,
(On-Line Transaction Processing OLTP).
,-
.;
-.:.'.
,.:.,..'.,;
-,.;,
"
....".
-..'
-.
( , , ).
( -) ,
,
. -
, . 2.12. , .
. -
.
. 2.12. -
"/"
106
!.
http://openlib.org.ua/
. -
, ,
, . , , Oracle 1, Informix 2 IMS
3. -
DTP (Distributed Transaction Processing ) /Open. ,
,
-, .
DTP 22 23.
. - ,
,
. , ,
.
.
. . - ,
, , , . , . ;
, , , .
, -
, . -
, .
- . - .
- CICS Encina
IBM ( IBM
AIX Windows NT, IBM TXSeries),
Tuxedo BEA Systems.
2.7.
2.4 ,
. .
. ,
, .. , " ".
2.
107
http://openlib.org.ua/
. 2.5 , . , ,
. :
, ;
;
, ,
, ,
.
, ,
. :
;
;
, ; .
, " "
, .
, .
, .
- .
, .
.
, - . , .
,
. ,
.
.
2.7.1. IRDS
, ,
. . , , , , CASE-, , .
108
I.
http://openlib.org.ua/
, . , .
. (Information Resource Dictionary System IRDS). IRDS
, , .
, , ,
.
. , IRDS , IRDS- DB2, IRDS-
Oracle DB2.
IRDS
. , - (,
), IRDS
. IRDS
(International Organization
for Standardization ISO) [172], [174].
IRDS
, :
;
;
.
IRDS ,
,
. ,
;
;
/;
.
,
. QBE .
, . (
) . / ,
IRDS- .
IRDS . , , , - .
IRDS , . 2.13.
2.
109
http://openlib.org.ua/
. 2.13. IRDS
ANSI-SPARC : , .
. .
, . ,
, , , .
. , , , ..
. .
.
, .
, .
: DDL
(Data Definition Language) DML (Data
Manipulation Language). DDL , DML .
110
!.
http://openlib.org.ua/
,
, , . : , . , .
"-", , - ,
, .
, ,
, ,
.
,
.
"/" ( ), , . ,
.
(-) ,
, , ,
(On-Line Transaction Processing - OLTP). : , , ,
.
.
" ", . . IRDS (Information Resource Dictionary
System) ISO,
. .
2.1.
2.2.
2.3.
2.4.
2.,5.
26.
.
ANSI-SPARC.
.
?
.
.
, .
2.5 , ? .
2.
111
http://openlib.org.ua/
2.7.
, 2.5.
2.8.
, "/".
, . .
2.9. (-)? (OLTP)?
2.10. .
2.11. , .
, . ?
?
. ?
2.12. ,
. , .
, .
?
2.13. ,
. ,
. , . ,
.
2.14. , 2.13,
"/"?
, ?
112
I.
http://openlib.org.ua/
SQL:
SQL:
QBE
: Access Oracle
115
137
163
211
255
283
http://openlib.org.ua/
http://openlib.org.ua/
...
.
.
.
.
.
, ,
.
" " " ".
,
.
.
15-20 ( 50
),
25%.
,
, . . (. F. Codd) 1970 .
().
()
. () .
. , , , (.. ).
.
.
,
.
, 3.1 -
http://openlib.org.ua/
. 3.2 . 3.3 ,
. 3.4 , , , , .
, 5, 6 21, SQL (Structured Query
Language ), , 7
QBE (Query-By-Example), . 14-17 . ,
. DreamHome, 10.4 .
3.1.
. . (. F. Codd)
1970 "
" [65].
, , , [58]. .
.
, , ,
.
, . , , ..
. ( 13.)
.
,
.
1970- IBM , , (Astrahan),
"System R",
[9].
.
, , , , , , .
- . , System R :
116
II.
http://openlib.org.ua/
SQL (
"S-Q-L", ()
"See-Quel"), ISO
(International Organization for Standardization) ;
,
1970- 1980- , DB2
SQL/DS IBM, Oracle Oracle Corporation.
,
, INGRES (Interactive GRaphics REtrieval System),
( ) , System R. INGRES
, System R.
INGRES, . INGRES Relational
Technology Inc. ( INGRES II Computer Associates) Intelligent
Database Machine Britton Lee Inc.
Peterlee Relational Test Vehicle IBM, , [305].
, System R INGRES. , , ,
.
1970- - 1980- . , ,
, . Access FoxPro
Microsoft, Paradox Corel Corporation, InterBase BDE
Borland, R:Base R:Base Technologies.
, . , IDMS
Computer Associates, CA-IDMS/SQL
. , , Model 204
Computer Corporation of America ADABAS Software AG,
, , [70], - [294],
[121].
, 24-27, .
3.2.
, . , , , ,
.
, .
3.
117
http://openlib.org.ua/
3.2.1.
. . , .;
,
. ,
, ..
ANSI-SPARC,
2.1.
,
( ),
. .
, ;1 . , , .
, .
, Branch, faranchNo ( ),
street (), city () postcode ( ). Staff (), staff No ( ), fName
(), IName (), position (), sex (), DOB ( ),
salary (), branchNo ( ). . 3.1 Branch Staff. ,
, branchNo .
. .
.
. , . . 3.1
Branch S t a f f . , , .
, ,
.
, . , , . ,
, , (
, ).
. ,
, , .
118
II.
http://openlib.org.ua/
branchNo
BranchNumbers
; 4,
1
' ' - '
street
StreetNames
; 25
city
cityNames
; 15
postcode
Postcodes
; 8
fi
Sex
sx
; 1,
1
1
' ' F
DOB
DatesOf Birth
; l-Jan20, dd-mmm-yy
salary
Salaries
; 7 , 6000.00-40000.00
Branch
branchNo
street
city
005
BOOT
004
002
22 Deer Rd
16 Argyll St
163 Main St
32 Manse Rd
56 Clover Dr
London
Aberdeen
Glasgow
Bristol
London
postcode
SW1 4EH
AB23SU
01 1 9QX
BS991NZ
NW106EU
S.
=2
Staff
SG37
SG14
SA9
SG5
SL41
John
Ann
David
Mary
Susan
Julie
White
Beech
Ford
Howe
Brand
Lee
Manager
Assistant
Supervisor
Assistant
Manager
Assistant
sex
DOB
F
M
F
F
F
1-Oct-45
IO-Nov-60
24-Mar-58
19-Feb-70
3-Jun-40
13-Jun-65
salary branchNo
30000
12000
18000
9000
24000
9000
BOOS
007
005
3.
119
http://openlib.org.ua/
. .
, , . Branch , . , , , .
( (intension)). ,
, . (extension), (state) , .
. ,
,
Branch, . 3.1, , , , . ,
, .. ,
. 1
(unary) ( ).
(binary), (ternary),
- (-).
.
. , .
.
. .
, .
. , .
, , (normalization).
13.
, ,
,
. (file), (records), (fields).
,
. . 3.2 ,
.
1 20
II.
http://openlib.org.ua/
3.2.
3.2.2.
. , , DI D2 ,
D!= {2,4} D 2 = {1,3,5}.
( D2XD2) ,
D l t D2.
, Dlf D3. :
DpOj = { (2,1) , ( 2 , 3 ) , ( 2 , 5 ) , (4,1) , {4,3} , ( 4 , 5 ) }
.
, R, .
R = { (2,1) , (4,1)}
, ,
. , , R ,
1, R :
R = { (,) |xeD 1 ( yeD 2 y=l}
, S, . S :
S = { (,) | x e D 1 ( y e D 2 =2}
:
S = {(2,1)}
.
D l t D2 D 3 > D^xD2xD^
,
, D lt D 2 , D3.
.
:
D! = { ( 1 , 3 ) } , D2 = { ( 2 , 4 ) } D a = { ( 5 , 6 ) }
DiXD^XDa =
{(1,2,5), (1,2,6), (1,4,5), (1,4,6), (3,2,5), (3,2,6), (3,4,5), (3,4,6)}
3.
121
http://openlib.org.ua/
. , . Db D 2 , ..., Dn. :
DiXDzX. . .xD n = { ( d 1 ( d 2 ,
dj l^eD^djeDa, . - . ,d n eD n }
.
-
. ,
, ,
.
3.2.3.
, .
" . ,
.
, 1( :;, ..., D l t D 2 , ..., Dn
{ :D l f A, :D 2 , . . .,A n :D r .}. R, S, . , R n- (A^d^ : 3 2 , . . . ,A n :d r .}, d 1 eD 1 ,d 2 eD 2 , . . . ,dneDr..
- . ,
(d 1 ( d 2 , . . . ,dj , . , ,
.
, . 3.1, Branch branchNo,
street, city postcode . Branch
,
BranchNurnbers, StreetNames ,,
, :
{ ( 0 0 5 , 2 2 Deer Rd,
London,
SW1 4 E H ) }
:
{(branchNo: B005, street: 22 Deer Rd, city: London, postcode: SW1 4EH)}
. Branch , . , . , , .
122
II.
http://openlib.org.ua/
. , . . .
R!, R3, ..., Rn , ( ) R :
R =
Rj. , R 2 , - - . , R n
3.2.4.
.
,
.
()
.
.
.
, ..
.
.
. ( .)
Branch, . 3.1.
, . ,
. ,
, , ,
, ( 13.)
, ,
. branchNo
BranchNumbers , , .
. , (005, 22 Deer Rd, London, SWl 4EH)
.
,
. ,
city postcode, . ,
(, 005 004); .
.
(, )
. ,
. 3.
1 23
http://openlib.org.ua/
.
.
, , .
, .
. ,
-.
, . , .
. , (1, 2)
(2, 1).
, , . , , .
,
. , ,
.
3.2.5.
, .
( ), , .
(superkey). , . .
. ,
, , ,
.
:
. , ,
^ .
R .
. R .
.
.
. , . Branch, . 3.1.
city (, 124
II,
http://openlib.org.ua/
).
. , DreamHome , ( branchNo)
( Branch), branchNo . , postcode .
Viewing (),
. (clientNo),
(propertyNo), (viewDate) , , (comment). (clientNo)
. , (propertyNo)
,
. , (clientNo)
(propertyNo)
. clientNo
propertyNo . ,
, (viewDate). , .
,
,
. ,
-, ,
. - , .
" ";
-. , . ,
. 3.1 , Staff IName, .
, White, White
IName .
. , .
-, . , .
, , , . , , . Branch branchNo,
postcode. viewing , clientNo propertyNo,
.
3.
125
http://openlib.org.ua/
. , ";
( , )
..
,
. , branchNo Branch Staff
, it . Branch
branchNo , Staff
, . Staff
branchNo . ,
branchNo Staff , ..
branchNo, (Branch). (
.) , .
3.2.6.
.
DreamHome, , :
Branch (branchNo, street, cizy, postcode)
S t a f f ( s t a f f N o , fName, IName, position, sex, DOB, salary, branchNo}
PropertyForRent (propertyNo, street, city, postcode, type, rooms,
rent, ownerNo, staf fNo, branchNo)
Client (clientNo, fName, IName, telNo, prefType, maxRent)
PrivateOwner (ownerNo, fName, IName, address, telNo)
Viewing (clientNo, propertyNo, viewDate, comment)
Registration (cJlientNo, branchNo, s t a f f N o , dateJoined)
,
( ) .
() .
, , . . 3.3-3.9 .
3.3.
DreamHome. Branch
city
postcode
22 Deer Rd
London
SW1 4EH
16 Argyll St
Aberdeen
AB23SU
163 Main St
Glasgow
Gil 9QX
004
32 Manse Rd
Bristol
BS99 1N2
002
56 Clover Dr
London
NW10 6EU
branchNo
street
005
007
1 26
II.
http://openlib.org.ua/
3.4.
DreamHome. Staff
staffNo
fName
[Name
SL21
John
position
sex
DOB
salary
branchNo
White
Manager
l-Oct-45
30000
BOOS
SG37
Ann
Beech
Assistant
lO-Nov-60
12000
B003
SG14
David
Ford
Supervisor
24-Mar-58
18000
B003
SA9
Mary
Howe
Assistant
9000
B007
Susan
Brand
Manager
1
I
19-Feb-70
SG5
3-Jun-40
24000
BOOS
SL41
Julie
Lee
Assistant
13-Jun-65
9000
BOOS
.5.
DreamHome. PropertyForRent
property
street
city
postcode
type
branch
No
14
16Holhead
Aberdeen
AB7 5SU
House
650
C046
SA9
B007
PL94
6 Argyll St
London
NW2
'
400
C087
SL41
BOOS
PG4
6 Lawrence St
Glasgow
Gil 9QX
350
C040
PG36
2 Manor Rd
Glasgow
G32 4QX
Flat
375
C093
SG37
BOOS
PG21
18 Dale Rd
Glasgow
G12
House
600
COS7
SG37
PG16
5 Novar Dr
Glasgow
G129AX
Flat
450
C093
SG14
No
,!.
BOOS
3.6.
DreamHome. Client
clientNo
fName
IName
telNo
prefType
maxRent
CR76
John
Kay
0207-774-5632
Flat
425
056
Aline
Stewart
0141-848-1825
Flat
350
CR74
Mike
Ritchie
01475-392178
House
750
CR62
Mary
Tregear
01224-196720
Flat
600
.7.
DreamHome. PrivateOwner
ownerNo
fName
IName
address
telNo
046
Joe
Keogh
01224-861212
087
Carol
Parrel
0141-357-7419
040
Tina
Murphy
0141-943-1728
093
Tony
Shaw
0141-225-7025
3.
127
http://openlib.org.ua/
3.8.
DreamHome. Viewing
clientNo
propertyNo
viewDate
comment
CR56
14
24-May-Ol
too small
CR76
PG4
20-Apr-Ol
too remote
CR56
PG4
26-May-Ol
CR62
14
14~May-01
CR56
PG36
28-Apr-Ol
no dining room
.9.
DreamHome. Registration
clientNo
branchNo
staffNo
dateJoined
CR76
005
SL41
2-Jan-Ol
CR56
SG37
11-Apr-OO
CR74
SG37
16-Nov-99
CR62
007
SA9
7-Mar-OO
3.3.
. 2.3,
: ,
, ,
. , .
,
. , ,
, , . . ,
, .
3.3.1.
. , / .
( NULL) "". , , . NULL
. NULL .
,
128
http://openlib.org.ua/
NULL - . NULL , .
" NULL", NULL , , " NULL"
.
, . 3.8 Viewing Comment
, .
NULL - , ,
. -1. , Viewing hasCommentBeenS.upplied ( ) Y (Yes), , N (No)
. .
NULL .
- , , , , , ..
: . NULL
, , [74], [75], [77].
NULL . [77] NULL ,
, , ,
, NULL [87].
.
3.3.2.
. , (. 2.1). 3.4.
.
, , NULL.
, , . , . NULL
, , ,
. , branchNo
Branch, Branch , NULL branchNo.
Viewing,
(clientNo) (propertyNo).
Viewing , NULL clientNo propertyNo, .
3.
129
http://openlib.org.ua/
, . -, , , ? -, ? ,
Viewing (. . 3.8), : "
".
comment. ,
,
NULL ( PG36 PG4 CR56). ,
NULL . [76], [92].
3.3.3.
.
. ,
? !
HULL.
, branchNo Staff ,
branchNo Branch.
025 , Branch , 025.
NULL , .
,
, - .
3.3.4.
. , .
,
. , 20 , ,
, s t a f f
, 20 .
,
. 6 16.
130
II.
http://openlib.org.ua/
3.4.
2 ANSI-SPAKC . "" (view)
.
, (virtual relation), .. , ,
(, ). ,
( ) , ,
. , , . 6.4
SQL.
3.4.1.
, ,
.
I . ,
),"; , .
.
. ,
-^ .; . ,
, . f -
'
'
. - " -
'
,.
''.'-.
"
'
,
. ,
( ). . ,
. , ..
, , , .
, . , . 6.4.
3.
131
http://openlib.org.ua/
3.4.2.
.
,
.
- , .
,
.
. ,
(. 4.1),
, .
,
, . .
Branch , ,
. Branch Staff Manager.
s t a f f
salary.
, , ( branchNo)
(Branch Number),
.
, .
, (. 2.1.5).
, . ,
, , . ,
,
. 6.4.7,
.
3.4.3.
, . ,
. ,
132
II.
http://openlib.org.ua/
, . , .
, .
, .
, .
:
, .
[119].
Y^-IHIHfHRBH
, 15-20 (50
),
25%.
;
, . . .
.
.
- ,
.
, , , ,
, .
:
, , ,
, - .
,
. , , , -
.
( ), ,
. , . .
( ) ,
.
3.
133
http://openlib.org.ua/
(NULL) , .
,
. ,
, NULL.
, () . ,
. .
[
3.1.
3.2.
3.3.
3.4.
3,5.
3.6.
3.7.
:
) ;
) ;
) ;
) ;
) ;
) .
?
.
?
.
. " "?
? , .
, .
? .
,.,.
.
Hotel
134
II.
http://openlib.org.ua/
Hotel ,
hotelNo . Room , (roomNo, hotelNo)
. Booking ;
(hotelNo, guestNo, dateFrom). , Guest
, guestNo.
3.8. . ,
,
3.9.
,
.
, .
. , . , , ,
.
3.11. ,
. , , .
3.
135
http://openlib.org.ua/
http://openlib.org.ua/
...
" ".
.
.
.
(Data
Manipulation Language DML).
. 2.3, ( ),
.
, . ,
, [66J . () , ,
. , , ,
, , . , , , .. ( ).
, .
. , , .
. ,
,
.
. , , ,
, .
http://openlib.org.ua/
4.1 ,
4.2 : . 4.3 .
DreamHome, . 3.3-3.9.
5, 6 21 SQL (Structured Query Language
)
,
. 7 QBE (Query-By-Example
), , .
4.1.
, . , ,
.
( , ), . . ,
, , ,
.
, , , ,
,, . .
. [404].
,
. [67] ,
. , (selection), (projection),
(cartesian product), (union)
(set difference),
, . , (join), (intersection) (division),
.
. 4.1.
,
. ,
. R
S , = { 1( , . . ., )
= (bj, 2 , . . ., ) .
138
II.
http://openlib.org.ua/
ffxfi
a
a
RDS
RUS
1
2
3
1
2
3
-S
.*; s
7-
) ) )
b
b
) ( )
V+W
1
2
1
2
1
. 4.1.
4.1.1.
: .
4.
139
http://openlib.org.ua/
( )
0^()- R
, ()
R, ().
4.1.
, 10000 .
" s a l a r v a l Q Q Q O \ t )
s t a f f , salary>!0000. , s t a f f ,
salary 10000 . . 4.1. (AND), v (OR) - (NOT).
4.1. Staff
salary > 10000
position
sex
DOB
salary
branchNo
White
Manager
l-Oct-45
30000
BOOS
Beech
Ass .slant
10-Nov-60
12000
B003
Ford
Supervisor
24-Mar-58
18000
BOOS
Brand
Manager
3-Jun-40
24000
BOOS
staffNo
fName
IName
SL21
John
SG37
Ann
SG14
David
SG5
Susan
-.,. .J[R).
; R ! , R,
" . -.
4.2,
staffNo, fName, INametf salary.
n.t af Ha,fName,IName,salary ( S t a f f )
,
s t a f f N o , fName, IName salary S t a f f ,
. . 4.2.
140
II.
http://openlib.org.ua/
fName
IName
salary
SL21
John
30000
SG37
Ann
White
Beech
12000
SG14
David
Ford
18000
SA9
Mary
Howe
9000
SG5
Susan
Brand
24000
SL41
Julie
Lee
9000
4.1 .2.
.
. , , , .
. '' , :
<_ , R, S, R -*;
, . R s .
R S , , / J , , ,
(/ + J) . ,
, .. ,
.
, . ,
,
.
.
I 4.3.
,
.
n c i t i P (Branch) uFIcity (PropertyForRent}
, Branch
PropertyForRent city, . .
. 4.3.
4.
141
http://openlib.org.ua/
city
London
Aberdeen
Glasgow
Bristol
' R-S. R s ,
R, s. R s
; .
4.4.
, ,
, .
' '
n c i t y (Branch) - 1 ( PropertyForRent)
Branch PropertyForRent,
city.
.
. 4.4.
4.4. , city Branch
PropertyForRent
city
Bristol
R n S. , , R, s. R s
.. .
4.5.
, ,
, .
n c i E y (Branch) n n city (PropertyForRent)
142
II.
http://openlib.org.ua/
London
Glasgow
:
R n S - R - (R - S)
.ftxS. ,
;' (.. ) , R s.
. , . ,
/ N , J , (/ J)
(* + ) . . , .
4.6.
, ,
.
Client,
Viewing. , :
(n c ii e n tNo,fName,lName ( C l i e n t ) ) X (n c l i e n C N O ,propertyNo, comment ( V i e w i n g ) )
. 4.6.
, . ,
clientNo.
,
Client .clientNo=Vlewing.clientNo. ,
.
4.
143
http://openlib.org.ua/
(Viewing))}
. 4.7. , .
4.6. Client
Viewing ( )
Viewing .client
No
property
Kay
CR56
PA14
Too small
( )
John
Kay
CR76
PG4
Too remote
( )
CR76
John
Kay
CR56
PG4
CR76
John
Kay
CR62
PA14
CR76
John
Kay
CR56
PG36
CR56
Aline
Stewart
CR56
PA14
Too small
( )
CR56
Aline
Stewart
CR76
PG4
Too remote
( )
CR56
Aline
Stewart
CR56
PG4
CR56
Aline
Stewart
CR62
PA14
CR56
Aline
Stewart
CR56
PG36
CR74
Mike
Ritchie
CR56
PA14
Too small
( )
CR74
Mike
Ritchie
CR76
PG4
Too remote
( )
CR74
Mike
Ritchie
CR56
PG4
CR74
Mike
Ritchie
CR62
PA14
CR74
Mike
Ritchie
CR56
PG36
CR62
Mary
Tregear
CR56
PA14
Too small
( )
CR62
Mary
Tregear
CR76
PG4
Too remote
( )
CR62
Mary
Tregear
CR56
PG4
CR62
Mary
Tregear
CR62
PA14
CR62
Mary
Tregear
CR56
PG36
Client. client
fName
IName
CR76
John
CR76
No
144
comment
No
No Dining room
( )
No Dining room
( )
No Dining room
( )
No Dining room
( )
II.
http://openlib.org.ua/
4.7.
Client Viewing ( )
Client. clientNo
fName
I Name
Viewing .clientNo
propertyNo
comment
CR76
John
Kay
CR76
PG4
Too remote
( ]
CR56
Aline
Stewart
CR56
PA14
Too small
( )
CR56
Aline
Stewart
CR56
PG4
CR56
Aline
Stewart
CR56
PG36
CR62
Mary
Tregear
CR62
PA14
No dining room
(
)
. .
, (<).
;
< , . ,
:
TempViewing(clientNo, propertyNo, comment) < , lierit.No, propertyNo,
*^ (Vie wing)
TempClient(clientNo, fName, iName) ^- ri clientNo , fNatne , 1Naroe (Client)
CommentfclientNo, fName, IName, vclientNo, propertyNo, comment) <
TempClient X TempViewing
Result 4- (
vciincHc.(Comment)
( ""), .
.
ps(E) pS(,1,...,.n)(E).
; s ,
4.1.3.
,
, .
4.
145
http://openlib.org.ua/
. . ,
- , , .
, , .
20.4.3.
,
.
- (theta join).
(equijoin),
-.
(natural join).
(outer join).
(semijoin).
-
R >-^ S. - ,
;.- R s, pv ? .aj.0s.bi,
(<, <, >, >,~=).
-
, .
R X F S=0 F (RXS)
I 4.7.
, ,
.
4.6
. .
(n c l i e n t K O i t t - a r a e i i H a m a (Client) )
^Client.clientNo.Viewing.clientNo U elienl:No, propereyNo, comment (Viewing) }
146
II.
http://openlib.org.ua/
R txi S. '*
R S, ,
i .
R S .
4.8.
, ,
.
4.7 , clientNo.
.
' c l i e n t N o , IName.lNarne ( C l i e n t ) )
fName
IName
propertyNo
comment
CR76
John
Aline
Aline
Aline
Mary
Kay
PG4
Stewart.
Stewart
Stewart
Tregear
PA14
Too remote ( )
Too small ( )
CR56
CR56
CR56
CR62
PG4
PG36
PA 14
No dining room { )
, . , .
, , . .
4.
147
http://openlib.org.ua/
, R ix S. ,
R, : s.
NULL. , ,
SQL (. 5.3.7).
, , .. ,
.
4.9.
.
, (
), , . .
(n c l i e n c N o , B t r e e t ,ci C y (PropertyForRent) ) = Viewing
. 4.9.
4.9. PropertyForRent Viewing
propertyNo
street
city
clientNo
viewDate
comment
PA14
16 Holhead
Aberdeen
CR56
24-May-Ol
Too small (
}
PA14
16 Holhead
Aberdeen
CR62
14-May-Ol
No dining room (
)
PL94
6ArgyllSt
London
NULL
NULL
NULL
PG4
6 Lawrence St
Glasgow
CR76
20-Apr-Ol
Too remote (
)
PG4
6 Lawrence St
Glasgow
CR56
26-May-Ol
PG36
2 Manor Rd
Glasgow
PG21
18 Dale Rd
Glasgow
CR56
NULL
NULL
NULL
Glasgow
NULL
NULL
NULL
PG16
5 Novar Dr
28-Apr-Ol
, 4.9 ,
. , , . ,
,
NULL.
148
II.
http://openlib.org.ua/
R >F S- , R, R s.
, , . (. 22.4.2 23.7.2). :
R >F S = { XF S)
R.
-, , .
4.10.
, ,
, 'Glasgow1,
Staff, , , . 4.10.
^stafE.branchNo-branch.branchNo and branch, city - 'Glasgow 1
fName
IName
position
sex
DOB
salary
branchNo
SG37
Ann
Beech
BOOS
Ford
10-Nov-60
24-Mar-58
3-Jun-40
12000
David
Susan
Assistant
Supervisor
Manager
SG14
18000
B003
24000
BOOS
SG5
Brand
M
F
4.1.4.
,
. , R , S , (.. ). -, ..
R,
S.
.
R + S, R,.;
,
I s.
4.
149
http://openlib.org.ua/
:
!<-()
T 2 <-n c ({SxT 1 )-R)
4.11.
,
.
, ,
.
, . 4.11-4.13.
(ncLientto,pr0pertyNo (Viewing) )-(>.3 (ProperCyForRent) ) )
4.11. nctentNOipropertvNo{Viewing)
Viewing
clientNo
propertyNo
CR56
14
CR76
PG4
CR56
PG4
CR62
14
CR56
PG36
4. 1 2.
PropertyForRent
clientNo
PG4
PG36
4.13.
clientNo
CR56
4.1.5.
. 4.14.
150
I I .
http://openlib.org.ua/
4.14.
,
() R,
()
....... (R)
RuS
R-S
RnS
,
R,
-
,
, R, S,
R ,
. R s
R s ,
R. s.
R s
, ,
R, S.
R S
RxS
,
(.. )
R S
Rixi F S
,
R S,
F
R><]FS
,
R S,
F (
)
RixiS
R s,
,
, R,
s,
()
R>FS
,
R, R s
,
R, ,
s,
, R,
s
4.
151
http://openlib.org.ua/
4.2.
, . ,
, , .
,
, .
: [67] [202] .
( ) .
, , . ,
" " "
, " ,
. ''
" (" "),
" , " (" " " ").
, " ", .
, . ,
" ",
" " .
,
, .
, , , :
{ ( ) }
(AND), v
(OR) ~ (NOT) .
4.2.1.
, .
. ,
. ,
. ( " "
, , .)
, Staff
S :
152
II.
http://openlib.org.ua/
Staff(S)
, " S, F ( S ) " :
(S|F(S)}
F ( ,
Well-Formed Formula, WFF). , " s t a f f No, fName, IName, position, sex, DOB,
salary branchNo ,
10 000 " :
{SJStaff(S)
S . s a l a r y > 10000}
S. salary salary
S. (, salary),
:
{ S . s a l a r y [ S t a f f ( S ) ' . s a l a r y > 10000}
,
, . (3), "", , , :
S t a f f (S) {} (Branch(B)
.city='London')
(.branchNo=S.branchNo)
, Branch , branchNo,
branchNo S S t a f f , city
' London'. (V), " ", , , :
(VB)
(.city * 'Paris')
E F2(X)>
= F2{X))
= ~(VX) ( - ( F i t X ) )
v ~{F2(X)>)
= -OX) ( - ( F i t X ) )
v~{F2(X)J)
:
~()(.city ='Paris')
, .
, V 3; . , 4.
153
http://openlib.org.ua/
, (|). , S
S S t a f f .
{S.fName, S.IName | Staff (S) ()
S.branchNo) .city = ' L o n d o n 1 ) }
(Branch(B) (B.branchNc =
, ,
.
.
:
{Si.aj,
S 3 .a 2 , ...,
S n .a n
F(SL,
S2
, SJ } ;
ra>n
S 17 S2,..., S n ,. . ., Sm , a^ ,
Si, a F
( )
,
.
R ( S i ) , Sj , a R .
Si.! 9 Sj.a 2 , Si Sj , ! ,
S i T 2 , Sj, 6 (<,
<> >, >, =, *); ^ , 9 .
S i - a j 9 , 3 , , Sit ! 6 .
.
.
F! F2 , ,
(Fi/\F2), (FjVFjj)
(-Fi), .
F X, () (F) (VX) (; .
4.12.
. , 25000 .
(S.fName,S.IName|Staff(S)5.position='Manager'.salary>25000}
. ,
.
{S S t a f f ( ) ( ) ( P r o p e r t y F o r R e n t ( ) ( P . s t a f f N o = S . s t a f }
P.city='Glasgow1)}
154
II.
http://openlib.org.ua/
, :
{S.fName,S.IName|Staff(S){(Vp)(-PropertyForRent(P)v
~(S.stafNo=P.staffNo)))}
, , .
(C.fNarae,C.lName|Client()((3V)()(Viewing(V)
PropertyForRent(P} (C.clientNo=V.clientNo)
(V.propertyNo=P.propertyNo) P . c i t y = ' G l a s g o w ' } ) }
, ", 'Glasgow'",
", Viewing
' Glasgow' ".
, , ,
.
{.city|Branch(){-()(PropertyForRent(P).city=P.city))}
,
4.4.
. , ,
.
{.city]Branch()(()(PropertyForRent(P).city=P.city))}
,
4.5.
. , ,
.
4.3
. , ,
, 4.
155
http://openlib.org.ua/
. , , Branch, PrcpertyForRent (
).
, , ,
. ,
,
.
, ,
. , , , S t a f f :
{S|-Staff(S)}
. , ,
, ,
;
dora(E). , ,
. ,
, S t a f f .
, , , .
, , Staff (.. ,
). ,
, . ,
, RANGE.
[93].
4.2.2. "
,
. , , , .
:
{di, d2
d, I F t d i , d2
dj);
m > n
II.
http://openlib.org.ua/
R (d l 7 d 2 , . . . , d n ) , R di .
di dj, di dj 9
(<, < >, >, =, ?*); di dj ,
0 .
di 9 , d t , di 9 .
.
.
F2 , ,
(] ), (F^yF;,)
(~Fj), .
F^ X, () (F) (Vx) ( F ) .
4.13.
:
(3d1( d2
d n ) (3d,) ,
(3d 2 ) ,
(3dJ
. , 25000 .
{ f N , IN J (3sN, posn, sex, DOB, sal, b N ) ( S t a f f ( s N , f N , IN, posn,
sex, DOB, sal, bN} posn = 'Manager' sal > 2 5 0 0 0 ) }
, 4.12, , , (). Staff (sN, fN, . . ., bN} ,
.
posn = 'Manager'
Staff .position = 'Manager'. .
posn
s t a f f
Staff {posn). ,
posn
, , Staff (sN, fN, IN,
posn, sex, DOB, sal, bN),
position, s t a f f .
, ( posn sal).
, ,
.
{sN, f N , IN, posn, sex, DOB, sal, bN |
{3sNl, cty)
157
http://openlib.org.ua/
:
{sN, f N , IN, posn, sex, DOB, sal, bN |
( S t a f f ( s N , f N , IN, posn, sex, DOB, sal, bN}
1
PropertyForRent (pN, st, 'Glasgow , pc, typ, rms, rnt, oN, sN, b N l ) ) }
cty PropertyForRent
'Glasgow', sN,
, Staff,
PropertyForRent.
. ,
- .
{fN, IN | (3sN) { S t a f f { s N , f N , IN, posn, sex, DOB, sal, bN} (~ (BsNl)
(PropertyForRent(pN, st, cty, pc, typ, rms, rnt, oN, sNl, bNl)
(sN = s N l ) ) ) ) }
. , .
. { f N , IN |
(Client(cN, fN, IN, tel, pT, mR) Viewing(cNl, pNl, dt, crat}
PropertyForRent(pN, st, cty, pc, typ, rms, rnt, oN, sN, bN)
[cN = cNl} {pN =. pNl) cty'= 'Glasgow')}
. , ,
.
{cty | (Branch(bN, st, cty, pc) ( ~ ( B c t y l J
(PropertyForRent(pN, stl, ctyl, p e l , typ, rms, rnt, oN, sN, bNl)
(cty = c t y l } ) ) }
E , ,
.
{cty | (Branch(bN, st, cty, pc) (3ctyl)
(PropertyForRent(pN, st1, ctyl, pel, typ, rms, rnt, oN, sN, bNl)
(cty = c t y l ) ) }
. , ,
.
{cty | {Branch(bN, st, cty, pc) v
PropertyForRent(pN, stl, cty, pel, typ, rms, rnt, oN, sN, b N ) ) }
, ,
, , , ,
, . , ,
.
1 58
II.
http://openlib.org.ua/
4.3.
,
,
.
: .
,
. . SQUARE [37], SEQUEL [53] ,
SQL. SQL 5, 6 21.
.
,
. QBE (Query-By-Example)
[331]. 7.
(Fourth-Generation Language 4GL),
, (. 2.2 ). , ..
, (Fifth-Generation Language 5GL).
.
,
, . , ,
. , ..
( ).
. , ,
, . , , , , ,
, .
,
, : , , , . , , ,
.
4.
159
http://openlib.org.ua/
, . : .
,
. , , , , .
, .
( ).
, , ,
.
4.1.
4.2.
4.3.
4.4.
4.5.
4.6.
4.7.
?
?
:
) ;
) .
. ,
.
,
(-, , , ). , .
,
. .
( )
.
, . . ,
.
Hotel,
3.
4.8.
, :
) 1{1 (Room) )
) O H otel.hotelNo - Room.hotelNo ( I ! o t e l
) llhotelName (Hotel
160
Room)
5 0 (RoOTTl)
) )
I E .
http://openlib.org.ua/
) Guest =><
) Hotel
&J
GUSt)
-S-
, 4.8.
4.10. , :
4.9.
) {H.hotelName | H o t e l ( H ) A H . c i t y = ' L o n d o n }
) {H.hotelNarae | H o t e l ( ) (3R)
R.hotelNo R . p r i c e > 5 0 ) }
(Room(R) H.hotelNo =
4.11.
,
4.10.
4.12. ,
,
) .
6} 20
.
) ,
.
) Grosvenor
.
) ,
Grosvenor.
) Grosvenor
, ,
, .
) Grosvenor
( guestNo, guestName guest Address).
4. ,
Grosvenor, . ?
4.14. ,
.
? , ,
4.1.
4.
161
http://openlib.org.ua/
http://openlib.org.ua/
SQL:
...
SQL;
GROUP BY;
;
;
(UNION, INTERSECT, EXCEPT).
INSERT, UPDATE
DELETE.
3 4
. , , Structured Query Language (SQL),
.
SQL (ANSI)
1986 , 1987 (ISO)
[170].
SQL ,
,
.
, SQL ,
, ,
, , -
http://openlib.org.ua/
, .
SQL,
ISO. -
.
, SQL .
5.1 SQL ,
. 5.2 , SQL. 5.3 SQL, , .
6 SQL,
, , .
21 SQL
: , SQL . 27.4
, SQL -
( SQL3). SQL . ( ),
4.
SQL. SQL
, 4.
. 3.33.9 DreamHome.
5.1. SQL
SQL,
, .
5.1.1. SQL
:
;
,
, ;
.
, ,
. , , , .. ,
164
II.
http://openlib.org.ua/
. SQL .
SQL , ,
. SQL, ISO,
:
DDL (Data Definition Language),
;
DML (Data Manipulation Language),
.
SQL3 SQL
; -
. , IF ... THEN ...
ELSE, GO TO, DO ... WHILE ,
.
( ) ( , ).
( )
SQL . ,
SQL. SQL , 21. SQL3, 1999 , 27.
SQL .
, , , . , SQL ,
, SQL
. , .
,
, CREATE TABLE ( ), INSERT (), SELECT (). :
CREATE TABLE S t a f f ( s t a f f N o VARCHAR(S),
salary D E C I M A L ( 7 , 2 ) ) ;
INSERT INTO Staff VALUES
('SG16',
IName V A R C H A R ( 1 5 ) ,
'Brown', 8300);
SQL ,
(), ,
.
SQL [173],
[176], , .
5. SQL:
165
http://openlib.org.ua/
5.1.2. SQL
3, (
SQL) 1970 . .
( IBM
-). 1974 . , , , "Structured English Query Language",
SEQUEL. 1976 ,
SEQUEL/2; SQL
SEQUEL - .
- SQL "", "--".
1976 SEQUEL/2 IBM
, "System R" [9]. . ,
SQL,
SQUARE (Specifying Queries as Rational Expressions), System R. SQUARE
, [37].
1970- , ,
Oracle, Oracle. , , SQL.
INGRES, QUEL.
, SQL,
. , SQL
, INGRES . 1981 IBM
SQL/DS (
DOS/VSE). 1982 VM/CMS,
1983 MVS, DB2.
1982 (ANSI) RDL (Relation Database Language), , IBM. 1983
(ISO). SQL.
( RDL 1984 , SQL.)
, ISO 1987 ,
. , ,
, , , .
,
[89], [90], [92].
, . ,
(
, , ), , ,
.
1989 ISO , [171]. 1992 166
II.
http://openlib.org.ua/
, ISO,
SQL2 ( SQL-92) [173]. ,
SQL.
, SQL3 [176],
1999 .
- ,
27.4.
, , . ,
SQL , . . .
,
, ISO.
,
, SQL,
. SQL .
SQL IBM,
.
, SQL, ,
5.1.3. SQL
SQL , .
, NDL (Network
Database Language),
CODASYL, .
SQL SQL, , , , . SQL
, .
(, System Application Architecture
(SAA) IBM),
(, /Open,
UNIX), SQL
(Federal Information Processing
Standard FIPS), . SQL Access
Group SQL,
.
SQL
. ISO "Information Resource Dictionary System"
(IRDS) (. 2.7.1) "Remote Data Access" (RDA). ,
, 5. SQL:
167
http://openlib.org.ua/
. , .
SQL, , OnLine Analytical Processing (OLAP).
5.1.4.
ISO SQL , , , , . SQL
ISO. , , SQL ,
3. , SQL ,
SELECT
,
, .
5.2. SQL
SQL ,
SQL. SQL ,
, . SQL .
, ,
. , , (
)
, , , .. . , SQL , ; ,
(;).
SQL .
, , .
, , , . ,
' S M I T H 1 ,
' Smith 1 , .
SQL , SQL
. .
.
,
.
-:: ,
, .
SQL BNF
(Backus Naur Form -).
168
http://openlib.org.ua/
, .
,
.
( ) , a
b | .
, {}.
, [].
( . . . )
,
{ } [ , . . . ] . ,
, .
( )
DDL, DML.
DML DDL.
DML . DDL .
5.3.
SQL DML:
SELECT ;
INSERT ;
UPDATE ;
DELETE .
SELECT
DML, SELECT .
,
, , ,
. INSERT, UPDATE DELETE SQL.
SQL
DreamHome, . 3-33.9. DreamHome :
Branch
Staff
5. SQL:
169
http://openlib.org.ua/
DML, , , "".
, SQL.
, SQL
( 6.1.1).
, ,
, . , .
.
INSERT INTO PropertyForRent(propertyNo, street, city, postcode,type,
rooms, rent, ownerNo, staffNo, ranchNo)
1
1
1
1
V A L U E S ( ' P A 1 4 ' , 46 Holhead , 'Aberdeen , 'AB7 5SU , 'House , 6 ,
1
1
650.00, 'C046 , 'SA9 , ' B 0 0 7 ' ) ;
rooms ,
rent .
. .
5.3.1.
SELECT . , ,
, (. 4.1), . SELECT
SQL. SELECT :
^SELECT [DISTINCT; [ ALL] .{ * I
[,'...'}'}
170
http://openlib.org.ua/
HAVING.
.
SELECT. , .
ORDER BY. .
SELECT .
SELECT FROM ,
.
SELECT , ,
(. 4.1). , .
5.1.
.
,
WHERE. ,
. :
SELECT staffNo, fName, IName, position, sex, DOB, salary, branchNo
FROM S t a f f ;
, SQL " " - (*).
:
SELECT *
FROM Staff;
. 5.1.
5.1. 5.1
position
sex
White
Manager
Ann
Beech
Assistant
David
Ford
Supervisor
SA9
Mary
Howe
SG5
Susan
Brand
SL41
Julie
Lee
staffNo
fName
IName
SL21
John
SG37
SG14
DOB
salary
branchNo
l-Oct-45
30000.00
BOOS
lO-Nov-60
12000.00
BOOS
24-Mar-58
18000.00
BOOS
Assistant
19-Feb-70
9000.00
B007
Manager
3-Jun-40
24000.00
BOOS
Assistant
13-Jun-65
9000.00
BOOS
5. SQL:
1
171
http://openlib.org.ua/
5.2.
( staffNo), , .
fName
IName
salary
SL21
John
White
30000.00
SG37
Ann
Beech
12000.00
SG14
David
Ford
18000.00
SA9
Mary
Howe
9000.00
SG5
Susan
Brand
24000.00
SL41
Julie
Lee
9000.00
5.. DISTINCT
, .
SELECT propertyNo
FROM Viewing;
. 5.3. , , , (.
4.1.1), SELECT
.
DISTINCT. :
SELECT DISTINCT propertyNo
FROM Viewing;
. 5,4.
172
II.
http://openlib.org.ua/
5.3.
5.3
5.4.
5.3
propertyNo
14
PG4
PG36
5.4.
,
, .
SELECT s t a f f N o , fName, IName, salary/12
FROM S t a f f ;
5.2, ,
, . 12. . 5.5.
5.5. 5.4
staffNo
fName
IName
co!4
SL21
John
White
2500.00
SG37
Ann
Beech
1000.00
SG14
David
Ford
1500.00
SA9
Mary
Howe
750.00
SG5
Susan
Brand
2000.00
SL41
Julie
Lee
750.00
( , ).
SELECT SQL.
5. SQL:
173
http://openlib.org.ua/
, , . .
, , , .
, , !4. . , SQL
. SQL
(, !4),
, SELECT. ISO
,
AS. SELECT
:
SELECT staffNo,
FROM S t a f f ;
fName,
monthlySalary, col4.
( WHERE)
SELECT
.
,
.
WHERE. WHERE, , ,
. ( , ISO).
. .
. ,
.
. ,
.
. , .
NULL. , NULL
( ).
WHERE ,
4.1.1. .
174
II.
http://openlib.org.ua/
5.5.
10 000
.
SELECT s t a f f N o , fName, IName, position, salary
FROM Staff
WHERE salary > 10000;
Staff salary > 10000.
,
Staff, salary 10 000 . . 5.6.
5.6. 5.5
staffNo
fName
IName
position
salary
SL21
John
Ann
SG14
David
Susan
White
Beech
Ford
Brand
Manager
Assistant
Supervisor
Manager
30000.00
SG37
SG5
12000.00
18000.00
24000.00
SQL , . 5.7.
5.7.
!<
>=
( ISO)
( )
AND, OR NOT, , ( ).
.
.
.
NOT AND OR.
AND OR.
.
5. SQL:
175
http://openlib.org.ua/
5.6.
.
SELECT *
FROM Branch
1
1
WHERE city = 'London OR city = ' G l a s g o w ;
,
(city = 'London') (city = 'Glasgow'),
WHERE OR.
. 5.8.
5.8. 5.6
branchNo
street
005
002
city
postcode
22 Deer Rd
London
SW1 4EH
163 Main St
Glasgow
Gil 9QX
56 Clover Dr
London
NW106EU
1
BETWEEN .
20 000 30 000 . . 5,9.
5.9. 5.7
staffNo
fName
IName
position
salary
SL21
John
White
Manager
30000.00
SG5
Susan
Brand
Manager
24000.00
, (NOT BETWEEN), ,
.
BETWEEN SQL, . :
SELECT staffNo, fName, IName, position, salary
FROM S t a f f
WHERE salary >= 20000 AND salary <= 30000;
176
II.
http://openlib.org.ua/
,
BETWEEN , .
5.8.
(IN/NOT IN)
.
SELECT staffNo, fName, IName, posicion
FROM S t a f f
'Supervisor');
IN. ,
'Manager 1 'Supervisor 1 . . 5.10.
5.10. 5.8
staffNo
fName
IName
position
SL21
John
White
Manager
SG14
David
Ford
Supervisor
SG5
Susan
Brand
Manager
,
(NOT IN), , ,
. BETWEEN, IN SQL
:
SELECT staffNo,
fName,
IName, position
FROM S t a f f
177
http://openlib.org.ua/
%. ( ).
_. .
.
address LIKE 'H%'. ,
, .
address LIKE 'H
'. ,
, , ' ' .
address LIKE ' %'.
,
.
address LIKE '%Glasgow%'. ,
, Glasgow;
address NOT LIKE ' H % ' . ,
, .
,
,
ESCAPE "" , , , . ,
45%' :
LIKE '15#%' ESCAPE ' # '
, SQL,
,
. :
SELECT ownerNo, fName, IName, address, telNo
FROM PrivateOwner
. 5.11.
5.11. 5.9
ownerNo
fName
IName
address
telNo
087
Carol
Parrel
0141-357-7419
040
Tina
Murphy
0141-943-1728
093
Shaw
0141-225-7025
1
5.10. NULL
(IS NULL/IS NOT NULL)
PG4,
.
Viewing (. . 3.8), ,
178
http://openlib.org.ua/
P G 4 ' , ,
. ,
:
(propertyNo = ' PG4 ' AND comment = ' ' )
date
CR56
26--01
, NULL, ,
(IS NOT NULL).
ISO, .
5. SQL:
179
http://openlib.org.ua/
.
SQL , ORDER BY
SELECT. ORDER BY
SELECT.
5.11.
,
.
fName
IName
salary
SL21
John
White
30000.00
SG5
Susan
Brand
24000.00
SG14
David
Ford
18000.00
Ann
Beech
12000.00
SA9
Mary
Howe
9000.00
SL41
Julie
Lee
9000.00
SG37
ORDER BY .
.
salary. , . ,
,
.
- . ORDER BY , .
180
II.
http://openlib.org.ua/
5.12.
, .
SELECT propertyNo, type, rooms, rent
FROM PropertyForRent
ORDER BY type;
(.5.14).
5.14. 5.12
propertyNo
type
rooms
rent
PL94
Flat
400
PG4
Fiat
350
PG36
Flat
375
PG16
Flat
450
PA14
House
650
PG21
House
600
.
, . , ,
rent, :
SELECT propertyNo, type, rooms, rent
FROM PropertyForRent
ORDER BY type, rent DESC;
( , ) (
),
.
. 5.15.
5.15. 5.12
propertyNo
type
rooms
rent
PG16
Flat
450
PL94
Flat
400
PG36
Flat
375
PG4
Flat
350
14
House
650
PG21
House
600
5. SQL;
181
http://openlib.org.ua/
5.3.3. SQL
ISO :
COUNT ;
SUM ;
AVG ;
MIN ;
.
.
. COUNT, MIN
, , SUM AVG . COUNT ( * ) , ,
. COUNT (*}
COUNT , , , .
, DISTINCT. ' ISO
ALL , , ,
. DISTINCT
MIN .
SUM AVG, ,
. ,
DISTINCT .
,
SELECT HAVING (. 5.3.4). .
SELECT , GROUP BY, (. 5.3.4), SELECT
- , , . ,
:
SELECT staffNo, COUNT(salary)
FROM S t a f f ;
, GROUP
BY, s t a f f N o SELECT
.
182
II.
http://openlib.org.ua/
5.13. COUNT(*)
, 350
,
SELECT COUNT(*) AS count
FROM PropertyForRent
WHERE rent > 350;
,
350 ,
WHERE. ,
,
COUNT. . 5.16.
5.16. 5.13
count
5.14. COUNT(DISTINCT)
,
2001 .
SELECT COUNT(DISTINCT propertyNo) AS count
FROM Viewing
WHERE date BETWEEN ' l - M a y - 0 1 1 AND ' 3 1 - M a y - O l 1 ;
, 2001 ,
WHERE. , , COUNT. ,
,
DISTINCT
. . 5.17.
5.17. 5.14
count
183
http://openlib.org.ua/
sum
54000.00
min
max
avg
9000.00
30000.00
17000.00
II.
http://openlib.org.ua/
5.17. GROUP BY
, ,
.
SELECT branchNo, COUNT{staffNo} AS count, SUM(salary) AS sum
FROM Staff
GROUP BY branchNo
ORDER BY branchNo;
s t a f f N o salary GROUP BY, SELECT
. branchNo SELECT - GROUP BY. . 5.20.
5.20. 5.17
branchNo
count
sum
8003
54000.00
005
39000.00
007
9000.00
.
1. Staff .
.
, . 5.1.
2. , , salary,
.
.
3. , branchNo.
5. SQL:
185
http://openlib.org.ua/
' branchNo
005
005
007
staffNo
salary
SG37
12000.00
18000.00
24000.00
30000.00
9000.00
9000.00
SG14
SG5
SL21
SL41
SA9
COUNT(staffNo)
SUM(salary)
54000.00
39000.00
9000.00
. 5.1. ,
SQL SELECT ( 5.3.5).
:
SELECT branchNo,
(SELECT C O U N T { s t a f f N o ) AS count
FROM S t a f f s
,
Branch, ,
, .
( HAVING)
HAVING GROUP BY ,
, . HAVING WHERE , .
WHERE , , HAVING
, . ISO , ,
HAVING, GROUP BY .
HAVING , , ;
WHERE . (,
WHERE.)
HAVING SQL -
, HAVING, , .
186
II,
http://openlib.org.ua/
5.18. HAVING
.
SELECT branchNo, COUNT(staffNo) AS count, SUM(salary) AS sum
FROM Staff
GROUP BY branchNo
HAVING COUNT(staffNo) > 1
ORDER BY branchNo;
,
, , , . , HAVING. . 5.21.
5.21. 5.18
branchNo
count
sum
54000.00
005
39000.00
5.3.5.
SELECT,
SELECT. () SELECT
() .
WHERE HAVING SELECT
, . , SELECT INSERT,
UPDATE DELETE (. 5.3.10). .
, , .. . , . 5.13 5.14.
,
. , ,
. 5.15 , .
, ,
IN.
5. SQL:
187
http://openlib.org.ua/
5.19.
, ,
1
463 Main St .
SELECT staffNo, fName, IName, position
FROM Staff
WHERE branchNo = (SELECT branchNo
FROM Branch
WHERE street = '163 Main S t ' } ;
SELECT (SELECT branchNo FROM Branch ...)
, '163
Main S t ' . ( ,
.)
,
. , SELECT , ' B O O V . ,
1
'163 Main St . SELECT
:
SELECT staffNo, fName, IName, position
FROM Staff
WHERE branchNo = 'B0031;
. 5.22.
5.22. 5.19
staffNo
fName
IName
position
SG37
Ann
SG14
David
Susan
Beech
Ford
Brand
Assistant
Supervisor
Manager
SG5
5.20.
, , ,
.
SELECT staffNo, fName, IName, position,
salary - (SELECT AVG(salary) FROM S t a f f ) AS salDiff
FROM Staff
WHERE salary > (SELECT AVG(salary) FROM S t a f f ) ;
,
'WHERE salary > AVG (salary) ',
188
II.
http://openlib.org.ua/
WHERE .
, ,
SELECT, ,
. ,
, 17 000 .
SELECT ,
. SELECT :
SELECT staffNo, fName, IName, position, salary - 17000 As salDiff
FROM S t a f f
WHERE salary > 17000;
. 5.23
5.23. 5.20
staffNo
fName
IName
position
salDiff
SL21
John
White
Manager
13000.00
SG14
David
Ford
Supervisor
1000.00
SG5
Susan
Brand
Manager
7000.00
.
1. ORDER BY,
SELECT.
2. SELECT
, ,
EXISTS (. 5.3.8).
3. , FROM .
, FROM ,
( ).
4. , , . , ,
salary.
SELECT s t a f f N o , fName, IName, position, salary
FROM S t a f f
WHERE (SELECT AVG(salary) FROM Staff) < salary;
5.21. IN
,
, '163 Main st1.
SELECT propertyNo, street, city, postcode, type, rooms, rent
FROM PropertyForRent
5. SQL:
189
http://openlib.org.ua/
WHERE
staffNo
IN
(SELECT s t a f f N o
FROM S t a f f
postcode
propertyNo
street
type
rooms
rent
PG16
5 Novar Dr
Glasgow
PG36
2 Manor Rd
Glasgow
G129AX
Flat
450
G324QX
Flat
375
House
PG21
18 Dale Rd
Glasgow
G12
600
,
' 1 , ,
(. 5.20), , 190
II.
http://openlib.org.ua/
fName
(Name
SL21
John
SG14
David
SG5
Susan
position
salary
White
Manager
30000.00
Ford
Supervisor
18000.00
Brand
Manager
24000.00
5.23. ALL
,
' '.
SELECT staffNo, fName, INarae, position, salary
FROM S t a f f
WHERE salary > ALL{SELECT salary
FROM Staff
WHERE branchNo = 'BOG3');
.
, ' ' ,
,
. ALL. . 5.26.
5.26. 5.23
staffNo
fName
IName
position
salary
SL21
John
White
Manager
30000,00
,
1
5.3.7.
:
. .
, . SQL
, .
.
5. SQL
191
http://openlib.org.ua/
, , . ' , . FROM
, ,
WHERE , . , , FROM.
. ,
,
. , . , , .
5.24.
,
.
SELECT c.clientNo, fName, IName, propertyNo, comment
FROM Client c, Viewing v
WHERE c.clientNo = v.clientNo;
Client, Viewing, . SELECT ,
. ,
(clientNo) ,
, .
, . (
clientNo Viewing.)
{ ). ' ' , Client.
, clientNo. .clientNo=v.clientNo.
.
, 4.1.3. . 5.27.
5.27. 5.24
clientNo
fName
IName
propertyNo
CR56
Aline
PG36
CR56
Aline
CR56
Aline
Stewart
Stewart
Stewart
Tregear
Kay
CR62
Mary
CR76
John
192
PA14
comment
too small
PG4
PA14
PG4
no dining room
too remote
II.
http://openlib.org.ua/
,
" " (1:*), - (.
11.6.2). , Client
Viewing, .
Viewing () Client (),
Client ()
Viewing (). , , . 3.2.5 ,
"-" . , , , , , . - SQL
, .
5.24 Client (. clientNo)
Viewing (v. clientNo).
SQL
:
FROM Client JOIN Viewing v ON .clientNo = v.clientNo
FROM Client JOIN Viewing USING clientNo
FROM Client NATURAL JOIN Viewing
FROM FROM
WHERE.
clientNo, clientNo.
5.25.
,
- , ,
.
SELECT s.branchNo, s . s t a f f N o , fName, IName, propertyNo
FROM Staff s, PropertyForRent p
WHERE s . s t a f f N o = p . s t a f f N o
ORDER BY s.branchNo, s.staffNo, propertyNo;
,
,
. . 5.28.
5.28. 5.25
branchNo
StaffNo
fName
IName
propertyNo
SG14
David
Ford
PGi6
SG37
Ann
Beech
PG21
SG37
Ann
Beech
PG36
BOOS
SL41
Julie
Lee
PL94
007
SA9
Mary
Howe
PA14
5. SQL:
193
http://openlib.org.ua/
5.26.
,
- , ,
, ,
.
SELECT b.branchNo, b.city, s.staffNo, fName, IName, propertyNo
FROM Branch b, S t a f f s, PropertyForRent p
WHERE b.branchNo = s.branchNo AND s . s t a f f N o = p . s t a f f N o
ORDER BY b.branchNo, s . s t a f f N o , propertyNo;
Branch, Staff PropertyForRent, . Branch Staff
b.branchNo=*s .branchNo, . Staff
PropertyForRent
city
staff Mo
fName
IName
propertyNo
Glasgow
SG14
David
Ford
PG16
Glasgow
SG37
Ann
Beech
PG21
Glasgow
SG37
Ann
Beech
PG36
005
London
SL41
Julie
Lee
PL94
007
Aberdeen
SA9
Mary
Howe
PA14
, SQL
FROM WHERE:
FROM
5.27.
,
,
SELECT s.branchNo, S.staffNo, COUNT(*) AS count
FROM S t a f f s, PropertyForRent p
WHERE S . s t a f f N o = p . s t a f f N o
GROUP BY s.branchNo, s . s t a f f N o
ORDER BY s.branchNo, s . s t a f f N o ;
, ,
. Staff PropertyForRent
194
II.
http://openlib.org.ua/
staffNo FROM/WHERE. ,
,
GROUP BY. ,
ORDER BY. . 5,30.
5.30. 5.27
branchNo
staffNo
count
SG14
SG37
8005
SL41
007
SA9
, (. 4.1.2).
,
, . , . WHERE, SQL
. , ISO SELECT,
:
-."SELECT [DISTINCT. | ALL] {* j columnList]
FROM
tableNamel CROSS JOIN 2
5.24, client
Viewing clientNo,
, . 3.6 3.8, 20 (4 Client x 5
viewing = 20 ). 5.24 , WHERE.
, SELECT, .
1. , FROM.
2. WHERE,
, .
.
3. ,
SELECT, .
4. SELECT DISTINCT,
-.
5. SQL:
195
http://openlib.org.ua/
, 3 4 ,
, SELECT.
5. ORDER BY, .
,
.
, .
. ISO , (. 4.1.3).
,
.
, Branch
PropertyForRent, . 5.31 5.32.
5.31. Branch"!
branchNo
bCity
Glasgow
004
Bristol
002
London
5.32. PropertyForRentl
pCity
Aberdeen
London
Glasgow
() SQL:
SELECT b . * , p . *
FROM Branchl b, PropertyForRentl p
WHERE b . b C i t y = p . p C i t y ;
. 5.33.
5.33.
Branchl PropertyForRentl
branchNo
bCity
propertyNo
Glasgow
London
PG4
Glasgow
PL94
London
002
196
pC'rty
II.
http://openlib.org.ua/
,
, , .
,
, .
, .
: , .
.
5.28.
,
, ,
.
, :
SELECT . * , . *
FROM Branchl b LEFT JOIN PropertyForRentl p ON b . b C i t y = p.pCity;
. 5.34.
,
, (),
(). NULL.
5.34. 5.28
branch No
bCity
propertyNo
pClty
Glasgow
PG4
004
Bristol
NULL
Glasgow
NULL
002
London
PL94
London
5.29.
,
, ,
.
,
:
SELECT b . * , p . *
FROM Branchl b RIGHT JOIN PropertyForRentl p ON b.bCity = p.pCity;
. 5.35.
,
,
() , ()
. NULL.
5. SQL:
197
http://openlib.org.ua/
5.35. 5.29
branchNo
bCity
propertyNo
pCity
NULL
NULL
PA14
Aberdeen
B003
Glasgow
PG4
Glasgow
B002
London
PL94
London
5.30. }
,
, ,
.
, :
SELECT . * ( . *
FROM Branchl b FULL JOIN PropertyForRent p ON b.bCity = p.pCity;
. 5.36.
,
, , . ,
, NULL.
5.36. 5.30
branchNo
bCity
propertyNo
pClty
NULL
NULL
PA14
Aberdeen
Glasgow
PG4
004
Bristol
NULL
Glasgow
NULL
002
London
PL94
London
198
II.
http://openlib.org.ua/
5.31. EXISTS
, .
SELECT staffNo, fName, IName, position
FROM Staff
WHERE EXISTS(SELECT *
FROM Branch b
WHERE s.branchNo = b.branchNo AND city = 'London');
: "
, Branch ,
branchNo, ,
City 'London'".
. , EXISTS
TRUE. . 5.37.
5.37. 5.31
staff
No
fName
IName
position
SL21
John
White
Manager
SL41
Julie
Lee
Assistant
, , s.branchNo=b.branchNo,
, .
,
, SELECT * FROM Branch
WHERE city='London' TRUE. :
SELECT s t a f f N o , fName, IName, position FROM Staff WHERE true;
:
SELECT staffNo, fName, IName, position FROM S t a f f ;
, , :
SELECT s t a f f N o , fName, IName, position
FROM S t a f f s, Branch b
WHERE s.branchNo = b.branchNo AND city = 'London 1 ;
5.3.9.
( UNION, INTERSECT EXCEPT)
SQL
(union), (intersection) (difference),
.
5. SQL:
199
http://openlib.org.ua/
,
, (), ()
,
, , ,
.
, ,
, .
. 5.2. , , . ,
, ..
. ,
,
. , , . , , , SMALLINT.
Bns
-s
. 5.2.
(, )
, ISO, UNION, INTERSECT EXCEPT.
:
opera tor .[ALL]
...]}
200
II.
http://openlib.org.ua/
5.32. UNION
, ,
.
(SELECT city
FROM Branch
WHERE city IS NOT NULL)
UNION
(SELECT city
FROM PropertyForRent
{SELECT *
FROM Branch
WHERE city IS NOT NULL)
UNION CORRESPONDING BY city
(SELECT *
FROM PropertyForRent
,
, .
. 5.38.
5.38. 5.32
city
London
Glasgow
Aberdeen
Bristol
5.33. INTERSECT
, ,
.
(SELECT city
FROM Branch)
INTERSECT
(SELECT c i t y
FROM PropertyForRent);
(SELECT *
FROM Branch)
INTERSECT CORRESPONDING BY city
(SELECT *
FROM PropertyForRent};
, ,
.
. 5.39.
5.39. 5.33
city
Aberdeen
Glasgow
London
5. SQL:
201
http://openlib.org.ua/
INTERSECT:
SELECT b . c i t y
WHERE b . c i t y = p . c i t y ;
WHERE EXISTS(SELECT *
FROM PropertyForRent p
WHERE p . c i t y = b . c i t y ) ;
SQL , .
I 5.34. EXCEPT
, ,
,
(SELECT city
(SELECT *
FROM Branch)
FROM Branch)
EXCEPT
EXCEPT CORRESPONDING BY city
(SELECT city
(SELECT *
FROM PropertyForRent);
FROM PropertyForRent);
, ,
, . . 5.40.
5.40. 5.34
city
Bristol
EXCEPT:
SELECT DISTINCT city
FROM Branch
WHERE city NOT IN
(SELECT city
FROM PropertyForRent);
5.3.10.
SQL , , .
, SELECT. SQL, .
INSERT ,
UPDATE ,
.
DELETE .
202
II.
http://openlib.org.ua/
( INSERT)
INSERT.
. INSERT
:
# INSERT . INTO TableName
^VALUES
TableName ( ) , ( 6.4). colunmList ( ) ,
, . coIumnLisC
. ,
, ,
CREATE TABLE. INSERT
,
NULL
,
DEFAULT ( 6.3.2). dataValueList ( )
columnList:
;
,
da ta Val uebist
columnList, dataValuel/ist columnList ..;
dataValueList
.
5.35. INSERT... VALUES
staff , .
INSERT INTO Staff
VALUES('SG16', 'Alan', 'Brown', 'Assistant 1 , ' M 1 , DATE '1957-05-25',
8300, ' B 0 0 3 ' ) ;
, . ,
(, ' A l a n ' ) .
I 5.36. ,
staff ,
: staffNo, ftfame, IName, position, salary branchNo.
INSERT INTO Staff (staffNo, fName, IName, position, salary, branchNo)
VALUES { ' S G 4 4 1 , ' A n n e 1 , 'Jones', ' A s s i s t a n t ' , 8100, ' ' } ;
5. SQL:
203
http://openlib.org.ua/
, , . ,
, . , INSERT
:
INSERT INTO Staff
VALUES ( ' S G 4 4 1 , 'Anne 1 , ' J o n e s 1 , ' A s s i s t a n t 1 , NULL, NULL, 8100,
NULL, ' B G 0 3 . ' ) ;
, sex DOB NULL.
--.. -".
INSERT . :
r
,
, . UNION,
,
. , ,
. 204
II.
http://openlib.org.ua/
fName
IName
propCount
SG14
David
Ford
SL21
John
White
SG37
Ann
Beech
SA9
Mary
Howe
SG5
Susan
Brand
SL41
Julie
Lee
, SQL
UNION INSERT.
( UPDATE)
UPDATE
. :
^UPDATE.
SET calumnNamel = dataValuel
[WHERE searchCondition]
5.38.
UPDATE
3%.
UPDATE Staff
SET salary = salary*!.03;
S t a f f , WHERE
.
" 5. SQL:
205
http://openlib.org.ua/
5.39.
UPDATE
5%.
UPDATE Staff
SET salary = salary*!.05
1
WHERE position = ' M a n a g e r ;
WHERE , .
salary , salary =
salary*!.05.
5.40.
UPDATE
(BtafNo='SGl4 ')
18 000 .
UPDATE Staff
SET position = 'Manager', salary = 18000
WHERE staffNo = 'SG14';
( DELETE)
DELETE .
:
'''DELETE FROM TableName
:[WHERE searchConditionJ
INSERT UPDATE, TableName
,
(. 6.4). searchCondition ,
. .
, , DROP TABLE (. 6.3.3). WHSRE ,
, , searchCondition,
5.41. ( DELETE)
PG4.
DELETE FROM Viewing
WHERE propertyNo = 'PG4';
WHERE
,,
' PG4 ', .
206
II.
http://openlib.org.ua/
5.42. ( DELETE)
viewing.
DELETE FROM Viewing/
WHERE ,
. Viewing, .
207
http://openlib.org.ua/
,
. , WHERE, HAVING .
SELECT,
.
WHERE HAVING SELECT,
.
, . , .
: , .
;
, . , .
, .
, , . . , , IN.
, .
FROM, ,
, WHERE. ISO . , (, ), UNION, INTERSECT EXCEPT.
SELECT, SQL DML INSERT,
,
. UPDATE
. DELETE
.
(
5.1.
5.2.
5.3.
5.4.
SQL. ?
SQL?
, SELECT.
?
SELECT? NULL?
5.5.
5.6.
? ?
208
II.
http://openlib.org.ua/
5.7-5.28 Hotel, 3.
5.7.
5.8.
.
,
.
5.9.
,
, .
5.10. 40 ,
.
5.11. , dateTo.
5.12.
5.13.
5.14.
5.15.
?
?
?
?
5.16. Grosvenor,
5.17. ,
Grosvenor.
5.18. ,
Grosvenor, .
5.19. ,
Grosvenor, ?
5.20. Grosvenor, .
5.21. - Grosvenor ?
5.22. .
5.23. ,
.
5.24. ,
?
5.25. ?
5.26. -
?
5. SQL:
209
http://openlib.org.ua/
5.27. .
5.28. 5%.
5.29. SQL ,
.
ISO.
, . ., ?
5.30. , ,
HAVING,
HAVING.
5.31. , SQL .
210
II.
http://openlib.org.ua/
SQL:
...
, SQL.
SQL.
SQL, :
;
;
;
;
, .
CREATE TABLE ALTER TABLE.
,
SQL.
.
, .
.
ISO.
GRANT REVOKE .
SQL ,
.
SQL .
6.1 ISO SQL. 1989 ISO
(Integrity Enhancement Feature IEF),
[171]. -
http://openlib.org.ua/
. IEF SQL ,
. 6.2,
SQL 6.3.
6.4 ,
SQL, ,
.
, , ISO SQL , . 6.5 ISO SQL.
. , SQL , ,
.
6.6.
21 SQL , SQL. 27.4 , SQL
- ,
SQL3. , SQL , Dreamffome.
SQL ,
5.2.
6.1. SQL,
ISO
, ISO SQL.
SQL.
6.1.1. SQL
SQL
, . ,
SQL, . ISO
, ;
(A-Z, a-z), (0-9) (_). .
:
128 ( );
;
.
212
II.
http://openlib.org.ua/
6.1.2. SQL
. 6.1 SQL, ISO.
, -
character bit " ",
exact numeric approximate numeric " ". SQL3 , , 27.4.
6.1. SQL, ISO
boolean
()
character
()
bit
()
exact numeric
( )
approximate numeric
( )
datetime
(/)
interval
()
BOOLEAN
LOB
( )
CHAR
VARCHAR
BIT
BIT VARYING
NUMERIC
DECIMAL
INTEGER
FLOAT
REAL
DOUBLE
PRECISION
DATE
TIME
TIMESTAMP
SMALLINT
INTERVAL
CHARACTER
LARGE
OBJECT
BINARY
LARGE
OBJECT
( boolean)
TRUE
() FALSE (). UNKNOWN (), NULL,
- NOT NULL.
SQL . TRUE
FALSE, , NULL UNKNOWN,
UNKNOWN.
( character)
,
.
SQL, , , . ASCII EBCDIC.
:
6. SQL:
213
http://openlib.org.ua/
length ,
( 1).
(VARYING) . ,
, . ,
,
. , branchNo
Branch
:
branchNo CHAR(4)
address PrivateOwner
{ 30 ), :
address VARCHAR(30)
( bit)
, .. (), 0, 1. , :
BIT(4)
II.
http://openlib.org.ua/
NUMERIC DECIMAL
. ,
. INTEGER
.
SMALLINT .
. , , SMALLINT,
32 767. rooms PropertyForRent,
, SMALLINT :
rooms
SMALLINT
salary S t a f f :
salary
DECIMAL(7,2)
99 999.99
,
( approximate numeric)
, , .
,
, (), : 10, +5.26, - 0 . 2 - 4 .
:
I FLOAT
[precision]
' REAL
' DOUBLE PRECISION
precision .
REAL DOUBLE PRECISION .
( datetime)
"/"
. , . ISO "/" YEAR (), MONTH (), DAY (), HOUR (), MINUTE (), SECOND
(), TIMEZONE_HOUR ( ) TIMEZONE_MINUTE ( ).
(
). /.
J'DATE
DATE ,
YEAR, MONTH DAY. TIME -
6. SQL:
215
http://openlib.org.ua/
DATE
interval
. : YEAR, MONTH,
DAY, HOUR, MINUTE SECOND. : - - . YEAR / MONTH.
DAY, HOUR, MINUTE, SECOND.
:
INTERVAL -{{startField TQ.endField} singleDatetimeField}
StartField = YEAR
MONTH | DAY j HOUR | MINUTE
[CintervaiLeadingFieldPrecisicm) ]
endField
YEAR | MONTH | DAY j .HOUR-.. | MINUTE | SECOND
[(fractionalSecondsPrecision)]
singleDatetimeField = startPield |;SECONB
[ (intervejlbeadingFie.IdPrecis.icm
[,fractionalSecondsRrecision])]
startField
(intervalLeadingFieldPrecision),
. :
INTERVAL Y E A R ( 2 )
MONTH
, 0 , 0 99 , 11 . :
INTERVAL HOUR TO SECOND(4)
, 0 , 0 , 99 , 59 5 9 . 9 9 9 9 .
( 4.)
SQL
, , .. , .
(+, -, * /)
, . 6.2.
216
II.
http://openlib.org.ua/
BIT_LENGTH
. ,
BIT_LENGTH(X'FFFF') 16
OCTET_LENGTH
( ,
8}. ,
OCTETJjENGTHfX'FFFF') 2
CHAR__LENGTH
( ,
). ,
CHAR_LENGTH ( ' Beech') 5
CAST
,
, .
CAST ( .26 AS INTEGER)
,
.
, f Name j | IName
CURRENTJJSER USER
,
(,
, )
SESSION_USER
,
SQL
SYSTEMJJSER
,
,
LOWER
. ,
LOWER(SELECT fName FROM Staff WHERE staffNo =
'SL21') ' john'
UPPER
. ,
UPPER(SELECT fName FROM Staff WHERE staffNo =
SL21') 'JOHN'
TRIM
(LEADING),
(TRAILING) (BOTH) .
, TRIM (BOTH ' * ' FROM ' ***
Hello World * * * ' ) 'Hello World 1
POSITION
.
, POSITION ( ' '
IN 'Beech') 2
SUBSTRING
.
,
SUBSTRING!'Beech' FROM 1 )
'Bee 1
EXTRACT
, .
EXTRACT(YEAR FROM Registration.dateJoined)
6. SQL:
217
http://openlib.org.ua/
. 6.2
CASE
CASE type
WHEN 'House'
WHEN ' F l a t '
ELSE
END
THEN 1
THEN 2
0
CURRENT_DATE
CURRENTJTIME
,
,
, CTJRRENTJTIME ( 6 )
CURRENT_TIME_STAMP
,
. , CURRENT_TIMESTAMP(O)
6.2.
, , SQL.
,
. 3.3 :
;
;
;
;
.
CREATE TABLE ALTER
TABLE.
6.2.1.
, (
NULL). NULL ;
, ,
(. 3.3.1). ,
: , .. ISO NOT
NULL, CREATE TABLE ALTER TABLE.
NOT NULL, 218
II.
http://openlib.org.ua/
.
NULL,
NULL. ISO NULL. , , position
() Staff () ,
, .
position VARCHAR(IO) NOT NULL
6.2.2.
, ..
(. 3.2.1). , , sex () Staff
' ' , ' F ' . ISO
CREATE TABLE ALTER TABLE. CHECK, . CHECK :
:
CHECK
{searchCandition}
CHECK
. , , sex ( ' '
'F'), :
CHAR NOT NULL CHECK
{sex IN
CM ,
'F })
ISO ,
CREATE DOMAIN,
:
: CREATE DOMAIN domainWame [AS] datatype
[DEFAULT defaultOption]
.:[CHECK (searcftCoriditicn)]
,
domainName, , dataType (. 6.1.2), ,
defaulCOption, ,
CHECK. ,
CREATE DOMAIN ,
. ,
sex :
CREATE DOMAIN SexType AS CHAR
DEFAULT ' M '
CHECK (VALUE I N { ' M ' , ' F ' ) ) ;
SexType, ,
6. SQL:
219
http://openlib.org.ua/
searchCondicion
. , BranchNumber ( ), , branchNo
Branch. :
CREATE DOMAIN BranchNumber AS VARCHAR(4)
CHECK (VALUE IN (SELECT branchNo PROM Branch));
DROP
DOMAIN, :
"DROP DOMAIN domainName [RESTRICT | CASCADE]
(RESTRICT CASCADE) ,
, . RESTRICT, , (. 6.5.2),
. CASCADE,
, , ,
,
.
6.2.3.
. , PropertyForRent
,
propertyNo;
, . ISO
PRIMARY KEY CREATE TABLE ALTER TABLE. ,
PropertyForRent :
PRIMARY KEY(staffNo)
, ,
Viewing, clientNo propertyNo,
PRIMARY KEY
PRIMARY KEY(clientNo, propertyNo)
PRIMARY KEY
.
,
UNIQUE. , 220
II.
http://openlib.org.ua/
NOT NULL.
UNIQUE. INSERT UPDATE,
( ). , Viewing :
clientNo VARCHAR{5) NOT NULL,
propertyNo VARCHAR(S) NOT NULL,
UNIQUE (clientNo, propertyNo)
6.2.4.
, ,
, ,
. ,
,
(. 3.3.3). , branchNo
PropertyForRent Branch, , .
, branchNo Branch. .
ISO FOREIGN KEY CREATE TABLE ALTER TABLE.
,
branchNo
PropertyForRent :
FOREIGN KEY(branchNo) REFERENCES Branch
INSERT UPDATE,
, . , UPDATE DELETE,
,
,
, ON
UPDATE ON DELETE FOREIGN KEY. , , , SQL .
CASCADE. . , ,
,
.. , .
6. SQL:
221
http://openlib.org.ua/
SET NULL. ,
NULL. , NOT NULL.
SET DEFAULT. ,
, .
DEFAULT ,
(. 6.3.2).
NO ACTION. . , ON DELETE .
SQL , .
CASCADE , . , , . ,
PropertyForRent s t a f f No
, staff.
, ,
staff staffNo PropertyForRent NULL:
FOREIGN KEY (staffNo} REFERENCES Staff ON DELETE SET NULL
,
ownerNo PropertyForRent ,
PrivateOwner. , , PrivateOwner ownerNo PropertyForRent
:
FOREIGN KEY {ownerNo) REFERENCES PrivateOwner ON UPDATE CASCADE
6.2.5.
( ), , . , DreamHome
, ) ,
, . ISO CHECK UNIQUE CREATE TABLE ALTER TABLE, CREATE
ASSERTION. CHECK UNIQUE . CREATE ASSERTION
,
. :
222
II.
http://openlib.org.ua/
CREATE ASSERTION
CHECK, . , , ASSERTION,
. ,
,
, :
CHEATS ASSERTION Staff NotHandlingTooMuch
CHECK (NOT EXISTS (SELECT staff No
FROM PropertyForRent
GROUP BY staffNo
HAVING COUNT(*} > 1 0 0 ) )
,
CREATE TABLE ALTER TABLE.
6.3.
SQL DDL (Data Definition Language)
, , , , .
, ,
, . ISO
, . . [45].
SQL.
CREATE
CREATE
CREATE
CREATE
SCHEMA
DOMAIN
TABLE
VIEW
ALTER DOMAIN
ALTER TABLE
DROP
DROP
DROP
DROP
SCHEMA
DOMAIN
TABLE
VIEW
, , .
, SQL:
CREATE INDEX
DROP INDEX
, , , .
6.3.1.
.
().
6. SQL:
223
http://openlib.org.ua/
,
.
ISO , ,
SQL .
ISO,
(environment). , (catalog),
(schema).
,
( ). ],!, , , , , .
, .
, .
():
:
, SqlTests Smith, :
CREATE SCHEMA SqlTests AUTHORIZATION Smith;
ISO , ,
. .
DROP SCHEMA, :
| SCHEMA Name' [ RESTRICT j "CASCADE")
RESTRICT ( ), , .
CASCADE, , ,
. , DROP SCHEMA .
DROP SCHEMA CASCADE
, .
CREATE SCHEMA DROP SCHEMA
.
II.
http://openlib.org.ua/
,
ALTER TABLE, .
PRIMARY KEY ,
. SQL, , . , , NOT NULL.
PRIMARY KEY. INSERT
UPDATE, () PRIMARY KEY. , .
FOREIGN KEY ()
() . .
UstOfForeignKeyColumns, , .
REFERENCES,
(.. , . SQL:
225
http://openlib.org.ua/
). UstOfCandidateKsyCalumns , , .
CREATE TABLE PRIMARY KEY.
(ON UPDATE)
(referentialAction)
, . referentiaJAcCion
CASCADE, SET NULL, SET DEFAULT NO ACTION. ON
UPDATE , ,
, NO ACTION (. 6.2).
(ON DELETE)
(referentialAction) , , .
referentzalAction
ON UPDATE.
,
NULL . MATCH
, NULL
. MATCH FULL,
(NULL), . MATCH PARTIAL, (NULL), ,
, NULL . , MATCH FULL.
FOREIGN KEY. CHECK CONSTRAINT
. CHECK
, .
SQL , ,
, SQL
(, 6.5). 6.1 CREATE TABLE.
II.
http://openlib.org.ua/
CREATE
CREATE
CREATE
CREATE
staffNo
PropertyForRent NULL, , ,
Staff
g t a f f N o PropertyForRent.
(ownerNo) ,
PrivateOwner. NO ACTION
PrivateOwner, PropertyForRent
ownerNo. 6. SQL:
227
http://openlib.org.ua/
CASCADE ,
ownerNo PropertyForRent .
branchNo. FOREIGN KEY HstOCandidateKeyColunms, ,
.
, s t a f f N o
NOT NULL , - ,
(, ).
( ownerNo
brancbNo, )
.
6.3.3.
( ALTER TABLE)
ISO ALTER TABLE . ALTER
TABLE , :
;
;
(5;
;
, ;
, ,
.
.
"ALTER TABLE 'TableName
. [ADD [COLUMN] columnNattie dataType [NOT NULL] . [UNIQUE].
' [DEFAULT defaultOptionJ [CHECK 4searchCondition)]]
[COLUMN] columnWame [RESTRICT | CASCADE]].,
[CONSTRAINT [ConstralntName] ] tableConstraintDefinitian]
tDROP CONSTRAINT ConstraintWame '[RESTRICT | CASCADE]]
[ALTER [COLUMN] SET DEFAULT defaulcpption]
[ALTER [COLUMN] DROP DEFAULT]
CREATE TABLE, , CaJbleConstraintDefinition
PRIMARY KKY, UNIQUE, FOREIGN KEY CHECK. ADD COLUMN CREATE
TABLE. DROP COLUMN , , , ,
DROP , .
228
II.
http://openlib.org.ua/
RESTRICT, DROP ,
(, ). .
CASCADE. DROP
, . ,
, , , -
, , ..
6. SQL:
229
http://openlib.org.ua/
, PropertyForRent
:
DROP TABLE PropertyForRent;
, , .
, , DELETE (. 5.3.10). DROP TABLE
, .
RESTRICT. DROP ,
, ,
.
CASCADE. DROP ,
( , ).
DROP TABLE
CASCADE ,
.
DROP TABLE ,
. ,
DROP TABLE , .
L, - 1 )
. , .
UNIQUE, 230
II.
http://openlib.org.ua/
.
, , ,
(, ).
,
,
. , ( ) . .
Staff PropertyForRent ,
, :
CREATE UNIQUE INDEX ScaffNoInd ON S t a f f ( s t a f f N o ) ;
CREATE UNIQUE INDEX PropertyNoInd ON PropertyForRent
(propertyNo);
(ASC) (DESC),
. , PropertyForRent
:
CREATE INDEX Rentlnd ON PropertyForRent (city, rent) , Rentlnd, PropertyForRent.
city,
rent.
,
.
DROP INDEX Rentlnd;
6.4.
, 3.4.
. , *
, . - :
, ,
.
,
.
6. SQL:
231
http://openlib.org.ua/
.
, . . , ,
. , , , ,
. , (
SQL, ),
6.4.3. ,
, ,
, . 6.4.8.
, .
...])].
II.
http://openlib.org.ua/
6.3.
, ' '
, .
, .
CREATE VIEW Manager3Staff
AS SELECT *
FROM Staff
WHERE branchNo = '';
Manager3Staff, S t a f f ,
, ' ' . ( ,
branchNo
, ' '.) SQL, , . 6.3.
SELECT * FROM Manager3Staff;
6.3. , ManagerSStaff
staffNo
fName
SG37
INatne
position
sex
DOB
salary
branchNo
10-Nov-60
12000.00
8003
24-Mar-Sa
18000.00
3-Jun-40
24000,00
Beech
Assistant
SG14
David
Ford
Supervisor
SG5
Susan
Brand
Manager
,
Staff, , ,
ManagerSStaff. -
s t a f f ,
, . 6.6.
6.4.
,
' ', ,
,
.
, .
CREATE VIEW Staff3
AS SELECT staffNo, fName, IName, position, sex
6. SQL:
233
http://openlib.org.ua/
FROM S t a f f
WHERE branchNo = ' B O Q 3 ' ;
, ,
Staff ManagerSStaff:
CREATE VIEW S t a f f s
AS SELECT s t a f f N o , fName,
FROM Manager3Staff;
iNa'ne,
position,
sex
Staffs,
S t a f f , salary, DOB branchNo. , , , 6.4.
6.4. , Staff.3
position
sex
Beech
Assistant
Ford
Supervisor
Brand
Manager
staffNo
fName
(Name
SG37
Ann
SG14
David
SG5
Susan
,
, 1
'
S t a f f s , St.if f ManagersStaff.
, , , . ,
,
, , .
I 6.5. ,
, ,
. ,
, (. 5.27).
CREATE VIEW StaffPropCnt (branchNo, s t a f f N o ,
AS SELECT s.branchNo, s . s t a f f N o , COUNT{*)
FROM S t a f f s, PropertyForRent p
WHERE s . s t a f f N o = p . s t a f f N o
GROUP BY s.branchNo, s , s t a f f N o ;
cnt)
, . 6.5. , GROUP BY (
) (
).
234
II.
http://openlib.org.ua/
.
. ,
,
COUNT.
6.5. , StaffPropCnt
branchNo
staffNo
cnt
SG14
SG37
005
SL41
007
SA9
6.4.3.
, , , . SQL ,
, ' ' .
StaffPropCnt, 6.5:
SELECT staffWo, cnt
FROM StaffPropCnt
WHERE branchNo = ''
ORDER BY staffNo;
6. SQL:
235
http://openlib.org.ua/
Staff PropCnt .
1. , SELECT , .
SELECT :
SELECT s . s t a f f N o AS staf::No, COUNT{*) AS cnt
2. , FROM ,
FROM :
FROM Staff s, PropertyForrRent p
3. WHERE WHERE AND:
WHERE s . s t a f f N o = p . s t a f f N o AND branchNo = ' B 0 0 3 1
4. GROUP BY HAVING
.
GROUP BY:
GROUP BY s . s t a f f N o , s.branchNo
5. ORDER BY
,
:
ORDER BY s.staffNo
6
:
SELECT s . s t a f f N o AS s t a J i f N o ,
COUNT ( * ) AS cnt
FROM S t a f f s, PropertyForRerit p
WHERE s . s t a f f N o = p.sta.':fNo AND branchNo = ' B 0 0 3 1
GROUP BY s . s t a f f N o , s.branchNo
ORDER BY S . s t a f f N o ;
. 6.6.
6.6. ,
staffNo
cnt
SG14
5G37
6.4.4.
ISO ,
SQL .
236
II.
http://openlib.org.ua/
, SELECT ORDER
BY , . , WHERE,
, . , StaffPropCnt, 6.5. cnt COUNT.
.
SELECT COUNT()
FROM StaffPropCnt;
, cnt ,
. ,
:
SELECT *
FROM S t a f f P r o p C n t
WHERE cnt > 2;
, WHERE cnt , .
'' . , StaffPropCnt ,
.
6.4.5.
, , , . , ,
, ()
, . .
StaffPropCnt, 6.5. , ,
INSERT ,
, SG5
:
INSERT INTO StaffPropCnt
VALUES (' 1 , 'SG5', 2) ;
PropertyForRent , ,
' SG5 ' .
, , .
PropertyForRent, .
6. SQL:
237
http://openlib.org.ua/
:
CREATE VIEW StaffPropLiat (branchNo, staffNo, propertyNo)
AS SELECT s.branchNo, s . s t a f f N o , p.propertyNo
FROM Staff s, PropertyForRent p
WHERE s . s t a f f N o = p. s t a f f No,-
:
INSERT INTO StaffPropList
VALUES { ' B 0 0 3 ' , ' S G 5 ' , ' P G 1 9 ' ) ;
, PropertyForRent ,
( postcode staffNo)
NULL (. 6.1). StaffPropList PropertyForRent, , .
ISO , , . ISO
, :
DISTINCT, .. ;
SELECT
{ , ),
;
FROM , ..
, .
,
.
, , (UNION), (INTERSECT) (EXCEPT) ;
WHERE -
SELECT, , FROM;
GROUP BY HAVING.
, , ,
,
. ,
,
, NULL.
NOT NULL,
. , , .
. S ,
- .
238
II.
http://openlib.org.ua/
239
http://openlib.org.ua/
Manager3Staf f :
UPDATE Managers Staff
SET salary = 9500
WHERE staffNo = 'SG371;
. ,
HighSalary, LowSalary,
HighSalary.
8 000 , ,
LowSalary. HighSalary WITH CASCADED CHECK OPTION,
( 9 500, 8 000 )
,
HighSalary. ,
,
, H;J
WITH CASCADED CHECK OPTION.
6.4.7.
, , .
SQL .
, , SQL. . 6.7.
240
II.
http://openlib.org.ua/
6.7. SQL
.
. .
,
, (, ,
, , ).
,
, .
,
, . , , , .
. , Client :
Client (clientNo, fName, IName, address, telNo, prefType, maxRent)
,
, ClientDetails ClientReqts:
ClientDetails (clientNo, fName, IName, telNo)
ClientReqts (clientNo, prefType, maxRent)
-
,
Client, ClientDetails
ClientReqts, clientNo:
CREATE VIEW Client
AS SELECT cd.clientNo, fName, IName, telNo, prefType, maxRent
FROM ClientDetails cd, ClientReqts cr
WHERE cd.clientNo = cr.clientNo;
\
6. SQL:
241
http://openlib.org.ua/
, , .
,
, .
.
, .
.
, ,
. ; , .
,
. .
CREATE VIEW ' WITH CHECK
OPTION, . , , WHERE ..
.
, SQL .
6.4.5 , , .
. SELECT * PROM..., *
, .
, ,
.
242
II.
http://openlib.org.ua/
. , . , , , ,
, .
.
, .
6.4.8.
, ,
6.4.3. .
, . , .
, , ,
. , .
, , , . .
.
.
,
, . , , :
CR3ATE VIEW StaffPropRent ( s t a f f N o )
AS
SELECT DISTINCT S t a f f N o
FROM PropertyForRent
WHERE branchNo = ' B 0 0 3 ' AND rent > 4 0 0 ;
,
, . 6.8. PropertyForRent
, rent ^ 400, . PropertyForRent
( ' P G 2 4 ' , . . . , 550, ' 0 4 0 ' , ' S G 1 9 1 , ' '),
. ,
( ' P G 5 4 ' , . . . , 4 5 0 ,
'039', 'SG37',
' ' )
6. SQL:
243
http://openlib.org.ua/
PropertyForRent , SG37. ,
, , PropertyForRent,
6.8. Staff PropRent
staffNo
SG37
SG14
PropertyForRent 1
( ' P G 2 4 , . . . , 550, ' 0 4 0 ' , 'SG19', ' ' ) ,
.
PropertyForRent
( ' PG5 4 ' , . . . , 450, ' 08 9 ' , ' i!G3 7 ' , ' 3 ' ) , , SG37, , , PG21.
, , PropertyForRent.
[146].
6.5.
II.
http://openlib.org.ua/
SQL (. 21)
, COMMIT
.
SQL
,
.
SQL (.
19.4). SET TRANSACTION
.
:
.SET' TRANSACTION
:
." [READ ONLY \ READ WRITS} |'
[ISOLATION LEVEL READ UNCOMMITTED
REPEATABLE READ SERIALIZABLE3 :
READ COMMITTED
HEAD
UNCOMMITTED
READ COMMITTED
REPEATABLE READ
SERIALISABLE
SERIALIZABLE,
. , , . , 19.
.
6. SQL:
245
http://openlib.org.ua/
6.5.1.
SQL, .
INITIALLY IMMEDIATE INITIALLY DEFERRED.
, ,
[NO"] DEFERRABLE.
INITIALLY IMMEDIATE.
SET CONSTRAINTS
.
:
;''SET .CONSTRAINTS
, {ALL i constraintName [, ... ]}.{DEFERRED V]'IMMEDIATE}
6.6.
2.4 , , ,
, . SQL
GRANT REVOKE,
. , ,
SQL, . , (),
, , . SQL
- .
,
.
SQL .
AUTHORIZATION , (. 6.3.1),
.
,
.
ISO :
246
II.
http://openlib.org.ua/
SELECT ;
INSERT ;
UPDATE ;
DELETE ;
REFERENCES ;
USAGE , , . , . , [45].
INSERT UPDATE ;
, .
, REFERENCES
, (,
CHECK FOREIGN KEY), , .
CREATE TABLE ,
.
- . , , GRANT.
CREATE
VIEW, , .
SELECT
REFERENCES
, .
INSERT, UPDATE DELETE
, .
6.6.1.
( GRANT)
GRANT
.
. GRANT :
?
GRANT
VON
: TO
{AuthorizationldList \ PUBLIC}
"[WITH GRANT OPTION]
PrivilegeList ,
, :
SELECT
DELETE
6. SQL;
247
http://openlib.org.ua/
INSERT [(columntfame [, . . . ] ) ]
UPDATE [(columnWame [, . . . ] ) ]
REFERENCES [(columntfame [, ...
USAGE
])]
, GRANT
ALL PRIVILEGES,
. PUBLIC, ^
,
, .
ObjectName ,
, , , .
WITH GRANT OPTION AuthorizationldList
.
WITH GRANT OPTION, , ,
.
,
. , ,
.
I 6.7.
Manager
staff.
GRANT ALL PRIVILEGES
ON Staff
TO Manager WITH GRANT OPTION;
Manager
S t a f f , ,
. , Manager
Staff , . WITH GRANT OPTION,
Manager
.
6.8.
Personnel Director SELECTn UPDATE
salary- staff.
GRANT SELECT, UPDATE (salary)
ON S t a f f
TO Personnel, Director;
WITH GRANT OPTION
, Personnel Director
.
248
II.
http://openlib.org.ua/
6.9.
PUBLIC
Branch.
GRANT SELECT
ON Branch
TO PUBLIC;
PUBLIC ,
( , ,
) ,
Branch. , WITH GRANT OPTION, .
6.6.2.
( REVOKE)
SQL GRANT REVOKE. ,
. REVOKE :
^REVOKE {GRANT OPTION FOR] {PrivilegeList \ ALL PRIVILEGES}''
; ON
ObjectWame
"PROM . . {AuthorizationldList \,PUBLIC} [RESTRICT |. \CASCADE] =
i'V - ' . ' - -
'
"
" -
-:
ALL PRIVILEGES ,
, , . GRANT OPTION FOR
, GRANT WITH GRANT OPTION,
.
RESTRICT CASCADE ,
DROP TABLE, 6.3.3.
, ,
( , , ). REVOKE ,
(, ), CASCADE. CASCADE, (,
, ),
REVOKE, DROP.
,
, REVOKE. , , . , . 6.1 ,
INSERT S t a f f ,
6. SQL:
249
http://openlib.org.ua/
GRANT INSERT
ON Staff
WITH GRANT OPTION
. 6.1. REVOKE
6.10. ,
SELECT,
Branch.
REVOKE SELECT
ON Branch
FROM PUBLIC;
6.11. ,
,
Director staff.
REVOKE ALL PRIVILEGES
ON Staff
FROM Director;
250
II.
http://openlib.org.ua/
REVOKE
SELECT ..., Director
.
ISO :
, , , / , .
SQL DDL . CREATE DROP SCHEMA . CREATE, ALTER DROP TABLE , . CREATE DROP INDEX
.
ISO SQL CREATE
TABLE ALTER TABLE , , ; ;
; (-) .
NOT
NULL. CHECK,
CREATE DOMAIN. PRIMARY KEY,
NOT NULL UNIQUE.
FOREIGN KEY,
ON UPDATE ON
DELETE. - CHECK UNIQUE. , ,
CREATE ASSERTION.
,
/ , / , . CREATE VIEW .
,
.
. , / .
.
, ; ().
. ,
, , -
. SQL:
251
http://openlib.org.ua/
. , .. , .
.
COMMIT , . ROLLBACK ,
,
.
SQL
, .
() . SQL . ,
G^ANT.
REVOKE.
USAGE, SELECT, DELETE, INSERT, UPDATE
REFERENCES,
. , WITH GRANT OPTION. GRANT OPTION FOR REVOKE.
(
6.1.
6.2.
6.3.
6.4.
6.5.
6.6.
.
, .
.
, ?
?
, SQL.
,
, 3.
6.7.
Hotel
SQL.
6.8.
Room, Booking Guest SQL :
) Single, Double
Family;
252
II.
http://openlib.org.ua/
6.9.
6.10.
6.11.
6.12.
6.13.
6.14.
) 10 100
;
) roomNo 1 100;
) dateFrom dateTo
;
) ;
) .
,
Booking, .
INSERT Book:, 3 , ,
1 2000 . Booking,
, , .
, Grosuenor.
Manager Director
,
.
Accounts SELECT.
.
, Hotel:
CREATE VIEW HotelBookingCount (hotelNo, bookingCount)
AS SELECT h.hotelNo, COUNTf*)
FROM Hotel h., Room r, Booking b
WHERE h.hotelNo = r.hotelNo AND r.roomNo = b.roomNo
GROUP BY h.hotelNo;
, , ,
.
a)SELECT *
FROM Hot e1Book ingCount;
) SELECT hotelNo
FROM HotelBookingCount
WHERE hotelNo = 'H001';
) SELECT WIN(bookingCount}
FROM HotelBookingCount;
r) SELECT COUNT(*)
FROM HotelBookingCount;
)SELECT hotelNo
FROM HotelBookingCount
WHERE bookingCount > 1000;
e) SELECT hotelNo
FROM HotelBookingCount
ORDER BY bookingCount;
6. SQL:
253
http://openlib.org.ua/
6.15.
:
Part
(partHo,
contract
partCost)
Part,
(
).
ExpensiveParts, ,
1000 :
CREATE VIEW ExpensiveParts
AS SELECT DISTINCT partNo
FROM Part
WHERE parCCost > 1000;
(partNo)
, Part.
6.16. , :
Supplier
(supplierNo,
partNo,
price)
, SupplierParts, , , , ;
CREATE VIEW SupplierParts (partNo}
AS SELECT DISTINCT partNo
FROM Supplier s. P a r t p
WHERE s . p a r t N o = p . p a r t N o ;
6.17.
6.18.
6.19.
6.20.
254
,
Part Supplier.
SQL , . ,
DDL ISO. , . ?
DreamHome,
3.2.6, ,
. 3.3-3.9.
, , SQL, 5.
Hotel,
3, ,
SQL, 5.7-5.28.
II.
http://openlib.org.ua/
...
(Query-by-Example QBE).
, QBE Microsoft Access.
QBE .
QBE .
QBE.
QBE,
, , ,
,
.
QBE
.
QBE
(Query-by-Example )
Microsoft Access 2000. QBE
, [331]. QBE
, , , .
QBE IBM 1970-
, .
,
, Microsoft Access. QBE Microsoft Access
. QBE
,
, ,
.
, . ,
QBE , , ,
http://openlib.org.ua/
.
.
3.3-3.9
DreamHome, 10.4 .
Microsoft Access QBE
SQL,
, SQL , . , SQL,
5 6. QBE, , SQL
Microsoft Access. SQL , 5 6.
QBE
Microsoft Access, Microsoft Access 2000
8. , 16 17
,
Microsoft Access.
.:.:.
,,,
. .
. . .
1119^19^^0*1
7.1.
Microsoft Access
Microsoft Access
(, , )
Database ( ). DreamHome
, , . 7.1.
, , .
, .
, , . Microsoft Access (dynaset).
, , . , . , , , .
256
II.
http://openlib.org.ua/
, *: ^ ; ^ J <
0]
, |jfp
(3
=; '
Branch
Client
PrivateOwner
PropertyForRent
Registration
Staff
Viewing
;
sjjj
.:
7. QBE
257
http://openlib.org.ua/
. 7.1
(
, ,
)
. ,
,
SQL (
,
,
,
)
.
SQL, , ,
' (. 5 6),
.
, SQL,
SQL Server Microsoft Sybase
Microsoft Access
New Query ( ), . 7.2.
( Design View
()),
Access, .
. ,
.
.
KOHCTDVKTOC
_ -
II.
http://openlib.org.ua/
.
. 7.2, ,
,
, . ,
,
(, ) .
7.2. QBE
.
, ( ). , . ,
, ,
.
, ,
, . 7.2.
Design View ,
- . , .
Select
Query ( ) , ,
Dream-Home.
/ , .
Select Query QBE.
.
,
. ,
, QBE.
QBE Microsoft Access
SQL. SQL SQL.
SQL , QBE
. ,
SQL, Microsoft Access,
SQL, 5 6.
7.2.1.
, , . , PropertyForRent (propertyNo),
(city), (type) (rent) QBE
?.
259
http://openlib.org.ua/
, . 7.3, . ,
PropertyForRent (. 7.3, ). SQL . 7.3, .
, . 7.3, Select Query
( ) (
PropertyForRent), QBE.
QBE,
() , .
, , , 7.3, ,
, , , .. ,
)
PropertyForRent
' *? ;
I |gl 1 :
prcpertyNo ___
street
city
:ostcode
]
QBE
<U
: propertyNo
: Prcp*rtyFoiRent
:
:
*:
:
:
:
city
ProoertvForRent
;
E
type
PiocertyForRenL
rent
Proper tyForfler*
._
rU
rl.1
';
,,
[ 1 ! :
propertyNo
city
type
renl
'^~>
_PA14
Aberdeen
House
6501
PL94
I PG4
London
Glasgow
Flat
Flat
400
350J
PG36
Gla sgow
PG21
PG16
Gla sgow
Gla sgow
Flat
House
375
600!
III
&: "
' 'I
Flat
d.nMj " -
450
;
;;
;"
260
II.
http://openlib.org.ua/
, city 'Glasgow 1 .
QBE Criteria city. ,
.
Criteria, Access , AND () OR
().
QBE, Access AND. , , . QBE, Microsoft Access OR.
, .
,
, 350
450 , 'Glasgow'
Criteria ( ) city 'Between 350 And
4 5 0 ' Criteria rent. QBE . 7.4, .
, , , . 7.4, . SQL
. 7.4, ,
, , , ,
. 'Aberdeen'
or ' Glasgow' city. QBE
. 7.5, .
, , (. 7.5, ). SQL
. 7.5, . , , city 'Glasgow' ( And) rent 350 450 , ( Or) ,
city 'Aberdeen 1 ( rent).
, ,
LIKE.
. , ,
, ,
.
LIKE
Criteria city 'LIKE Glasgo 1 . 'Glasg*', . (*) . ,
, 'Glasg??'. (?) .
?.
261
http://openlib.org.ua/
7.2.2.
. , ,
.
,
; , QBE.
,
, , , ,
. 7.6, . ( :
PrivateOwner PropertyForRent) QBE.
propwtyTJo
street
'*
postcode
*:
: FropartyFcrRefit
:
;
:
:
QBE
ProoertvfprRent
ProPertvFoiRent
"Glasgow"
,
And
And
. 7.4. : ) QBE , - ,
350 450 ; )
; ) SQL
262
II.
http://openlib.org.ua/
IBS? 3.j(i[nwt
a-irijitji: , i
H !] 3 1 1^
KM
sropettyNo j;
street
postcode
QBE
'
*]
. .rtwie: orocertvUo
: PropertyforRent
:
I ;
0
i:
:
uty
'rooeiCvForRent
tvoe
PropertyFotflent
rent
ProMrtyForfler*
_a
"Glasgow"
"Abwdeenf-'s-
,
Or
,
And
^
^
:j,ni|i 1C
properiyNo
_ pA14
; Pb4
i PG36
_i.
PG1
-^
(
'
ly
Ctty : ='
Aberdeen
House
Glasgow
Glasgow
Glasgow
Flat
Flat
Flat
5 1*15
660
350
375
450
. 7.5. : ) QBE
, 350 450 , , ; ) ;
) SQL
PrivateOwner fName INarae, PropertyForRent property-No city.
, ,
, . 7.6, 6. SQL . 7.6, .
(. 7.6),
() .
4.1.3 5.3.7.
?.
263
http://openlib.org.ua/
,
1:
PropertyForRent
PrivateQwner
Li? -.>[:1 ;
- ,
1 fName
Name
, address
telNo
LIJ
QBE grid
, 1 postcode
-I* type
\
rooms
HwEj^^^B
-1
:
,*J
~l
rent
&
ownerNc '
staffwo
\
F
; i 1
: ' TivateOwrier
;
;
:
.
- IName
PrlvateOwrief
D'opertyl^o
3
rooertvFwRfnt
dtv
PrjoertyForRenC
PropertyForRent
PrivateOwner
i.
| 1 :
fName
Joe
Carol
Tna
Tony
Carol
Tony
INarre
Keogh
Panel
Murphy
Shaw
Parrel
Shaw
.. : JiijJl"
''
properlyNo
! 14
F L94
;F G36
F G21
i G16
7 j.J.hjbj-Jto 7
'
t fl^^^v^^^^^^H
- city
Aberdeen
London
.Glasgow
Glasgow
Glasaow
^
jj
SELECT PrivateOwn erf Name, PrivateOwner.lName, Property ForRent. pro pertyN , Prop ertyForRent. city
FROM PrivateOwner INNER JOIN PropertyForRent ON PrivateOwner.ownerNo =
Property ForRent. ownerNo;
. 7.6. : ) QBE ,
,
; ) ; ) SQL
, , , .. Microsoft Access ,
. , . 7.6, Access 1, " ". -
264
http://openlib.org.ua/
, .
, , .
Access - ,
. , , QBE.
, . , . 7.6, ownerNo
( ) PrivateOwner
PropertyForRent. ,
.
Microsoft Access ,
.
QBE.
7.2.3.
. , ? ? ?
( ). Microsoft Access , (Sum),
(Avg), (Min) () , (Count). ,
Totals (), QBE Total ( ).
, , .
,
. , ,
,
. city,
Group By,
Count. QBE
. 7.7, ; . 7.7, ; SQL . 7.7, .
. , , ,
PropertyForRent,
(propertyNo), (city) (type).
(12).
QBE ' Yearly rent:
?.
265
http://openlib.org.ua/
7.3. QBE
Microsoft Access .
, :
;
;
;
, .
)
') :
;;:
prcpert>*to
street
tty
Bostcode
jj
QBE
PropiftyForRent
city,
,
propertyMo
PropertvFgrRent
propertyNo.
,
tjj5 1 : H.I (*
HHE3I
Count-prgpertyNo
Glasgow
4|
Londcn
: llljj'l
I _tMk! 3
. 7.7. : ) QBE ,
, ; ) ; ) SQL
266
II.
http://openlib.org.ua/
a)
^!
= '
Yearly Rent
; proportytto
sweet
:
f; city
, - >_ postcode
TI
Lu
2
. : ofODWtvNo
: propertvForfient
!
w :
:.;
otv
ProoertyforRent
tvoe
ProoectyForRent
'
propertyNo,
city type
Yearly Rent
IV,
14
PG16
PG21
PG36
PG4
PL94
Aberdeen
.Glasgow
Glasgow
Glasgow
Glasgow
London
House
Flat
House
Flal
Flat
Flal
: _
7800
5400
7200
4500 j
4200
4800
, 7.8. : ) QBE ,
; ) ; ) SQL
7.3.1.
,
().
Criteria (
) , .
,
. , , , . 7.6, , ,
. QBE . 7.9, .
, 7.
http://openlib.org.ua/
owneitto
FName
Name
" J
address
jj
LJ
HlliiEil
. - '
=1
prcpertyNo
street
city
postcode
_^J
LZ__I
Done: :Name
Name
orocertyNo
: PrivateQwnet
PrivateOwner
PrceertyForRent
:
:
0
: ^Enter Owner's Frst Dams] [Enter Owner's Last name]
;
city
Proper tyForRent
:
f Name
IName
(d)
. 7.9. : ) QBE ;
) ; ) , ; ) SQL
268
II.
http://openlib.org.ua/
7.3.2.
.
.
. CrossTab Query
Wizard ( )
QBE. , , , ,
.
, ,
, ,
. PropertyForRent .
, . 7.10, . ,
. 7.10, ; SQL . 7.10, .
.
Crosstab (),
QBE Crosstab ( ).
,
.
. 7.11, .
(. 7.11, ]. . SQL . 7.11, . ,
TRANSFORM SQL Microsoft Access SQL.
7.3.3.
Find Duplicates ( )
, ,
. ,
,
.
?.
269
http://openlib.org.ua/
I? 3iiipoc1 : *
,
-y
\
I .
L_
_^j
pjQ
Name
Warn*
position
;>:|
property) ^J
street
|
y
postcode
type
H
'r
_j
liLJ
'(Tow
CQOfHpOBKf
;.-.;
FName
Staff
IName
Staff
type
PropwtvForRerit
LI 1
-5
Ann
Ann
propertyNo,
,
type
Bungalow
Cottage
Flal
Bee:h
Mid-Terrace
Ann
Beech
Semi-Detached
David
Ford
David
David
David
Ford
Ford
Forrj
Bungalow
Cottage
Flat
Semi-Detached
Mary
Howe
Bungalow
Mary
Howe
Cottage
Mary
Mary
Howe
Howe
Flat
Mid-Terrace
Mary
Howe
Serni-Delached
>J >Ut*l ro 14
j^^^^^^^^^^^^H
Count-prQpertyNo ]
Ann
; .1 ill
Beech
Seech
:
Bee:h
1 11)1 'i>iiii>ui,l :
fName
- IName
prooertyNo
FrooettyForRent
Count
43
4
45
26
33
7
2
14
42
45
4
31
2
7
'"
. 7.10. : ) QBE, ; ) ; )
SQL
270
II.
http://openlib.org.ua/
"
1 IS* 1
. |*^~'
stafffta
fNetne
Warne
position
,
prapertvfto -^J
\nreat
rty
-J
'
postcode
..*j
type
^J
propertyNo
;
1LJ
.
. .
'
IName
Staff
Name
Staff
fName IName
tyoe
PropertyFotRent
:=
Drccei (yNo
ProcertyFotRent
Count
type
city, , . , -
'Carol Parrel 1 ,
. , .
, Find Duplicates Query Wizard
( ), , . 7.2. ( fName IName). ,
, . ,
QBE , . 7.12, . , 'Carol Parrel 1 ,
. 7.12, ff, SQL . 7.12, .
?.
271
http://openlib.org.ua/
, SQL ,
SQL SELECT, Criteria ( )
fName QBE . 7.12, .
7.3.4. ,
_|
ovmeftio
(Name
IName
address
teWo
*j
j
3
LLJ
:
(*| ;
:
1 :
fName
PriveteO iner
;;
IName
PrivateOviner
<
ounerNo
PrivateOwner
adCreii
PrivateOwner
telNo
Prival.eOwner
In (SELECT [fName] FR
,. 1
fName IName
||3 ! :
ft'Jame
Parrel
Carol
Farrel
*
: ..1
IName
^
ownerNc
address
097
C087
I
telNoI
1 >..].H.| _*Jn=2 - .,
,.. .- -
. 7.12. : ) QBE ;
) ; ) SQL
272
II. .
http://openlib.org.ua/
. 7.13, . ,
Client , Viewing
. 'Mike Ritchie '.
, Show box clientNo QBE
, . SQL . 7.13, .
, , , 4.1.3 5.3.7.
7.3.5.
.
, , Microsoft Access , . , , a) [i|ij? ! :
gSi;;,,,
- |'^!
- * clentNo
DropertyNo
viewDate
_^j
comment
: clientNo
. : Client
:
:
:
,,"->
,^, -
fMame
Client
3
IName
Client
El
"
3^fj
.
tdNo
Client
^j
clientNo
Viewina
ElNul
clientNo, fName, IName telNo
6)
! :
client No
fName
IName
Ritchie
jJcR74(_
Mike
: 1 ' i *
i .>..1
Client,
foi* !,:
tetNo
Viewing
1
01 475-3921 78
. 7.13. : ) QBE ,
; ) ; )
SQL
?.
273
http://openlib.org.ua/
( staf fNo),
PropertyForRent Staff,
.
, .
QBE
, " ",
, . , . , ,
PropertyForRent Staff, staffNo ( )
PropertyForRent. QBE
. 7.14, . . 7.14, , , , .
,
(, ' SA9). , Microsoft
Access Staff ,
Mary Howe. SQL
. 7.14, .
7.4.
Microsoft Access , Query ( ) . .
, ,
, , .
, , . .
: , , .
7.4.1.
.
. ,
,
. . , , ,
, .
274
II.
http://openlib.org.ua/
]
type
gOM
staff No ( )
PropertyForRent
turn
rent
owner Ivo
staff Mo
.:' 'I.,
JJ
ProBHtyForRsnt
:
t-a !
> :
' :
street
(Tojertvfnrftent
PTOIMrtvFC'RWlt
slaffNa
SrcDertvFarRHV
ctY
Staff
^~
.1
'-
PropertyForRent,
6)
"Wffl
'Man*
Staff
1 1 :
proper! 'No
| PA14
I PL94
PG36
PG21
PG16
./ PG97
street
16 Halhead
Argyll St
2 Manor Rd
18 Dale Rd
5 Novar Dr
Muir Drive
Staff,
city
Aberdeen
London
Glasgow
Glasgow
Glasgow
Aberdeen
staffNo
SA9
SL41
SG37
SG37
SGH
5H3
^ Six
fNa me
Mary
Julie
Ann
Ann
David
Mary
IName
Howe
Lee
Beech
Beech
Ford
Howe
1 L
staffNo
fName IName ,
'SA91
'SA9'
staffNo
. 7.14. : ) QBE ;
) ; ) SQL
, S t a f f C u t ,
staffNo, fName, IName, position salary, Staff. , s t a f f . Design View Make Table (
...), ,
. 7.15, . . . 7.15, QBE .
, .
. 7.15, . , StaffCut, , 7.15, . SQL . 7.15, .
?.
275
http://openlib.org.ua/
f fiase
31
1 :
Name
position
00
sabry
^J
'
jj
ULJ
: staff
^' 5WFF
:
'
:
3Biin:
:
/
:
;
:
No
IName
Staff
Staf-
0
0
1^1
jx^tipn
Staff
1-1
salary
Staff
L_
___
(3
;T
) ) " : 6.
'__ S
""
- .
..
SG37
StaffCut
1^^^^
^^|
slaflNo
INama
SL21
ZSAS
sG5
VJ
John
Arm
David
tName-
White
Baech
Ford
posttiorv
salary
Manager
30000
12000
16000
9000
240
9000
Mary
Howe
Assistant
Supervisor
AssislariT
Susan
Julie
Brand
Ue
Manager
Assistant
, Staff
SELECT Staff .statINo, Staff .fName, Staff.IName, Staff, posit ion, Staff .salary INTO StaffCut
FROM Staff;
276
II.
http://openlib.org.ua/
7.4.2.
. ; ,
" "; ,
" ", , .
, , , , .
PropertyForRent. Design View
Delete (). QBE . 7.16, . PropertyForRent Viewing
" ", Cascade Delete Related records, Viewing, ,
. ,
.
. 7.16, . , PropertyForRent, ,
Viewing,
. 7.16, . SQL . 7.16, .
7.4.3.
. , ,
10%. ProperyForRent. Design View
Update (). Update To ()
rent ' [rent]*!.!',
. 7.17, . (. 7.17, ), .
, rent PropertyForRent
(. 7,17, ). SQL . 7.17, .
7.4.4.
. ,
.
( ) ,
. , ,
PrivateOwner
7. QBE
277
http://openlib.org.ua/
, . ,
NewOwner, ownerNo, fName, IName address. , PrivateOwner ,
. PrivateOwner , NewOwner .
,
, NewOwner.
Append (),
(. 7.18, ),
.
QBE
. 7.18, . (. 7.18, ).
.
, PrivateOwner
, NewOwner (. 7.18, ).
SQL . 7.18, .
7.1.
7.2.
278
DreamHome,
. 3.3-3.9,
, QBE,
, .
QBE
DreamHome,
QBE, , :
)
;
) , , '03 ';
) ,
;
)
25 ;
) , , , ;
) ;
) , , .
http://openlib.org.ua/
1|:1 :
propertyNo
street
city
postcode
^j
QBE
: ProoertyForRent.*
tfm> : PropertyFcrfient
:
:
;
.11..
-"
dty
PrODertyFotRent
"Glasgow"
---'
; ; _.
! Miciosolt Access
! ; 4.
'' mnei lei am .
.
;.'' ')''',
,-
HW I
>
|
1
properlyNo
* PG37
* PL94
: Jijjjj
street
16 Holhead
Muir Drive
Argyll St
city
Aberdeen
Aberdeen
London
postcode
AB75SU
HW2
; ;
> JHJn
^jj
PropertyForRent,
(
)
,
Viewing :
chentNo
B?ag
CR62
propertyNo
vipwOale
PA14
24-May-01
PA14
14-May-01
IF? ( 531
:
commsnl j
too small
no dining room
Viewing,
ri
(
(c
. 7.16. : ) QBE ;
) ; ) PropertyForRent
Viewing ; ) SQL
?.
279
http://openlib.org.ua/
If J 1 sanooc Ri*!E3l|
postcode
Zj
property!*
street
^1
.1LJ
QBE
: rent
: ProoertvForRent
:
1
iMicmsnft Access
^
I
H ^
,
rent
10%
HHtxl
: 6.
i\ \ "" * .
- ' ,
r:::.At:..,_ii
'
HST
yp :1 :
properlyNo
\ 1
PG16
PG21
PG36
PG4
PL94
: J* | ill
street
16Holiead
5 Novar Dr
18 Dale Rd
2 MamrRd
6 Lawience St
6 Argyll St
city
rent
715
495
EGO
412
365
440
Aberdeen
Glasgow
Glasgow
Glasgow
Glasgow
London
I JULtli^],
.-1*
. -:. .-
rent,
10%
280
II.
http://openlib.org.ua/
j
:, [^^
WO
'. I .V
-lU
: -
>
QBE
(] NewQwner
.
: 2 "" on
^ *
0121
0123
0125
121
Anne
Dave
Annel
Andrew
Arme
Tina
C046
C087
Jce
C037
Carol
Carol
'
..
Barnelscr
MacGregoi
Sinclair
Nollirigham
.Barnatson
MacGreg
.Murphy
Keogh
Parrel
Shaw
Parrel
I
.
,
PrivateOwner
7. QBE
281
http://openlib.org.ua/
7.3.
7.4.
QBE
DreamHome, QBE, ,
:
) , ,
;
) ,
, ; ;
) PropertyForRent, , 'Carol Parrel' '
Shaw' .
, , . ,
,
;
) Staff: , 1
'David Ford .
;
) , , ,
;
) ,
PropertyForRent
,
.
DreamHome,
QBE,
, :
) PropertyForRent PropertyGlasgow, propertyNo,
street, postcode type
, ;
) Viewing
Comment;
7.5.
282
) 12,5% , ;
) NewClient,
; Client.
DreamHome, QBE SQL,
5.
II.
http://openlib.org.ua/
:
ACCESS ORACLE
...
Microsoft Access:
;
;
;
;
().
Oracle:
;
;
;
PL/SQL;
;
.
3,
.
15-20
( 50 ),
25%. .
.
, .
: Microsoft Access Oracle. (
, 3).
http://openlib.org.ua/
(Graphical
User Interface GUI); , Microsoft Access
VBA (Microsoft Visual Basic for Applications). ,
Access , (Wizards),
, - .
Access (Builders),
, SQL. Access SQL, 5 6,
Microsoft ODBC (Open Database Connectivity
), SQL, Oracle Informix.
ODBC 21.3. Microsoft Access , .
8.1.1.
Microsoft Access , .
, . Microsoft ( )
( }.
,
. ,
. .
,
.
.
( ) Web, (
Microsoft Access Microsoft SQL Server)
Internet ( ).
,
Microsoft Excel.
, , . , .
VBA,
.
, Microsoft Access.
II.
http://openlib.org.ua/
Microsoft Access .
/. Access
, . Access.
/. Access ,
ODBC , SQL
Server. Access 2000 . adp
(Access Project File), , ,
VBA
SQL Server, OLE DB
, , 8. : Access Oracle
285
http://openlib.org.ua/
. , MSDE.
.
Access . .
,
(replica) , (Design Master). (replica set).
. ,
. 23.6.
Web. (
) ,
Access SQL Server. Internet Explorer 5 . 28.10.5.
,
.
Jet . Idb ( locking
database file ),
, . , . 19.2.
8.1.3.
Microsoft Access () .
Database Wizard ( ) , ,
. Database Wizard ,
, .
Table Wizard ( )
, , , .
(
datasheet).
Access
.
Design View () .
CREATE TABLE ( )
SQL View.
286
II,
http://openlib.org.ua/
Microsoft Access
SQL
6.3.2 SQL CREATE TABLE, . Microsoft Access 2000
SQL, CREATE TABLE Access DEFAULT CHECK. , SQL, . , . 8.1, Access SQL. 6.1 6 ,
PropertyForRent SQL. . 8.1 SQL View Access.
8.1. Microsoft Access
(text)
/, ,
, .
(character)
SQL (. 6.1.2)
255
(memo)
64000
(number)
,
,
, (
(currency)).
(exact numeric)
(approximate numeric)
SQL (. 6.1.2)
1, 2,4 8 (16
ID )
/
(Date/Time)
.
(datetime) SQL(CM. 6.1.2)
(currency)
(autonumber) ( 1) ,
4 (16
ID )
/
(Yes/No)
,
, / (Yes/No), /
(True/False), / (On/Of f).
(bit) SQL
(, 6.1.2)
OLE
( Microsoft Word,
Microsoft Excel, ,
),
, OLE,
Microsoft
Access
64000
8. : Access Oracle
287
http://openlib.org.ua/
. 8.1
Lookup Wizard
,
(
)
(combo box).
Lookup Wizard,
,
,
,
( 4
)
! ! :
CREATE TABLE PropertyForRent(propertyNo VARCHAR(S), street VARCHAR(25) NOT NULL, city VARCHAR(IS) NOT NULL,
postcode VARCHAR(8), type CHAR NOT NULL, room-; 5MALLINT NOT NULL, rent NUMBER NOT NULL,
owner* VARCHAR(S) NOT NULL, staff No VARCHAR(S), branchNo CHAR{4) NOT NULL,
CONSTRAINT pkl PRIMARY KEY (propertyNo),
:ON5TRAINT fkpfrl FOREIGN KEY (ownerNo) REFERENCES Owner (owner No),
CONSTRAINT fkpff2 FOREIGN KEV (staff No) REFERENCES Staff (staff No),
CONSTRAINT fkpfr3 FOREIGN KEY (branchNo) REFERENCES ranch (branchNo));
Microsoft Access
Design View
. 8.2 PropertyForRent Design View (). , , Design View , ,
.
IvJpropertyNo
Lljitreet
LJcit
postcode
SktCTiebti
^lype
:
*
.
i 100
_X rent
ounenNo
_ staff*
LJbfar*4*i
rooms
1 15
1
. .
-*!*
-
^ raff .'
'
!
*
;
' -
1
',
, 1
;> )
! ,
Hontp , so on lepe
S
.!_'
:
4
--lind^-LS
t * - 1 15
hei
he
' ^ -t
.
/ fl ,
288
II.
http://openlib.org.ua/
Microsoft Access
Field Properties ( )
Design View. ,
, . ,
, , Field Size ( ). ,
. Design View , .
.
Field Size
Field Size , (Text), (Number)
(AutoNumber). , . 8.2,
Field Size propertyNo 5 , Field Size rooms ,
0 255. ,
:
Integer ( ) 16- ( -32768
32767);
Long integer ( ) 32- ;
Single ( ) ,
32- ;
Double ( ) ,
64- ;
ID () - - 128- , , .
Format
Format ( )
, , . Microsoft Access . ,
/ (Date/Time) , (Short Date), (Medium
Date) (Long Date). 1 1933 01/11/33 (Short Date), Ol-Nov-33 (Medium Date) 1 November
1933 (Long Date).
Decimal Places
Decimal Places ( ) (
, ).
Input Mask
Input Mask ( ) ,
, . , .
8. : Access Oracle
289
http://openlib.org.ua/
. Microsoft Access
. , ,
propertyNo, : ' 1
, ( Property),
, , . (, 9, PG21, PL306).
' \P>L099 ':
' V , , ,
(, \ );
' >L' , , ,
;
' ' , , ' 9 ' .
Caption
Caption ()
. ,
1
Property Number' ( ) Caption
propertyNo, Datasheet View Property Number, , 'propertyNo 1 .
Default Value
Default Value ( )
,
. , . 8.2, , rooms 4.
Validation Rule/Validation Text
Validation Rule ( )
, . , , Validation Text
( ) . . , .
, 1
15. rooms . 8.2.
Required
Required ( ) . ' Y e s ' , , (NULL). Required
NOT NULL SQL (. 6.2.1).
.
290
II.
http://openlib.org.ua/
( )
16 5.3 , DreamHome
.
8.1.4.
. 8.1, Microsoft Access
CREATE TABLE SQL. Relationships ( ).
, , . Access .
. 8.3, , " " (1:*) S t a f f
Manages PropertyForRent, . 8.3,
Relationships . Microsoft Access .
1, " " (1:*) ,
; " " (1:1) , .
2.
, NO ACTION
CASCADE (. 6.2.4). , ,
, Access, .
8. : Access Oracle
291
http://openlib.org.ua/
.
.! /
S I
/;
VWc
,
,
ON UPDATE CASCADE
X/
/
/satpoT,
_iJ staffNo
* j
7 jjTac )
~
w ;
! -->
1-
31
*-
tropettyNo
street
City
postcode
type
rooms
rent
owner No
3
.1.111..
IName
position
sen
salary
branchMo
branchlJo
LLJ.
___
'
Puc. 5.3. : )
, "
"
Staff
Manages
PropertyForRent ( ,
); )
" " Staff Manages PropertyForRent
8.1.5.
Microsoft Access , ,
;
;
Visual Basic for Applications (VBA).
8.1.3 .
.
. ,
. , -
292
II.
http://openlib.org.ua/
. , DreamHome : 90 1 .
Lease (),
:
[dateFinish]-[dateStart] Between 90 and 365
. 8.4 Table Properties ( ) Lease.
if]*
I
,.,,,,,...,.,
.
. . . .
; ,...
. . . . . . . . . .
.....
' ,
, ^ . . . . . .
; , . . , , . , ,
^
-. .
,
^
;
|{rentfinish]-[rentS(:art] Between 90 And 365
I
VBA
DreamHome , 100 . , ,
.
Access . , . Microsoft Access , , ,
. .
(. 8.1.8),
, ,
. 8.1
BeforeUpdate,
.
8.1. VBA ,
100
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim MyDB As Database
Dim MySet As Recordset
8. : Access Oracle
293
http://openlib.org.ua/
,
. staffNoFieud -
MyQuery= "SELECT staffNo FROM PropertyPorRent WHERE staffNo = '" + _
staffNoField +
1
Set MyDB= DBEngine.Workspaces(0).Databases(0)
Set MySet = MyDB.OpenRecordset; (MyQuery)
1
, >- ,
RecordCount
If {NOT MySet.EOF) Then
MySet.MoveLast
1
100,
1
If (MySet.RecordCount = 100) Then
MsgBox " 100 "
Me.Undo
1
End If
End If
MySet.Close
MyDB.Close
End Sub
-
,
, 8.1,
VBA. , , .
8.1.6.
Microsoft Access , , .
, (controls)
(control objects). , , (text boxes) , (labels) ,
(command buttons) . . ,
,
Access Control Wizard,
, .
(Form Header). , , (title).
(Detail).
.
(Form Footer), , , (total).
294
II.
http://openlib.org.ua/
, ,
(subforms). , , ( )
( ). , ( "
" Branch Has Staff).
: Design View (), Form View
( ) Datasheet View ( ). . 8.5 Design View, ,
(toolbox)
, . Datasheet View
, Form View . . 8.6
Datasheet View, Form View.
l a i 'i'ui)M.ii : 1)(,1
(*12
, i .i . , .. i .. i .4 i i.
1*
'
i ' 9 - ' W i 11 ^1
[]
~3
i
J
* *
branet No"
stmet
Cttji
i
3
poslco de
| branchNo
_J
,
,
stieel
dtv
poslcdde
^56 i
-:
- . -i
Access
, . Access
(Form Wizard),
, :
;
, ;
(, ,
);
, ;
.
8.1.7.
Microsoft Access Reports ,
, .
. , Access Reports
8. ; Access Oracle
295
http://openlib.org.ua/
;
;
;
.
, Report's Design View
, .
(Report Header). ,
, , (title).
' (Page Header) ,
,
(column headings).
(Detail) ,
.
(Page Footer) , , .
(Report Footer) , , , .
, ,
,
. .
(Group Header) ,
, ,
.
(Group Footer) , , .
Datasheet View,
Design View, (Print
Preview) (Layout Preview). . 8.7 Design View, , . . 8.8
Print Preview. Layout Preview Print Preview,
, .
IBB !
"
>
002
BOQ3
005
007
56 Clover Dr
163 Main St
32'ManseRd
22 Deet RA
16 Argyll St
London
Glasgow
Bristol
London
Aberdeen
NW10 5EU
011
BS913 1WZ
SW1 4EH
AB23SU
branch No
street
66 Clover Dr
city
London
ooslcode
NW106EU
: JjLLUI
>'
>*! HJ 5
. 8.6. : ) Datasheet
View; ) . Form View
296
I E .
http://openlib.org.ua/
' e i / i ! i ' i *( --
Report Header,
Page Header,
Group Header,
branchNo
Detail,
Group Footer
branchNo,
rent
Page Footer,
Report Footer,
rent no
Property M Type
No ofRoaias
Rent
~SG
PG16
PG3P
PG4
PG21
450.00
600.00
375.00
350.00
1/75.00
BOOS
PL94
400.00 ,
400.00
B007
PAH
Sa.mm aryfor B6&7
550.00
850.00
. 8.8. PropertyForRent
, branchNo,
Print Preview
8. : Access Oracle
297
http://openlib.org.ua/
Access
. Access (Report
Wizard), , :
;
, ;
, , ;
, ;
;
, ;
.
8.1.8.
, Microsoft Access
. Access
:
, , , , ;
, , , ,
;
, (
, ,
..), , (
);
, , ,
.
Access , .
8.1,5,
.
, . ,
Access. , Print
(), Close (), Applyl r ilter ( ).
, SelectObject,
,
. ,
, , (action arguments), ,
. ,
SetValue, , , , , ,
. , (pop-up message box), .
298
II.
http://openlib.org.ua/
. 8.9 , ,
.
, ;
100.
, VBA
(. 8.1). ,
, PropertyForRent (Forms ! PropertyForRerit " s t a f f No). 100, RunCommand Save ( ),
StopMacro. MsgBox, , CancelEvent, .
DCOUNT
SELECT COUNT ( * ) ;
( . . . ) Condition , .
SetWarnings, RunCommand StopMacro,
D C O U N T ( " * " , "PropertyForRent", " [ s t a f f N o ] =
Forms 1 P r o p e r t y F o r R e n t J s t a f f N o " ) < 100
MsgBox CancelEvent.
cmdAddjdfck
[)^"^^
SstWamincg:
- Run Command
StopMeero
Cance vent
. 8.9. , , 100
8. : Access Oracle
299
http://openlib.org.ua/
Oracle 8i
Oracle
Oracle
, ,
;
OLTP (Online Transaction Processing
)
Oracle 8f Personal
Edition
Oracle,
, Oracle Si/Oracle 8i Enterprise
Etfition
Oracle 8i Lite
()
Oracle , .
Oracle (Oracle Parallel Server).
, , , (Symmetrical Multiprocessing SMP).
. Oracle
Parallel Server SMP,
.
Oracle (Oracle Application Server). Web, Web-, . Oracle Application Server 28.
300
II.
http://openlib.org.ua/
8.2.1.
Oracle , , .
8. : Access Oracle
301
http://openlib.org.ua/
(Tables). , .
Oracle .
(tablespace)
(. 8.2.2).
(Objects). ;
Oracle. 6.1, SQL
: , .
, .
- Oracle 27.
(Clusters). , .
, , ,
.
. , 5.2 16.
(Indexes). . Oracle 8 ,
(index-only table), , .
, 5.3 16.
(Views). ,
,
(. 6.4).
(Synonyms). .
(Sequences). Oracle
.
, , ,
,
, .
(Functions).
SQL PL/SQL,
.
(Procedures).
, , ,
. SQL , SQL,
.
(Packages). , ,
SQL,
.
(Triggers). (),
() ,
.
, Oracle.
302
If.
http://openlib.org.ua/
8.2.2. Oracle
Oracle /, 2.6.3. Oracle ( ,
) (instance)
( , ). .
, ,
, ,
Oracle. , .
Oracle
Oracle
(tablespaces), (schemas), (data blocks) /
(extents/segments).
Oracle , . . ,
.
Oracle SYSTEM, .
SYSTEM ( Oracle
) .
SYSTEM. , ,
(. . 16.1 16.2 16).
. 8.10 Oracle,
SYSTEM USER_DATA.
CREATE TABLESPACE, :
CREATE TABLESPACE user_data
DATAFILE 'DATA3.ORA' SIZE 100K;
CREATE TABLE ALTER TABLE, :
CREATE TABLE PropertyForRent
TABLESPACE user_data;
, ,
,
(user account). 18.4 , .
8. : Access Oracle
303
http://openlib.org.ua/
,
{
(user) ( username) ,
,
. ,
, , ,
.
() .
( Oracle Forms SQL*Plus) ,
username, .
. , ,
, .
, . ( ,
:
, .)
,
(data block) ,
Oracle .
.
Oracle
, 8.10. ,
Oracle
304
II.
http://openlib.org.ua/
Oracle
. ( ) .
.
(Header). ,
(Table directory). ,
.
(Row directory).
.
(Row data). . .
(Free space). , . , , PCTFREE PCTUSED,
.
,
Oracle, .
(extent). , .
(segment). , . ,
, . . 8.11 , . Oracle , . ,
.
Oracle
Oracle
(datafiles), (redo log files)
(control files).
2
8 ,
4
32 ,.
8 24
. 8.11. , Oracle
8. : Access Oracle
305
http://openlib.org.ua/
Oracle
.
( ).
. 8.10, .
Oracle
. , , , .
Oracle
,
.
, . 19.3.
Oracle ,
, , . , (
).
.
PCTFREE PCTUSED
, PCTFREE PCTUSED,
. ( ).
PCTFREE ( ).
.
PCTFREE. , , : ( 10).
PCTUSED. ,
, , Oracle
( 40).
, PCTFREE,
Oracle ,
PCTUSED. , Oracle
,
.
PCTFREE
. ,
,
306
II.
http://openlib.org.ua/
/ . PCTUSED
,
/.
, PCTFREE PCTUSED 100.
100, ,
, , 100%
, . , 2048 100 , 390
( 20% ),
PCTFREE PCTUSED, 80%. , 100%, Oracle
, PCTFREE, . PCTFREE PCTUSED . 8.12.
Oracle
Oracle Oracle (shared memory), . Oracle,
,
. 8.13. , Oracle ,
.
, (System Global Area SGA) (Program
Global Area PGA).
. SGA
, Oracle. SGA Oracle Oracle.
SGA , .
80%,
PCTFREE ,
20%
,
,
.
,
40%
8. : Access Oracle
307
http://openlib.org.ua/
http://openlib.org.ua/
,
, Oracle , ,
8. : Access Oracle
309
http://openlib.org.ua/
, .
Oracle (communication program) NetS, .
NetS , TCP/IP, LU6.2. DECnet
SPX/IPX, , ,
, , .
LCKO
RECO
PMON
SMON
ARCO
DBWO
LGWR
310
II.
http://openlib.org.ua/
1.
. , Net8.
2.
() .
3. SQL, ,
.
4. SQL, SQL. SQL
,
() ,
SQL ;
, SQL .
5.
() ,
SGA.
6. SGA. DBWR
.
LGWR .
7.
.
8. , , . , Oracle
, .
8.2.3.
6.3,2 CREATE TABLE SQL.
Oracle 8 CREATE TABLE SQL, :
(primary keys), PRIMARY KEY;
(alternate keys), UNIQUE;
(default values), DEFAULT;
(not null attributes), NOT
NULL;
(foreign keys), FOREIGN KEY;
,
CHECK CONSTRAINT.
27.6, Oracle 8 , . , . 8.3,
SQL.
311
http://openlib.org.ua/
8.3. Oracle
char(size)
(
1}
2000
.
nchar(size)
, char (size),
,
(,
,
- )
varchar2(size)
nvarchar2(size)
, varchar2,
, nchar
varchar
, char.
varchar2,
^
number(I, d)
, 1 , a d .
, number (5, 2)
, 9 9 9 . 9 9
4000
2000
1.0-130..
9.99125
decimal(1, d) ,
dec (1, d)
numeric^, d)
, number.
SQL
integer, int
smallint
SQL. number (38)
Date
1 Jan 4712 ( . .) 31
Dec 4712 AD (b. .)
blob
clob
raw(size)
,
,
2000
, Microsoft Access
Autonumber,
. Oracle ,
, ()
CREATE SEQUENCE SQL. ,
.
CREATE SEQUENCE appNoSeq
START WITH 1 INCREMENT BY 1 CACHE 3 0 ;
appNoSeq,
1 1. CACHE 30 ,
312
II.
http://openlib.org.ua/
Oracle 30 . SQL,
.
CURRVAL. .
NEXTVAL. 1 .
SQL.
INSERT INTO Appointment(appNo, aDate, aTime, clientNo)
VALUES (appNoSeq.nextval, SYSDATE, ' 1 2 . 0 0 ' , ' C R 7 6 ' ) ;
Appointmer.t
() appNo ( ), .
, PropertyForRent Oracle 8 (), 6.1.
SQL*Plus
Oracle 8
SQL*Plus , Oracle. SQL*Plus
, SQL Oracle. . 8.14 PropertyForRent
Oracle CREATE TABLE SQL.
Oracle ON DELETE NO ACTIGI,
ON UPDATE NO ACTION .
Oracle . ON DELETE
CASCADE . , * Oiecle SQL-Plus
Connected to:
Oraclpel Enterprise Edition Reipase 8.1.5.0.8 - Production
Witn the Partitioning and Jaua options
SQL>
2
3
:
4
5
; 7
1
S
:
1H
11
12
Table created.
SQL)
. 8.14. PropertyForRent
Oracle SQL*Plus
CREATE TABLE SQL
8. : Access Oracle
313
http://openlib.org.ua/
, . Oracle
ON UPDATE CASCADE SET DEFAULT SET
NULL. ,
.
8.2.7.
Final Keviei*
rU*mw*t
*
4
USft.OATA
irColuwis!
it Up Oi
ptonefyMc
city
poilcod.
( "
loams
VARCHAR2I5)
VAriCHAR2li5) ""
2||
" "CHAR|il"
NUMBER
LL ij ^^'
8.2.4.
Oracle
, ,
SQL, CHECK CONSTRAINT
CREATE ALTER TABLE;
;
;
.
6.1.
- 27. ,
Oracle PL/SQL (Programming Language/SQL).
314
II.
http://openlib.org.ua/
8.2.5. PL/SQL
PL/SQL Oracle SQL.
PL/SQL; Oracle,
,
Oracle. , , ,
PL/SQL Oracle ,
[DECLARE '
-- ]
BEGIN
--
{EXCEPTION
- .; -- ]
END;
, 8.16. PL/SQL
,
, . . 8.3. .
vStaffNo VARCHAR2(5);
vRent NUMBER(6, 2) NOT NULL := 600;
yAX_PROPERTIES CONSTANT NUMBER := 100;
, NOT
NULL, .
8. : Access Oracle
315
http://openlib.org.ua/
%TYPE ,
, . , , vStaf fNc
, st.affNo Staff, :
vStaffNo
vStaffNol
Staff.staffNofcTYPE;
vStaffNo%TYPE;
Staff%ROWTYPE;
PL/SQL : (:=)
SELECT FETCH SQL. :
vStaffNo:= "SG14";
vRent:= 500;
SELECT COUNT (*) INTO x FROM PropertyForRent WHERE staffNo =
vStaffNo;
SELECT ( ,
SG14).
PL/SQL , :
IF-THEN-ELSE-END IF;
LOOP-EXIT WHEN-END LOOP, FOR-END LOOP WHILE-END LOOP;
GOTO.
(exception) PL/SQL , .
,
. Oracle, ,
NO_DATA_FOUND , SELECT . , RAISE.
,
(exception handlers).
316
II.
http://openlib.org.ua/
, PL/SQL. , , .
PL/SQL, 8.2 . Oracle DBMS_OUTPUT,
PL/SQL. put_line SGA, , get_line
SERVEROUTPUT ON SQL*Plus.
SELECT , . , (.. , ),
PL/SQL (cursors). . ,
. 1.
, . , FETCH,
SELECT. ( 21 , SQL
, .)
8.3
, SG14,
. .
DECLARE property-Cursor.
. , SELECT,
CURSOR, ,
( ), . , , PL/SQL .
FETCH INTO. ,
FETCH
.
, -
(propertyCursor%NOTFOUND), , (EXIT WHEN). DBMS_OUTPUT .
.
8. : Access Oracle
317
http://openlib.org.ua/
.
%NOTFOUND, ,
, .
%FOUND. , (.. , %NOTFOUND).
%ISOPEN. , .
%ROWCOUNT. , .
8.2. PL/SQL
DECLARE
X
NUMBER;
vStaf f No PropertyForRent. Eitaf fNo%TYPE : = ' SG14 ' ,--
-- ,
-- 100
e_too_many_properties EXCEPTION;
PRAGMA EXCEPTION INIT(e_too_many_properties, -20000);
BEGIN
FROM PropertyForRent
WHERE staffNo = vStaffNo;
IF x=100
-- , ,
--
RAISE e_too_many_properties;
END IF;
UPDATE PropertyForRent SET staffNo = vStaffNo WHERE propertyNo
= 'PG4';
EXCEPTION
--
--
WHEN e__too_many__propertiei3 THEN
dbms_output.put__line(' ' |\ staffNo
1
100 ');
END;
8.3. PL/SQL
DECLARE
vPropertyNo
PropertyForRent.propertyNo%TYPE;
vStreet
ProperiyForRent.street%TYPE;
vCity
Proper-yForRent.city%TYPE;
vPostcode
Proper'iyForRent. postcode%TYPE ;
CURSOR propertyCursor IS
SELECT propertyNo, street, city, postcode
FROM PropertyForRent:
318
II.
http://openlib.org.ua/
PL/SQL
, . , , , , :
CURSOR propertyCursor (vStaffNo VARCHAR2) IS
SELECT propertyNo, street, city, postcode
FROM PropertyForRent
WHERE staffNo = vStaffNo
ORDER BY propertyNo;
, , :
vStaffNol PropertyForRent.staffNo%TYPE:='SG14';
OPEN propertyCursor('SG14');
OPEN propertyCursor('SA9'};
OPEN propertyCursor(vStaffNol);
8. : Access Oracle
319
http://openlib.org.ua/
. , , , ,
, FOR UPDATE.
- ,
( 19).
, , SG14, SG37, :
CURSOR propertyCursor IS
8.2.6. , ,
PL/SQL,
. PL/SQL , () .
, , . , , .
, , .
, , .
PL/SQL
: , 320
II.
http://openlib.org.ua/
,
,
. , .
IN. .
OUT. .
IN OUT. , .
, PL/SQL,
8.3, , :
CREATE OR REPLACE PROCEDURE PropertiesForStaff
(IN v S t a f f N o VARCHAR2)
AS. . .
SQL*Plus :
SQL>SET SERVEROUTPUT ON;
SQL>EXECUTE PropertiesForStaff('SG14');
, ,
SQL, . : . (public constructs)
, (
(private)) , .
.
Oracle .
.
.
.
:
CREATE OR REPLACE PACKAGE StaffPropertiesPackage AS
procedure P r o p e r t i e s F o r S t a f f ( v S t a f f N o VARCHAR2);
END StaffPropertiesPackage;
(.. ) :
CREATE OR REPLACE PACKAGE BODY StaffPropertiesPackage
AS
END StaffPropertiesPackage;
, ,
(dot notation). ,
PropertiesForStaf f :
StaffPropertiesPackage.PropertiesForStaff('SG14'};
8. : Access Oracle
321
http://openlib.org.ua/
8.2.7.
, . , . , ,
PL/SQL, Java
, "--" (EventCondition-Action EGA),
( ),
Oracle,
INSERT, UPDATE DELETE, (, , );
CREATE, ALT3R DROP,
;
Oracle; ;
.
,
.
, , . , ,
, .
, . SQL , ,
.
: (row-level triggers),
, (statement-level triggers),
, . Oracle INSTEAD-OF,
, SQL DML (INSERT, UPDATE
DELETE). INSTEAD-OF, , , Oracle
(instead-of) SQL.
. ,
, , , , .
, DreamHome ,
100 . , 8.4,
. ,
PropertyForRent
. 100
, .
.
322
II.
http://openlib.org.ua/
BEFORE , ,
PropertyForRent.
FOR EACH ROW ,
,
PropertyForRent, .
new .
( old,
.)
8.4. ,
100
CREATE TRIGGER StaffNotHandlingTooMuch
BEFORE INSERT OR UPDATE ON PropertyForRent
FOR EACH ROW
DECLARE
X
NUMBER;
BEGIN
SELECT COUNT(*) INTO x
FROM PropertyForRent
WHERE staffNo = :new.staffNo;
IF x=100
raise_application_error(-2QOOO,{' ' || :new.staffNo (|
1
100 1);
END IF,END;
8.2.3 , Oracle ON DELETE NO ACTION ON UPDATE NO ACTION
. Oracle ON DELETE CASCADE , .
ON UPDATE CASCADE SET DEFAULT SET NULL.
, . , 6.1 6 s t a f f N o PropertyForRent
ON UPDATE CASCADE. , 8.5.
1 (Property ForRent_Check_Bef ore)
, 8.5, , PropertyForRent staffNo. , , Staff.
Invalid_staf f , .
8. : Access Oracle
323
http://openlib.org.ua/
, Staff
, 8.6, ,
Staff s t a f f N o . updateSequence (public) updateSeq (
seqPackage). , PropertyForRent
updateid, ,
, .
2 (Cascade_StaffNo_Update1)
(statement-level)
s t a f f N o Staff , .
3 (Cascade_Staff No Up<late2)
() ,
PropertyForRent staffNo
(: old. staffNo) (: new. staffNo) .
4 (Caseade_StaffNo UpdateS)
() , .
.5. Oracle ON UPDATE CASCADE no
staffNo PropertyForRent,
staffNo Staff:
PropertyForRent
staffNo PropertyForRent
-- ,
-- Staff
CREATE TRIGGER PropertyForRent_Check_Before
,
BEFORE UPDATE OF staffNo ON PropertyForRent
-- FOR EACH ROW
-- new.staffNo IS NOT NULL
FOR EACH ROW WHEN (.staffNo IS NOT NULL)
DECLARE
dummy CHAR(5);
invalid_staff EXCEPTION;
valid_staff EXCEPTION;
mutating_table EXCEPTION;
PRAGMA EXCEPTION_INIT (mutating_table,-4091);
--
. FOR UPDATE OF
-- ,
--
CURSOR update_cursor {sn CHAR(5}) IS
SELECT StaffNo FROM Staff
WHERE staffNo = sn
FOR UPDATE OF staffNo;
324
II.
http://openlib.org.ua/
BEGIN
OPEN update_cursor(:new.staffNo);
FETCH update_cursor INTO dummy,-- .
--
-- NOTFOUND ,
-- staffNo
IF update_cursor%NOTFOUND THEN
RAISE invalid_staff;
ELSE
RAISE valid_staff;
END IF;
EXCEPTION
-- ,
-- staffNo
WHEN invalid_staff THEN
CLOSE update__cursor ,raise_application_error{-20000,' '
:new.staffNo;
WHEN valid_staff THEN
CLOSE update_cursor;
-- (mutating) - ,
-- INSERT, UPDATE DELETE; ,
--
-- DELETE CASCADE.
,
-- , ,
-- .
WHEN mutating_table THEN
NULL;
END;
8.6. Staff
--
-- UPDATESEQ
updateseq NUMBER;
END seqpackage
CREATE or REPLACE PACKAGE BODY seqpackage AS END seqpackage;
-- PropertyForRent
-- .
--
- - PropertyForRent
ALTER TABLE PropertyForRent ADD updateid NUMBER;
-- Staff ,
--
-- UPDATESEQ
CREATE TRIGGER Cascade_StaffNoJJpdatel
-- ,
8. : Access Oracle
325
http://openlib.org.ua/
--
--
CREATE TRIGGER Cascade_StaffNo_Update3
AFTER UPDATE OF staffNo ON Staff
-- ,
BEGIN
--
UPDATE PropertyForRent SET updated = NULL -- ,
WHERE updateid = seqpackacge.updateseq;
--
END;
--
( )
. 15-20
( 50
), 25%.
Microsoft Access Microsoft
Windows . Microsoft Access
, ,
. II Access , ,
(Graphical
User Interface GUI);
, Microsoft
Access VBA (Visual Basic for Applications).
Microsoft Access
, , , , , , .
( ) ( ).
,
326
II.
http://openlib.org.ua/
. , . ,
. . Web-,
{ Microsoft Access
Microsoft SQL Server) Internet
(intranet). , , .
VBA,
.
Microsoft Access . Access 2000 :
Jet Microsoft Data Engine
(MSDE), Microsoft BackOffice SQL Server.
Oracle
. 10 , ,
145 , Oracle . 400
80% Oracle .
Oracle ,
. Oracle ( ); (
Oracle); ( , , );
(, ); ( ); ( ); ( ); / ( SQL
PL/SQL, );
( , , SQL,
);
(, ()
, ).
Oracle / .
Oracle ( ,
) (
, ). .
, , , , Oracle.
8.1.
8.2.
8.3.
Microsoft Access?
Access ?
Access ?
8. : Access Oracle
327
http://openlib.org.ua/
8.4.
8.5.
8.13.
Access?
Access.
Oracle?
Oracle.
Oracle.
,
PCTFREE PCTUSED?
Oracle
.
Oracle.
Oracle.
PL/SQL?
328
8.6. .
8.7.
8.8.
8.9.
8.10.
8.11.
8.12.
http://openlib.org.ua/
,
""
"-"
331
367
397
429
447
http://openlib.org.ua/
http://openlib.org.ua/
"
...
.
.
: ,
.
CASE-
.
.
.
.
.
, .
,
. ,
. , ,
,
.
, ,
. , , , . , " ".
1960- ,
40 .
"
". -
http://openlib.org.ua/
- _
' . : :
9.1 , . 9.2 .
9.3-9.13, 9.14 CASE-,
.
9.15, .
9.1.
. ', ,
, .
1970- ,
(Information System IS) . 332
III.
http://openlib.org.ua/
, ,
, . ,
, () ().
.
, . , , .
: , , , , , , .
.
,
.
" " " " , , , .
9.2.
,
.
,
. . 9.1.
, .
, , (feedback loops). , ,
.
, . 9.1 . ,
, . 9.1.
.
,
, . ,
.
,
.
9.,
333
http://openlib.org.ua/
^
( 9.
( 9.4) '
( 9.6)
.1
('
) ( 9;1
'-
1
( 9-S)"
'^
&
/.
( stranj
( 9.9) '";:
( 9-50).
.&^5
|
( 9.13)
. 9.1.
334
III.
http://openlib.org.ua/
9.1. ,
( )
( )
( )
, ,
. , ,
.
9.3.
i . , :~ .
. :
- ;
9.,
335
http://openlib.org.ua/
;
.
, ,
. [261].
.
. , , , (,
).
.
.
, .
, , ,
, ,
.
, , , , .
DreamHome 10.4.2,
, , ,
,
. , .
, , . , , , , , , . ,
(, ..).
9.4.
.
, .
, . 336
111.
http://openlib.org.ua/
, . . 10.10 ,
DreamHome. , , .
9.4.1.
.
1 { icneicrop) ( , ).
.
, ,
. ,
.
,
(.. ,
). . . 9.2
1-6).
, (13,
5 6) ( ),
4 .
9.5.
( . , , .
, .
, , 10.
(
).
, .
9. ,
337
http://openlib.org.ua/
6 V.
:'!-.'(
. 92.
.
.
.
(
), . ,
.
, . - . (paralysis by analysis),
,
.
, . , , ,
(Structured Analysis and Design
SAD), (Data Flow Diagrams DFD)
"--" (Hierarchical Input Process Output HIPO),
. , -
338
III.
http://openlib.org.ua/
, , CASE-, .
,
, .
,
, ,
, ,
.
, ,
, ,
.
, .
.
.
.
9.5.1.
-
"," "'
' . ; ; ; / > ,
'
<
' / -
'
. .
,
. , , , , . (. 9.6)
, , , . , . . 9.3
1-3. ,
,
.
9.5.2.
.
, -,
. , ;;
^ ^ .
9. ,
339
http://openlib.org.ua/
1
ER-
. 9.3. 1-3
. (. 9.6)
. ,
, ,
. , .
. 9.4 1-3
. ,
, ,
,
. 3 15.
9.6.
. ,
.
. .
: , .
340
III.
http://openlib.org.ua/
2
,
. 9.4. 1-3
9.6.1.
:
.
(.. ),
, . 13 , .
,
.
.
, .
9. ,
341
http://openlib.org.ua/
, ,
. ,
, .
. , ,
, . "-". , . , PrivateQwner () PropertyForRent (
), PrivateOwner Owns
() PropertyForRent
, PrivateOwner
{ownerNo,
name,
address)
9.6.2.
() .
, .
, ,
. , .
,
.
,
, :
;
;
.
, .
, , .
342
III.
http://openlib.org.ua/
. , ,
"-" (Entity-Relationship model ER) 11 12.
, . 9.2 [116]. , . , ,
9.2.
, ..
-
, ,
9.6.3.
: , .
.
. ,
. . 9. ,
343
http://openlib.org.ua/
,
. , ,
, , , . 14 .
.
.
. = ,
.
.
. ,
, .
(, ).
,
. ,
, , , -.
, , .
.
. , , ,
, . , , 13. ,
, ,
.
, , .
.
, , .
15.
344
III.
http://openlib.org.ua/
.
| ; - -.
|; , , >
$ , . .
, . ( ). ,
, ,
. ,
, . . , ,
, .
, .
:
, ;
, ;
.
.
.
, , , .
, , ,
, , .
, .
,
, .
.
, , ,
. .
,
9. ,
345
http://openlib.org.ua/
.
. ,
.
,
.
2 ANSI-SPARC, ,
. . 9.5
, .
16 17
. 9.5.
ANSI-SPARC
9.7.
. ,
!! .
,
(. . 9.1). , ,
, , , .
, ,
, , .
, , , ,
346
III.
http://openlib.org.ua/
,
, ,
.
,
, , .
.
, , , .
.
9.7.1.
. 9.3.
9.3.
-
, ,
, . ,
(
), , ,
, .
-
, ,
.
, , , ,
. ,
, , ,
.
, . .
9. ,
347
http://openlib.org.ua/
,
, World Wide Web. ,
Web- , ( www.intelligententerprise.com). ,
Web- .
, (, ),
(, ). . 9.4 , : , , , , , .
9.4.
:
SQL2/SQL3 ODMG
348
III.
http://openlib.org.ua/
. 9.4
CASE-
Web
Internet
- "/"
XML
, . ,
.
, .
. 9.5
. , 10-
, ( ) .
. ,
9. ,
349
http://openlib.org.ua/
0,15
1,2
0,2
1,2
0,25
1,0
0,15
0,9
0,15
0,9
0,05
0,35
0,05
0,2
0,00
0,00
41
1,0
5,75
5,75
0,25
1,44
. ,
.
, . 9.5 " "
5,75, 0,25.
, , ,
. .
, , , .
, - .
.
Transaction Processing Council
, www.tpc.org,
350
III.
http://openlib.org.ua/
,
.
9.8.
^ .
^ , .
. 9.1 ,
.
. ,
, .
, , , . , , .. .
, ,
. .
. , .
, ,
, . , , .
, .
9.8.1.
,
.
. . ,
; ( ),
:
.
, , , ,
9. ,
351
http://openlib.org.ua/
.
, , .
, , ,
.
. .
. , , ( , ). - , ,
.
, () () ,
.
,
, .
,
, :
, ;
;
, ;
;
.
,
. :
, .
.
( ),
,
.
.
, .
( ), .
352
III.
http://openlib.org.ua/
9.8.2.
( ),
.
. 9.6 [275].
9.6.
.1
. , . ,
.
, , .
, /. /
. ,
9. ,
353
http://openlib.org.ua/
. , .
. , Sex () Gender,
.
, .
. ,
.
. ,
, ,
.
,
, . .
,
. , .
,
, .
,
<Backspace> .
. .
.
.
354
III.
http://openlib.org.ua/
,
(, )
.
, . ,
.
9.9.
, .
. .
,
. , , , . ( ),
. , ,
, ,
.
.
:
.
. ,
, .
9.10.
!: . .
( ) , .
(DDL) , ,
9. ,
355
http://openlib.org.ua/
DDL . DDL .
.
. (DML)
, Visual Basic, Delphi, , C++, Java,
COBOL, Fortran, Ada Pascal. ,
, , . ,
, , , .
. DDL , , ,
, ,
, . , DDL DML SQL,
5 6.
9.11.
-
- ; .
- , -.
. -
-.--
...
.. -
-,
, -
.... ..-..
.. .
I .
; : . .
,
. . - , .
, . ,
,
.
9.12.
. .
,
.
, , . ,
,
356
111.
http://openlib.org.ua/
.
, , . , , , . ,
, -, , . ,
.
,
. , .
.
,
.
9.13.
*
.
^^ .
.
, .
.
.
, .
( )
.
.
, , .
,
. , ,
(
), .
()
(,
), , , .
,
9. ,
357
http://openlib.org.ua/
.
,
. , ,
,
. ,
, , ,
.
.
. , . , . ,
, , .
9.14. CASE-
, ..
, ,
CASE- (Computer-Aided Software Engineering).
"CASE-" . . CASE-
:
, ,
;
, ;
, ;
, .
. 9.6, CASE- : CASE- , CASE-
CASE-, CASE-
,
, CASE-
, ,
.
CASE- , CASE , .
358
II.
http://openlib.org.ua/
CASE-
-
!
/ ,;
15)&-::'|
: - j
. 9.6. CASE-
CASE-
CASE- .
"" ,
. ( ), . - . ,
.
- .
, . ,
, , . ,
. , ,
(, ),
-.
9.
359
http://openlib.org.ua/
CASE- , .
. CASE-
,
. , , .
. CASE-
(. 2.7), ,
.
, ,
.
.
. ,
,
. CASE .
. , CASE- ,
. CASE- . , , .
CASE-
[21], [120], [185].
9.15.
() () ,
, .
,
.
.
9.15.1.
. ,
, , , - ;
.
360
III.
http://openlib.org.ua/
,
.
,
.
, . , ,
. , , . 9.7.
9.7. ,
,
-
,
-
, , , , , ,
,
9.15.2.
. : , -;
; ! ,
^ ,
,
9. ,
361
http://openlib.org.ua/
, ,
. ^
, ,
. 9.8. , ,
.
. 9.8.
9.8.
1
, ,
,
^!?
9.15.3.
. .
. 9.9 ,
. , . , .
9.9. ,
362
III.
http://openlib.org.ua/
. 9.9
, , , .
,
, , ,
, , .
,
. ,
, .
, ,
, , ( ), , ( ), ,
, , .
, ,
,
.
,
(, ),
( , , ).
,
, .
: , .
9. ,
363
http://openlib.org.ua/
, .
, .
,
-. , .
,
.
,
, .
.
, , ,
- ,
.
, ,
, , . ,
. .
,
,
.
?
.
,
, , .
CASE- (..
) , , . CASE-
: CASE- , CASE CASE-.
,
, ,
, . .
364
III.
http://openlib.org.ua/
,
, , .
9.1.
9.2.
?
?
9.3. , .
9.4.
?
9.5.
, .
9.6.
.
9.7.
?
?
9.8.
"" .
9.9.
.
.
9.10. ,
?
9.11. .
9.12. ?
9.13.
, .
, ,
, .
.
9.14.
, .
9.15. ,
. , , ,
, ,
, .
9. ,
365
http://openlib.org.ua/
http://openlib.org.ua/
...
.
,
.
,
.
.
,
.
DreamHome, .
.
9
. ,
.
, , ,
, , . .
1 . , 5 , .,
.
,', '
,^
|
:
.
, . . , DreamHome, , ,
. DreamHome
.
http://openlib.org.ua/
10,1 , . ( "
", , , . .) 10.2 ,
. 10.3
. 10.4 DreamHome , .
DreamHome. , : ,
, .
.
10.1.
, , , *:, . , , , , () . , ,
. ,
, ,
. (
) ,
: .
, , .
9,
(paralysis by analysis),
, .
10.2.
.
. 10.1 , .
9,
, 368
III,
http://openlib.org.ua/
(feedback loops). , . , , , , .
10.1. ,
(
)
/
(
ER-,
);
(
)
;
;
10.
369
http://openlib.org.ua/
10.3.
.
.
.
.
.
.
.
.
10.3.1.
:- , , , . , ,
. , , ,
, . , , . 10.2.
10.2. ,
, ,
, /
, .
,
- .
.
/.
.
- ,
.
.
.
10.3.2.
. . , ,
, ,
370
III.
http://openlib.org.ua/
, .
, , , , .
.
. 10.3.
: . ,
, , . , , ,
.
,
.
, ,
.
.
(open-ended questions) ,
.
: " ?" , (closed-ended questions), , .
: " ?" "
?" "" "".
,
.
10.3.
,
, ,
, ,
, ,
10.3.3.
. ,
10.
371
http://openlib.org.ua/
, . , ,
,
.
,
- , . , , :
" , ?" " , ?"
. 10,4.
10.4.
, ,
10.3.4.
. , Internet
( ) . ,
, .
. 10.5.
10.5.
372
III.
http://openlib.org.ua/
. 10.5
,
,
10.3.5.
. , , . ,
.
. 10.6.
, : (free-format questions) (fixed-format
questions).
. : "
?" " - ? , , ".
, ,
.
. . . ,
, , . :
" ,
?"
"" ""
, " ", "", " ", " ", " ".
10.4.
DreamHome, a
. , , ,
, : , , .
10.
373
http://openlib.org.ua/
10.6.
<
; 5-10%
10.4.1. DreamHome
DreamHome , , 1992 .
. ,
.
. (Sally Mellweadows) ,
,
- . ,
,
DreamHome. , DreamHome,
DreamHome , ,
, DreamHome, .
DreamHome 2000
, 100 .
DreamHome
(DreamHome Staff Registration Form). . 10.1 ,
(Susan Brand).
, (Manager), (Supervisors),
(Assistants). ,
, . , , . 10.2.
,
. DreamHome, DreamHome.
. . 10,3.
374
III.
http://openlib.org.ua/
DreamHome
Staff Registration Form
3-Jun-40
Telephone Number(s)
, 0141-339-2178 / 0141-339-4439
Position Manager
Salary 24000
. 10.1. DreamHome
DreamHome
Staff Listing
Branch Address
163 Main St, Glasgow
Telephone Number(s)
G119QX
0141-339-2178 / 0141-339-4439
Staff Number
Name
SG5 .
SG14
SG37
- SG112
SGI 26
SG132
Susan Brand
David Ford
Ann Beech
Annet Longhorn
Chris Lawrence
Sofie Walters
Position
Manager ; , '"
Supervisor
Assistant .
Supervisor
Assistant -v- '4""
Assistant >,
Page!
. 10.2. , DreamHome
10.
375
http://openlib.org.ua/
DreamHome
Property Registration Form
Owner Number C093
(If known)
Rooms 4
Rent 450
Person/Business Name
Tony Shaw
Address
Glasgow G4OQR
Glasgow, G1 2 9AX
Tel No 0141-225-7025
Type of business
Contact Name
Managed by staff
Registered at branch
David Ford
. 10.3.
DreamHome
, DreamHome , ,
, , , DreamHome.
( ), ,
( ) . DreamHome , .
, ,
DreamHome DreamHome. ,
, . . 10.4
(Mike Ritchie).
, .
,
, . 10.5.
. , ,
. 10.6. ,
.
376
III.
http://openlib.org.ua/
DreamHome
Client Registration Form
Full Name
Mike Ritchie
Registered By
Ann Beech
Date Registered 16-Nov-99
Max Rent 750
. 10.4.
DreamHome
DreamHome
Property Listing for Week beginning 01/06/01
Telephone Number(s)
0141-339-2178 / 0141-339-4439
G119QX
Property No
Address
PG4
PG36
PG21
PG16
PG77
PG81
Type
Flat
Flat
House
Flat
House
Flat
Rooms
Rent
3
3
350
375
600
450
560
440
. 5
4
6
*='..
Page 1
. 10.5. DreamHome
,
10.
377
http://openlib.org.ua/
DreamHome
Property Viewing Report
Property Address
6 Lawrence St, Glasgow
Rent 350
Client No
Name
CR76
CR56
CR74
CR62
John Kay
Atine Stewart
Mike Ritchie
Mary Tregeor
Date
Comments
Too remote.
20/04/01
26/05/01
11/11/01
11/11/01 OK, but needs redeeoratfon throughout.
Page 1
. 10.6. DreamHome no
DreamHome Lease
Number 00345810
Client Number CR74
(Enter if known)
Full Name
Mike Ritchie
(Please print)
SNovorDr, Glasgow
Client Signature
Duration 1 year
. 10.7. DreamHome
,
378
III.
http://openlib.org.ua/
,
. . 10.7.
;
. .
10.4.2. DreamHome
(mission statement) , . (mission
objectives), ,
(. 9.3).
DreamHome
DreamHome , .
. .
" ?"
" , , ?"
" , ?"
,
DreamHome, .
?
, . , , ,
.
,
, , ?
,
, .
,
, . -
10.
379
http://openlib.org.ua/
,
.
,
,
?
lice, , , . ,
,
.
, .
, ?
" DreamHome ,
,
".
. 10.8. DreamHome
.
DreamHome . 10.8.
, DreamHome,
.
DreamHome
. , . ,
DreamHome. .
" ?"
" ?"
" ?"
" ?"
" ?"
" ?"
( ) DreamHome
: , .
, .
380
III.
http://openlib.org.ua/
?
.
.
,
?
,
DreamHome.
, ,
. ,
?
, , . ,
DreamHome,
,
,
?
, , .
, ,
"" ?
10.
381
http://openlib.org.ua/
382
. ,
?
,
,
.
,
,
.
.
,
-
?
, ,
, .
, ;
.
,
.
, , . ,
,
,
- . , , , .
, , , ,
, ,
.
, ,
.
,
- , , .
, ,
III.
http://openlib.org.ua/
?
,
, , . ,
,
?
. ,
.
?
, : , , .
, ,
,
, , , .
?
. ,
, , , . , , , ,
,
?
,
,
. , , , .
, .
?
10.
383
http://openlib.org.ua/
, , ,
?
,
?
,
.
, .
.,
?
.
?
, . : " -
?"
. , ,
,
?
, .
?
,
.
?
?
, , "
; ?" "
?"
. Dream.Home . 10.9.
384
III.
http://openlib.org.ua/
10.4.3. DreamHome
. 9.4.1 , ( ) ( ) ,
.
DreamHome
, . , , 10.4.1. , ,
, . DreamHome 10.10.
(, ) .
(, ) .
(, ) ,
.
(, ) .
(, ) ,
(, ) .
(, ) , .
(, ) .
.
.
. .
.
.
.
.
.
, .
, .
, .
.
.
, .
.
,.
.
.
.
, 10.9. DreamHome
10.
385
http://openlib.org.ua/
,
10,10. DreamHome
DreamHome
, .
: ,
.
DreamHome . 10.7.
10.7.
DreamHome
386
X
X
X
.
X
X
X
III.
http://openlib.org.ua/
. 10.7
'
10.
:<
387
http://openlib.org.ua/
10.4.4. DreamHome
1\
DreamHome
,
, . , ( X), , .
" X?"
" X?"
?
, , ,
?
.
,
.
. ,
,
388
III.
http://openlib.org.ua/
,
. .
DreamHome
.
, , .
" ?"
" ?"
" ?"
" , ?"
" ?"
" ,
?"
" ?"
"
?"
" ?"
, .
?
,
,
.
, , ,
,
?
,
,
.
,
10.
389
http://openlib.org.ua/
?
, , ?
.
, , . ,
12 14 17 19
?
, ,
, , ,
, ,
. ,
, . , , ,
,
,
?
, ,
. ,
,
?
, ,
.
,
,
, . .
390
III.
http://openlib.org.ua/
?
, , ,
.
, ,
,
, 100 .
.
-
,
?
, .
,
, , . ,
. ?
. .
DreamHome
, ? ,
,
, . . 10.8 , ,
, DreamHome
( : , , , , , , ).
. 10.8 , ,
, .
. ,
,
10.
391
http://openlib.org.ua/
. ,
,
(
Branch)
(
S t a f f ) . , Branch Staff,
,
10.8.
,
DreamHome
branch ()
staff ()
owner ()
client ()
property viewing ( )
lease ( )
newspaper ( )
DreamHome, ,
, , 15 , .
, , , .
. ,
, , ,
(, , )
. 16
.
,
, , . ,
. Branch Staff DreamHome .
DreamHome.
392
III.
http://openlib.org.ua/
DreamHome
DreamHome. ,
,
;
;
;
;
;
;
;
.
DreamHome
1. 2000 100 .
20 40 .
2. 100 000
. 1000 3000
.
3. 60 000 , 600
1000 .
4. 100 000 . 1000 1500
.
5. 4 000 000 . 40 000 100 000 .
6. 400 000 .
40 000 10 000
.
7. 50 000 100 .
1. 500
200 .
2.
, .
100 .
3. 2 , . 100 .
4. 20 .
. 20 .
10.
393
http://openlib.org.ua/
5. 1000 .
2 , .
100 .
6. 5000 .
.
7. 1000 . .
8. 1000 .
.
1. 10 .
2. 20 .
3.
5000 ( ), 10 000
( ). 12.00 14.00 17.00
19.00 .
4. 100 .
5. 1000 ( ), 2000 ( ).
12.00 14.00 17.00 19.00 .
6. 2000
( ), 5000
( ). 12.00 14.00 17.00
19.00 .
7. 1000
( ), 2000 (
). 12.00 14.00 17.00 19.00 .
, DreamHome , . 2 3 .
.
1. , ,
1 .
5 .
2. , ,
5 .
10 .
394
III.
http://openlib.org.ua/
3. , ,
/ 1 . /
5 .
1. .
2. ()
,
: , , .
3. , ,
,
.
, . DreamHome
, ,
, .
10.4.5. DreamHome
Branch Staff
DreamHome. , . 14 16 DreamHome, ,
Dreamffome,
, .
,
, .
, , , .
, , , .
, ,
.
,
, .
10.
395
http://openlib.org.ua/
,
, , .
10.1. ?
10.2. ?
10.3. , .
10.4.
.
, ,
, .
.
10.5. .
10.6. ?
10.7.
?
,
?
10.9.
,
; ()
( ). ,
, . ,
,
10.10. ,
, . , , .
10.11.
, ,
.
10.12. , , , .
10.13.
, ,
.
396
III.
http://openlib.org.ua/
"-"
...
ER-
.
, "-" (EntityRelationship model, ER-).
ER-
UML.
ER-, "
".
ER- .
10
,
.
.
, , , , -.
,
, ,
.
, ,
.
"-"
(Entity-Relationship
model,
ER-).
ER
, , (entities), (relationships) ,
.
, , , (attributes), , , . ER- ,
; , .
ER-,
, -
http://openlib.org.ua/
, ,
.
, - UML
(Unified Modeling Language ) [35].
UML - , 1980-1990- . , OMG (Object
Management Group ), UML, , UML . UML ER-,
ER- - . ,
ER-.
,
ER-. ER-
"" , EER- (Enhanced
Entity-Relationship
"-"). 12 , EER, /, .
, ER-, . 11.1,
EER-, . 12.8.
11.1.
;
. , v
.7
398
=. -
.-".
' . - ':'
-- i
http://openlib.org.ua/
11. "-"
399
http://openlib.org.ua/
11.1.
. , .
, , (entity occurrence).
, ,
,
. , , .
, . 11.1 , S t a f f , Branch.,
PropertyForRent PrivateOwner.
; ]! . UML
(.
Staff
PropertyForRent). . 11.2
Staff Branch.
. 11.2,
S t a f f Branch
400
III.
http://openlib.org.ua/
11.2.
^ . .
(relationship type) (
) , .
, .
POwns ( )
PrivateOwner ( ) Proper tyForRent
( ), . 11.1.
,
" " " ".
. ,
.
, .
, , , , .
Has, Branch () Staff (), ,
Branch Has Staff ( ). Has Branch Staff. Has
.
,
. . 11.3
Has (
rl, 2 ).
Branch Staff. , Branch Staff. , rl
Branch SG37 S t a f f .
, . 11.3 Branch
Staff
(branchNo staffNo).
.
,
- .
"-" (ER-). ER- , , .
11. "-"
401
http://openlib.org.ua/
Branch
(branchNo)
Has*-
Staff
(staffNo)
. 11.3, ,
Has
" "
, . (, Supervises
() Manages ()) ,
(, LeasedBy ( )). . ER- .
, (,
Branch Has Staff ( ) ,
Staff Has Branch ( )).
,
,
(. Branch Has > Staff), . 11.4.
402
III.
http://openlib.org.ua/
11.2.1.
. , . , , .
(degree) . ,
, . (binary). Has, , 11.4, , Staff
Branch.
. 11.5 POwns
PrivateOwner PropertyForRene. . 11.1.
Has POwna,
. ,
, .. .
" "
POwns*-
. 11.5. POwns
(ternary). Registers ()
, Staff, Branch Client.
.
.
UML
. , , ,
. , . 11.6
.Registers. . 11.1 .
"
"
. 11.6. Registers
11. "-"
403
http://openlib.org.ua/
(quaternary). . 11.1 ,
. 11.7 Arranges , Buyer (), Solicitor (
), Financiallnstitution ( -) Bid ().
, ,
, .
11.2.2.
: . , , .
Supervises, , . , S t a f f Supervises :
, , .
(unary).
, .
, .
. 11.8 Supervises. Supervises Staff
Supervisor (), Supervisee (
).
, . , Staff Branch Manages Has. . 11.9,
. ,
Staff Manages Branch, ( Staff) Manager () ( Branch), Branch
O f f i c e ( ). Branch Has Staff
Branch O f f i c e , Member of Staff ( ).
",
, ''
. 11.7, Arranges
404
III.
http://openlib.org.ua/
" (Supervisor)
(Supervisee)"
Supervisee
. 11.8. Supervises
Supervisor Supervisee
' '
Manages
-Has
" "
. 11.9. ,
Manages Has,
, ,
, .
11.3.
. .
. ,
staff () staffNo (
), name (), position () salary (). , , .
11. "-"
405
http://openlib.org.ua/
, , , , ,
11.5. .
- . .
, .
,
; , (. 3.2). ,
1 15 . ,
rooms ( ) PropertyForRent
1 15.
. , address () Branch ( ), PrivateOwner ( ) BusinessOwner
( ) ,
. , . , address Branch ,
street, city postcode.
name () ,
. , ,
,
.
, ER-.
, , , .
11.3.1.
. ,
j .
. position () salary
() Staff. ,
* , ,
; .
, . , address
() Branch, ,
'163 Main St, Glasgow, Gil 9QX 1
street ('163 Main St'), city ('Glasgow 1 ) postcode ( ' G i l 9QX 1 ) address
street, city postcode , address
.
406
III.
http://openlib.org.ua/
11.3.2.
; . ,
^ .
. , Branch
(branchNo), , ' ' . branchNo .
>. . ,
; .
. , Branch
telNo ( ). , '' '0141-339-2178' '0141-3394 4 3 9 ' . , telNo .
(, ,
). , telNo . ,
.
11.3.3.
; . , ,
^ ,
j ( ) .
. , duration ( ) Lease (
) rentstart ( )
rentFinish ( ),
Lease. duration ,
rentstart rentFinish.
. , totalStaff
( ) staff
s t a f f .
. , deposit
() Lease. deposit
. , deposit Lease rent PropertyForRent.
11. "-"
407
http://openlib.org.ua/
11.3.4.
. ,
.
,
. , (branchNo)
Branch, Branch. ,
. , NULL
(. 3.2). , (, ' '), .
^;1^|^9^^|;91 ^^||3-11^^1^11^; '" ' '
. ,
|: .
!|
. ,
staf fKo,
(National Insurance Number NIN),
. , Staff
, .
, ,
. , (, ' SG14 ' )
, ,
(, ' WL2206S8D 1 ). , Staff staff No, NIN, .
. ,
.
, , , , . , Advert ( ) propertyNo, newspaperName, dateAdvert cost.
. propertyNo, newspaperName ( )
dateAdvert ( ). , Advert
( ) ,
propertyNo, newspaperName dateAdvert.
, , ,
. ,
408
III.
http://openlib.org.ua/
Manages *-
Staff /
f
staff No {PK}
name
position
salary
/totalStaff -*
Has
Branch
/
\- J
^"""
~~*^
branchNo {PK}
street
city
telNo [1..3]
~-"
ER-
.
, . ER- ,
{} .
,
. , . , . 11.10
address Branch, ,
, street, city postcode.
.
, telNo [1. .*] , ,
telNo . , 11. "-"
409
http://openlib.org.ua/
11.4.
.
. ,
- .
, . , . 11.1, S t a f f , Branch, PropertyForRent Client. , ()
. ,
staff No, S t a f f .
::: . / - .
.
Preference () . 11.11. ,
,
. , ,
Preference . ,
Preference
.
, ,
Client, : clientNo. Preference Client
,
.
, , , .
11.5.
11.3, .
Advertises
Newspaper PropertyForRent, . 11.1. ,
, .
410
111.
http://openlib.org.ua/
" "
States
. 11,11. Client
Preference
, ,
, . , , , ,
() ,
. , . 11.12
Advertises dateAdvert cost.
. 11.1 Manages
mgrStartDate bonus.
" "
Newspaper
newspaperName
Advertises *
i
l
i
l
l
l
PropertyForRent
propertyNo
dateAdvert
cost
. 11.12. Advertises
daCeAdverC cost
,
,
. , dateAdvert cost
Advertises Advert (
).
11. "-"
411
http://openlib.org.ua/
11.6.
, ,
. , . ,
. ,
, .
= . ( )
, ,
.
. ( -), . ,
.
, . " "
(1:1), " " (1:*) " " (*:*),
:
(1:1);
,
(1:*);
(*:*)
11.6.1-11.6.3 ,
, ER-.
11.6.4 .
, ER-. , ER-
, .
, , . 412
111.
http://openlib.org.ua/
Staff (staffNo)
SG5
\
\
Manages
/
/
Branch (branchNo)
/
/"-..,:
* '--.
Sl.21
BOQ5
I
\
, , ,
. , , , .
. 11.13, s t a f f No ( ) SG5 branchNo, , s t a f f N o SL21 branchNo B005,
staffNo SG37 . ,
, . , , , ,
" " (1:1).
1:1
. 11.14 ER- Staff Manages Branch.
,
, Branch
. .1. ,
, Staff
1. .1. ( , 1:1 , .)
11. "-"
413
http://openlib.org.ua/
,
, ,
"
^,
[
1
' ^/
Staff
staffNo
1..1
Manages >
Branch
0..1
branchNo
. 11.14.
(1:1)
Staff
(staffNo)
SG37
PropertyForRer t
(propertyNo)
^-
SA9
r2
& ""'
p<*3
PA;
. 11.15 , staffNo, SG37, propertyNo PG21
PG36, s t a f f N o SA9 propertyNo PA14, staffNo
SG5 , propertyNo PG4 . ,
, , ,
. , ,
, , , ,
. "
" (1:*).
1 :*
. 11.16
ER-
Staff
Oversees
PropertyForRent. , 414
III.
http://openlib.org.ua/
, ,
,
PropertyForRent 0. . *. ,
, S t a f f . . 1.
( , 1:* ,
, "" "".)
,
. , , ,
100, 0. . * 0. . 100.
Advertises
Newspaper
. 11.17, Glasgow Daily
propertyNo PG21 PG36, The
West News propertyNo PG36,
Aberdeen Express
propertyNo PA14. , propertyNo PG4
. , , ,
. , , , .
" " (*;*).
" ?*
,
".
Staff
staffNo
0..1
"
,
,
"
Oversees >
PropertyForRent
0..*
propertyNo
Property
415
http://openlib.org.ua/
Newspaper
(newspaperName)
Advertises
PropertyForRent
(propertyNo)
*:*
. 11.18 ER- Newspaper Advertises
PropertyForRent. ,
, ,
PropertyForRent 1..*.
, ,
, ,
Newspaper 0. . *.
( , *:* ,
, .)
11.6.4.
, , .
" ,
,
"
"
,
,
,
"
Advertises
.
. 11.18.
Newspaper
PropertyForRent " "
416
Advertises
III.
http://openlib.org.ua/
( ). (
^ ) n- , <-1) .
, n- , , , (-1)
, , . ,
, ,
. Registers Staff, Branch 1 lent
(, 11.19 11.20). . 11.19
Registers ( rl 5). ()
Staff, Branch Client. Staff, Branch Client, : staffNo, branchNo
clientNo. , . 11.19 Registers, Staff Branch .
Staff/Branch
(staff No/branchNo)
Registers
Client (clientNo]
. 11.20. Registers
11. "-"
417
http://openlib.org.ua/
. 11.19 staffNo/branchNo clientNo, , sCaf fNo SG37, branchNo B003, clientNo CR56 CR74, staffNo SG14 branchNo
clientNo CR62, CR84 CR91. , staffNo SG5 kranchNo . , staffNo branchNo , clientNo
. .Registers
Staff Branch 0..*, ER- 0. . *, Client.
, , Staff/Client 1..1,
Branch. , Client/Branch
1..1, Staff.
ER- Registers . 11.20.
,
,
. 11.2.
11.2.
. .1
1. . 1 ( 1)
0 . . * ( *)
1--*
, , -
, , ,
11.6.5.
,
.
:: . -:
, ,
. \
'.
'.I 1 '"
- '
V >'._" ,:
^ "
" (1:1), " " (1:*) " " (*:*).
::;
. _ . - , ; - .
' - , !
"> '
''
'
',
"
" :
'
. -'
.. .
'
. . ,
^ .
VV /
418
'
'
'
III.
http://openlib.org.ua/
11.7. ER
,
. ,
(connection trap),
[160].
:
"" (fan trap) "" (chasm trap), ER-.
, . ,
.
11.7.1. ""
"". , ; ,
[ .
"
"
"
"
Staff
staffNo
Branch
Manages *
1..1
0..1
"
-
" (
)
branchNo
"
'
(
]_
. 11.21. ,
Staff Manages Branch (1:1)
11. "-1
419
http://openlib.org.ua/
UML
{}
EntityName
attributeName {PK}
attributeName {AK}
attributeName
attributeName
attributeName
/attributeName
attribute [min..max]
RelationshipName
Minvalue.. Maxvalue
.
().
().
.
/ .
[min..max]
(MinVa!ue..MaxValue)
()
. 11.22. , , ER-
"" ,
1:* .
"" . 11.23, 1:* (Has
Operates) Division.
420
III.
http://openlib.org.ua/
Staff
4 Has
1..'
1..1
Division
Operates *
1..1
1..'
Branch
. 11.23. ""
, (Division)
(Branch) .
, . . 11.24 , Has Operates
S t a f f , Division Branch.
: " 'SG37'?"
, , . ,
' ' ' 0 0 7 ' .
"", S t a f f , Division Branch. ER- , . 11.25.
Staff
Division
Has
Operates
Branch
"
11. "-"
421
http://openlib.org.ua/
Operates Has
(. 11.26), , . , 'SG37' ' ', ' D1'.
11.7.2. ""
"". , , ' ;.
"" ,
, ( ),
. . 11.27 ""
Branch, Staff PropertyForRent.
, ,
, .
- .
, , .
. 11.28 Has Oversees,
Branch,
Staff PropertyForRent.
Division
Branch
Operates
Staff
Branch
Has*1..1
1/
Staff
Oversees *
0..1
PropertyForRent
. 11.27. '"
422
III.
http://openlib.org.ua/
Staff
Branch
Oversees
PropertyForRent
: "
' 1 4 ' ? " , ,
,
- . ( ,
- ),
"".
S t a f f PropertyForRent Oversees , , ,
. Offers
Branch PropertyForRent. ER-,
. 11.29, . , , , , .
Has,
Oversees Offers (. 11.30), , : '14'
' 0 0 7 * .
Has
Oversees
Offers
Offers
""
11. "-"
423
http://openlib.org.ua/
Branch
Has
Staff
PropertyForRent
,
( ). ,
.
. , , ,
, .
, , .
.
, .
, .
,
.
424
III,
http://openlib.org.ua/
,
.
,
.
, , ,
.
,
,
, .
,
.
,
. , .
(
) ,
.
(
) -
, (-1) .
, .
,
.
"" ,
, .
"" , , .
11.1. , ER-,
.
11.2. , ER-,
-, -, - .
11.3. , ER-, , , ,
.
11.4. ?
11.5. ?
11. "-"
425
http://openlib.org.ua/
11.6.
, ?
11.7. .
11.8. ,
.
11.9. ""
"" ER- ?
11.10. ER- .
) , .
) , ), , .
) !!, ),
,
.
) , ),
.
) ER-, )-),
ER-.
11.11. , ,
. 30 , 100
. , , . , .
.
) .
) .
, .
) ) ), ER-,
.
11.12. ,
. .
, ,
, , , . , . , , .
:
, .
426
II.
http://openlib.org.ua/
, .
, . ,
, , , ,
, , , , , . . ,
. , Action (), Adult ( ), Children
( ), Drama (), Horror ( ) SciFi ( ). , . ,
. , , . , .
. , , : , , , , ,
, , , . .
) .
) " , ),
ER-.
) ,
).
ER-, ).
) .
ER-, ).
) () .
) , )-), ER-. , .
11. "-"
427
http://openlib.org.ua/
http://openlib.org.ua/
"-"
...
, ER-,
,
.
"-" (EER
Enhanced Entity-Relationship), /,
.
/,
EER-
UML (Unified Modeling Language ).
11 "-" (ER
Entity-Relationship).
,
, ,
. 1980- ,
.
(CAD Computer-Aided Design),
( Computer-Aided Manufacturing), (CASE Computer-Aided Software Engineering),
(OIS Office Information Systems) ,
(GIS
Geographical Information Systems). 24. ER-
, ,
"" . , ER-.
ER-, ,
"-"
(Enhanced
EntityRelationship EER). EER-: /, . -
http://openlib.org.ua/
/, EER-
UML (Unified Modeling Language ) [35]. 11 UML
ER-.
12.1. /
/ ,
, . ,
, /. . /, . ,
/
"-" (EER-) UML.
, /
"-" (ER-) Branch
DreamHome, , 11.1.
12.1.1.
11,
, Staff (), Branch () PropertyForRent
( ). , , .
. , ; ,
.
."
.;.,
,;
. 1 .
III.
http://openlib.org.ua/
12.1.2. /
.
, , , ,
,
. "
" (1:1) / (. 11.6.1). ;
,
, , Manager
SalesPersonnel
S t a f f . , ; , ,
, .
, , . , , salesArea ( ) carAllowance
( ). Staff
, , ,
, . , , s t a f f N o ( ), name ( ),
position () salary (). ,
. , , , (), . ,
, ,
, SalesPersonnel
Uses Car ( ).
AllStaff
( ), . 12.1.
, .
, ( ), , ,
( : staffNo, name, 'position salary), ,
,
, . ,
, Manager (mgrStartDate (
) bonus ()), SalesPersonnel (salesArea carAllowance)
Secretary (typingSpeed ( )), , . , , 12. "-"
431
http://openlib.org.ua/
12.1.3.
, , ,
" ", ,
, , , .
,
SalesPersonnel Staff ( staffNo,
name, position salary), ,
SalesPersonnel ( salesArea carAllowance).
, , ,
, . , .. . ; ,
(, Manager Staff),
(, Staff Manager)
IS-A (, Manager IS-A ( ) Staff). .
, , . ,
,
II
staffNo
name
position
salary
SL21
SG37
SG66
John White
Ann Beech
Mary Martinez
Mary Howe
Stuart Stern
Robert Chin
Susan Brand
Manager
Assistant
Sales Manager
Assistant
Secretary.
Snr Sales Asst
Manager
30000 01/02/95
12000
27000
9000
8500
17000
24000 01/06/91
SA9
SL89
SL31
SG5
,
,
II
mgrStartDate bonus
sales
Area
car
Allowance
SA1A
5000
SA2B
3700
*'
typing
Speed
2000
100
2350
. 12.1. AllStaff,
432
http://openlib.org.ua/
. , , . .
12.1.4.
. ;:; .
.
.
, ( ),
( ). , ,
S t a f f . S t a f f , , / . , ,
, , , Manager, SalesPersonnel
Secretary S t a f f .
12.1.5.
I .
.
, . , , Manager,
SalesPersonnel Secretary .
,
, . ,
, , , Manager, SalesPersonnel
Secretary s t a f f .
,
/.
/
UML /. , / Staff, , . Staff Manager, SalesPersonnel Secretary
12. "-"
433
http://openlib.org.ua/
"-" (EER-),
. 12.2. , Staff , .
, .
{Optional, And) / , .
12,1,6.
, ,
, . ,
salesArea carAllowance SalesPersonnel
Manager Secretary.
, Manager
(mgrStartDate bonus) Secretary (typingSpeed).
, , , . , s t a f f No, name,
position salary S t a f f . , , . ,
. 12.2 Manager Branch
Manages (), Staff Branch Has ().
. ,
Staff FullTimePermanent
( ) Part Time Temporary ( ),
,
. 12.2. / S t a f f , ,
434
III.
http://openlib.org.ua/
,
AssistantSecretary
Secretary, S t a f f . ,
AssistantSecretary
Secretary S t a f f . AssistantSecretary Staff (staffNo, name, position salary) Secretary (typingSpeed), startDate.
{Mandatory, Or}
FullTitnePermanenl
PartTimeTemporary
salaryScale
holidayAllowance
hourlyRate
, 12.3. / Staff,
12. "-"
435
http://openlib.org.ua/
12.1.6. /
/ , : (participation constraint) (disjoint constraint)
; . , .
"
- ;
: - . : > . /
< :
\:
..
''
'
'
:*,'2,
.
/ ,
. , , "Mandatory" (). , . 12.3 /, ,
.
436
111.
http://openlib.org.ua/
/ , .
, , , ,
"Optional" (). ,
, /,
. 12.3, , , , Manager, SalesPersonnel Secretary.
; .
,
; .
, . , .
/
"Or". , . 12.3 /, , , ,
,
, .
, /, ( ),
.
/
"And". , . 12.3 /
, ,
Manager, SalesPersonnel Secretary. , SalesManager, . 12.4.
, , , ,
SalesManager AssistantSecretary, . 12.4, .
,
, , : " ", " ", " " " ".
12.1.7. /
Branch DreamHome
, , EER- /
( 1.6). ,
12. "-"
437
http://openlib.org.ua/
, ( ),
,
EER-.
11 , ER. Branch
Dreamffome. . 11,1 ER-.
/
ER- Branch EER-.
, . 11.1. ,
, . Branch , /, .
) , S t a f f , . 11.1, . Branch DreamHome,
,
, : Manager Supervisor ().
. ,
staff (. . 11.1),
S t a f f , Manager Supervisor,
Manager Supervisor S t a f f . , . ,
S t a f f Manager
Supervisor, staf fNo.
, Supervisor , . ,
Manager : ragrStartDate
bonus. Manager Supervisor
Manager Manages Branch ( )
Supervisor Supervises 3'iaff ( ).
Manager Supervisor Staff, . 12.5. , EER- .
; ,
/ .
/ Staff
( (Optional, Or}),
, ,
. , S t a f f ,
, ,
: Manager Manager Branch Supervisor Supervises S t a f f .
438
III.
http://openlib.org.ua/
Supervises
. 12.5.
Manager
Staff
Supervisor
) / .
Branch : PrivateOwner
( ) BusinessOwner ( ),
. 11.1. . , PrivateOwner BusinessOwner (. . 11.1),
Owner (), , PrivateOwner BusinessOwner
Owner. , , ,
. PrivateOwner
BusinessOwner (address () telNo
( )) ,
(PrivateOwner
POwns
PropertyForRent
12. "-"
439
http://openlib.org.ua/
Owner
PropertyForRent
Owns >
address
telNo
1..1
(Mandatory, Or)
PrivateOwner
BusinessOwner
ownerNo {PK}
name
bNarne {PK}
bType
contactName
1..*
propertyNo jPK}
address
street
city
postcode
type
rooms
rent
/
. / ,
.
) Branch DreamHome , . , , , number name.
Person (),
Staff ( Manager
Supervisor), PrivateOwner Client, . 12.7.
,
/ Branch
DreamHome.
/, ) ),
) (. 12.8). EER- , . 12.7, / ,
, , Branch PropertyForRent.
, / , .
,
14, /
1.6.
2.3,
, ,
, , . , / , 440
III.
http://openlib.org.ua/
{Mandatory, Or}
Staff
PrivateOwner
Client
position
salary
address
telNo
telNo
(Optional, 0 ;
Supervisor
Manager
dateMgrStart
bonus
12.2.
-. "has-a" () "is-part-of (
) , "", "".
, .
"has-a" "is-part-of",
("")*
(""). [35]. ,
,
.
Has, Branch ("") Staff ("").
12. "-"
441
http://openlib.org.ua/
dvartises
0..'
Newspaper
news pa rN a m e
Pi ivate Owner
BusinessOwner
ownerNo
bName
UML , , "". . 12.9 EER-, . 12.8, . EER- : Branch Has
Staff ( ) Branch Offers PropertyForRent
442
III.
http://openlib.org.ua/
,
' ""
. Has Offers^
"
Branch
branchNo
,
( "1'
Offers
. 12.9. : Branch Has
Branch O f f e r s PropertyForJ?ent
staff
( ). Branch "",
.
12.3.
. , , : "" "".
!(.'..
"'
"
.:;.-
-,.',-..-,.
.;:.
"
,
, ""
"". , , "" "" [35]. "" "", ,
"". , .
. 12.8 .
, Displays (), Newspaper () Advert ( ).
12. "-"
443
http://openlib.org.ua/
, , Advert
("") Newspaper ("").
,
. , Staff
"" Branch.
UML , , "". ,
. 12.10, Newspaper Displays Advert
Newspaper, "", .
,
"" 8
Displays
""
Displays
. 12.10.
Advert
Newspaper
Displays
/, ,
, . , , "has-a" "is-part-of", , , it
( "", "").
( 2.5
15). , EER-, . 12.11.
,
.
,
, ER-.
444
111.
http://openlib.org.ua/
, = Mandatory
Optional
/".
= And Or
"
""
"1
""
,
"" ""
. 12.11. , EER-
12. "-'
445
http://openlib.org.ua/
,
, .
, .
.
.
/ : .
, .
, - ,
"has-a" () "is-part-of" (
) , "", "".
, ,
"" "".
:
12.1. .
12.2. .
12.3. .
12.4. EER-?
12.5. ?
12.6. .
12.7. , ,
/.
12.8. , .
12.9. , "-", /, / , ,
.
12.10. , "-", /, / , ER- , 11.12.
, ER-
EER- .
446
ill.
http://openlib.org.ua/
...
.
, ,
: ,
.
.
.
, .
,
:
(1), (2) (),
- ().
(4) (5) .
, .
. , ,
(normalization).
, . , IV, , , .
.
'
-':: .,'"'
- ;".'
1 :,': . '<!:"
' 1 ,;:
13.1 .
13.2 , . 13.3
, : -
http://openlib.org.ua/
, . 13.4
, :
(1) ( 13.5), (2) ( 13.6)
() ( 13.7). 2 ,
, . 13.8
2 ,
. 13.9
, - (). 13.10 , () . 13.11
13.12 , ,
(4) (5) .
15 , ER- ( 11 12) .
, .
DreamHome,
10.4, .
13.1.
- .
I , .
. . [68]. ( ) . :
(1), (2) (). . . . [69]
, - (). , [212], , , .
(4) (5) [109], [110]. .
3 , .
, ER- (. 15). ,
.
, 448
. 111.
http://openlib.org.ua/
, . ,
, .
13.2.
, , , . ,
, , Staff
Branch . 13.1 13.2 StaffBranch . 13-3.
StaffBranch Staff
Branch. :
Staff
Branch
StaffBranch
, .
13.1. Staff
staffNo
sName
position
salary
branchNo
SL21
John White
Manager
30000
BOOS
SG37
Ann Beech
Assistant
12000
B003
SG14
David Ford
Supervisor
18000
SA9
Mary Howe
Assistant
9000
B007
SG5
Susan Brand
Manager
24000
SL41
Julie Lee
Assistant
9000
BOOS
13.2. Branch
branchNo
bAddress
005
007
13.3. StaffBranch
position
salary
branchNo
bAddress
John White
Manager
30000
BOOS
Ann Beech
Assistant
12000
David Ford
Supervisor
18000
staffNo
sName
SL21
SG37
SG14
13.
449
http://openlib.org.ua/
. 13.3
staffNo
sName
position
salary
branchNo
bAddress
SA9
Mary Howe
Assistant
9000
8007
SG5
Susan Brand
Manager
24000
BOOS
SL41
Julie Lee
Assistant
9000
BOOS
Staff Branch ,
,
. Branch , Staff
(branchNo),
. , ,
, , .
13.2.1.
,
Staf fBranch (, . 13.3).
Staf fBranch. , . ,
' 0 0 7 ' ' 0 0 7 ' ,
StaffBranch. , . 13.1
13.2, , Staff
. ,
' B O Q 7 ' , Branch.
,
, NULL StaffBranch,
staffNo. staffNo StaffBranch,
NULL staffNo
(. 3.3) . ,
StaffBranch , NULL staffNo. , . 13.1 13.2,
, Branch . , ,
Staff .
13.2.2.
StaffBranch
. ,
450
III.
http://openlib.org.ua/
13.2.3.
Staff Branch (,
' ' ) .
Staf fBranch., . ,
' ' , , .
,
. 13.1 13.2 Staff Branch , Staf fBranch, . 13.3. ,
StaffBranch ,
Staff Branch.
. -, , . -, , ,
. , , , ,
.
.
, .
13.3.
(functional dependency)
[212].
,
.
13.3.1.
, (, , , . . ., Z)
R = (, , , . . . , Z ) . ,
.
13.
451
http://openlib.org.ua/
. . R, ,
( {)),
. ( . .)
( ) . ,
, , .
, . ,
, ,
. ,
, . .
, . 13.1.
. 13.1.
. , .
, ,
(determinant). , . 13.1
. .
13.1.
staffNo position Staff,
. 13.1. staffNo (, 'SL21'),
, ('Manager'). ,
position staffNo,
. 13.2, . . 13.2, , , staffNo position.
, , , .
staffNo position " "
(1:1),
. position s t a f f N o "
" (1:*), ( 452
III.
http://openlib.org.ua/
), . staffNo staffNo-position.
, " ".
position
staffNo
SL21
Manager
staffNo
position
SL21
Manager
SG5
)
, , , . , (.. ),
(.. ) (. 3.2.1).
.
I 13.2. ,
, staffNo sName
Staff (. . 13.1). ,
staffNo, SL21,
, John White. , , , sName, John White,
,
SL21. ,
13.
453
http://openlib.org.ua/
staffNo sName /
sName staffNo? , Staff (. . 13.1),
s t a f f No sName,
:
staffNo - sName
sNarae
> staffNo
, Staff (. 13.1), staffNo sName - , ", .
, , , , . , ,
.
,
. , ,
staffNo, , , sName, . , (staffNo) ,
(sName). , sName
, ,
(staffNo) . , staffNo sName
" " (1:1), . , sName
staffNo " " (1:*),
. , s t a f f N o sName Staff,
:
staffNo > sName
,
,
. ,
. , . , ,
, ( ) ., ()
, .
454
III.
http://openlib.org.ua/
I 13.3.
Staff .
s t a f f N o , sName sName
staffNo, sName - staffNo
staffNo
sName Staff, ,
, .
, ; ,
.
:
" " , ;
;
.
.
I 13.4.
StaffBranch
StaffBranch
(. . 13.3J. , ,
, .
,
:
s t a f f N o sName, position, salary, branchNo, bAddress
branchNo > bAddress
bAddress > branchNo
branchNo, position > salary
bAddress, position > salary
,
StaffBranch,
staffNo,
branchNo,
bAddress, (branchNo, position) (bAddress, position).
,
, ,
, .
13.3.2.
,
13.
455
http://openlib.org.ua/
. ,
,
.
.
I 13.5. StaffBranch
StaffBranch (. . 13.3).
staffNo, branchNo, bAddress,
(branchNo, position) (bAddress, position).
() StaffBranch,
, ( ) .
, ,
(.
3.2.5). , (
, ), .
StaffBranch, , staffNo, staffNo.
branchNo, bAddress, (branchNo, position)
(bAddress, position) ,
.
,
,
, , ( ) . .
. , ,
13.4, .
13.3.3.
" "
(1:1), , .
, . ,
( X) , ,
( Y)
, , Y X.
456
III.
http://openlib.org.ua/
,
X, , (Y).
, , . , >, ,
>. > 13.7.1.
, . ,
,
. .
"" .
,
,
, .
, X, X X*. , ,
, X* X. ,
, [7]. , , R. .
1. . , >.
2. . -^, , >, .
3. . > -, ^.
,
. ; , X , ,
X, X .
, - , X.
, X*.
, , ,
X 4 . , D R, .
4. . -^.
5. . >,
, - >.
6. . - ->, -*, .
7. . C->D, ,
>,
D.
1 () 4 () ,
. 13.
457
http://openlib.org.ua/
, , , ,
. 2 () ,
, . 3 ()
, . 5 () ,
. -^, , D
-, A-D. 6 () , , -, > A-D ,
, D. 7 () , 6, , .
F
, , , .
( 1-3) , . ,
,
, , .
*
, F (* F).
13.3.4.
. Y X, Y X*; ,
X.
X ,
.
1. X .
2. > X >,
, , X.
3. X , X.
, .
X X raln , X. ,
. StaffBranch
.
458
hi.
http://openlib.org.ua/
I 13.6.
StaffBranch
, , StaffBranch, 13.4, :
s t a f f No sName
staffNo
> position
s t a f f N o > salary
s t a f f N o - branchNo
s t a f f N o > bAddress
branchNo bAddress
bAddress branchNo
branchNo, position salary
bAddress, position > salary
StaffBranch. 1 , . 2
3 , ,
( 2),
,
X ( 3).
13.4.
( ) [68]. ,
, .
,
, ( )
.
, , .
() . ,
(1).
.
, 13.2, ().
. 13.3 . , 1
, 2 ..
. , 13.
459
http://openlib.org.ua/
. 13.3.
.
, .
13.5 (1).
13.6 13.7 (2) () , ,
( 13.8).
(2 ) , . 13.9
- (), ,
(4 5),
( 13.10 13.11).
,
,
. , . , IV , ,
, , ,
ER-, 11 12.
ER- , , , .
13.5. (1)
, .
(). ,
.
(1). , .
460
ill.
http://openlib.org.ua/
(, )
.
() .
(1)
.
,
, () .
, "" , , . .
1. .
, . ""
("flattening") . , , (
)
.
, .
2.
,
. .
,
.
, . ,
.
, ,
1 .
1 , . Dreamffome.
13.7. (1)
. 13.4 ,
DreamHome.
'John Kay 1 , , ' Tina Murphy'. ,
.
, , 'John Kay' 'Aline
Srewart', ,
. 13.4. ().
13.
461
http://openlib.org.ua/
DreamHome Lease
DreamHome Lease
<
DreamHome Lease
Property Number PG4
Property Address
6 Lawrence St, Glasgow
John Kay
Full Name
^ Murphy
(Please print)
. 13.4. DreamHome
13.4. ClientRental
client
No
CR76
CR56
cName property
No
pAddress
rent
Start
rent
Finish
rent
owner
No
oName
John
Kay
PG4
6 Lawrence
St Glasgow
1-Jul-OO
31-Aug-Ol
350
C040
Tina
Murphy
PG16
5 Novar Dr,
Glasgow
l-Sep-01
l-Sep-02
450
C093
Tony
Shaw
6 Lawrence
St, Glasgow
l-Sep-99
10-Jun-OO
350
C040
Tina
Murphy
PG36
2 Manor Rd,
Glasgow
10-Oct-OO
l-Dec-01
375
C093
Tony
Shaw
PG16
5 Novar Dr,
Glasgow
l-Nov-02
10-Aug-03
450
C093
Tony
Shaw
Aline
PG4
Stewart
ClientRental
(-) clientNo ( ). ,
. :
= (propertyNo, pAddress, rentStart,
rentFinish,rent, ownerNo, oName)
-
. , John
462
III.
http://openlib.org.ua/
rent
owner oName
No
350
C040
Tina
Murphy
l-Sep-01 l-Sep-02
450
C093
Tony
Shaw
6 Lawrence St,
Glasgow
l-Sep-99 10-Jim-OO
350
C040
Tina
Murphy
Aline
Stewart
2 Manor Rd,
Glasgow
10-Oct-OO l-Dec-01
375
C093
Tony
Shaw
Aline
Stewart
5 NovarDr,
Glasgow
l-Nov-02 10-Aug-03
450
C093
Tony
Shaw
clientNo property
No
cName
pAddress
rentstart rent
Finish
CR76
PG4
John Kay
6 Lawrence St,
Glasgow
1-Jul-OO
CR76
PG16
John Kay
5 Novar Dr,
Glasgow
CR56
PG4
Aline
Stewart
CR56
PG36
CR56
PG16
31-Aug-Ol
ClientRental :
ClientRental (clientNo, propertyNo, cName, pAddress, rentstart,
rentFini sh, rent, ownerNo, oName)
ClientRental ,
.
, , . , ClientRental . 1 , 13.2.
, .
( )
(clientNo),
. 13.7. (
. 13.6.)
. 1 .
13.
463
http://openlib.org.ua/
cName
CR76
John Kay
CR56
Aline Stewart
13.7.
(1) PropertyRentalOwner
rentStart
rentFinish
rent
owner
oName
No
property pAddress
No
CR76
PG4
6 Lawrence St,
Glasgow
1-Jul-OO
31-Aug-Ol
350
C040
Tina
Murphy
CR76
PG16
5 NovarDr,
Glasgow
l-Sep-01
l-Sep-02
450
C093
Tony
Shaw
CR56
PG4
6 Lawrence St,
Glasgow
l-Sep-99
10-Jun-OO
350
C040
Tina
Murphy
CR56
PG36
2 Manor Rd,
Glasgow
10-Oct-OO
l-Dec-01
375
C093
Tony
Shaw
CR56
PG16
5 Novar Dr,
Glasgow
l-Nov-02
10-Aug-03
450
CO 93
Tony
Shaw
client
No
(Client PropertyRentalOwner)
, . Client ,
PropertyRentalOwner . , . 1,3.7, , , 13.2.
1 2 Client Rental,
. 13.5. , . Client PropertyRentalOwner.
13.6. (2)
(2) , .
464
III.
http://openlib.org.ua/
13.6.1.
. -~ ,
,
,
.
> , - . -^ ,
, .
, :
staffNo, sName > branchNo
( s t a f f N o , sName) toranchNo. ,
branchNo {staffNo,
sName), .. staffNo. .
13.6.2.
, .. , . ,
, , 2. , 2, , 13.2. , ,
' PG4',
ClientRental, . 13.5.
, .
* (2). ,
, t , ; .
1 2
, ClientRental, . 13.5. , -
. 1
2 .
13.
465
http://openlib.org.ua/
I 13.8. (2)
. 13.5 ( fdl fd6) ClientRental (clientNo, propertyNo}
.
ClientRental
clientNo prop srtyNo
cHame
fdl
fd2
( )
( )
fd3
11
i (
(
1 )
fd4|_
^
fdS
wet
t
t
1\
( )
, 13.5. ClientRenCal
ClientRental ,
,
, . 13.8.
ClientRental
fdl
fda
fd3
id Pi
fd6
ClientRental
.
466
III.
http://openlib.org.ua/
. , cName , ,
clientNo ( fd2).
, (pAddress, rent, ownerNo, oName)
,
propertyNo ( fd3). , (rentstart rentFinish) , ..
clientNo propertyNo ( fdl).
, . 13.5 (transitive dependence) ( fd4). ,
2.
.
, ClientRental, a
, .
ClientRental 2
, , , ,
, .
Client, Rental PropertyOwner,
. 13.8-13.10.
, , ,
.
:
Client
Rental
PropertyOwner
(clientJJo, cName)
(clientNo, properjtyNo, rentstart, rentFinish)
(propertyNo, pAddress, rent, ownerNo, oName)
cName
CR76
John Kay
CR56
Aline Stewart
rentstart
rentFinish
CRT 6
PG4
1-Jul-OO
31-Aug-Ol
CR76
PG16
l-Sep-01
l-Sep-02
CR56
PG4
l-Sep-99
10-Jun-OO
CR56
PG36
10-Oct-OO
l-Dec-01
CR56
PG16
l-Nov-02
10-Aug-03
clientNo
13.
467
http://openlib.org.ua/
pAddress
rent
ownerNo
oName
PG4
6 Lawrence St,
Glasgow
350
C040
Tina Murphy
PG16
5 Novar Dr,
Glasgow
450
C093
Tony Shaw
PG36
2 Manor Rd,
Glasgow
375
Tony Shaw
13.7. ()
2 ,
1, . , (,
Tony Shaw ( ownerNo))
PropertyOwner, . 13.10. , .
, . . .
13.7.1.
. ,
- -*, , ( , , ).
. , StaffBranch (. . 13.3):
s t a f f N o -> branchNo
branchNo > bAddress
13.7.2.
(). ,
,
, .
468
III.
http://openlib.org.ua/
2 .
,
. 2 13.9.
I 13.9. ()
,
Client, Rental PropertyOwner, .
ci lent
fd2
Rental
fdl
fd5*
fd6*
PropertyOwner
fd3
fd4
ownerNo -* oName
Client Rental
. , Client Rental
(). ,
(fd)
(*), fd5*, (
).
PropertyOwner , oName, ownerNo ( fd4).
, (oNarae)
, (ownerNo).
. 13.5.
PropertyOwner
PropertyForRent Owner, . 13.11 13.12. :
PropertyForRent
Owner
13.
469
http://openlib.org.ua/
pAddress
rent
ownerNo
PG4
6 Lawrence St,
350
C040
C093
C093
Glasgow
PG16
5 NovarDr, Glasgow
450
PG36
375
13.12. Owner ,
PropertyOwner
ownerNo
oName
040
093
Tina Murphy
Tony Shaw
PropertyForRent Owner ,
.
. 13.5
ClientRental ,
. . 13.6
, , 1 , :
Client
Rental
PropertyForRent
Owner
tclientNp, cName)
(clientNo, prop_ertyNq, rentStart, rentFinish)
(propertyNo, pAddress, rent, ownerNo)
(ownerNo, oName)
ClientRental, . 13.5,
Client, Rental, PropertyForRent
Owner.
. , ownerNo
Owner , , PropertyForRent . ownerNo,
, PropertyForRent Owner , .
ClientMental
PropertyOwner
Client
Rental
PropertyForRent Owner
. 13.6. 1
ClientRental
470
III.
http://openlib.org.ua/
cName
CR76
John Kay
.356
Aline Stewart
13.14. Rental ,
ClientRental
clientNo
propertyNo
rentStart
rentFinish
CR76
PG4
1-Jul-OO
31-Aug-Ol
CR76
PG16
l-Sep-01
l-Sep-02
CR56
PG4
l-Sep-99
10-Jun-OO
CR56
PG36
10-Oct-OO
l-Dec-01
CR56
PG16
l-Nov-02
10-Aug-03
13.15. PropertyForRent ,
ClientRental
propertyNo
pAddress
rent
ownerNo
PG4
350
C040
PG16
450
C093
PG36
375
C093
13.16. Owner ,
ClientRental
ownerNo
oName
40
Tina Murphy
093
Tony Shaw
13.
471
http://openlib.org.ua/
13.8.
(2) () ,
13.6 13.7, , , 13.2.
, .
2 , .
, 1,
. ,
,
.
(2).
, , , .
(). s
, ,
;; , .
2
, .
, , .
, , .
, , 2 ,
, , .
, 2 13.8 13.9, 13.6 13.7,
.
.
13.9. - ()
, ,
,
472
111.
http://openlib.org.ua/
13.2. ,
. ,
13.8, , , 13.8 2 .
,
. ,
,
, - () [69].
13.9.1. -
- () , .
, 13.8.
- ().
i: , .
, .
, ,
.
, , , . ,
. ,
- , ,
.
, Client, Rental, PropertyForRent Owner, . 13.1313.16. Client, PropertyForRent Owner
, ,
. , Rental : (clientNo,
propertyNo}, (clientNo, rentStart) (propertyNo, rentstart),
13.5 :
fdl
fdS*
fd6*
Rental , Rental . ,
:
13.
473
http://openlib.org.ua/
( ) ;
, .. , , .
,
,
.
13.10. - ()
DreatnHome . , , clientlnterview
(. 13.17). , ,
.
.
, .
13.17. Clientlnterview
clientNo
interview/Date
interviewTime
staffNo
roomNo
CR76
13--02
10:30
SG5
G101
CR56
13--02
12:00
SG5
G101
CR74
13--02
12:00
SG37
G102
CR56
l-Jul-02
10:30
SG5
G102
Clientlnterview :
(clientNo, interviewDate) , I s t a f f N o , interviewDate, interviewTime)
(roomNo,
interviewDate,
interviewTime).
,
Clientlnterview ,
,
interviewDate. (clientNo, interviewDate).
:
Clientlnterview (clientNo,
roomNo)
i nteviewDate,
interviewTime, staffNo,
Clientlnterview
fdl
fd2
fd3
fd4
474
- III.
http://openlib.org.ua/
Clientlnterview.
fdl, fd2 fd3 ,
. staffNo, interviewDate > roomNo ( fd4).
(staffNo, interviewDate} Clientlnterview,
, roomNo
(roomNo,
interviewDate,
interviewTime). (clientNo, interviewDate}
fd4, , Clientlnterview ,
(
),
(staffNo,
interviewDate), . , . Clientlnterview
. , 13 2002 (
--02 1 ) , 'SG5 1 ,
.
, .
Clientlnterview
Interview StaffRoom,
. 13.18 13.19. Interview Staf fRoom :
Interview
StaffRoom
staffNo)
13.18. Interview
clientNo
interviewDate
interviewTime
staffNo
CR76
13-May-02
10.30
SG5
CR56
13-May-02
12.00
SG5
CR74
13-~02
12.00
SG37
CR56
l-Jul-02
10.30
SG5
interviewDate
roomNo
SG5
13-May-02
G101
SG37
13-May-02
G102
SG5
l-Jul-02
G102
, , , . . ,
13.
475
http://openlib.org.ua/
( ). , .
, , .
, 13.10 Clientlnterview "" : roomNo, interviewDate, interviewTime
> staffNo, clientNo ( fd3), , . , staffNo, interviewDate > roomNo ( fd4),
Clientlnterview .
,
, , - fd4, ,
"" fd3. , ,
, fd4 Clientlnterview
.
, , fd4 Clientlnterview
. , fd3. , , fd3 - ,
. , .
13.10.
(1)
, .
- ( 13.11). 2 , .
2 .
13.11.
- ()
DreamHome ,
.
.
.
476
III.
http://openlib.org.ua/
,
. . 13.7
"Property Inspection Report" DreamHome
.
' PG4 ', .
DreamHome
Property Inspection Report
DreamHome
Property Inspection Report
Property Number PG4
Property Address 6Lawrence St, Glasgow
Inspection Inspection
Time
Date
18-Oct-OQ
10.00
22-Apr-Q1
1-Qet-OI
09.00
12.00
Comments
Need to replace
. crockery
in good order
Damp rot in bathroon
Registration
SG37
Ann Beech
SGt4
SGt4
M231JGR
Page 1
. 13.7. "Property Inspection Report" DreamHome
(1)
, . Staff Property Inspect ion;
. 13.20. propertyNo.
,
. , .
= (iDate, iTime, comments, s t a f f N o , sNarae,
carReg)
. , propertyNo (' PG4 ')
iDate (' IS-Oct-oo', '22-Apr-Ol 1 , '1-Oct-Ol')- ,
, 13.5.
13.
477
http://openlib.org.ua/
( ) ( ). StaffPropertylnspection , . 13.21.
13.20. StaffPropertylnspection
iTime comments
property pAddress
No
iDate
PG4
18-Oct-OO
6 Lawrence
St, Glasgow
l-Oct-01
5 Novar Dr,
Glasgow
sName carReg
No
22-Apr-Ol
PG16
staff
22-Apr-Ol
24-Oct-Ol
SG37
Beech
M231
JGR
SG14
David
Ford
M533
SG14
David
Ford
N721
HFR
SG14
David
Ford
M533
Ann
N721
HFR
SG37
Beech
HDR
HOR
13.21. StaffPropertylnspection
property
No
iDate
iTlme
pAddress
comments
staffNo
sName
carReg
PG4
18-Oct-OO
10.00
6 Lawrence St,
Glasgow
SG37
Ann
M231
JGR
PG4
22-Apr-Ol
09.00 6 LawenceSt,
Glasgow
12.00 6 Lawrence St,
Glasgow
13.00 5 Novar Or,
Glasgow
14.00 5 Novar Dr,
Glasgow
Need to replace
crockery
In good order
SG14
David
Ford
David
Ford
M533
PG4
l-Oct-01
PG16
22-Apr-Ol
PG16
24-Oct-Ol
Damp rotin
bathroom
Replace living
room carpet
Good condition
SG14
SG14
SG37
Beech
David
Ford
Ann
Beech
HDR
N721
HFR
M533
HDR
N721
HFR
StaffPropertylnspection :
StaffPropertylnspection (propertyN_o, iDate, iTime, pAddress,
comments, s t a f f N o , sName, carReg)
478
III.
http://openlib.org.ua/
StaffPropertylnspection ,
. , .
StaffPropertylnspection . , 1 .
.
(2)
1 2 . ,
.
( fdl fd6) StaffPropertylnspection
(propertyNo, iDate) . 13.8.
fdl
propertyNo,
iDate
>
s t a f f No , sName , carReg
fd2
propertyNo
fd3
staff
-*
sName
fd4
No
iTime,
comments,
Address
fd5
fd6
pAddress, comments
StaffPropertylnspection
propertyNo IDate {Time pAddress comments sta fhlo sName carReg
fdll
fti2\
t ( )
* ( )
{
1 )
fd3
fd4
fdsf
fdef
J ( )
( )
. 13.8. StaffPropertylnspection
13.
479
http://openlib.org.ua/
{propertyNo, Address)
(propertyNo, iDate, iTime,
sName, carReg)
comments,
staffNo,
, , ,
.
()
2
.
. Property
Propertylnspection
Property
fd2
Propertylnspection
fdl*
fd3
s t a f f N o ~* sNarae
fd4
staffNo,
480
HI.
http://openlib.org.ua/
fd5*
fd6*
Property , ().
Propertylnspection
, sName
staffNo ( fd3).
, staffNo, iDate -> carReg
( fd4J
carReg staffNo.
, , iDate. ,
, ,
. ( , 13.9.1,
, staffNo,
iDate - carReg , carReg
, {carReg, iDate, iTime)
Staff Propertylnspection.)
staff Propertylnspection staffNo > sName.
staff
PropertyInspect:
Staff
Propertylnspect
(staffNo, sNarae)
(propertyNo, iDate, iTime, comments, staffNo, carReg)
staff Propertylnspect , , , , . ,
Staff Propertylnspection, . 13,8, :
Property
{propertyNo, pAddress)
Staff
( s t a f f N o , sName)
Propertylnspect (p_rop_e_rtyNo, iDate, iTime, comments, staffNo, carReg}
- ()
13.
481
http://openlib.org.ua/
Property
fd2
propertyNo - pAddress
staff
fd3
s t a f f N o - Name
Propertyinspection
fdl*
fd4
s t a f f N o , iDate - carReg
fd5*
fd6*
, Property Staff
, . ,
, Property-Inspect, {staffNo, iDate), ( fd4). Propertylnspect
. , , ' SG14 ' 22
2000 (' 22-- '},
.
, .
Propertylnspect
, ,
StaffCar Inspection. :
StaffCar
Inspection
StaffCar Inspection , .
. 13.21
StaffPropertyinspection ( ) , . 13.9. Staf f Propertylnspect ion carReg,
iDate, iTime * propertyNo, pAddress, comments, staffNo, sName ( fd5*), . ,
staffNo, iDate > carReg ( fd4),
Propertyinspection .
, ,
:
Property
(propertyNo, pAddress)
Staff
(staffNo, sNaraei
Inspection (propertyNo, iDate, iTime, comments, s t a f f N o )
StaffCar
( s t a f f N o , iDate, carReg)
482
III.
http://openlib.org.ua/
Staff Propertylnspection
Propertylnspection
Propertylnspect
Staff
StaffCar
Inspection
Property
13.11. (4)
, , .
(Multi-Valued Dependency MVD), , [109].
(4).
13.11.1.
1,
. ,
. .
. 13.22 BranchStaffOwner, (sName) (oName)
(branchNo). , (sName)
, (oName) .
13.
483
http://openlib.org.ua/
13.22. BranchStaffOwner
branchNo
sManie
oName
Ann Beech
Carol Farrel
David Ford
Carol Farrel
Ann Beech
Tina Murphy
David Ford
Tina Murphy
1
' 1
'Ann Beech' 'David Ford . , 'Carol Farrel' 'Tina Murphy'.
,
,
. BranchStaffOwner . , ,
1:*.
: . (, , ),
. ^ .
,
:
->
-
, , BranchStaffOwner, . 13.22, ;
branchNo > sName
branchNo > oName
. , > R ,
= R. , , . ()
, .
. 13.22
BranchStaffOwner ,
.
,
BranchStaffOwner , ,
, sName
oName. , 484
III.
http://openlib.org.ua/
, , , . ,
.
BranchStaffOwner ,
- , . ,
, , BranchStaf fOwner.
13.11.2.
(4) -, * .
(4)
-, 4 [109].
4 .
, BranchStaf fOwner (. . 13.22)
4, .
BranchStaf f BranchOwner, . 13.23
13.24. 4,
BranchStaff branchNo - sName,
BranchOwner branchNo - oName. ,
4 , . , , BranchOvmer.
13.23. BranchStaff 4
branchNo
sName
Ann Beech
David Ford
13.24. BranchOwner 4
branchNo
oName
Carol Parrel
Tina Murphy
13.
485
http://openlib.org.ua/
13.12. (5)
. , . ,
. ( )
,
(5).
(5),
13.12.1.
. ,
.
. ,
, .
( ), ,
. , BranchStaff BranchOwner (. . 13,23 13.24), BranchStaffOwner (. . 13.22),
. ,
BranchStaf fOwner BranchStaff BranchOwner. ,
, [3]. (5).
13.12.2. (5)
(5). .
(5), , (Project-Join Normal Form PJNF), ,
[].
. 13.10
Property! temSupplieir.
(propertyNo),
(ItemDescription), (supplierNo)
(propertyNo). , - () (i), (s) (i), (s) , ,
(), ()
486
III.
http://openlib.org.ua/
PG4
'Bed'()
( 1),
PG4 S2
( 2 ) 1,
S2 'Bed
( 3 ) ,
1
S2 'Bed
PG4
ItemDescription
PG4
Bed
PG4
Chair
PG16
Bed
'
13.26. ItemSupplier 5
ItemDescription
supplierNo
Bed
Chair
Bed
13.
487
http://openlib.org.ua/
13.27. PropertySupplier 5
propertyNo
supplierNo
PG4
SI
PG4
S2
PG16
, ,
PropertyltemSupplier
.
[93], [106] [154].
) PropertyItemSupplier
( )
propertyNo Item Description upplierNo
PG4
PG4
PG16
Bed
Chair
Bed
S1
S2
S2
) PropertyltemSuppller
( )
propertyNo itemDescrlption supplierNo
PG4
PG4
PG16
PG4
Bed
Chair
Bed
Bed
81
S2
S2
32
:
,
. 13.10. : )
PropertyltemSupplier; ) PropertyltemSupplier
, . ,
.
, , .
, .
R.
( -), . (
.)
488
III.
http://openlib.org.ua/
( ), ,
.
,
, : " " , , .
() ,
.
(1) , .
(2) ,
, ,
, .
:
, , - .
() ,
, , , .
, : > -,
( , ).
(2) , , ,
, . ,
.
() , ,
, , . ,
.
() ,
.
(4) , - . , ,
3 , .
, , .
(5) ,
. R , , . . . ,
Z ,
R , , . . ., Z.
13.
489
http://openlib.org.ua/
13.1. ?
13.2. , , .
13.3. .
13.4. , ?
13.5. , ?
13.6. .
13.7. ()
(1).
13.8. , , , . .
13.9. (1)
(2)?
13.10. , 2. .
13.11. ,
. .
13.12. 2 2 . .
13.13. - () . .
13.14. ,
4. .
13.15. ,
5. .
490
ill.
http://openlib.org.ua/
Wellmeadows Hospital
Patient Medication Form
Patient Number:
FufI Name:
Robert MacDonold
Bed Number: 84
DrUfl
Number
Name
Description
P10034
WardJf
WardNumber:
Ward Name:
Dosage
Method of
Admin
10223
Morphine
Paia Kilter
JOmg/ml
Oral
10334
Tetracyclene
Antibiotic
Q.5mg/ml
IV
10223
Morphine
Pain Killer
JOmg/mf
Oral
QrMeyroedfc
Units per
Day
''-- 50
..
10 '
10
"
24/04/02
24/03/01
17/04/01
25/04/02
02/05/03
13.17. . 13.28
. ,
, . ,
, .
) . 13.28 .
, .
) . 13.28
. , , .
13.18. Instant Cover
. . 13.29 .
(National Insurance Number NIN).
) . 13.29 .
, .
) . 13.29
. , , .
13.19. . 13.30 (staffName),
(wardName), (patientName),
.
. , (staffName) , (patientName) .
" 13.
491
http://openlib.org.ua/
) , , . 13,30,
, 4.
) , . 13.30, . , .
) ,
. 13.30, 4.
13.20. , . 13.31,
(hospitalName), (itemDescription), (supplierNo)
(hospitalName). , (h)
(1), (s) (i)
()
(h), (s)
(i) (h).
(itemDescription) .
) , , . 13.31,
5.
) ,
. 13.31, 5.
13.28.
staffNo
dentistName
patNo
patName
appointment
date
appointment
time
surgery
No
S1011
Tony Smith
P100
Gillian
White
12-Sep-Ol
10.00
S15
S1011
Tony Smith
P105
Jill Bell
12-Sep-Ol
12.00
S15
S1024
Helen
Pearson
P10S
Ian
12-Sep-Ol
10.00
S10
S1024
Helen
Pearson
P108
Ian
14-Sep-Ol
14.00
S10
S1032
Robin Plevin
P105
Jill Bell
14-Sep-Ol
16.30
S15
S1032
Robin Plevin
P110
John
Walker
15-Sep-Ol
18.00
S13
MacKay
MacKay
contractNo
hours
eName
hNo
hLoc
1135
C1024
16
Smith J
H25
East Kilbride
1057
C1024
24
Hocine D
H25
East Kilbride
1068
C1025
28
White
H4
Glasgow
1135
C1025
15
Smith J
H4
Glasgow
492
III.
http://openlib.org.ua/
13.30. WardStaffPatient
ward Name
staff Name
patientName
Pediatrics
Kim Jones
Claire Johnson
Pediatrics
Kim Jones
Brian White
Pediatrics
Stephen Ball
Claire Johnson
Pediatrics
Stephen Ball
Brian White
13.31. HospitalltemSupplier
hiospitalName
itemDescription
supplierNo
Western General
Antiseptic Wipes
SI
Western General
Paper Towels
S2
Yorkhill
Antiseptic Wipes
S2
Western General
Antiseptic Wipes
S2
13.
493
http://openlib.org.ua/
http://openlib.org.ua/
497
525
569
603
http://openlib.org.ua/
http://openlib.org.ua/
...
.
: ,
,
.
"-"
, ,
.
.
.
.
. .
,
-.
, 15-17 ,
, ,
. , : ,
(. 9.1). .
,
.
, .
,
( ) ,
.
http://openlib.org.ua/
14.1
, .
14.2 ,
. 14.3 ; , .
,
,
ER-, 11 12.
15 . , .
. ,
, .
16 17
. ,
,
. ,
. , , .
, . " " " " "" "",
; ""
. ,
Staff DreamHome,
10.4 .
14.1.
, , , ,
.
498
IV.
http://openlib.org.ua/
14.1.1.
. , , ,
,
: .
, , , . , , . , , , ,
,
, , ,
14.1.2. ,
: ,
.
. 4 , -
^.
, . ,
, ,
, .
. ,
: .
(, ). .
,
.
14.
499
http://openlib.org.ua/
.
, .
". , , . , '= ! .
. . , ,
, .
14.1.3.
,
.
.
.
, , .
.
, .
.
(Database Design
Language DBDL).
DBDL .
,
.
, .
14.2.
,
. .
500
IV.
http://openlib.org.ua/
1. .
2. .
3. .
4. .
5. .
6. , .
7. ( ).
8. .
9.
.
10.
.
( )
1. .
2. ,
( ).
3.
.
4. .
5. .
6. .
7. .
8. .
9. .
10. .
11. .
12. .
( )
1.
2.
3.
4.
5.
.
.
, .
.
.
14.
501
http://openlib.org.ua/
6.
7.
8.
9.
10.
11.
12.
13.
.
.
.
.
.
.
.
.
. ( ) , .
, .
( ), ER-, .
. ,
,
.
, .
,
. 2
, .
(
) ( ). ,
; ,
. , .
,
. , ,
.
, ,
,
. , , , ,
. ,
502
IV.
http://openlib.org.ua/
. , .
, 16 17.
14.3.
.
1.
' . : . . ,
:
= . . . - . "
' '
'
..
/:
/ '
, ; .
, , , ,
.
( 10.4.4} ,
DreamHome .
Branch, , Director () Manager ().
S t a f f ,
, Supervisor () Assistant
().
Staff DreamHome, ,
, ,
Branch,
. 12.8. :
;
;
;
14.
503
http://openlib.org.ua/
;
;
.
,
, .
, , .
.
1. .
2. .
3. .
4. .
5. , .
6. ( ).
7. ,
8.
.
9.
.
1.1.
. , .
, . , (. 11.1).
. (, " ",
" ", " ", " ", " ", " ").
( , )
, . , , " " " ", ""
(staff), " ", " ", " " " " " " (PropertyForRent).
,
. , Staff, ,
, , , - "", , .
.
504
IV.
http://openlib.org.ua/
- . , , ,
. , , . ,
. , (, "", "",
"" "").
, .
, , ,
"" "". ,
, , . ,
"" , , .
, , . , ? .
, ,
. .
,
.
, . , , , .
, . . , .
,
. . 14.1
, , Staff DreamHome.
14.1. Staff
DreamHome,
Staff
DreamHome
Employee
14.
505
http://openlib.org.ua/
, 14.1
PropertyForR
ent
Property
,
. , , ,
1.2.
I . , , .
(. 11.2).
, .
. , ,
, :
Staff Manages PropertyForRent ( );
PrivateQwner' Owns PropertyForRent (
);
PropertyForRent AssociatedWith Lease (
).
, ,
, . .
,
. , Staff Manages PropertyForRent PrivateOwner
Owns PropertyForRent.
(, Staff
Assists PrivateOwner) . , ,
,
.
, ,
.
,
(. 11.2.1),
,
(. 11.2.2).
506
IV.
http://openlib.org.ua/
, ,
.
, , , . ,
, . , ,
, ( 1.8).
"-" (ER-)
, , .
"-" (ER-). ER- .
.
, UML
(Unified Modeling Language ),
.
,
, , (. 1.6). , .
.
, ,
. , , .
"" ""
, " ".
, ,
"" "" (. 11.7).
,
,
, ,
, 2.2 .
.
,
, - , 14.
507
http://openlib.org.ua/
, . , , , - .
,
, . . 14.1 ER-
Staff DreamHome.
Supervises
. 14.1. ER-,
Staff DreamHome
, . , , , . 14.2
, S t a f f DreamHome.
14.2. Staff
DreamHome,
Manages
PropertyForRent
0. .100
Supervises
Staff
0. .10
AssociatedWith
Lease
0 .*
staff
0. .1
0. .1
1. .1
PropertyForRent
508
IV.
http://openlib.org.ua/
1.3.
. .
, ,
. , .
, .
, , ,
(. 11.3).
() ()
: "
?" . ,
. , ,
,
.
, , (. 11,3.1). . , address ()
, "115
Dumbarton Road, Glasgow, Gil 6YG". , .. , , street (115 Dumbarton
Road), city (Glasgow) postcode (Gil 6YG). , .
, .
, address , .
,
, , .
,
(. 11.3.2).
,
; , ,
,
. , telNo ( ) Client
, .
14.
509
http://openlib.org.ua/
, , Client. . 2.2,
,
,
, (. 11.3). :
;
, ;
, ( ).
. ,
,
, , .
,
.
, ,
. .
, , ,
, .
, 16 ( 4.2).
, ,
, . , ,
, .
,
, .
. ,
.
,
.
, , . .
510
IV.
http://openlib.org.ua/
DreamHome
Staff DreamHome , . 14.3.
14.3. DreamHome
SCaff
PropertyForRent
PrivateOwner
BusinessOwner
Client
Preference
prefType, maxRent
Lease
14.
511
http://openlib.org.ua/
DreamHome
.
. Staff DreamHome , . 14.4.
14.4. DreamHome
Views
viewDate,comment
, .
:
;
;
, ;
, , , ;
, ;
, ,
, ;
, ( ).
. 14.5 , Staff DreamHome,
14.5. Staff
DreamHome,
Staff
staffNo
name
fName
15
IName
!5
10
position
sex
512
( F)
IV.
http://openlib.org.ua/
. 14.5
Property
ForRent
DOE
property
No
1.4.
|. , !
.
,
(. 11.3). ,
. .
,
(staf fNo). ,
; , 1 3, 1 999.
sex Staff,
"" "F". "" "F".
. :
;
.
, ,
, . .
. , ,
.
14.
513
http://openlib.org.ua/
1.5. ,
. . , /] , .
( ), (. 11.3.4). ,
.
. , . .
. , , Staff
name ( ). , Dreamffome
, ,
name . , DreamHome. ,
, ,
, staff No
Staff owr.erNo PrivateOwner, , .
.
.
,
.
,
( ).
,
( ).
,
( ).
, .
, .
, ,
(. 11.4).
- ,
! .
2.2 (. 15).
.
514
IV.
http://openlib.org.ua/
DreamHome
Staff DreamHome
. 14.2. , Preference
, , Views
(viewDate comment).
(
) .
1.6.
( )
:
.
, /, .
ER-
, 12,
/, .
,
. , , . "has-a" () "is-part-of" ( )
; "",
Supervises
" 14.
515
http://openlib.org.ua/
"". ( ) ,
"" "".
Staff DreamHome (PrivateOwner BusinessOwner)
Owner, ownerNo, address telNo.
Owner ( (Mandatory, Or}), Owner ,
.
, , Staff
( Supervisor), Supervises (). Staff Supervisor , Staff
Supervisor. . ER- Staff
DreamHome . 14.3.
, ER- , -
Supervises
{Mandatory. Or)
PrivateOwner
BusinessOwner
. 14.3. ER- S t a f f
DreamHome /
516
IV.
http://openlib.org.ua/
.
, ER- . , , ER-
.
ER. ,
"ER-" .
1.7.
^^^^^^^^|^^|^^^1^|^^^^^^^>^|^^|^
. - .:
^^^^^^^8^^88^^^^1^^^^^86^^^
:
, .
.
1. " " (1:1).
2. .
" " (1:1)
, , . , , (Client
Renter), ; ,
Client Renter.
. , , .
,
. , ,
. ER- , , . ,
, .
, . , ,
Man (), Woman () Child (),
. 14.4. , Man Child
: FatherOf ( ),
MarriedTo ( ) MotherOf ( ). , FatherOf .
.
14.
517
http://openlib.org.ua/
1. , 1:1.
2. -
, ( - ,
).
FatherOf, .
.
1.8.
. ,
, .
,
.
, ,
. .
,
. , , , . , ,
- , .
, .
1. .
2. .
,
(, ),
MarriedTo >
' 1
i
FatherOf
MotherOf
. 14.4. FatherOf
518
IV.
http://openlib.org.ua/
.
.
DreamHome, , S t a f f .
D. ,
PropertyForRent,
, ,
Staff,
Staff Manages PropertyForRent.
, ER-.
Staff (. ) . 14.5. , ,
.
, , ,
. -
. 14.5.
14.
519
http://openlib.org.ua/
,
. , , , - , , .
,
, . , ,
- , .
,
, ,
.
.
, ,
.
1.9.
.
^ .
, .
ER- ,
. - , ( , ). ,
, .
, .
'
, , ,, .
,
.
, .
, , ,
520
IV.
http://openlib.org.ua/
,
, .
.
(, ),
.
. , ,
.
,
. ,
,
,
.
.
,
. ,
/ ,
, ,
/ .
,
.
, .
: , , , ,
.
( ), .
,
.
. -, , (, ),
(
). -, ER- .
14.
521
http://openlib.org.ua/
14.1. ?
14.2. ?
14.3.
.
14.4.
?
14.5.
?
14.6. ?
14.7. ?
14.8. , ?
14.9. / ?
?
14.10. . .
14.11. ,
, .
14.12. , ?
DreamHome
14.13.
Branch DreamHome, . ER- ,
. 12.8, .
14.14. , Branch DreamHome, , .
University Accommodation Office
14.15.
University Accommodation Office, .
14.16. . , . ,
.
EasyDrive School of Motoring
14.17.
EasyDrive School of Motoring, .
522
IV.
http://openlib.org.ua/
14.18. . , . , .
Wellmeadows Hospital
14.19. Medical
Director ( ) Charge Nurse ( ) Wellmeadows Hospital, .
14.20.
.
14.21.
. , .
14.
523
http://openlib.org.ua/
http://openlib.org.ua/
...
.
.
.
.
,
,
.
.
.
(. 14).
, ( " "). , , .
, " " , . , 13.
,
. ,
.
, . , -
http://openlib.org.ua/
( 3), , .
16 17 . .
, .
,
; , ,
. ,
Staff DreamHome. ,
,
Staff, Branch
DreamHome, . 12.8. Staff Branch .
15.1.
: , . .
. ,
.
.
1.
.
2. .
2.
. , ,
.
526
IV.
http://openlib.org.ua/
,
1, ,
ER- .
, ,
( " ").
, .
, ,
, . , . ,
.
, .
, , , .
,, , .
.
1. ,
( ).
2. .
3. .
4.
.
5. .
6. .
, Staff
DreamHome. . 15.1 , . , ,
Staff, Branch
DreamHome, . 12.8.
2.1. ,
( )
-.
, .
1
, . ,
. ,
. , .
15. 527
http://openlib.org.ua/
, .
. , 2.2
, .
.
1. " " (*:*).
2. " " (*:*).
3. .
4. .
Supervises
. 15.1. S t a f f ,
528
IV.
http://openlib.org.ua/
Client
Views
0 ."
clientNo {PK}
vewDate
comment
I)
PropertyForRent
propertyNo {PK}
Viewing
Takes
1..1
0..*
viewDate
comment
Client
4 Requests
0..*
1..1
clientNo {PK}
6)
. 15.2. : ) Client Views PropertyForRent
*:*; ) 1:* ("Takes Requests^ () Viewing
15. 529
http://openlib.org.ua/
0..*
Staff
0..*
Supervises
Supervisor
staffNo
a)
Staff
staffNo
Staff
staffNo
"
0..*
1/
staffNo
''
Supervision
Supervises *
!
Staff
()
Supervises >
Supervised By
0..*
0.."
1..1
Staff
()
staffNo
a)
1..1
0..*
SupervisedBy ^
1..1
-
Supervision
r)
. 15.3. ; ) Supervises
" " (*:*); ) Supervises *:*
; ,1* *:*
() Supervision SupervisedBy; ) S t a f f
530
IV.
http://openlib.org.ua/
, .
() 1:* .
, Registers ()
Branch , (. 15.4, ). ,
()
.
Registers () Registration (). : Branch .Registers Registration ( ), Staff Processes Registration (
) Client Agrees Registration (
), . 15.4, .
4.
,
(. 11.3.2). , . , Branch
, , t e INo ranch
15. 531
http://openlib.org.ua/
(. 15.5, ).
Telephone telNo, , ( ), Provides
() 1:3, . 15.5, .
2.2.
.
, .
,
, , . DBDL (Database Definition Language
), . DBDL ,
.
/
. ,
.
, .
" / ". ,
() ,
, , , ,
. ,
, ,
.
, .
Provides
. 15.5. : )
Branch telNo; () telNo
Telephone ( )
telNo Prcvides 1:3
532
IV.
http://openlib.org.ua/
1.
, .
(, name) ( fName iName). Staff, . 15.1.
Staff (staffNo, fName, IName, position, sex, DOB)
staffNo
2.
, ,
, .
-
, -. , Preference (. 15.1) :
Preference (prefType, maxRent)
( )
Preference ,
States .
3. " " (1 :*}
1:* ,
"", , "" . ()
,
, .
, Staff Registers client ( ) (, . 1-5.1) 1:*,
.
staff "" ,
Client "" .
() Staff (staffNo) ()
Client. Staff Client
. 15.6.
staffNo Client, Registers 1 :*
15. 533
http://openlib.org.ua/
, 1:* ,
. , Staff .Registers Client
dateRegister ( ), ,
,
Client
S t a f f , staf fNo.
4. " " (1:1)
, 1:1, , , , , . , ,
, (.
11.6.5). , .
1. 1:1.
2. 1:1.
3. 1:1.
. 1:1
, , , ( ) .
Client States Preference ( ) 1:1 . , Client:
Client (clientNo, fName, IName, telNo, prefType, raaxRent, staffNo)
clientNo
s t a f f N o S t a f f ( s t a f f N o )
, 1:1
,
. , States
dateStated, , Client.
, , , (, 1:*). , states
/ .
.
534
IV.
http://openlib.org.ua/
6. 1:1
1:1 . , ,
, , ,
. , , . , .
, Client States Preference 1:1
Client ( ,
),
Client ,
Preference . () Preference () Client (
clientNo), , . 15.7.
, Preference .
Preference ,
Client
Preference.
, , .
. 1:1
,
, -
,
.
, , Staff Uses Car
( ) 1:1 . ( , 1:1 ,
.)
- ,
, . ,
Staff .
, , ( ), , . 1:1
Client clientNo
Preference, States
, 15.7. 1:1
15. 535
http://openlib.org.ua/
Car, ,
S t a f f . S t a f f ,
staff (
staf fNo) .
5. " " (1:1)
1:1
, 1:1.
1:1 . 1:1 .
1:1,
, .
1:1
,
, , , . , .
,
,
.
1:1 ,
, .
6. /
/ , , ,
, , . . ,
, / (. 12.1.6), , , , /. . 15.1 /
.
, / Owner,
. 15.1. . 15.1, ;
( 15.1) , (pOwnerFlag
bOwnerFlag), ,
( 1),
( 4).
/ , . . 15.1,
Owner , Owner
(PrivateOwner BuainessOwner),
. 3, , , ()
.
536
IV.
http://openlib.org.ua/
15.1.
/
{Mandatory}
{And}
( ,
)
{Optional}
{And}
: , ( ,
)
{Mandatory}
{Or}
:
/
{Optional}
{or}
: ,
15.1. /
Owner,
, . 15.1
1 - ,
AllOwner (ownerNo, address, telNo, fName, INarae, bName, toType,
contactName, pOwnerFlag, bownerFlag)
ownerNo
_2_ - ,
Owner (ownerNo, address, telNo)
ownerNo
OwnerDeCails (ownerNo, fName IName, bName, bType, contactName,
pOwnerFlag, bOwnerFlag)
ownerNo
ownerNo Owner(ownerNo)
3 - ,
PrivateOwner (ownerNo, fName, IName, address, telNo)
ownerNo
BusinessOwner (ownerNo, bName, bType, contactName, address, telNo}
ownerNo
4 - ,__
Owner (ownerNo, address, telNo)
ownerNo
PrivateOwner (ownerNo, fName, IName}
ownerNo
ownerNo Owner(ownerNo)
BusinessOwner (ownerNo, bName, bType, contactName)
ownerNo
ownerNo Owner(ownerNo)
15. 537
http://openlib.org.ua/
, , . 15.1, , . , 1
(, ) , . , , PrivateOwner, BusinessOwner .
, , , , NULL, . , (, NULL).
. 15.1 / Staf Supervisor . Staff (Supervisor), . , " " ,
:
Staff ( s t a f f N o , fName, IName, position, sex, DOB,
supervisorStaffNo)
s t a f f N o
supervisorStaffNo Staff
(staffNo)
/ - 1:* (
. 14.2) , , .
, , 2.1. , .
7. " " (*:*)
*:* , , ,
. , , . ,
, . , ,
- . .
, . Client Views Proper tyPorRent *:*
(. 15.2, ). client PropertyForRent, Viewing,
Views. , . 15.8,
, ,
. 15.2, , *:* .
538
IV.
http://openlib.org.ua/
, 15.8. *:*
.
' , ,
, ,
, .
, "" (, 1..*,
0..*), , ,
, .
, Registers Branch , ,
(. 15.4, ).
, Branch, Staff Client, a
Registration, Registers. , . 15.9.
-, ,
, , . 15.4, ,
.
Staff (staffNo, fName, IName, position, sex, DOB, supervisorStaffNo)
staffNo
supervisorStaffNo Staff (staffNo)
Branch (branchNo, street, city, postcode)
branchNo
Client (clientNo, fName, IName, teiNo, prefType, maxRent, staffNo)
clientNo
slaffNo Staff (staffNo)
15. 539
http://openlib.org.ua/
9.
,
,
.
,
.
, Branch , , telNo
Branch (. . 15.5, ).
Branch
Telephone, telNo. , . 15.10.
branchNo Telephone
, . 15.5, . . 15.2
.
15.2.
/
, (
-
)
1:*
"" ,
"". ""
1:1:
""
, ""
540
IV.
http://openlib.org.ua/
. 15.2
/
"/"
*:*,
. . 15.1
, , .
-
, , -
2.2 DBDL , . ,
staff DreamHome,
. 15.3.
15.3. , Staff
DreamHome
staffNo
supervisorStaf fNo Staff {staffNo)
BusinessOwner (ownerNo, bName, , contactName, address, telNo)
ownerNo
bName
telNo
PropertyForRent (propertyNo, street, city, postcode, type, rooms, rent,
ownerNo, staffNo)
propertyNo
ownerNo PrivateOwner (ownerNo)
BusinessQwner(ownerNo)
staff NO staff (staffNo)
Lease (leaseNo, paymentMethod, depositPaid, rentStart, rentFinish,
clientNo, propertyNo)
leaseNo
propertyNo, rentstart
clientNo, rentStart
15. 541
http://openlib.org.ua/
. 15.3
,
/ . ,
( ). ,
Viewing ,
PropertyForRent ( propertyNo)
Client ( clientNo).
,
, DBDL ( 2.5). ,
, . ,
Lease ,
(propertyNo, rents tart) (clientNo, rentStart).
2,3.
-". , .
13.
, ,
. ,
6' , ,
.
, 2.2.
, . ,
. .
542
IV.
http://openlib.org.ua/
. .
.
, .
,
.
. , ,
. 17 ( 8).
, 13.
,
, .
, .
.
,
.
,
.
. ,
. :
(1),
;
(2),
;
(),
;
- (), .
, , , , , . , , ,
. -'
, .
15. 543
http://openlib.org.ua/
2.4.
. ., , =
.
, , .
. 1.8 (. 14) ,
. ,
,
; , .
, /
, , ER- .
,
. -
, , , .
, , , , , .
2.5.
. , - ,
,'; .
.
, , . ,
, . , .
,
. .
.
.
.
544
IV.
http://openlib.org.ua/
.
.
.
, . ,
(, ""
"").
( 1.3, 14).
,
. , sex
"" "F",
, .
,
( 1.4, 14).
. , staff ; staffNo.
( 1.5, 14).
,
. ,
, . ,
Staff Manages PropertyForRent. staffNo
PropertyForRent
S t a f f , , . staffNo
NULL, ,
s t a f f N o s t a f f , .
, . , , . ,
,
(..
staffNo)? ,
, ,
, .
, , . , ,
.
15. 545
http://openlib.org.ua/
.
, , , .
, , Staf E Manages PropertyForRent 1:*.
1. (PropertyForRent}
,
staffNo PropertyForRent
, Staff.
2. (PropertyForRent)
.
3.
(PropertyForRent)
1. , staffNo
PropertyForRent ,
, Staff.
4. (Staff)
( s t a f f ) . , . ,
.
5. (Staff)
,
, .
, , , , . .
NO ACTION. ,
. : " , ".
CASCADE.
. , , .. , . ,
. : " 546
IV.
http://openlib.org.ua/
, ". ,
.
, CASCADE (. 12.3).
SET NULL.
. ,
.
: " , , , , ". ,
.
SET DEFAULT.
, . ,
,
. : "
, , (, )".
,
,
.
NO CHECK. .
6. (Staff)
,
, , . , ,
,
.
.
CASCADE , ( )., , , ,
, ..
, CASCADE.
, Staff DreamHome, 15.2.
15. 547
http://openlib.org.ua/
15.2. ,
Staff
DreamHome
Staff {staffNo, fName, IName, position, sex, DOB, supervisorStaffNo)
staffNo
SupervisorStafJ:No Staff{staffNo) ON
UPDATE CASCADE ON DELETE SE7 NULL
Client {clientNo, fName, IName, telNo, prefType, maxRent, staffNo)
clientNo
staffNo Staff{staffNo} ON UPDATE CASCADE
ON DELETE NO ACTION
PropertyForRent {propertyNo, street, city, postcode, type, rooms,
rent, ownerNo, staffNo}
propertyNo
ownerNo PrivateOwner(ownerNo)
BusinessOwner(ownerNo) ON UPDATE CASCADE ON DELETE NO ACTION
staffNo Staff(staffNo) ON UPDATE CASCADE
ON DELETE SET NULL
Viewing (clientNo, propertyMo, dateView, comment)
clientNo, propertyNo
clientNo Client(clientNo) ON UPDATE
CASCADE ON DELETE NO ACTION
propertyNo PropertyForRent(propertyNo) ON
UPDATE CASCADE ON DELETE CASCADE
Lease (leaseNo, paymentMethod, depositPaid, rentStart, rentFinish,
clientNo, propertyNo)
leaseNo
propertyNo, rentStart
clientNo, rentStart
clientNo Client(clientNo) ON UPDATE
CASCADE ON DELETE NO ACTION
propertyNo PropertyForRent(propertyNo) ON
UPDATE CASCADE ON DELETE NC ACTION
, ( -). ,
,
, . DreamHome
, : .
.
.
548
IV.
http://openlib.org.ua/
2.6.
. , | ,;
| .
~~" : - -
'
--
- .
'"'-..
\"
\;,
, ,
.
, .
,
, . , , , .
, , , .
. (Data Flow Diagram DFD) . , , , ,
, .
(
) , . ,
, .
, ..
.
.
3.
. :
, \
: .
"-
-: 15. 549
http://openlib.org.ua/
,
,
.
, ,
.
, 2.3
2.4. ,
. ,
, ,
. .
,
, . , , , . ,
. ,
, .
.
1. .
2. .
3. .
4. .
, Staff
DreamHome, , 11 12
Branch DreamHome. . 15.4 , Branch (. 12.8) ER-.
(. 15.10).
15.4. , Branch
DreamHome
( s t a f f N o , name, position,
salary,
supervisorStaffNo,'branchNo)
s t a f f N o
supervisorStaf fNo S t a f f ( s t a f f N o )
branchNo Branch(branchNo)
550
IV.
http://openlib.org.ua/
. 15.4
ownerNo
PropertyForRent {propertyNo, street, city, postcode, type, rooms, rent,
ownerNo, staffNo, bName, branchKo)
propertyNo
ownerNo PrivateOwner (ownerNo)
leaseNo
propertyNo, rentStart
clientNo, rentStart
clientNo Client (clientNo)
propertyNo PropertyForRent (propertyNo)
deposit (PropertyForRent .rent*2)
telNo
branchNo Branch (branchNo)
Manager (staffNo, mgrStartDate, bonus)
staffNo
staff No staff {staffNo)
BusinessOwner (bName, bType, contactName, address, telNo)
bName
telNo
Client (clientNo, name, telNo, prefType, maxRent)
clientNo
Registration (clientNo, branchNo, staffNo, dateJoined)
clientNo
telNo
15. 551
http://openlib.org.ua/
3.1.
. /
^ .
, . . , - ' - . "
.->--:
ER-, , , .
, .
, - , .
.
,
.
[22], [32], [36] [289].
.
1. /
.
2. / .
3. /, .
4. ( ) /,
.
5. / .
6. ( ) / ,
.
7. , / / .
8. .
9. .
10. ER-/ .
11. ,
"/" "/ ". , ER- , ER-, ,
. , ,
, ER-, , . , "
" ,
.
552
IV.
http://openlib.org.ua/
,
..
,
. ,
.
1 . /
, ;
. :
/ ,
( );
/ ,
( ).
/. , / , , .
. 15.5 , Branch Staff DreamHome. , , .
1 5.5. /,
Branch Staff
Branch
Staff
Branch
branchNo
postcode
Telephone
telNo
Staff
staff Ho
Staff
staffNo
Manager
staffNo
ownerNo
PrivateOwner
ownerNo
PrivabeOwner
BusinessOwner
bWame
BusinessOwner
telNo
ownerNo
Client
clientNo
PropertyForRent
properbyNo
Lease
leaseHo
propertyNo,
Client
clientNo
PropertyForRent
properCyNo
Viewing
clientNo,
propertyNo
Lease
leaseHo
rent Start
clientNo,
rentstart
15. 553
http://openlib.org.ua/
. 15.5
Branch
Staff
Registration
clientNo
Newspaper
newpaperName
telNo
Advert
{propertyNo,
newspaperName,
dateAdvert)
2. /
/. ,
. 15.6 Branch
Staff DreamHome. ,
, . , ,
, ,
Staff PropertyForRent (branchNo).
15.6. Branch Staff
Branch
Staff
Branch
rngrStaf fNo
Manager ( staff Mo)
Manages
Telephone
branchNo
Branch (branchNo)
Staff
supervisors taiif No
-* Staff (staffNo)
Supervises
branchNo -^
Branch(branchNo)
Has
staffNo -*
Staff(staffNo;
Manager
s up e ryi_is S
taffNo -
Staff (staff
No)
Supervise ji
staffNo ^
Staf f {staff
No)
Registers
L)
PrivateOwner
BusinessOwner
Client
PropertyFor
Rent
554
owner
No
PrivateOwner (owner
Ho)
Owns
ownerNo >
PrivateOwne
r (ownerMo)
POwne
ownerNo
BusinessOwner (owne
rNo)
Owns
ownerNo >
BusineasOwn
er (ownerNo}
BOwns
IV.
http://openlib.org.ua/
. 15.6
Branch
Staff
staffMo ->
Staff(staffNo)
Oversees
staffHo ->
Staff (staff
No)
Manages
branchNo >
Branch(branchNo)
Offers
clientNo ->
Client(clie
ntNo)
Requests
propertyNo
->
PropertyFor
Rent(proper
tyNo)
Takes
Viewing
Lease
Registration
clientNo >
Client(clientNo)
Holds
clientNo ->
Client(clie
ntNo)
Holds
propertygo *
PropertyForRent(pr
opertyNo)
LeasedBy
prgpertyWo
=
PropertyFor
Rent(proper
tyNo}
Associated
With
clientNo
Client(clientNo)
(2)
branchNo >
Branch(branchNo)
(2)
staffNo -
Staff(staffNo)
Newspaper
Advert
propertyNo >
PropertyForRent(pr
opertyNo)
(3)
newspaperNarae
Newspaper(newspape
rName)
(3)
.
fl>
Telephone telNo.
' Registration Registers.
(3
' Advert Advertises " " (*:*).
(2
/ , .
, ,
. / / ,
15. 555
http://openlib.org.ua/
, , .
, ,
, , ( ).
Staff Manages PropertyForRent (
Staff) Manager Manages Branci ( Branch). , Manages (
Manages "", "").
, , , "
" . (, ,
), ,
. ,
. , Branch managerName ,
Manager .
3. /,
/ ,
, ,
/ " "
. , : :
/
;
/ ,
;
/
.
/
, / " " . / / . ,
. 15.11 , PrivateOwner, Branch S t a f f .
ownerNo. ,
, PrivateOwner ,
PrivateOwner. ,
, ,
.
( ) , , . , , fName IName.
556
IV.
http://openlib.org.ua/
Branch
Staff
PrivateOwner (ownerNo, fName, IName, address, telNo]
ownerNo
. 15.11. PrivateOwner Branch Staff
, . 15.2, S t a f f , client,
PropertyForRent Lease , .
/ ,
/ ,
. /
, . ,
. , . 15.12
, BusinessOwner, . BusinessOwner
Branch bName,
BusinessOwner Staff ownerNo.
BusinessOwner Staff bName. ,
, BusinessOwner Branch
BusinessOwner Staff. , . 15.12, bName .
/
/,
, , -, .
/ :
, ;
;
, .
, , staff ( ) Employee (),
.
15. 557
http://openlib.org.ua/
Branch
Staff
BuslnessOwner(bName, , contactName,
address, telNo)
bName
telNo
BusinessOwner {ownerNo, bName, bType, contactName, address, telNo}
ownerNo
bName
telNo
. 15.12, BusinessOwner
4. ( ) /,
,
.
- . . 15.2, Branch, Telephone, Manager, Registration, Newspaper Advert Branch , Viewing S t a f f .
5. /
/
. / ,
. :
/ ;
/ , .
, . 15.5 ,
, . 15.7 .
, Registers
: Staff
.Registers ,
, Branch ,
, , , , , Registration.
Registers Staff
/
Branch.
558
IV.
http://openlib.org.ua/
15.7.
staff
(Supervises)
Property
ForRent
ownerNo~PrivateOwner (ownerNo)
EusinessOwner (ownerNo)
(POwns/Bowns)
(Oversees/Manages)
clientNo-Client (clientNo)
(Holds)
propertyNoPropertyForRent (propertyNo)
(LeasedBy/Associa
tedWith)
Lease
6. ( ) / ,
,
/ ( /
/, ).
/ . . 15.6, / ,
. 15.8.
15.8. / ,
Branch
(Manages)
Telephone
Staff
(Has)
Manager
PropertyForRent
(Offers)
Viewing
(Requests)
(Takes)
Registration
clientNo - Client(clientNo)
branchNo - Branch(branchNo}
staffNo - Staff(staffNo)
Advert
7. , / /
, / / , .
, ,
15. 559
http://openlib.org.ua/
, .
: *:,
( , ). / /
. , , /
, / .
8.
/ /
, . , ' , . , DreamHome,
. 15.9.
1 S.9. ,
DreamHome
IV.
http://openlib.org.ua/
. 15.9
(PropertyForRent .rent*2)
staf fNo s t a f f ( s t a f f N o )
Newspaper (newspaperName, address, telNo, contactName)
newspaperName
telNo
9.
,
, . - , ,
. .
10. ER-/
, . ,
15. 561
http://openlib.org.ua/
, , .
ER-, ER-.
DreamHome . 15.13.
ientNo (, FK)
branchNo {FK}
s:affNo{FK}
properlyNo {PK)
ownerNo {FK}
staffNo {FK}
branchNo {FK}
A
Displays
Newspaper
newspaperName {PK}
. 15.13. DreamHome
562
IV.
http://openlib.org.ua/
11.
, .
,
.
( , ), . .
3.2.
| . , Mo- -
[: , ;;
^, .
2.3 2.4,
.
,
, . , .
3.3.
. , - - i
|; , s
1; ,
,
.
, ,
.
,
,
. ,
, , .
, . .
, .
.
15. 563
http://openlib.org.ua/
3.4.
. , ,
.
, ,
; .
,
.
: , .
,
,
.
ER-,
( ), .
, i ( 2);
( 3).
. , . 1:* , "",
"". *:*
, , .
, . ,
, . , ,
, . , , .
564
IV.
http://openlib.org.ua/
,
. : , , ,
.
, ,
, .
,
, , /: NO ACTION, CASCADE, SET NULL, SET DEFAULT NO CHECK.
-.
, "" ,
.
,
, ,
.
.
: /
; / ;
/, ; ( ) /, ; / ,
; ( ) / , ; ,
/ / .
15.1. ?
15.2. , , , . .
15.3. , :
) ;
) ;
) " " (1:1);
) " " (1:1);
) /;
) " " (*:*);
) ;
) .
.
15. 565
http://openlib.org.ua/
15.4. ,
, .
15.5. , , ?
15.6.
.
15.7. ,
, , ?
15.8. , .
15.9. , . 15.14.
, 15.14,
DreamHome
15. Branch
DreamHome ,
14.13, , . 15.4. .
566
IV.
http://openlib.org.ua/
15. 567
http://openlib.org.ua/
http://openlib.org.ua/
...
.
.
.
.
.
.
.
.
.
.
,
-
(. 14, 15). 1
2, . (. 13) .
3
, , , . , 3 ,
.
,
, (..
, , ) -
http://openlib.org.ua/
, .
, . ,
, ,
' . , : .
16.1
. 16.2 ,
. 16.3 ,
.
, ,
, . .
.
17 . , , , ,
, . ,
.
16.1.
: , .
, ,
.
.
,
. , ER , ,
, , ,
.
570
IV.
http://openlib.org.ua/
, .
, , ,
, .
, . ,
,
,
.
, .
. ,
,
. , ,
( ,
),
, .
16.2.
{" .
I ; " , , , ; - ,
:;; .
.
1. .
2. .
3. .
4. .
5. .
6. .
7. .
8. .
9. .
10. .
11. .
12. .
13. .
.
, 16.
571
http://openlib.org.ua/
4-9. 4
,
, .
5 . , ,
.
. ,
. (.
2.1.5).
(. . 2.1).
. ,
.
. 5 ,
, .
6 ,
. 7 , , .
8
, . , . 9
,
, , .
, , .
16.3.
. ,
572
IV.
http://openlib.org.ua/
. , , . (8 9) .
4.
.
|;, , ;:
$ .
, , ,
. , .
.
, . , :
;
, ;
(..
, NULL);
;
;
.
4 .
1. .
2. .
3. .
4.1.
';:''
. '
"
...--..
" ; ' ;-
- ..; >
'.",.',-.:
|. , .
, ,
. ,
DBDL. :
;
, ;
16.
573
http://openlib.org.ua/
( ) () (FK) ;
;
.
;
, ,
;
();
NULL .
DBDL, ,
NULL.
16.1 PropertyForRent
DreamHome,
16.1. PropertyForRent DBDL
Domain
Domain
Domain
Domain
Domain
PropertyNumber:
Street:
City:
Postcode:
PropertyType:
'E',
'F1 ,
'H1,
'M',
string,
string,
string,
string,
one of
length 5
length 25
length 15
length 8
' ' , ',
'S'
Domain PropertyRooms:
integer, in the range 1-15
Domain PropertyRent:
monetary value, in the range 0.00-9999.99
Domain OwnerNumber:
variable length character string, length 5
Domain StaffNumber:
variable length character string, length 5
Domain BranchNuraber:
fixed length character string, length 4
PropertyForRent(
propertyNo PropertyNumber NOT NULL,
street
Street
NOT NULL,
city
City
NOT NULL,
postcode
Postcode,
type
PropertyType
NOT NULL DEFAULT 'P',
rooms
PropertyRooms
NOT NULL DEFAULT 4,
rent
PropertyRent
NOT NULL DEFAULT 600,
ownerNo
OwnerNumber
NOT NULL,
staffNo
StafrNumber,
branchNo
BranchNumber
NOT NULL,
PRIMARY KEY (propertyNo),
FOREIGN KEY (staffNo) REFERENCES Staff(staffNo) ON UPDATE CASCADE
ON DELETE SET NULL,
FOREIGN KEY {ownerNo) REFERENCES PrivateOwner(ownerNo) and
BusinessOwner(ownerNo) ON UPDATE CASCADE ON DELETE NO ACTION,
FOREIGN KEY (branchNo) REFERENCES Branch{branchNo) ON UPDATE
CASCADE ON DELETE NO ACTION);
574
IV.
http://openlib.org.ua/
.
,
. : ISO SQL ( 6.1),
Microsoft Access ( 8.1.3) Oracle ( 8.2.3).
,
. , , , .
4.2.
.'
1.
, .
, ,
. ,
:
, ;
;
, .
,
. ,
, ,
(/), 11.1.2.
, .
, , . :
, ;
, .
.
staff ,
, . . 16.1
PropertyForRent, . 16.2 Staff noOfProperties, DreamHome, . 3.3-3.9.
16.
575
http://openlib.org.ua/
16.1. PropertyForRent
proper
rooms rent
owner staff
No
No
branch
No
House
650
C046
SA9
B007
lal
i at
400
C087
SL41
BOOB
350
C040
Flat
375
C093
SG37
B003
postcode type
street
city
PA14
16 Holhead
PL94
6 Argyll St
London
PG4
6 Lawrence St Glasgow
PG36
2 Manor Rd
tyNo
Glasgow
NW2
Gil
9QX
G32
BOOS
4QX
PG21
18 Dale Rd
Glasgow
G12
House
600
C087
SG37
B003
PG16
SNovarDr
Glasgow
G129AX
Flat
450
C093
SG14
BOOS
16.2. Staff
noOfProperties
staffNo
fName
IName
branch No
noOfProperties
SL21
John
White
BOOS
SG37
Ann
Beech
BOOS
SG14
David
Ford
BOOS
SA9
Mary
Howe
B007
SG5
Susan
Brand
BOOS
SL41
Julie
Lee
BOOS
. ,
- ; . noOfProperties 1. ,
, .
. , Staff,
, .
Staff PropertyForRent. ,
.
,
, .
1
, ,
,
. ,
SQL , , 5.
576
IV.
http://openlib.org.ua/
. ,
, , .
4.3.
. .
, , . -
, , . , SQL, . , DreamHome ,
.
CREATE TABLE SQL
PropertyForRent :
CONSTRAINT StaffNotHandlingTooMuch
CHECK
(NOT EXIST
{SELECT s t a f f N o
FROM PropertyForRent
GROUP BY s t a f f N o
HAVING C O U N T t * ) > 1 0 0 ) }
8.1.4
Microsoft Access VBA
(Visual Basic for Applications). , 8.2.7.
. ,
( )
, " 17:30 , , ".
, , .
,
.
16.
577
http://openlib.org.ua/
5.
.. , ,
; , -*
.
(. ). , .
.
, . ,
, .
. ,
.
. , ,
, ,
, .
. , .
.
. ,
. , .
, .
( 9).
(Data
Base
Administrator DBA) , . ,
, ,
. , , , , .
-
,
. ,
578
IV.
http://openlib.org.ua/
, ,
. , ,
. , ,
, .
,
. 20.
, ,
.
. ( ) ,
. , , . ,
, 5% .
10%,
. , ,
. , .
, .
,
, .
( ) ,
.
. .
, . ,
.
.
-.
-. ,
- .
, .
. , . . 16.1 16. 579
http://openlib.org.ua/
.
.
.
(. 19.3.3).
. .
.
, :
, , ;
-.
, , .
1. .
2. .
3. .
4. .
5.1.
. ,
^ , ,.
,
, . , . :
,
;
, ;
/,
( ).
. 16.1.
580
IV.
http://openlib.org.ua/
, . , , , , ,
, . .
, ""
( ,
). , 20% 80%
[325]. "80/20"
. , , , , , , ,
. ,
, .
.
,
.
, .
1.8, 2.4 3.2 / , , ; /.
, . 14.5,
,
. , - ,
. ,
. , . 16.3
, / DreamHome (. ).
(A)
(, PG4, Tina Murphy)
Staff
(B)
(C)
16.
581
http://openlib.org.ua/
(D)
, , ,
,
Branch
(E)
,
,
(F)
16.3.
/
()
I
()
R U D
()
R U D I
Branch
()
()
R U D I
X
R U D I
(F)
R U D I
R U D
X
Telephone
Staff
Manager
PrivateOwner
BusinessOwner
PropertyFor
Rent
X X X
Viewing
Client
Registration
Lease
Newspaper
Advert
. I ; R (); U ; D ,
, , ()
Staff,
PropertyForRent PrivateOwner/BusinessOwner. , (, , ).
,
. ,
Staff PropertyForRent ,
, . , , .
582
IV.
http://openlib.org.ua/
DreamHome,
10.4.4, , 100000 , 100 2000 , 1000 3000 . . 16.2 (),
(D), () (F), Staff
PropertyForRent, . PropertyForRent , .
, ,
, .
, ,
, , . ,
, 14:00 16:00
, , .
, 17:0019:00 ,
.
, . , ,
, , , .
,
, ,
, 8 .
,
(,
, , ).
avg = 50
max = 1 00
avg= 1000
max = 3000
. 16.2.
16. 583
http://openlib.org.ua/
. .
, , ; ,
, , ( ).
, , (
).
, ( SQL , WHERE).
, :
, name LIKE ' %Smith% ';
, salary BETWEEN 10000 AND 20000;
, salary = 30000.
,
,
, .
, .
, ,
.
1
.
; , , 50 .
; ,
, 1 .
, , .
. 16.3 (D). , 50
, , 100 ,
17:00 19:00. , ,
, .
SQL
.
SQL, :
;
, (
);
584
IV.
http://openlib.org.ua/
, ( );
, ( );
, ( AVG SUM);
, .
, . , :
( );
,
;
,
.
,
. , , , ,
.
5.2.
. ; .
. ,
, , .
, , , ,
. ,
, . ,
, , , .
, .
,
.
, . ,
.
.
.
16.
585
http://openlib.org.ua/
IV.
http://openlib.org.ua/
Staff no staffNo,
IName.
IName (. 5.3).
4. . , PropertyForRent
rooms rent, rooms.
.
5. .
(
- ).
.
-
- (ISAM)
5.2 . ISAM . , ,
.
ISAM
. ISAM
.
ISAM,
.
, . , ISAM , .
t
, (+-), 5.5 .
. ,
, .
,
. , ISAM,
. +- , . , ISAM, .
, - . , ISAM , ( - , ).
16.
587
http://openlib.org.ua/
, Oracle,
(. 6 ).
, , .
. ,
.
. ,
Oracle, .
, , . . .
,
( ). Oracle :
.
.
. Oracle
:
;
.
, ,
, .
, .
,
.
(
, Oracle .)
, . (
. Oracle ,
,
.)
, " " (1:*), , . (
() , , , ^ , ,
-.)
588
IV.
http://openlib.org.ua/
, ,
.
( , , ,
.)
, Oracle.
( Oracle
, . , ,
.)
.
, .
- .
. Oracle
:
,
(,
" ");
,
, .
, .
,
, , (). ()
.
, ,
, , .
,
,
.
, ,
.
,
. ( ,
, ,
. 16.
589
http://openlib.org.ua/
, .)
, .
, ,
, , ,
.
. . , , ( ).
5.3.
. . , .
, . (. 5 ). , ,
:
, ,
;
,
.
, ,
, , , , , . , , .
6.3.4, SQL;
CREATE INDEX. , PropertyForRent propertyNo
SQL:
CREATE UNIQUE INDEX PropertyNoInd ON PropertyForRent(propertyNo);
PropertyForRent
' staff No SQL:
CREATE INDEX StaffNoInd ON PropertyForRent(staffNo)
CLUSTER;
,
. , Oracle 590
IV.
http://openlib.org.ua/
, , ,
. , ,
INGRES, ,
CREATE INDEX:
[STRUCTURE = BTREE
ISAM
HASH
HEAP]
, . , PropertyForRent
(propertyNo), . , rent.
rent .
, ,
, . , ,
.
.
.
.
,
.
, ,
.
.
1. .
, , .
2. , ,
.
SQL , (. 6.2.3), , .
3. ,
. , , 16.
591
http://openlib.org.ua/
GROUP BY;
, ( UNION DISTINCT).
6. , , , . ,
,
SQL:
SELECT branchNo, A V G ( s a l a r y )
FROM Staff
GROUP BY branchNo;
,
branchNo,
GROUP BY.
branchNo, salary. , .
, , , .
7. , ,
,
, .
8. , .
9. , (, 25%)
. , .
10. , .
OR,
,
,
. , ,
592
IV.
http://openlib.org.ua/
(type =
'Flat 1 or rent> 500), , rooms , ,
WHERE . type rent
( , ),
, WHERE AND, type rent .
.
, . , . ,
(staffNo) staffNo ,
.
,
,
. , , , .
, ,
, .
,
;
(Query Execution Plan QEP). ,
Microsoft Access Performance Analyzer, Oracle
EXPLAIN PLAN (. 20.6.3), DB2 EXPLAIN, INGRES . , ,
, .
, , , . ,
10%, .
16. 593
http://openlib.org.ua/
, .
. ,
, , .
, . , , .
DreamHome,
Microsoft Access
( ) , Microsoft Access ,
, 5.2 . , , Microsoft Access .
Access, .
Access ,
Memo, Hyperlink OLE Object . , Microsoft , :
Text, Number, Currency Date/Time;
, , ;
, ;
, .
, , ,
.
, Microsoft :
, Access
, ;
,
, GROUP BY ,
, , .
Microsoft Access ( Access ). Microsoft Access Rushmore, .
AND OR, , :
594
IV.
http://openlib.org.ua/
(
)
Staff
Client
(a),(d)
: fName, IName
1
20
()
: staff
supervisorStaffNo
20
()
: fName, IName
20
()
; pos i t ion
20
()
: Staff staff No
1000-2000
: fName, IName
1000
16. 595
http://openlib.org.ua/
. 16.4
(
)
Property
ForRent
()
: rentPinish
5000-10000
rentFinish
:
PrivateCwner/BusinessOwner ownerNo
: staff no staff
city
: rent
; ci lent clientNo
: Client clientNo
: PropertyForRent
propertyNo
: PropertyForRent
propertyNo
: client clientNo
100
5000-10000
()
(d)
(f)
(f)
(g)
Viewing
Lease
(j)
(c)
(D
20
50
50
100
100
5000-10000
100
1000
, . 16.5. ,
Microsoft Access ,
Branch DreamHome (. 16.5).
16.5. ,
Microsoft Access
Staff DreamHome
Staff
Client
PropertyForRent
fName, IName
rentFiniah
city
rent
f Name, IName
position
DreamHome,
Oracle
Staff DreamHome.
Oracle,
.
596
IV.
http://openlib.org.ua/
Oracle
. , Oracle UNIQUE, UNIQUE, . Oracle UNIQUE
.
. , CREATE TABLE. . .AS SELECT UNIQUE
UNIQUE .
, , . , - .
, . , ,
Staff Dreamffome, , , . 16.6,
.
,
Oracle , Branch DreamHome (. 16.6).
16.6. ,
Oracle Staff
DreamHome
Staff
f Name, IName
supervisorstaffMo
position
staffNo
Client
PropertyForRent
Viewing
Lease
fName, IName
ownerNo
staffNo
clientNo
rentFinish
city
rent
clientNo
propertyNo
clientNo
5.4.
. , KOTOI
.
>
16.
597
http://openlib.org.ua/
,
. ,
, ,
. , . ,
, .
,
.
,
.
, Oracle.
6.
. , , .
,
14,
,
. . ,
10.4.4, DreamHome:
Branch,
Director Manager;
s t a f f ,
Supervisor Assistant.
2
, ,
3
.
,
. , .
. 6.4.7
, , . ISO SQL (. 6.4.10), ( ) Microsoft Access
(. 7) Oracle (. 8.2.5).
598
IV.
http://openlib.org.ua/
7.
. :> .
.
,
,
(. 10.4.4).
.
. , .
18, , , :
;
.
; , , .
( ),
,
. , . ISO SQL (. 6.6),
Microsoft Access (. 8.1.9) Oracle (. 8.2.5).
. ,
.
.
, ,
, .
.
( 4)
, .
16. 599
http://openlib.org.ua/
( 5) ,
. ,
, ,
.
, .
, .
,
.
, , , ,
.
- (ISAM)
, .
, , ,
, .
ISAM .
ISAM . ,
.
(+-), .
+-, ISAM
. , , - ,
,
, - ,
.
, < , .
, .
. , ( ). Oracle : .
, . , ,
, , .
600
IV.
http://openlib.org.ua/
.
. : ,
, .
6
, ;
,
SQL.
, .
7 ,
.
16.1. , ? ?
16.2. .
16.3.
, , ?
16.4.
. ?
DreamHome
16.5., 5.3 ,
Microsoft Access , Staff DreamHome. ,
Microsoft Access , Branch DreamHome.
16.6. 16.5 Oracle
.
16.7. , DreamHome ( 15),
, .
16.8. DreamHome, 16.7.
16.
601
http://openlib.org.ua/
602
IV,
http://openlib.org.ua/
...
.
.
.
. ,
,
. .
8.
.
.
,
. , . . ,
. , , .
, , .
:
, . ,
:
http://openlib.org.ua/
;
;
,
.
,
, , , . "" ,
, , . .
:
, . , , , 5.1. ,
, .
,
,
.
,
.
, . , Branch, :
Branch(branchNo,street,city,postcode,mgrStaffNo)
, , : city () postcode (
). , city,
postcode. , Branch
.
, :
Branch(branchNo,street, postcode,mgrStaffNo)
Branch(postcode, city)
city, ..
. ,
( ) ,
. ,
Branch.
, ,
.
; ,
, [116] [262].
,
.
1. " " (1:1).
604
IV.
http://openlib.org.ua/
Client
4 Attends
0..1
1..1
clientNo {PK}
Requests
0..*
viewing
Telephone
telNo {PK}
branchNo {FK}
0..'
1..3
Takes
PrivateOwner
ownerNo {PK}
Property ForRent
POwns*0..1
A
Provides
1..*
propertyNo {PK}
ownerNo {FK}
branchNo (FKJ
Branch
+ Offers
1..*
1..1
branchNo {PK}
. 17.1. DreamHome
17.1. Branch DreamHome
branchNo
street
city
postcode
005
22 Deer Rd
London
SW1 4EH
007
16 Argyll St
Aberben
AB2 3SU
163 Main St
Glasgow
Gil 9QX
004
32 Manse Rd
Bristol
BS99 1NZ
005
56 Clover Dr
London
NW10 6EU
17.
605
http://openlib.org.ua/
branchNo
0207-886-1212
005
0207-886-1300
005
0207-886-4100
005
01224-67125
007
0141-339-2178
0141-339-4439
0117-916-1170
004
0208-963-1030
002
property street
No
city
14
16 Holhead
PL94
6 Argyll St
London
House 6
Flat
NW2
650 C046
400
C087
staff
No
branch
No
SA9
B007
SL41
B005
PG4
6 Lawrence St
Glasgow
G119QX
Flat
350 C040
PG36
2 Manor Rd
Glasgow
OI324QX
Flat
375 C093
SG37
PG21
18 Dale Rd
Glasgow
G12
House 5
600 C087
SG37
PG16
5 Novar Dr
Glasgow
012 9AX
Flat
450 C093
SG14
fName
I Name
telNo
prefType
maxRent
CR76
John
Kay
0207-774-5632
Flat
426
CR56
Aline
Stewart
0141-848-1825
Flat
350
CR74
Mike
Mary
Ritchie
Tregear
01475-392178
House
750
012224-196720
Flat
600
CR62
staffNo
datelnterview
comment
CR56
SG37
11-Apr-OO
CR62
SA9
7-Mar-OO
fName
IName
C046
Joe
C087
Carol
C040
C093
606
Address
telNo
Keogh
01224-861212
Farre!
0141-357-7419
Tina
Murphy
0141-943-1728
Tony
Shaw
0141-225-7025
IV.
http://openlib.org.ua/
propertyNo
vfewDate
comment
CR56
14
24-May-Ol
too small
too remote
CR76
PG4
20-Apr-Ol
CR56
PG4
26-May-Ol
CR62
14
14-May-Ol
CR56
PG36
28--01
no dining room
. 17.2. Client
Interview:
17.8. Client Interview:
Clientlnterview
client
No
fName IName
CR76
John
Kay
CR56
House 750
tel
No
pref
Type
max
Rent
0207-774-5632
Flat
426
Aline
Stewart 0141-848-1825
Flat
350
CR74
Mike
Ritchie
01475-392178
CR62
Mary
Tregear
012224-196720 Flat
600
staff
No
SG37
SA9
datelnter
View
comments
11-Apr-OO
current lease
ends in June
17.
607
http://openlib.org.ua/
8.2. "
" (1 :*)
( ) , . , !
1:*. , PropertyForRent ( ) . SQL ( , . 17.1 . 17.1-17.7).
SELECT p . * , .IName
FROM PropertyForRent p, PrivateOwner
WHERE p.ownerNo=o.ownerNo AND b r a n c h N o = ' B 0 0 3 ' ;
PropertyForRent (
iName) . 17.9.
17.9. PropertyForRent:
IName, PrivateOwner
proper street
-tyNo
city
postcode type
rooms rent
14
House 6
650
C046
Keogh
SA9
B007
PL94
6 Argyll St
London
NW2
Flat
400
C087
Farrel
SL41
B005
PG4
6 Lawrence
St
Glasgow
G119QX
Flat
350
C040
Murphy
PG36
2 Manor Rd Glasgow
G324QX
Flat
375
C093
Shaw
PG21
18 Dale Rd
Glasgow
G12
House 5
600
C087
SG37 B003
PG16
5 NovarDr
Glasgow
G129AX
Flat
450
C093
SG14
B003
SG37
, ,
. ,
,
. , 1:*
(, Farrel Shaw
PropertyForRent ), . IName PrivateOwner,
PropertyForRent ,
.
, .
608
IV.
http://openlib.org.ua/
,
, IName .
. , ,
. , .
8.3. "
" (1 :*)
,
. ,
. ,
DreamHome, ,
. SQL ( , . 17.1 . 17.1-17.7):
SELECT .IName
FROM PropertyForRent p, PrivateOwner
WHERE p.ownerNo=o.ownerNo AND branchNo='B003';
, -
PrivateOwner Branch
( branchNo) PropertyForRent.
,
branchNo PrivateOwner. ,
Branch PrivateOwner. SQL :
SELECT .IName
FROM PrivateOwner
WHERE branchNO='B003';
IName
Address
telNo
branchNo
046
Joe
Keogh
01224-861212
BOO 7
087
Carol
Parrel
0141-357-7419
B003
040
Tina
Murphy
0141-943-1728
BOOS
093
Tony
Shaw
0141-225-7025
BOOS
17.
609
http://openlib.org.ua/
(, ).
PropertyForRent ( branchNo),
PropertyForRent Staff staffNo. SQL
SELECT o.lName
FROM Staff s, PropertyForRent p, PrivateOwner
WHERE s . s t a f f N o = p . s t a f f N o AND p.ownerNo=o.ownerNo AND
branchNo='B003 1 ;
, PrivateOwner
Branch, branchNo PrivateOwner.
Offers
Serves
. 17.3. : PrivateOwner
branchNo,
610
IV.
http://openlib.org.ua/
street Viewing,
PropertyForRent:
SELECT . * , v.street, v.viewDate
FROM Client c. Viewing v
WHERE c.clientNo=v.clientNo AND comment IS NULL;
Viewing . 17.11.
17.11. street PropertyForRent
Viewing
clientNo
propertyNo
street
viewDate
comment
too small
too remote
CR56
14
16 Holhead
24-May-Ol
CR76
PG4
6 Lawrence
20-Apr-Ol
CR56
PG4
St
6 Lawrence
26^May-01
St
CR62
14
16 Holhead
14-May-Ol
CRS6
PG36
2 Ma nor Rd
28-Apr-Ol
no dining room
8.5.
, .
, 1:*
() . . ,
DreamHome , .
Telephone
" " (3:1) Branch (. . 17.1 . 17.1-17.7).
, ,
Telephone Branch , ( . 17.4 . 17.12).
:
( , .. 3);
. 17.4.
: Branch
17.
611
http://openlib.org.ua/
17.12. Branch
branch
No
street
city
postcode
telNol
005
22 Deer Rd
London
SW1 4EH
0207-886-1212
007
16 Argyll St
Aberdeen AB23SU
01224-67125
163 Main St
Glasgow G119QX
0141-339-2178 0141-339-4439
004
32 Manse Rd
Bristol
BS99 1NZ
0117-916-1170
005
56 Clover Dr
London
NW10 6EU
0208-963-1030
telNoS
telNo2
0207-886-1300 0207-886^100
(
);
,
10 (, , ).
, . Branch
, Telephone, Branch,
.
8.6.
Type For
I '
. 17.5. , :
612
IV.
http://openlib.org.ua/
17.13. PropertyType
( )
type
description
House
Flat
17.14. PropertyForRent,
( )
property street
No
14
PL94
PG4
PG36
PG21
PG16
16 Holhead
6 Argyll St
6 Lawrence St
2 Manor Rd
18 Dale Rd
5 Novar Dr
city
Aberdeen
London
Glasgow
Glasgow
Glasgow
Glasgow
AB7 5SU
650
NW2
400
Gil 9QX
350
G32 4QX
375
G12
600
G129AX
450
C046
C087
C040
C093
C087
C093
staff
No
branch
No
SA9
B007
SL41
BOOS
BOOS
SG37
SG37
BOOS
SG14
BOOS
BOOS
, , description ()
(. 17,15). , . , ,
.
17.15. Property For Rent,
description
proper- street
tyNo
14
PL94
PG4
PG36
PG21
PG16
16 Holhead
6 Argyll St
6 Lawrence St
2 Manor Rd
18 Dale Rd
5 Novar Dr
city
post
code
type des
crip
tion
Aberdeen
London
Glasgow
Glasgow
Glasgow
Glasgow
AB7 5SU
NW2
Gil 9QX
G32 4QX F
G12
G129AX
House
Flat
Flat
Flal
House
Flat
rooms rent
650
400
350
375
600
450
owner staff
No
No
C046
C087
C040
C093
C087
C093
branch
No
B007
SL41 BOOS
BOOS
SG37 B003
SG37 BOOS
SA9
SG14
BOOS
8.7. ,
,
() .
,
17.
613
http://openlib.org.ua/
. , , (.. ,
). ,
, , ; , .
, .
, . , , . ,
,
9.
.
.
,
,
.
. , () . :
;
, , ;
, , ,
(
), ;
;
, .
, , . , 614
IV.
http://openlib.org.ua/
.
, . ,
, , . , ,
,
. , , ,
, , . ,
.
, (, ).
, ,
DreamHome
.
1.
, , .
Microsoft Access,
, OLE. OLE
(Object Linking and Embedding ) ,
; Microsoft
Word Microsoft Excel, ( , ), . OLE
Microsoft Access, .
PropertyForRent, : picture
OLE comments Memo ( ). . 17.6 , PropertyForRent,
picture comments.
picture ,
,
BMP ( Bit Map
). , , . DreamHome , ,
, , .
2. World Wide Web (WWW, Web)
.
Microsoft Access,
Oracle, Web- Internet. ,
, Web-,
17.
615
http://openlib.org.ua/
, 17.6. , PropertyForRent
picture comments
, , , ,
. ""
, ,
.
8
.
, .
, , .
: , .
9
.
616
IV.
http://openlib.org.ua/
17.1.
?
17.2.
? .
17.3.
,
Dream-Home, 9. ,
.
17.
617
http://openlib.org.ua/
http://openlib.org.ua/
|
SQL
621
655
723
777
http://openlib.org.ua/
http://openlib.org.ua/
...
, .
.
, .
.
, Microsoft Access Oracle.
Web.
,
, . ,
.
2 .
, , , . , , .
, , .
,
, ,
. , [250].
18.1 ,
, , . 18.2 ,
. 18.3 18.4 , -
http://openlib.org.ua/
18.1.
, , , . ,
,
.
.
( ) .
, .
, ,
, . ,
, , .
, , . ,
, .
, , .
,
.
:
;
( );
;
;
.
,
, , .. . , , ,
. ,
,
, ,
- , .
622
V.
http://openlib.org.ua/
.
,
. -
, .
. , ,
, . , , ,
, .
,
. , 24 7 . , , , ,
. , , .
,
.
.
,
.
18.1.1.
|. { ), : , , ,
! .
( ),
, ,
. (,
, )
(, ). , . , .
,
. , .
18.
623
http://openlib.org.ua/
, , ,
.
, . . 18.1 , . ,
, .
18.1.
- -
<
<
""
<
</
^
/
-S
624
V.
http://openlib.org.ua/
. 18.1
(
, ,
), ,
,
, ,
. ,
, .
, .
,
,
, ,
. , , , , .
, , .
, .
. 18.1 , .
18.2.
, ,
, .
, ,
, .
. 18.2.
18.
625
http://openlib.org.ua/
, .
.
,
.
.
.
.
RAID-.
//
-
/
(,
)
. 18.1. ,
626
V.
http://openlib.org.ua/
j1
-' ; 1
|
|
1 ^
-i
'
'.
. 18.2.
18.2.1.
'
&
"
- -
'
. ( ), "* i .
, ,
.
. ""
. ""
, , , ,
, .
18.
627
http://openlib.org.ua/
. , , '
.
,
. , ,
. , .
() , , .
,
.
.
(),
, .
, ,
. ,
. ,
, .
, , . , , , ,
. , , .
, ,
.
, .
, .
, , , .
. SQL 6.6.
.
, . ,
628
V.
http://openlib.org.ua/
. , .
, . , , ,
. ,
.
. ,
, - . SQL , - , ,
.
, . ,
, , ,
, .
. 18.2.
18.2.
S337
Sales
SG37
SG14
Sales
SG14
SG5
Sales
.
, ,
.
, (, (Select),
(Update), (Insert), (Delete) (All)). :
SELECT UPDATE
0001
0010
INSERT
0100
DELETE
1000
ALL
1111
,
, ( ) *
. . 18.3 , Sales SG37, SG5.
18.
629
http://openlib.org.ua/
18.3.
propartyNo
type
price
ownerNo
staff Ho
15
0111
0000
100
1111
1111
0000
0111
0101
1111
1111
0001
0001
0001
SG37
0101
0101
SG5
1111
1111
0000
0000
Sales
branchNo
,
Sales Select ( 0001)
propertyNo, type price. ,
, 15 . SG14
( David Ford) - , , . , SG37 (Arm
Beech) Select Insert (
0001 + 0100 = 0101) propertyNo, type ownerNo, a
Select, Update Insert ( 0001 + 0010 + 0100 =
0111) price staf fNo. ,
100 . SG5 (Susan Brand)
Select, Update, Insert Delete ( 0001 + 0010 + 0100 + 1000 =
nil), .. All , .
, .
, , ,
.
,
. ,
. ,
, .
18.2.2. ()
.
. ,
, |, .
, . ,
630
V.
http://openlib.org.ua/
, .
, ,
. ,
.
3.4 6.4.
18.2.3.
.
( , , ) -;
?> , .
, . , , , .
,
,
.
19.3.3.
: . , - <
,
,
.
,
, . ,
, , .
,
,
. , , .
19.3.3.
18.2.4.
, , ,
. 3.3.
18.
631
http://openlib.org.ua/
18.2.5.
. ,
, ,
,
(
). ,
. ( ),
, .
.
,
, . ,
, ,
. .
, :
,
( );
, , ;
, ;
, , .
, ,
, ,
,
.
,
[206]. ,
. DES (Data
Encryption Standard). ,
IBM. , , . 64- 56 . DES , . ,
PGP (Pretty Good Privacy) 128- ,
.
64 , 632
V.
http://openlib.org.ua/
, .
, .
, 80
, , 128
. " " " " , (),
, ().
. , , , .
, , , .
, .
" ", ,
.
RSA (
).
, , , ,
,
. Web
18.5.
18.2.6. RAID (
)
, ,
. ,
.
, , , , , , , .
.
RAID.
Redundant Array of
Inexpensive Disks ( ),
"I"
"independent" (). RAID-
, , ,
.
18.
633
http://openlib.org.ua/
. , ( ), .
, .
-,
- ( ).
.
RAID- ( )
,
, (Reed-Solomon) [252].
, 0 1,
, 1
, . ,
, 1 . , , . , ,
.
.
RAID- , RAID. & .
RAID 0 ( ).
, .
.
RAID 1 ( ).
() .
. .
RAID 0+1 ( ).
.
RAID 2 ( ,
).
.
RAID 3 (, ).
634
V.
http://openlib.org.ua/
( )
.
, , .
RAID 1, , .
RAID 4 (, ).
; ,
. , .
RAID 5 (, ).
, RAID 3,
, . , ,
.
RAID 6 ( P+Q).
RAID 5, . .
, Oracle RAID 1
.
RAID 5, , RAID 1 RAID 04-1. RAID , [56] [57].
635
http://openlib.org.ua/
,
. ( ToolS^Security)
;
. , .
, Microsoft Access ,
, , , , . . 18.3,
, . 18.3, 6 ,
, .
I Jcui.mm' (id JM
;
[ .. :
f :
(
^ )
. 18.3. DreamHome
: ) Set Database Password (
); ) Password Required
( ),
Microsoft Access
, . Microsoft Access . Microsoft
Access . Access
; ( Admins)
( Users), fro . . 18.4 ,
.
Assistants, , Assistant,
Users Assistants.
,
/
. (User an(
Group Permissions). . 18.4 ,
636
V.
http://openlib.org.ua/
Open/Run
, ,
Open
Exclusive
Read Design
Design
Modify
Design
Administer
: ,
: ,
Read Data
Update Data
( )
Insert Data
( )
Delete Data
( )
. -, . --
j | j
;
Assistant
Users Assistants
Assistants,
18.
637
http://openlib.org.ua/
| |
' :
Admin
Assistant
Staff 1_Vlew
-iB :
< /)>
Branch Managers
Branch Staff
Sanch Supervisors
properties by Price
Properties by Stall
|;
, ^-v.;..,-^
"
', "
"
! "
"
; jAdrtn
18.4. Oracle
Oracle 8/81 8.2,
, Oracle.
Microsoft
Access: . ,
Oracle. Access,
, Oracle, , .
. . 18.6
Beech, .
Beech Connect Log On (. 18.7)
.
18.2.1, SQL
. Oracle,
.
( ),
.
.
Oracle :
;
.
638
V.
http://openlib.org.ua/
Aut Iwibcatori
password
. 18.6. Beech,
I; ifeefHame:
JBeech
= gaeswerd;
! Siring:
| "
OK
.,
>~. - - - . . - , - -
, Jl)renrnHome|
j
;
Caf>t
' ' ' . - .
..-:-..
-.:.- . "
. 18.7. Log On , .
. ,
. Oracle 80 .
( ) :
Grant System Privileges/Roles Revoke System Privileges/Roles
Oracle Security Manager;
GRANT REVOKE SQL (, 6.6).
18.
639
http://openlib.org.ua/
,
ADMIN OPTION, GRANT
ANY PRIVILEGE.
, , ,
, . . , Staff.
( , )
;
. , ,
ALTER ANY CLUSTER.
, . ,
. SQL, , WITH GRANT OPTION ( GRANT), ,
, ; ,
. . 18.5
, .
.
. , Beech
PropertyForRent:
GRANT INSERT ON PropertyForRent TO Beech;
(
),
. , ,
PropertyForRent Assistant, , , Beech. , .
. 18.8
Assistant Oracle Security Manager.
, , , , .
18.5. Web
Web 28
Web. , ,
Web, 28 i
.
640
V.
http://openlib.org.ua/
18.5. ,
ALTER TABLE
DELETE. .
DELETE
SELECT
INDEX
CREATE INDEX
INSERT
INSERT
INSERT
REFERENCES
,
.
SELECT
SELECT
SELECT
UPDATE
UPDATE.
.
UPDATE
SELECT
UPDATE
DELETE
DELETE
Internet TCP/IP
HTTP.
. Internet
( )
. , , ,
, Internet
.
. , ,
Internet. , , Internet
:
, ();
();
,
();
18.
641
http://openlib.org.ua/
,
( );
(
, ).
'
equences
Snapshot
i--Q Synonyms
a- LJ Tables
i- BRANCH
*gBfpROPERTVFORRNT|
STAFF
ALTER
DELETE
INSERT
SELECT
NSERT ON MANAGER.PRQPERTYFORRENT
SELECT'ON MANAGEF1 PROPERTYFORRENT
UPbAfEONMANAGER.PROPERtYFORRENt
sjsJantMDT IDENTIFIED;
GI^JT-IHSERT ON "MANAGER"."PROFCRTYFORRENT'
TO "ASSISTANT"; ;= -
GI^NT SELECTION "MAi-tACiER^.'I'ROPEBTYfGf
,
- Web. , Web-. ,
Web
,
,
. , , ,
.
, Web,
, , ,
. , HTML- ActiveX, JavaScript/VBScript, Java.
, :
642
V.
http://openlib.org.ua/
;
;
;
,
;
;
,
;
, , .
. Internet
. , .
18.5.1. -
Web - ,
Web- Web-. Web-
, . Web-. -
: .
-
, . , , Web -.
Web-,
. Web-, , - , . - , , . -,
, CompuServe
America Online, .
- . , -
Web-.
18.5.2.
, Web-
18.
643
http://openlib.org.ua/
. Web- , , , ,
.
,
. , .
Internet , Internet ( ,
). ,
, , ,
. .
. , ,
, . , , . ,
IP-.
( IP- . IP-,
, .)
.
, FTP Telnet.
,
.
. TCP UDP (User
Datagram Protocol ).
.
-. ,
. -
.
. " "
.
,
, 18.2,
18.5.3.
( ) ()
( ).
:
644
V.
http://openlib.org.ua/
;
- ( -, , ).
: ,
"" ,
( ), .
,
( ), . , , :
;
( ,
);
;
, .
,
, ,
.
18.5.4.
, , , , , .
, , ( Certificate Authority). ,
. Internet.
, ,
, ,
(,
). , .
, ,
. , Internet,
,
,
18.
645
http://openlib.org.ua/
.
, , ,
. .509.
18.5.5. Kerberos
Kerberos ( , ). Kerberos
, . ,
Kerberos, . Kerberos ,
: .
, , Kerberos .
18.5.6.
HTTP
,
Internet, SSL
(Secure Sockets Layer ), Netscape Internet. SSL , SSL. SSL Netscape Navigator Internet Explorer, Web-
, . ( HTTP)
TCP/IP* , . SSL
, , , FTP NNTP.
Web S-HTTP (Secure HTTP ), HTTP.
S-HTTP Enterprise Integration Technologies (EIT),
Verifone 1995 . SSL , ,
S-HTTP .
SSL S-HTTP ,
.
IETF (Internet Engineering Task. Force
Internet) .
, Web-, SSL, -
646
V.
http://openlib.org.ua/
18.5.7.
SET (Secure Electronic Transactions ) ,
Internet, Netscape, Microsoft, Visa,
Mastercard, GTE, SAIC, Terisa Systems VeriSign. SET
Internet
. , , ,
, ,
, ,
, ,
. , ,
(, Visa), , .
SET , ,
.
. 18.9.
SET Microsoft Visa International, STT (Secure
Transaction Technology ),
Internet. STT DES,
RSA, , .
18.
647
http://openlib.org.ua/
(Secure Electronic Transactions SET)
,
,
.
,
.
6.
.
5. > ,
; '
2. ;
,
.
' ?
.
3;
,
,- " : '
.; .
. 18.9. SET
18.5.8. Java
28.8 Java,
Web. ,
Java, 28.8 .
Java,
( ""), ,
, , .
"" : ,
- .
Java Java (Java Virtual Machine - JVM), .
, , .
Java
"".
: -. , Java,
JVM Security Manager.
648
V.
http://openlib.org.ua/
;
, , / , . Java
,
( ).
, " "
, . ,
- , Java, , , . JVM , .
Java
, , Sun Microsystems ( Java),
. , Java,
(, ) .
-
JVM / ,
. ( ) , , ,
, . , :
;
/ ;
-
(, ); ;
- ;
.
Security Manager
Java . Java
(, Web- Web- Java)
. Java
Security Manager. , Web- Java Security Manager, , ,
Security
Manager. Security Manager
"" , , ,
18.
649
http://openlib.org.ua/
-, . , ,
, , .
.
(, ),
, , .
, , .class . ,
HTML- , , CODEBASE .
CODEBASE.
.
.
. ,
.
, Internet .
, , CLASSPATH.
, -
-. Appletviewer, JDK (Java Development
Kit Java), ,
. , Internet Explorer 4.0 Microsoft
, , . Java,
,
. , , .
"" API-
Java 1996 .
, ,
. -, ,
, ,
. -, , , , .
650
V.
http://openlib.org.ua/
18.5.9. ActiveX
ActiveX ,
Java. Java
, . ActiveX, , -
, , .
ActiveX Authenticode.
.
.
ActiveX, ( ,
), , , . .
.
, , (), , .
( ), , , , , .
: , , /, , RAID.
( ), . ,
, .
,
. , , -
18.
651
http://openlib.org.ua/
. ,
.
( , ,
),
. , ,
,
.
,
,
.
,
.
Microsoft Access Oracle : .
, , ,
, .
Web -, , ,
, Kerberos, SSL (Secure Sockets Layer) S (Secure HTTP), SET (Secure Electronic Transactions) STT (Secure
Transaction Technology), Java ActiveX.
652
V.
http://openlib.org.ua/
18.6.
, , ,
.
18.7. ,
Internet.
18.8. DreamHome, 10. , , .
18.9. Wellmeadows Hospital, . ,
, .
18,
653
http://openlib.org.ua/
http://openlib.org.ua/
...
.
.
,
.
.
.
.
.
.
.
.
,
.
.
.
.
Oracle.
2 ,
.
,
, : , . ,
,
. .
http://openlib.org.ua/
,
.
,
.
. ,
, . , .
, .
,
,
. : ,
,
, .. ,
.
( ), .
, , , , 19.1.
19.2
, .
19.3 , . 19.4
,
( ),
, . 19.5 Oracle.
, , .. ,
. 23 , (
, ).
19.1.
. ,
, ' .
656
V.
http://openlib.org.ua/
, . ,
(, INSERT UPDATE
SQL) , . , , .
DreamHome (. . 3.4 3.5):
Staff
, ,
,
. ,
. 19,1 ( ).
read(x) write (). . , (. 19.1)
read ( s t a f f N o = , salary), ,
salary , .
,
(read write), , (salary =
salary*! . 1).
19.1.
d e l e t e ( s t a f f N o = )
for all PropertyForRent records, pno
r e a d ( s t a f f N o = x,
salary)
begin
read(propertyNo = pno, s t a f f N o )
new_salary)
if ( s t a f f N o = x) then
begin
s t a f f N o = newStaffNo
write(propertyNo = pno, s t a f f N o )
end
end
, . 19.1
( ), , . ,
S t a f f , PropertyFarRent,
, , , , , newStaffNo.
,
19.
657
http://openlib.org.ua/
.
, , . , , . 19.1, , PropertyForRent
staffNo newStaffNo,
.
newStaf fNo.
.
(coramiti
, . , .
,
.
(roll back), .
. , , , , ( 19.4.2). . ,
, ,
, .
,
. , ,
. .
BEGIN TRANSACTION,
COMMIT ROLLBACK ( )1. ,
. COMMIT . , ROLLBACK.
. . 19.1.
, , ACTIVE,
COMMITTED ABORTED, , .
PARTIALLY COMMITTED.
. , ( 19.2.2) , .
,
, ,
. FAILED . ,
COMMITTED.
5
658
V.
http://openlib.org.ua/
FAILED. , , ACTIVE,
,
.
19.1.1.
,
. ,
ACID (Atomicity, Consistency, Isolation,
Durability , , , ),
[149].
. , " ".
, ,
.
.
.
.
, .
, , .
. , ,
,
, .
, . , - .
EN ^TRANSACTION
BEGIN_TRANSACTION
. 19.1.
19.
659
http://openlib.org.ua/
. .
,
. .
. () . .
19.1.2.
2. . 19.2
(. . 2.6),
, , .
. , .
,
.
, , .
,
. , ,
, , , . , .
19.2.
, , ,
.
.
.
, ^ .
19.2.1.
, .
,
, .
660
V.
http://openlib.org.ua/
. 19.2.
.
, , .
, , ( ) , ( ) .
, -, -,
. .
-.
.
-,
,
.
-. ,
. , ( , ) ,
,
, -.
, , -
19.
661
http://openlib.org.ua/
. ,
:
, .
DreamHome, ,
.
19.1.
.
. . , . 19.2. . TV 10
balx, 100 , 2 100 .
, ,
, 190 , .
, T t 2
, 100
. :, 100
, 200 ,
1. : bal x , 90 , , . "" 100 , .
2, T! bal x 2 .
19.2.
TI
ti
bal x
begin_trausaction
100
read (balx)
100
ta
begin_transaction
t3
read (bal x )
100
balx = 1 -10
write (balx)
200
t5
tt
write (balx)
commit
commit
90
90
19.2.
( "" )
,
,
662
V.
http://openlib.org.ua/
. . 19.3 , .
bal x , .
4 1 200
, ,
, 100 .
3 bal x (200 )
10 , , 190 ( 90 ). bal x , , .
,
19.3.
T3
balx
ti
begin_transaction
100
read(bal x )
100
t3
100
write (bal x )
200
begin
transaction
read (bal x )
t,
bal x = balx-10
tv
write (bal x )
tl
200
rollback
commit
100
190
190
; , (, ). , 3 4 ,
. , 3 bal x ,
4 .
, ,
. ,
, ,
, . .
19.3.
,
,
. , , ,
(, ), 19.
663
http://openlib.org.ua/
,
. . 19.4. 6 ,
, 5.
(100 ),
(50 ) z (25 ). 5 1
1. 6
( 10 ). ,
Ts bal x 1 , .
19.4.
- 5
begin
baly
bal,
sum
50
25
sum = 0
100
50
25
read (bal x )
100
bal x = balx-10
100
write (balx)
read(bal y }
90
50
read (1 )
90
50
25
100
'
.
bal : = b a l j + 10
90
write (bal z )
90
50
read(bal z }
90
50
ISO
sum = sum + 1
90
50
-'
185
90
50
35
185
commit
tn
transaction
balx
100
t!
ta
T6
commit
, ,
. ,
. ( ) . , , , ,
, () , . .
19.2.2. ^
,
, , . 664
V.
http://openlib.org.ua/
,
.
, ,
, (
"" "" , , ). , ,
, , , . , , [245].
.
J
. ' , .
, , , . S
, 1 2, ..., ,
, ,
. TI S.
. , ! , .
.
, (: 2),
1( 2 ( 2 , T^). , , . ,
. , , (..
).
' . , ,; .
, 19.1-19.3,
,
( ) ( ).
.
19.
665
http://openlib.org.ua/
, ,
. ,
.
, , ,
, .
, () ,
, . . , , ,
. ^, .
,
.
, .
,
,
.
Slt . 19.5.
, 7 . 1 T s
toaly 7 , S2, .
,
S3, (. 19.5), .
write (bal x ) write (bal x ) 7.
read(bal x ) read (bal. y ] 7.
read(bal x } write (baly) 7.
S 3 , Si S2 S;, .
666
V.
http://openlib.org.ua/
19.5. : s:;
sa, s^
S3,
! 2
-,
ti
ta
i
t
begin_transaction
read(bal x )
write (bal x )
begin_ransaction
read (bal x )
write (balx)
ts
tl
tl
ta
tB
read(baly)
write(baly)
..
commit
read (baly}
1
tu
write (baly)
commit
ti
ta
begin_transaction
read (bal x )
w r i t e (balx)
begin__transaction
read(ba! K )
ts
t
read(baly)
write (bals)
t7
tl
-9
write tbaly)
commit
read (baly)
write (bal y )
commit
tip
til
tl2
ti
ts
t3
tt
ts
tt
begin__transaction
read (balx)
write (bal x )
read(baly)
write (baly)
commit
t,
tl
begin_transaction
read (bal x )
ts
write (balx)
tio
read ( b a l y )
tu
tl2
19.
write (baly)
commit
667
http://openlib.org.ua/
.
. ,
( ,
, ),
( ). s
G = ( N , E ) , N, .
, .
TI>Tj, 3 , .
Ti~Tj, ^ , ']\.
Ti-s-Tj, Tj , .
, S, TI>Tj, S 1 , S,
TI Tj. ,
.
19.4. ,
,
. 19.6. 100 bal x
1. 10
10%. ,
. 19.3, , .
19.6.
10
TS
ti
begin_transaction
t2
read(bal x )
t3
t4
t
bal x = bal x + 10
write(balx)
begin_transaction
read(bal x )
t7
write (bal x )
te
read(baly)
tg
baly = baly*l.l
tio
write (baly)
668
V. >
http://openlib.org.ua/
. 19.6
tn
I
t
tl4
9
read(bal y )
10
commit
. 19.3.
. 19.6
, ,
, .
.
, ! S2, ,
Tlt 2 , ..., , , .
: S^ Td
S 2 .
Ti
S3: T j t
S2 , Tj.
: 5 T i f
S2.
,
. , . , ,
. 19.7, , . 12 13
, , , . ,
, , .
19.
669
http://openlib.org.ua/
19.7. ,
TU
ti
begin_transaction
tj
12
TU
read {balx)
begin_transaction
t4
write (bal x )
commit
ts
ts
t,
write {balx}
commit
ta
t,
tin
begin_transaction
write (bal x )
commit
, , NP- ( ), , - [404].
. , .
, . .
,
, .
, . , , ,
. ,
, ( , ).
, . 19.6.
, commit
. 10 balx, 9, .
, 10,
1,
. . , . .
. ,
. T-J : TJ
, ,
: ^ fj. TJ.
670
V,
http://openlib.org.ua/
.
,
:
.
, , ( ) ,
,
. ,
, , ,
, .
.
19.2.3.
, . i-' . , ( >; )-
% ,
.
,
:
()
() , . , .
-~ . .
, , .
. .
19.2.8, " ". .
. - "
, ,
-; .
' 19.
671
http://openlib.org.ua/
.
, , |
.
,
.
. , ,
, , .
, .
, , .
,
, ,
, .
- , .
, ,
. ,
, . , , .
, ,
( ).
, .
, , . , , .
, ,
. .
, .. .
,
. 19.5.
672
V.
http://openlib.org.ua/
I 19.5.
, . 19.6. , , :
S (write_locK(T 9 , b a l j , read(T 9 , balj , write (,, bal x ) ,
unlock(T 9 , bal x ) , write_lock(T 1 0 , bal x ) , read{T 10 , balj ,
write (T 10 , bal x } , unlock {T 10/ bal x ) , write_lock (T 10 , bal y ) ,
read(T 1 0 , b a l y ) , write (T 10 , bal y ) , unlock (T 1 0 / bal y ) ,
commit (T 10 ) , write_lock ( , bal y ) , read(T 9 , bal y ) ,
write(T 9 , b a l y ) , unlock{T 9 , bal y ) , commit ( ) }
bal x 100
, bal y 400 ,
bal x 220
, bal y 330 ,
9 10. 10
T s , bal x 210 ,
bal y 340 . S
bal x , 220 , a bal y 340. ( ,
S .)
, , / (,
balx) . (baly) , bal x
. ,
,
.
,
. (2PL).
.
, .
: , , , ,
. , . , , , 19.
673
http://openlib.org.ua/
.
, ,
.
.
, . , .
, .
,
.
,
. .
,
, 19.2.1.
19.6.
. 19.8.
, 2 1. , 100
. bal x . , 1
2 ,
^ , ^ (wait) 2 .
2 ,
19.8.
TI
ti
t2
t3
begin_transaction
write_lock (balx)
balx
begin_transaction
100
write_lock(balx)
read (bal x )
t4
WAIT
ts
WAIT
write (bal x )
t6
WAIT
commit/unlock (balx)
t7
read(bal x )
ts
ts
tlo
674
bal x = balx+100
100
100
100
200
200
200
write (bal x )
200
190
commit/unlock (bal x )
190
V.
http://openlib.org.ua/
19.7.
. 19.9.
^ bal x .
, 100 ,
. 1 , 100 . 3
1. , , 4,
4 . 4 .
19.9.
ti
bal x
begin transaction
ta
I
tt
begin___transact ion
write_lock (balj
t6
WAIT
100
w r i t e lock (bal x )
100
read (balx)
100
100
write (bal x )
200
rollback/unlock (bal x )
100
' '
t,
read(balx)
100
100
write (bal x )
90
commit/unlock (bal x )
90
n;
19.8.
. 19.10.
5
,
. 5 bal x . bal x 6
,
, .. .
19.
675
http://openlib.org.ua/
19.10.
ti
t
ta
begin transaction
begin transaction
sum = 0
balx
baly
balj.
sum
100
50
25
100
50
25
100
50
25
100
50
write_lock (bal x )
t4
read (balx)
bal x = balx-
WAIT
100
50
-..
write (balx)
WAIT
90
50
25
write_lock(bal z )
WAIT
90
50
25
t,
read (bal z )
WAIT
90
balz - bal z + 10
WAIT
90
.-
: ,
w r i t e (ba! E )
WAIT
90
50
35
WAIT
90
50
35
read (bal x )
90
50
90
50
90
90
50
tl!
read(baly)
90
tl.
90
read l o c k ( b a l E )
'
tlfl
til
'
commit/
unlock ( b a l x , bal z )
tie
read (bal z )
til
tao
commit/unlock (bal x ,
baly, b a l z )
0
90
.
50
-.
35
50
90
90
1'
51
140
175
175
, , [108]. , , , .
19.9.
, . 19.11,
. 14 bal x , bal y , , bal* , . 15
balx, , , . , 16 balx .
676
V.
http://openlib.org.ua/
14. T l s 14 ( , 14),
. , 16
15 . , ,
,
19.11.
14
ti
begin_transaction
write lock(balx)
:>
.s
T1S
read(bal x }
read_lock (bal y )
5
read(baly)
t.
write (bal x )
unlock (baljt)
begin_transaction
write_lock (bal x )
t,
tie
read(bal x )
,,
write (bain)
tl2
unlock (balx)
t
tic
rollback
begin transaction
tie
read_lock ( b a l x )
t17
rollback
tie
rollback
tl?
,
.
, , .
,
.
, 15
, 14 . . ,
, .
19.
677
http://openlib.org.ua/
2PL, - , . 2PL.
, ,
. ,
.
, ,
. (
19.2.4.) ,
,
- ,
. ,
, .
, , . ,
,
" , ".
( ) , . ,
( ),
. .
.
, .
,
.
- ( )
-. , - , ,
, - .
.
678
V.
http://openlib.org.ua/
,
, . , .
.
-, .
-
,
. ,
, , ,
. ()
,
-, ,
-. -
.
, , .
, , .
[290].
,
, ,
.
( ) -. , ,
, . ,
,
.
19.2.4.
. , ,
( ) , .
. 19.12 , 17 1, , . t 2
17
bal x , t s 18
19.
679
http://openlib.org.ua/
baly. t fi 17
1, ,
18. t 7 19, , 1
,
1 . , . ,
. .
19.12.
tj,
begin_transaction
t2
write_lock(bal x )
t3
t4
read (balx)
balx = bal x - 10
ts
w r i t e (balx)
TIB
begin_transaction
write_lock (bal v )
read(baly)
bal y = bal y + 100
ts
write_lock (baly)
write (bal y )
t?
WAIT
write^lock(bal x )
ta
WAIT
WAIT
t9
WAIT
WAIT
t 10
WAIT
, : . , . . 19.12 , , T 1S .
,
17 . ,
.
: , , . - , - ,
, . , ,
.
,
. 680
V.
http://openlib.org.ua/
- , ,
.
-
-. ,
,
, .
, -.
,
, , .
, .
,
19.2.5. [264]. , "-", ,
.
.
. , "-", :
.
, , .
(Wait-For Graph WFG).
. Tj , TJ , IV G-- (N, ), N, .
, .
Ti-^Tj, , -,.
, [157]. . 19.4 , . 19.12. , (17-1-17), , .
19.
681
http://openlib.org.ua/
. 19.4. ,
,
.
. ,
. ,
. , . .
, ,
, ( ).
, .
.
1. , .
.
. , ,
,
. :
) ( ,
, ,
);
) , ( ,
, , );
682
V.
http://openlib.org.ua/
) ,
(
, , , ). ,
.
2. . , . ,
, , .
,
.
3. . , , .
, 19.2.3,
, , . , ,
.
19.2.5.
. , .
, ,
. , , .
(timestamp),
,
. - ,
, ,
. .
-
, .
?; . , ;
| .
.
19.
683
http://openlib.org.ua/
. ,
,
{ )
: .
,
,
, . , /, . ,
.
, .
.
(read_tiraestamp), /
, , (write_timestamp), /
, () . , , ts ( ) , .
1. read(x)
(),
()
:
ts(T)
<
write_timestamp (). ,
, .
, , ,
.
,
.
(ts{T) > write_timestarap (x))
:
read_timestamp() = m a x ( t s ( T ) , read_timestamp(x)) .
2. write(x)
(),
: t s ( T ) < read_timestamp (x),
, . ,
, ,
. 684
V.
http://openlib.org.ua/
.
(),
:
ts(T)
<
write_timestamp (). ,
() .
, .
,
: write_timestamp() = t s ( ) .
, , ,
, , . , ,
, .
. ,
.
, [303]. , ,
.
(),
: ts{T) < read_timestamp{x).
,
.
(),
: ts(T) < write_
timestamp (x). ,
, , , . .
. .
,
: write_timestamp() = t s ( ) .
,
-
, . , , . 19.7,
bal x , 11( 19.
685
http://openlib.org.ua/
, 12.
,
, . ,
- .
,
, .
I 19.10.
. 19.13 ,
19 ts(T l 9 ), 2 0 t s ( T j 0 ) , 31 t s ( T 2 1 ) ; ts(T 1 9 ) < t s ( T a o ) < t s ( T 2 1 ) .
19.13.
ti
t
T19
21
begin transaction
read (balx)
balx =
bal,c + 1 0
write (balx)
read (baly)
baly =
baly + 20
read (baly)
i,
i
read (balx)
balx = balx + 10
write (balx)
begin__transaction
read (baly)
baly =
baly + 20
write (baly) n
baly =
baly + 30
write (baly)
1 = 100
write (balz)
i
'- i
;
1
t
baly =
baly -t- 30
write (baly)
balz = 100
write (1)
12 = 50
balz = 50
write (balz)
write (balz)
read (baly)
baly =
baly + 20
write (baly)
tie
begin transaction
read (baly)
write (baly)
1
20
commit
commit
begin transaction
read (baly)
baly =
baly + 20
write (baly)
commit '
.
t e , ;, , .
ti4.
686
V.
http://openlib.org.ua/
t14 , Ti9,
, T2i t12.
. 19.5 (Conflict Serializability CS), , (View Serializability VS),
(Two-Phase Locking 2PL) (TimeStamping
TS). , , , ,
, 2PL
TS, , 2PL TS, .
, , (2PL TS), ,
2PL, TS, .
. 19,5.
(CS), , (VS), (2PL) (TSJ
19.2.6.
, ,
. ,
, - ,
.
, 19.4 [24], [59],
[60]. , [256], [257].
19.
687
http://openlib.org.ua/
19.5 Oracle .
, , ,
.
,
, ,
,
.
. -
, ,
.
,
Xi, x2, ... , i- .
x i t
, read^timestamp (xi), ,
Xi , write_timestarap (X;J,
, Xi.
t s ( T ) .
.
1. , write ().
, , 3 , , t s { T ) < ts{T-|}. ,
Tj. , Tj
, .
, Xj
, ts(T)
(..
write_timestamp(xj} < t s ( T ) ) read_timestamp(xj) > t s ( T ) , .
Xi
read_timestamp(x t ) = write_timestamp (Xi) = t s ( T ) .
2. , read ().
,
Xj
, ts (), , . write_timestamp(Xj), , write_timestamp(xj) < t s ( T ) . read_timestamp (^5 = m a x ( t s ( T ) ,
read_timestamp (-,)). , .
688
V.
http://openlib.org.ua/
, .
. ,
Xi .,
.
19.2.7.
, , ,
. , ,
, , [201]. , .
, . , , . , , , ,
, .
, ,
- .
, .
, , .
,
.
. , , .
. ,
, .
, , , -
.
, . , . , , ,
.
.
, , . , ,
.
19.
689
http://openlib.org.ua/
, . , start (). (validation ()) ( f i n i s h ( T ) , ).
, .
1. S
: finish (S) < start (T).
2. - S, :
) , , ,
;
)
: start () < finish(S)
< validation().
2, , , , . 2,<5 ,
,
.
, . ,
, . ,
,
,
. , , .
19.2.8.
. , .,
,
" ", ,
. , , (
, ).
.
.
690
V.
http://openlib.org.ua/
( ; , ).
,
.
( ) , ,
.
,
. ,
.
, .
, .
,
. , .
, . ,
95% ,
. .
, , . , ,
.
. ,
. ,
,
. ( ) .
. ,
. , , .
, .
, , . 19.6.
19.
691
http://openlib.org.ua/
. 19.6.
, 1-
, 2- . , ,
. - , -. ,
(),
(^ 2) (, 2) .
, , .
, ,
, ,
, , -
. ,
i
(2), () ,
, ( ) , . , , .
692
V.
http://openlib.org.ua/
, , -. , ?, ,
, , .
,
, , .
, [139]. ,
, . (, ^) , , , ,
.
(Shared ), (eXclusive ). (IS) ,
(IX) , . , (SIX), ,
IX. , SIX IS. ,
,
. 19.14.
19,14.
,
IS
IS
IX
SIX
IX
SIX
X
X
</ ~ ; *
.
, .
19.
693
http://openlib.org.ua/
,
.
,
.
, , .
. , - ,
.
19.3.
. , .
,
,
.
,
. ,
. , ,
, , , .
19.3.1.
, : , ,
. ,
.
. , ,
- .
,
, , .
, . , , ,
. ,
( ) .
,
( ),
. , 694
V.
http://openlib.org.ua/
RAID -, ,
( ) (. 18.2.6).
,
,
. ,
() . , .
, , .
, ,
, .
, , , ,
.
, ,
.
,
.
, , .
,
, : ,
, .
,
.
19.3.2.
. ACID ( ) .
,
,
. ,
( ), , ,
, , .
,
(, . 19.1, ). .
2
19.
695
http://openlib.org.ua/
, .
.
salary.
.
, .
.
salary .
.
.
, ,
.
(, ) , . .
, , .
,
(redo) (
), .
,
, (undo) ( ), . ,
. ,
, .
, , , .
, .
19.11.
. 19.7
..., 6. t a , t f
. , 2 3
.
, - Ts
. , . , , () 4 5,
. 696
V.
http://openlib.org.ua/
,
2
T3
T4
Ts
to
to
t,
, 19.7.
,
, . -
2, 3 , 4 5.
,
.
, , , , .
, , () ,
,
.
(First-In-First-Out FIFO) (Least Recently Used LRU). , ,
.
(pinCount dirty)
. , ,
.
,
.
,
1. , (
), pinCount (pin count
). , ,
. , .
" 19.
697
http://openlib.org.ua/
2. dirty , .
3. , dirty
.
pinCount 1. , , pinCount 1. , , ,
dirty , .. ""
( ). pinCount ,
,
(.. dirty ).
,
.
, ( ).
, "" , . .
, , ,
. .
, , ,
. , , , , , , ,
, ,
. , , , .
, , , , , , (
). ,
, ,
, , i
, ,
. 7
, '
.
698
V.
http://openlib.org.ua/
19.3.3.
:
,
;
,
;
,
;
,
, .
, ( ) .
.
(.. ).
, . ,
, ,
, .
, . .
,
;
( , ,
, );
,
( , );
, ..
( );
, .. ( );
,
(
).
, .
, (, , ..). (, ,
, ..).
19.
699
http://openlib.org.ua/
. . 19.15
, 2 . pPtr nPtr
.
19.15.
Tl
10:12
START
10:13
UPDATE
!;=
10:14
START
'
T2
10:16
INSERT
STAFF
SG37
T2
10:17
DELETE
STAFF
SA9
.,,.-,
10:17
UPDATE
10:18
START
10:18
COMMIT
10:19
CHECKPOINT
10:19
COMMIT
10:20
INSERT
STAFF
SL21
PROPERTY
PG16
nPtr
.,
pPtr
2.
'
PROPERTY
10;
COMMIT
, , . .
, . ,
. ,
, .
, (,
- 104 ),
. (,
). (, )
. ,
, .
700
V.
http://openlib.org.ua/
,
.
,
(, 70%). ,
.
,
. .
,
, . ,
, , .
.
, , , .
.
; .
. .
.
.
.
. ,
.
,
,
.
, ,
. ,
, , , . ,
1 , .
: , , , [, .
19.
701
http://openlib.org.ua/
19.12.
19.11. , t c
, ,
2 , .
.
4 5, . , 6,
.
,
. , 15-20 .
19.3.4.
, , , .
.
(, ),
, , . , , .
( , 16) , ,
, ,
, .
, .
, (, - ), , . ,
, . ,
, .
,
, ..
,
, (
,
. ,
, .
702
V.
http://openlib.org.ua/
, . ,
,
. ,
. .
.
(
, ). .
,
. ,
, , , . , .
.
,
, .
,
. , . ,
.
, ,
. ,
, , , .
,
, , ( , ).
, ,
.
, , , ,
, , .
,
, , .
19.
703
http://openlib.org.ua/
, . , , ,
.
.
.
.
,
.
.
.
, ( ) .
.
,
( )
. , ,
, , .
,
,
.
,
. ,
,
,
, .
. ,
, ,
, , . ,
, , , . , , . , ,
, .
704
V.
http://openlib.org.ua/
, ,
.
, .
, ,
[210]. . , .
. ,
. . : , ,
,
. :
.
19.4.
,
, ,
, . .
, , .
, .
24.1 ,
. (CAD), ()
(CASE), , .
, , , .
.
. ,
, .
, , , , .. 19.
705
http://openlib.org.ua/
.
,
.
.
,
.
.
.
.
,
, , , .
.
,
.
. , , , .
(, ). . ,
, .
, , , . ,
, [136].
. , .
19.4.1.
.
,
. .
706
V.
http://openlib.org.ua/
(Moss) 1981 .
,
,
.
. , ,
, , , .. , ,
{ ). . 19.16
T l t ,
.
(2), (5) (6). : (3)
- (4).
. ,
3 4 2, 2
^.
.
, .
.
. . (6)
.
, . , ,
, .
.
,
, , . , 3 ,
2 . ,
:. , .
(ACID), -
( ) .
,
. , . , ,
, , 19.
707
http://openlib.org.ua/
19.16.
begin_transaction Ti
Complete_Reservation
begin_transaction T2
Airline_reservation
begin__transaction T3
First_flight
Connecting_flight
reserve_airline_seat(Paris, New Y o r k ) ;
commit 4 ;
commit T2,begin_transaction Ts
Hotel_reservation
book_hotel(Hilton);
commit ,begin_transaction Ts
Car_reservation
book__car () ;
commit T 6 ;
commit Ti;
. ,
. , ,
.
.
. , .
.
, .
. .
. ,
-
.
. , ,
- .
708
V.
http://openlib.org.ua/
, . , , SAVE
3
WORK . ,
,
, , ROLLBACK WORK
__^. ,
, -
.
19.4.2.
. () , .
(sagas), - (GarsiaMolina) (Salem) 1987 , . ,
,
, .
,
, . , , , . , , T l s
2, ..., C lt 2, ..., ,
.
1. T lf 2, -.., .
2. 1 2 , ..., Ti, Ci. lt .,., -,
.
, ,
, :
3, 4 , , 6
-
, . 19.16. ,
, .
, . 3
SQL
.
19.
709
http://openlib.org.ua/
,
, . . ,
.
. ,
.
19.4.3.
, 19.4.1, ,
, . . , . , *
.
, .
,
[322], [323]. .
. L 0 , Lj
Ln, L 0
, a L n . , (L0) . ,
Li , , Li.! . ,
.
, , , 8, . 19.18. , .
7
, . 19.17.
, ,
.
19.17. 7
7:
71, balx 5
T7J, balv 5
710
T8i, baly
, 1 2
V.
http://openlib.org.ua/
19.18.
t,
begin_transaction
ta
read(bal x }
ta
bal x = bal x +
t<
write (balx)
begin transaction
i
t,
read (baly)
tT
baly = baly + 10
ta
write (baly)
t,
read (baly)
tio
baly = bal y - 5
tn
t
write (baly)
commit
read(bal x }
tn
bal x = balx - 2
tia
W r i t e (balx)
tii
commit
19.4.4.
, , ( ), , , , ..
, (ACID) ,
: (split_transaction)
(join_transaction) [253]. , , (, ).
(, ) , .
, ,
, ACID,
.
,
,
. ,
, , .
19.
711
http://openlib.org.ua/
19.4.5.
, ,
. , - ,
.
,
. ,
ACID , .
, , , (, , ).
,
DreamHome. ,
, ,
712
V.
http://openlib.org.ua/
. , , . ,
. ,
, .
: . ,
,
. , [267].
. ,
.
.
,
.
. ,
.
, , ..
,
. , , ,
. ,
. ,
. , , .
[20], [140], [186], [200] [281].
19.5.
Oracle
OracleSi [237].
Oracle
, 19.2. , .
19.
713
http://openlib.org.ua/
Oracle ,
.
, Oracle , , . ,
- ,
, ,
. . ,
Oracle: , .
Oracle 8.2.
19.5.1. Oracle
6.5 ,
. Oracle , ISO SQL
(READ
COMMITTED SERIALIZABLE).
READ COMMITTED. (
).
, ( ). , , ..
.
SERIALI2ABLE. , ,
,
,
INSERT, UPDATE DELETE.
, ,
. , ,
,
. , READ
COMMITTED .
SERIALIZABLE, , ,
. .
, Oracle , .
READ ONLY. ,
, , .
Oracle ALTER SESSION SET TRANSACTION SQL.
714
V.
http://openlib.org.ua/
19.5.2.
Oracle. ,
,
(System Change Number SCN) .
Oracle, .
Oracle
. ,
. , ;
.
Oracle (SCN),
, . Oracle
SCN
. SCN
,
. SCN , ,
, .
SQL, - .
Oracle , , , .
, .
,
Oracle ,
.
19.2,
. , ,
SQL . ,
,
.
,
, ,
,
19.
715
http://openlib.org.ua/
. Oracle
,
.
Oracle , . >
DDL. ,
.
DML. ; , ,
.
. .
. , , .
. .
. (Parallel
Cache Management )
.
19.5.3.
Oracle
, . , , . , ,
,
, .
19.5.4.
Oracle
, .
, . Oracle [237].
Oracle (Recovery MANager RMAN)
,
, :
;
;
;
.
716
V.
http://openlib.org.ua/
RMAN .
, .
Oracle Oracle ,
; .
Oracle , 19.3; ,
. Oracle
,
(INIT.ORA), , .
Oracle
(SCN).
, -
(, ). Oracle , ,
, .
Oracle . , Oracle
( )
.
.
, .
,
.
,
.
, .
19.
717
http://openlib.org.ua/
( ), ,
. ,
.
() ().
.
.
, ACID (Atomicity, Consistency, Isolation, Durability
, , , ).
,
.
, .
,
.
, , . . ,
.
, , . ( ) ( ). ,
.
, .
, , .
.
, ,
.
.
,
, . , -
, .
,
, , , .
/ . .
718
V.
http://openlib.org.ua/
, /
.
,
.
, . - .
, . ,
.
.
, .
, .
, , , .
19.1. ? ?
19.2. ,
(ACID) .
.
.
19.3. ,
.
19.4. ,
,
19.3.
?
?
19.5. , . .
19.6. ?
19.7. ?
19.8.
?
.
19.
719
http://openlib.org.ua/
19.9. .
,
, , ?
19.10. , .
, .
19.11. .
19.12.
?
19.13. , .
?
19.14.
? ,
, ,
. ?
?
19.15. .
19.16. :
) ;
) ;
) ;
) .
19.17. , .
? ? -
, 19.4?
19.18. , , , . , ,
a) readd1!, bal x ) , read{T 2 , balj , w r i t e ( T l f balj ,
write (T 2 / bal*)
commit (T a ) , commit ( T 2 ) ;
) read{T 1 ( bal x ) , read(T 2 , bal y ) , write (, bal x ) ,
readd2/ ba.lx} , read (T^ bal y ) , commit () , commit (T2);
) read(T 1 ( bal x ) , w r i t e ( T 2 , bal x ) write (Tlr balx) ,
abort (T 2 ) , commit di);
) write (T!, balj , read(T 2 , bal x ) , write di, bal x ) ,
commit (T 2 ) , abort (Tj ;
e) readd!, balj , write(T 2 , bal x ) , write{T l f bal x ) ,
read(T 3 , bal x ) , commit (TJ , commit (T 2 ) , commit (T 3 ).
720
V.
http://openlib.org.ua/
19.19. (-), .
19.20. .
) ,
? , , :
S = [R,(Z), R 2 (Y), W 2 (Y), R 3 (Y), R^X), W a (X), W^Z), W 3 (Y), R2(X), Ra(Y), W^Y),
W 2 (X), R 3 (W), W 3 (W)]
R i ( Z ) W i ( Z )
() 2 1;
) , ? .
?
19.21.
, .
13
Xg
X4 r X j
* 4
Xy
Xj
i6
X 4 , Xi>
Xg
19.22. . ?
19.23. ,
.
19.24. , 19.1-19.3,
,
.
19.25. . 19.5 (Venn),
, , , . ,
.
, ,
.
19.26. ,
? ?
19.27. ,
?
19.
721
http://openlib.org.ua/
http://openlib.org.ua/
...
.
.
.
,
.
.
.
,
.
.
.
.
.
.
Oracle.
,
, .
, . ,
,
.
-
, COBOL. 5 .
1 , ,
3QL, , , , . -
http://openlib.org.ua/
,
. , - ,
. ,
, , - .
,
.
. , .
( ), .
.
20.1 , 20.2 , . ,
, , ,
. 20.3 , ^
,
. 20.4 ,
.
,
.
20.5 , .
, , . Oracle.
, , .
,
. ( 23.7) !
27.5 , !
-*
, , i
, .
, !
, 4.1,
, . ,
Dreamttome,
10,4 .
724
V. ;
http://openlib.org.ua/
20.1.
: . , .
, ( SQL), ,
, . .
. .
.
,
, .
, [270].
, ,
[307].
, [162]. '
,
.
. . , .
, , ,
(. ). . , ,
. , , (,
), .
: . 20.4.1.
.
20.
725
http://openlib.org.ua/
I 20. 1 .
,
SQL :
SELECT *
FROM S t a f f s,
Branch b
3.
(CTposicion, 'Manager' ( S t a f f
Branch)
, ,
Staff 1000 , Branch 50. ,
50 ( )
.
,
. ,
- , .
, . ,
( , , ,
), ,
,
.
Staff Branch, (1000+50)
, (1000*50) . (1000*50)
, .
:
(1000 + 50} + 2* (1000 * 50) = 101 050
staff
Branch branchNo, 10004-50
. , 1000
(
).
1000
, :
2*1000 +
726
{1000 + 5 0 )
= 3 050
V.
http://openlib.org.ua/
Staff , , 1000 .
50 . Branch , . 50 . Staff Branch, 50+5
. , :
1000 + 2 * 5 0 + 5 + (50 + 5) = 1 160
, ,
87 .
Staff 10 000,
500,
870 ! , ,
.
,
. ,
,
, .
:
( ), , , . 20.1.
20.2 , . .
.
. . , .
, ,
. , , .
,
,
.
; , .
- 1 .
,
" 20.
727
http://openlib.org.ua/
( SQL)
. 20.1.
.
. , , , .
,
, ,
.
.
, .
20.2.
.
i
*
.
, , .
728
V. ;
http://openlib.org.ua/
1.
, [2]. , .
, ,
. , :
SELECT StaffNumber
FROM Staff
WHERE position > 10;
.
1. StaffNumber,
Staff ( staffNo).
2. WHERE "> "
position, .
,
. , . .
- ( )
.
, .
.
- .
. 20.2 , SQL,
20.1. .
.
2.
,
. ( SQL WHERE),
,
Staff
b.eity.'London'
Branch
. 20.2.
20.
729
http://openlib.org.ua/
.
[181].
.
, (AND). ,
v (OR). :
(position 'Manager' v salary > 20000) branchNo = '
, ,
, .
.
, v (OR),
,
(AND). , :
(position == 'Manager' branchNo = ' ' ) v
1
(salary > 2 0 0 0 0 branchNo = ' }
, ,
, .
3.
,
. ,
. , . ,
. , Staff (position = 'Manager'
position = 'Assistant') , (Manager),
(Assistant). ({position = 'Manager 1 position =
'Assistant') v salary > 20000) (salary >
20000),
FALSE. ,
.
, .
.
1. [327]. , .
yaej
,
.
,
.
2. [263]. rpatj
, ,
.
-i
730
V. ;
http://openlib.org.ua/
0. , ,
0, . -> , , ( < b + ), 0 -> -,
( > ).
I 20.2.
SQL:
SELECT p.propertyNo, p.street
FROM Client . Viewing v, PropertyForRent p
WHERE c.clientNo = v.clientNo AND c.max_rent >= 500 AND
c.prefType = ' F l a t ' AND p.ownerNo = ' C 0 9 3 1 ;
. 20,3, :
) ; )
" 20.
731
http://openlib.org.ua/
:
SELECT p.propertyNo, p.street
. 20.3, . .maxRent 0,
, , , . ,
,
500 200 .
4.
, ,
. , , .. ,
.
, . ,
, :
() =
false = false
true =
(~) = false
( v q) =
() =
false =
true = true
(-p) = true
{ q) =
v
v
v
v
, ,
:
CREATE VIEW staffs
AS SELECT staffNo, fName, IName, salary, branchNo
FROM Staff
WHERE branchNo = 'B003';
SELECT *
FROM staffs
732
V. ;
http://openlib.org.ua/
WHERE (branchNo =
' AND salary > 20000).
. , , , Manager
20000 :
CREATE ASSERTION OnlyManagerSalaryHigh
, :
SELECT *
FROM Staff
WHERE (position = 'Manager' AND salary < 1 5 0 0 0 ) ;
, WHERE , 15000 ,
, .
5.
, .
.
20.3.
,
, . , 20.1 ,
, , . 20.3.1 , ,
, . , , 20.3.2 : ,
'. , .
20.3.1.
,
, . () , . 20.
733
http://openlib.org.ua/
[3].
R, S ,
R = { 1( 2 , > } S
= { 1( , ..., }. , q , , L l f L 2 j M, MI, 2 N
.
1.
( ).
<Wr(R> = o p (o q (o r (R)))
. :
-'' salary>15QOQ ( S t a f f )
2. .
0p(Oq(R) ) = Oq(Op(R))
:
a
3.
.
... (> = 0 L ( R )
:
1'lNamellbranchNo, name ( S t a f f I
= 1 11Narae ( S t a f f
4. .
, ,
:
1 ..... ^(OptRn-Opdl^ ..... fi m {R}> { 1( ,..., ^}
:
HfName.lName (^lName= ' Beech' { S t a f f ) )
5. - ( ).
R Xp S = R
R X S = S X R
-, .
, staff
Branch :
Staff
X s t a i f .branchNorBranch.branchNo
Branch
Staff
6. - ( ).
, ( ;
) :
734
V. ;
http://openlib.org.ua/
O p (R Xlr S)
= {0 P (R}) XT S
Op{R x S) = ( a p ( R ) ) x s
{A 3 f A 2 , ..., A n }
,
( q), R, q
S, - :
<Vq(R XT s) = ( a p ( R ) } xt C a g ( S ) )
cWR x s) - ( o p ( R ) ) x (o q ts)}
:
1
Bj
t c
Mana
( jo - i *i"'
er
9 '
(Staff) )
(Staff
Xscf t .branchNtwBranch.branchMo
>< sta.brancHto.aranch.branchN3
(Ocity.'LDJoii'
Branch)
(Branch) )
7. - ( ).
L = L3 u L2,
LI R, L2 S, , L, -
:
:
Hposition.city.branchNo ( S t a f f
(llpositioti,branchtfo (Staff } )
><
Staff.branchNo=Branch.branchNo
X staff -branchNo=Branch.branchtto
Branch)
,
L, = M! u 2, R, 2 S,
:
:
f ~ f ^*<*1
''^!'4}-! ^
position, cicy l^LdiO. '-"^staEE.branchNO'Branch-branchMo ci.eiiii.il/
^^staf .branchNo-Branch.hranchWo
(licity,
(Branch)) )
8. (
).
R U S = S U R
R S = S R
9-
(, ).
CF p (R U S)
CTp(S)
U Cp(R)
O p (R S) = Op(S) O p (R}
C p {R - S) = C p (S) - O p ( R )
" 20.
735
http://openlib.org.ua/
10. .
u s ) - n L ( s )
11. - ( ).
:
(R !>< S) ><1 = R X (S X }
(R X S) X = R X
(S X )
q S ,
- :
(R S) ^
= R ixfe (S IXq )
:
Staff
t^staff-staffNo=PropertyForRent . ataffNo
t ^ s t a f f - s t a f f M o ^ P r o p e r t y F o r R e n t . s t a f f N o Staff.lName=lName
(PropertyForRent
xWierno Owner)
,
,
( S t a f f . IName) PropertyForRent Owner:
PropertyForRent >^ r0 pertyForReiit.cwnerNo=Qwner.ownerNo Staf.lBame=Owner lHame Owner
12. ( ).
(R U S} U = S U
(RUT)
{R S) = S
(ROT)
20.3.
, , ,
' '.
SQL :
SELECT p.propertyNo, p.street
FRQM Client c. Viewing v, PropertyForRent p
WHERE c.prefType = ' F l a t ' AND c.clientNo = v.clientNo AND
v.propertyNo = p.propertyNo AND
c.max_rent >= p.rent AND c.prefType = p.type AND
p.ownerNo = ' C 0 9 3 1 ;
, , ''
. SQL :
736
V. >
http://openlib.org.ua/
I \C
VJ
X p) )
, . 20.4, .
.
1. . 1, , .
. 2 6, .
. 20.4, .
2. , 4.1.3,
,
, :
a R . aiS . b (R x S) = R >< R . aiS . b s
. . 20.4, .
3. 11, , p.ownerNo = ' ' ,
20.4, .
4. 4 7, , , .
. 20.4, .
,
, ,
.prefType=p. type
p.type = ' F l a t 1 ,
.pref Type= ' F l a t ' . , .
, . 20.4, .
" 20.
737
http://openlib.org.ua/
"
. p,itr*M
"*
/\ '
/\.
a)
6)
Q.cuntNe-v.oUintND
L
i
_Z ii_ _2 L..
aprtlTyp*
jLL~ *_J!L;L-n_lL.L
/
/ \ \
(Mint, P-typ*
v.dbntNo
parent
e)
/ \ \
J.4.
20.3: ) ; )
, ; ) , / ; ) ,
; ) ,
; ) , c.prefType =
'Flat' p. type
738
V.
http://openlib.org.ua/
20.3.2.
. ,
.
1. .
. 1 ,
2, 4, 6 9,
. ,
. ,
, .
2. , .
,
-;
OR. 0 s . b ( R X
S)
R . 0 s . b S
3. - , - .
,
. , :
(R Xfe. a e s.b S)
Xls.c 0 T . d
11 12,
- (
). ,
, .
.
4. .
, ,
, . 3 ,
4, 7 10, .
( ). ,
, .
5. .
, ' 20.
739
http://openlib.org.ua/
. , , ,
.
, .
23.7 ,
. 27.5 ,
- , ,
.
20.4.
.
.
, , , .
.
.
, , .
. , .
. , , .
,
.
20.4.1.
, . , , .
R
nTuples ( R ) , () R (.. ).
bFactor(R). R (..
R, ).
740
V. )
http://openlib.org.ua/
nBlocks ( R ) . , R, R
, :
nBlocks(R) = [nTuples{R}/bPactor(R)J
R
nDistinct A (R). R.
min A (R) , max A {R). R.
SC a {R). R. , , . ,
R
,
, SC A (R) , . 20.1.
20.1.
R
SC A {R) =1
SCA(R) = [nTuples {R}/nDistinct A( R) ]
R
R
, . SC A {R) , . 20.2.
20.2.
R
(>)
(<)
{A in
S C A ( R ) = s c A ( R ) *SC B (R)
sc A (R)=sc A {R)+sc B {R) -sc A (R)*sc B (R)
{Ci,c2,...,cn})
( )
(A v )
I
nLevels ft ( I ) . I.
nLf Blocks A {I). - I.
. , ,
20. .
741
http://openlib.org.ua/
. ,
,
(, ), . : ,
, .
20.4.2. (S = ap(R))
4.1.1,
, R.
S, R,
. , R , . ,
,
(AND), v (OR) - (NOT). , , , , . , .
( , ).
( , ).
.
, .
, .
, () .
, () .
, ^-.
. 20.3.
20.3. -
(
)
[nBlocks(R)/2]
;
nBlocks(R)
(
)
[log:(nBlocks{R)} ]
;
[loga(nBlocks(R) ) ] + [SC A (R)/bFactor (R)
-1
1
nLevelsA(I) +1
742
V.
http://openlib.org.ua/
. 20.3
()
()
*-
,
S, R. . , ,
, :
nTuples(S) = SC A (R)
( )
* S nDistinct a (S)
:
nTuples (S), nTuples (S}< nDistinct g (R}/2;
[(nTuples (S) + n D i s t i n c t a ( R ) ) / 3 ] ,
nDietinct s (R)/2 nTuples {S) <> 2*nDiatinct B ( R ) ;
nDistinct B {R), nTuples (S) > 2*nDistincC B (R).
,
, , [251],
Oracle 20.6.2.
1. ( )
, . , 20.1.
.
, ,
.
[nBlocks(R}/2]
,
, :
iBlocKs(R)
" 20.
743
http://openlib.org.ua/
20.1.
// .
// predicate - .
// . ,
// 1. ,
// R, predicate
//
for i = 1 to nBlocks(R) {
//
block = read_block(R, i) ;
for j 1 to nTuples(block) { // i
if (block.tuple[j] predicate>)
then < >;
2. ( )
(=) ,
R,
:
[log 2 (nBlocks(R) ) ]
20.2. :
[logj(nBlocks(R) )] + [SC A (R}/bFactor(R)] - 1
,
. , SC A (R) , [SC & (R) /bFactor (R) ] ( ,
.
20.2.
// .
// predicate - .
// .
// nBlocks , ,
// 1. (found),
// , ,
// , ,
//
next = I; last = nBlocks; found = FALSE; keep^searching = TRUE;
while (last >= 1 and (not found) and (keep_searching) ) {
i = (next + last) /2; //
block = read_block (R, i) ;
if (predicate < ordering_key_field(first_record (block) ))
then
//
last = i - l f
else if (predicate > ordering_key_f ield(la.st_record (block) ))
744
V.
http://openlib.org.ua/
then
//
next = i + 1;
else if (check_block_for_predicate(block, predicate, result))
then
//
found = TRUE;
else
//
keep_searching = FALSE;
3.
, . , 1.
, , ,
4.
(=), , , .
,
, .
:
nLevels A (I) + 1
5.
(<, <=, >, >=), , =. , , .
, ,
.
:
nLevels A { I ) + [nBlocks ( R ) /2 ]
6.
()
,
, , . :
nLevels f t (I)+ [SC A {R) /bFactor (R) ]
20.
745
http://openlib.org.ua/
, , , SC A (R) .
7.
()
,
, , . , ( ). :
nLevels A (I) + [ S C A ( R ) ]
8.
*-
(<, <=,
>, >=), +-, < <= - , > >= . ,
- .
:
nLevels A (l) + [nLfBlocks A (I) /2+nTuples ( R ) /2]
+-
20.3.
20.3- *- ,
//
//
//
//
//
//
//
//
//
//
//
//
+-.
+- ,
, . -,
: , .
: (key) ()
(, NULL) .
: key! <: key 2 < key3 < ... < keyn.!.
- .
predicate - .
(found) , ,
,
(return_address) ,
//
node = get_root_node (} ;
while (< ->) {
1=1;
// ,
while (not (i > n or predicate < node [i] .key) } {
i = i + 1;
746
V.
http://openlib.org.ua/
, .
, , . 20.2 , .
, .
, , .
, .
1. , , ,
2-8, .
.
2.
( ), ( ).
, .
3. , , , ,
, ,
,
. , ,
.
,
.
20.
747
http://openlib.org.ua/
v (OR)
, ,
. , , ,
20.4.5, . ,
, .
,
. ,
.
20.4.
staff .
( staffNo)
, .
branchNo,
.
+- Salary.
s t a f f , . 20.4.
20.4. Staff,
,
n T u p l e s ( S t a f f ) =3000
b F a c t o r ( S t a f f ) =30
nBlocks(Staff)=
100
SCbranchM ( S t a f f ) = 6
nDistinct p D ! ! i r ion(Staff) = 10
SCpo.itionfStaff)
SC B a i a c y(Staff) = 6
= 300
s t a f f N o 50
, () 100 . -
748
V.
http://openlib.org.ua/
;
S1 <7 8 t a ffNo,' S G5< ( S t a f f ) ;
S2
S3
^posiCion-'Manager1 ( S t a f f ) ;
Obranehuo.'' ( S t a f f ) ;
S4 O sa i arys20 ooo ( S t a f f ) ;
CJposition-'Manager' branchNo.'BOOJ' ( S t a f f ) .
1.
. staffNo , ,
, 1 .
:
SC.t.f , (Staff )*1,
2. , , 100
. :
SCposltioil ( S t a f f ) =300.
3. , , ,
. , : 2+ [6/30] =3 . : SC braneh! j 0 (Staff )=6.
4.
Salary.
+-, ,
: 2 + [50/2] + [3000/2] =1527 .
, ,
.
:
SCaalary ( s t a f f } = [3000* (50000-20000) / (5000010000)]=2250.
5. ,
branchNo.
S3, 3 .
,
(position^ 'Manager'). , : SCbrar.chNo ( S t a f f ) =6.
,
position .
: r>istinctpaBitian(T) = [ ( 6 + l Q ) / 3 ] =6. , : ^^ () =6/6=1, , DreamHome
.
20.
749
http://openlib.org.ua/
nBlocks(R)-(nBlocks(R)*nBlocks{S))
n B l o c k s { R } + [ n B l o c k s ( S ) * (nBlocks
(R}/(nBuffer-2))]
nBlocks(R)+nBlocks{S}
R s
(nBuffer-2)
,
R
,
:
nBlocks(R)+nTuples{R)*(nLevels f t
(D+l)
750
,
s
V.
http://openlib.org.ua/
. 20.5
nBlocks{R)+nTuples(R)*{nLevelsA
<I) + lSCA(R)/bFactor(R)]>
n B l o c k s ( R ) * [loga { n B l o c k s ( R ) ] 4
n B l o c k s ( S ) * [logs (nBlocks(S)]
nBlocks(R)+nBlocks{S)
3{nBlocks{R)+nBlocks ( S ) )
2 ( n B l o c k a ( R ) + n B l o c k s ( S ) ) * [lognBu
ffer-1{nBlocks(S))1]+nBlocks(R)+nBlocks(S)
R S, RXS,
:
nTuples(R) * nTuples(S)
,
,
. , ,
nTuples(T) nTuples(R) * nTuples(S)
, . , ,
(R.A = S . B ) .
1. R,
S R. ,
S:
nTuples(T) < nTuples(S)
2. , S,
nTuples(T) < nTuples(R)
3. , , :
nTuples(T) = SC A (R)*nTuples(S)
nTuples{T) = SC B (S)*nTuples ( R )
, s S SC A (R) 20.
751
http://openlib.org.ua/
R .
S, .
,
1.
,
.
R,
S. , ,
, ,
, ,
, 20.4.
20.4.
// .
// , 1.
// R S
//
R ,
S R,
nBlocks(R) + (nBlocks(R) * nBlocks(S))
, ,
,
. ,
,
.
(, R) . 752
V.
http://openlib.org.ua/
nBuf fer ,
nBuf fer-2 R S. R - nBlocks ( R ) , S [nBlocks (S) * (nBlocks (R) / (nBuffer-2) ) ] .
:
nBlocks(R) + [ n B l o c k s ( S J * { n B l o c k s ( R ) / ( n B u f f e r - 2 ) ) ]
R,
:
nBlocks(R) + nBlocks(S)
( ) ,
, .
2.
( -),
. R
S . 20.5.
,
. ,
R, .
(. 20.19).
20.5.
/ / R S ,
// .
, I S,
I [1] , 1 [ 2 ] , ... , I [m]
t I
R [ i ] . A .
// R , 1.
// R S
for iblock = 1 to nBlocks(R) {
Rblock = read_block(R, iblock);
for i = 1 to nTuples(Rblock) {
for j = 1 to ra {
if ( R b l o c k . t u p l e [ i ] . A = I [ j ] )
then < >,}
" 20.
753
http://openlib.org.ua/
,
R S. R nBlocks(R),
.
S
, . , S ,
nBlocks(R) + nTuples(R) * (nLevels A (I) + 1)
S , :
nBlocks(R) + nTuples{R)*(nLevels A (I) + [SC A (R) /bFactor (R) ] )
. -
, . R 5, . ,
.
, ,
, . , " ", .. , ,
,
. -
nBlocks(R) + nBlocks(S)
(, R) , ,
:
nBlocks ( R } * [log 2 (nBlocks(R}]
-
20.6.
20.6. -
//
//
//
//
//
//
R S .
" ".
. R S
{ ,
, )
Sort (R) ;
sort (S) ;
//
754
V.
http://openlib.org.ua/
nextR = 1; nextS = 1;
while (nextR <= nTuples(R) and nextS <=nTuples(S)) {
join_value = R.tuples[nextR].A/
// S ,
// , ,
while (S.tuplestnextS].A < join_value and nextS <= nTuples(S))
nextS = nextS + 1;
//
//
//
//
, R S.
S join_value
R
join_yalue. ( M:N)
while (S.tuples[nextS].A = joinjvalue and nextS <= nTuples(S))
m = nextR;
while (R.tuples[m].A * join_value and ra <= nTuples{RJ) {
S.tuples[nextS]
R.tuples[m] >;
m m -f 1;
}
nextS - nextS + 1;
}
// R S
// join_value. R
// join__value
while {R.tuples[nextR].A = join_value and nextR <= nTuples(R))
nextR = nextR + 1/
}
4.
( ) R
S . : ,
, R
S -,
. R S
,
.
. , R - h (^ R l f R 2 , ..., ^,, S
slt S2, -, Sm, R S
, a h (R.B)^h (S . ) , R.B^S.C. h ( R . B ) =h{S. ) ,
, R.B=S.C, .
, ,
R S.
20.
755
http://openlib.org.ua/
,
, RJ.. RI ,
Si RI. - R A -, ,
. 20.7.
:
3{nBlocks(R) + nBlocks(S) }
R S
, R S . ,
. , , - . , .
2(nBlocks(R)+nBlocks(S) )*[lognbuffer-l{nBlocks(S) ) - l ]
+nBlocks (R) +nBlocks (S)
20.7.
// ..
//
//
// R S
for i = 1 to nTuples (R) {
hash_value = hash_function (R. tuple [i] .A);
R. tuple [i] - R,
hash value>;
1
for j = 1 to nTuples (S) {
hash_yalue = hash_f unction (S .tuple [j ] .A) ,< S. tuple [j ] . S,
hash value>;
}
// ( )
for ihash = 1 to M {
R,
ihash>;
RP = Rpartition [ihash] ;
for i = l to 'nax_tuples_in_R_partition (RP) {
//
// hash_function2 () , hash_f unction ( )
new__hash = hash_funct:ion2 (RP. tuple [i] .A) ;
new_hash ,
>;
756
V.
http://openlib.org.ua/
// S
// R
SP = Spartition[ihash];
for j = 1 to max_tuples_in_S_partition(SP) {
< S -
h a s h _ f u n c t i o n 2 ( S P . t u p l e [ j ] . A > ) ;
< >;
< -
>;
20.5.
.
, -
staffNo Staff branchNo Branch.
100 .
,
. 20.6.
20.6. , ,
bFactor (Branch} = 50
nBlocks (Branch) = 10
. 20.7
, :
Staff t> staE fKo PropertyForRent;
J2 Branch >brancMto PropertyForRent.
,
,
. , .
20.
757
http://openlib.org.ua/
-, .
.
20.7. - ,
20.5
400200
20010
4282
nBuffer - 2
R
2 010
6 200
510
25 800
24 240
2 200
2 010
6 600
6 030
.
* R .
* R .
758
V.
http://openlib.org.ua/
,
, :
nTuplea(S) = nTuples (R)
(S = ()),
nTuples (S) = SC A (R)
, ,
(, , ),
:
1 .
. , .
R
. nBlocks (R) . nBlocks (R) * [Iog2 (nBlocks ( R ) ],
:
nBlocks ( R ) + nBlocks (R) * Elog 2 (nBlocks (R) ]
20.8.
20.8.
// .
// R 1( 3, ..., .
// S
//
//
for iblock = 1 to nBlocks (R) {
block = read_block (R, iblock);
for i = 1 to nTuples (block) {
copy block, tuple [i] .a.lf block, tuple [i] . a2, s, block, tuple [i] . amj
to output
}
// ,
if {1( a2, s, am} < >
then
S = ;
else {
20.
759
http://openlib.org.ua/
sort(T);
// ,
i =1; j = 2;
while (i <= nTuplea{T)} {
output T[i] to S;
// ,
while ( [13 T[j]) {
j = J + 1;
\
. )
i = j; J = i + 1 ;
2.
, . R . : , .
R, (nBuffer-1)
. R , h ( ) . - h ( ) ,
(nBuffer-l) .
, , , - . . :
(nBuffer-1)
;
( ) 2 ();
-, ;
- ,
, ,
, , ;
- .
, ,
R
, nb,
nBlocks(R) + nb
,
, . ' .
760
V.
http://openlib.org.ua/
20.4.5.
(T=RuS, T=RnS, T=R-S)
,
(RuS), (RnS) (R-S),
, (..
), 4.1.2,
. ,
, , .
, .
R, ,
S.
, -.
:
nBlocks{R)+nBlocks(S)-fnBlocks(R)* [loga (nBlocks (R) ] -t-nBlocks (S) *
[log 2 (nBlocks{S}]
, . ,
R S,
. .
,
,
:
max(nTuples{R), nTuples(S)) < nTuples(T) < nTuples(R) + nTuples(S)
< nTuples(T) < nTuples(R)
SQL, :
SELECT AVG(salary)
FROM Staff;
AVG ( ).
S t a f f Salary.
.
20.
761
http://openlib.org.ua/
SQL,
:
SELECT AVG(salary)
FROM Staff
GROUP BY branchNo;
B AVG,
.
, .
, .
( ) .
20.5.
() , ,
( ).
, .
.
, . , .
, 20.4.2 :
O"poeition-'Manag*r' ealary?200DO ( S t a l l
, Salary ,
:
Opoaition-'Manager 1 ( C salary>2DOOO { S t a l l
Salary;
, , .
, . , , .
, .
.
,
, . ,
762
V.
http://openlib.org.ua/
.
. ,
, -.
.
, , , . 20.5, . ( ).
, . , "" , ,
,
.
,
. ,
. 20.5, , , . 20.5, [134].
, - . . 20.5, (
), - .
,
. , , . ,
( ).
:
. ,
- , ,
, .
, System R [270].
, , .. , .
20.6. Oracle
,
Oracle Si [241].
, .
27.5 Oracle , , . Oracle,
.
Oracle 8.2.
20.
763
http://openlib.org.ua/
04
EX
/ \D
/\
A
A
a)
A
A
w
6)
/\
' A
/\ /\
. 20.5, : ) ; ) ; )
; ) ()
20.6.1.
Oracle , : .
Oracle ,
(. 20.8). ,
( ), . , , ( ) .
, Oracle
SQL,
.
, PropertyForRent
, (propertyNo),
rooms city:
SELECT propertyNo
FROM PropertyForRent
WHERE rooms > 7 AND city = 'London';
764
V.
http://openlib.org.ua/
20.8.
1
2
3
ROWID (ROW IDentifier )
4
5
6
7
9
10
11
12
13
-
MIN
14
ORDER BY
15
.
city,
WHERE (city = ' London'}. 9.
rooms, WHERE (rooms > 7 ) .
11.
,
SQL. 15.
propertyNo ,
WHERE
.
city.
Oracle
, Oracle 7. , ( , ). ,
;
20.
765
http://openlib.org.ua/
QPTIMIZER^MODE. , ( ).
, , .
Oracle ; .
, , ,
DBMS_STATS
PL/SQL. Oracle
,
. ,
Manager SQL:
EXECUTE DBMS_STATS.GATHER_SCHEMA_STATS('Manager');
. , ,
. ,
, .
.
, .
,
,
.
. , , 10% , .
Oracle
. COMPUTE STATISTICS CREATE INDEX ALTER INDEX. Oracle,
, . 20.9. .
ALL_
, ,
, .
D3A_
.
USER_
.
766
V.
http://openlib.org.ua/
20.9. Oracle
ALL_TABLES
TAB_HISTOGRAMS
TAE_COLUMNS
TAB_COL_STATISTICS
TAB_PARTITIONS
,
,
INDEXES
IND__COLUMNS
CONS__COLUMNS
CONSTRAINTS
LOBS
SEQUENCES
SYNONYMS
TRIGGERS
VIEWS
, ,
. SQL , , Oracle , ,
,
:
;
;
;
, f
-.
,
:
SELECT /*+ INDEX(sexlndex) */ fName, IName , position
FROM Staff
WHERE sex = ' M 1 ;
,
Staff , ,
, . , ,
Staff
20.
767
http://openlib.org.ua/
, , .
sex, . , sex.
,
SQL, , SQL. CREATE OUTLINE
, ,
. ,
, .
20.6.2.
,
. , , .
. , . 20.6, rooms
PropertyForRent, . 20.6, ,
.
: (1), (10) ( 100).
, rooms > 9, (1/10) *100 = 10 .
( . 20.6, , 1 ).
10
10 10
10 10 10 10
10 10
14 20 20 20
9 1 0
. 20.6. rooms
PropertyForRent: ) ; )
768
V.
http://openlib.org.ua/
, . . 20.7 :
, , (
), ,
;
, , ,
( ).
, , .
rooms, , . 20.7, .
( 1-2, 3-4 ..), ,
.
; , , , . rooms > 9.
, , ,
. , , , . 2*1 = 2;
, .
, , . 20.7, .
, 20 (100/5). ;
, , . rooms > 9, , ,
, ,
(1/5) *20 = 4. ,
, ,
. Oracle , .
20
20
20 20 20
20
10
1 2
20
II
4
40
II
6
28
II
8
8
9 10
ll_
91 0
20.
769
http://openlib.org.ua/
, , , .
,
.
, SQL Server Microsoft, ,
. Oracle .
DBMS_STATS PL/SQL. ,
WHERE SQL .
rooms, .
20.6.3.
Oracle , , EXPLAIN PLAN.
,
. EXPLAIN PLAN (
PLANJTABLE). .
STATEMENT_ID. STATEMENT_ID, EXPLAIN PLAN.
OPERATION. . SQL (SELECT, INSERT,
UPDATE DELETE).
OPTIONS. ,
QBJECT_NAME. .
ID. , .
PARENT_ID. ID ,
ID.
POSITION. ,
PARENT__ID.
COST. ( , , NULL).
CARDINALITY. , .
20.9.
.
( , ID
).
20.9. EXPLAIN PLAN
SQL>
2
3
4
770
EXPLAIN PLAN
SET STATEMENTJ[D ='PB'
FOR SELECT b.branchNo, b.city, propertyNo
FROM Branch b, PropertyForRent p
V.
http://openlib.org.ua/
2
3
4
5
Query Plan
0
1
2
3
4
5
0
1
2
2
4
SELECT STATEMENT
SORT ORDER BY
NESTED LOOPS
TABLE ACCESS FULL PROPERTYFORRENT
TABLE ACCESS BY INDEX ROWID BRANCH
INDEX UNIQUE SCAN SYS_C007455
6 rows selected.
,
( , SQL),
,
( ),
.
, , .
,
.
. , .
,
.
. , , .
: ( ), , . .
,
.
, , , . .
20.
771
http://openlib.org.ua/
, , . ,
, - (
), ( ), ( ).
; , ;
- , -
.
, . ; , ;
; ; .
( , ),
( , ), -,
,
, () ,
() +-.
, , - .
,, , .
, , . , .
,
.
.
, -
,
, , .
772
V.
http://openlib.org.ua/
20.1. ?
20.2.
,
?
20.3. ?
20.4. .
20.5.
?
20.6. ?
20.7. ,
:
a) ;
b) ;
c) -.
20.8. , .
20.9. ,
?
20.10.
?
20.11. ?
20.12.
?
20.13. . .
20.14. .
20.15. ,
20.1, , Staff 10 000
, Branch 500 , 500 ( ), 10 .
20.16. Hotel,
"" 3, , :
a)SELECT r.type, r.price
FROM Room r. Hotel h
WHERE r.hotel_number = h.hotel_number AND h.hotel_name = 'Gr
osvenor Hotel 1 AND r.type > 100;
6) SELECT g.guestNo, g.name
- ..
20.
773
http://openlib.org.ua/
nTuples(Room) = 10000
nTuples(Hotel) = 50
nTuples(Booking) = 100000
nDistincthocelNo(Room} = 50
nDistincttype(Room) = 10
nDistinctprlce(Rooin) = 500
tnin pl:lce (Room) = 200
nLevelshoCem0(I) = 2
iced) = 2
(Room) = 5 0
nLfBlockSprice(I) = 50
)
:
S1 OroomWol=i hoteiHo=Hi (Room);
S2 Ctype,1D. (Room);
774
V.
http://openlib.org.ua/
S3 ahoteiNosH3 (Room) ;
S4 CTprice>1{30 (Room) ;
S5 cjtype=,s, hoteiso- (Room) ;
S6 fft ^.fi. v price < 100
) :
Jl Hotel >< hoteiNo Room;
J2 Hotel >< hoteiwo Booking;
J3 Room ><
tclomNo
Booking;
2 nho
4 ~
5 FThoteiNo,
price
(Room}.
20.19. 20.4.3
,
(nBuffer-2)
R .
20.
775
http://openlib.org.ua/
<
http://openlib.org.ua/
SQL
...
SQL
.
SQL.
,
SQL.
,
SQL.
ODBC (Open Database Connectivity
),
.
5 6 SQL (Structured Query Language
), , . 5.1.1
, SQL, 1992 , ,
:
, IF. . .THEN. . .ELSE, GO TO DO. . .WHILE.
SQL
,
SQL
. , , , . SQL , SELECT,
.
SQL
.
SQL. SQL . ,
. -
SQL -
http://openlib.org.ua/
.
. ISO SQL
ADA, , COBOL, Fortran, MUMPS, Pascal PL/1.
(API Application
Programming Interface). , . API-
, ,
. , ,
.
API- ODBC (Open
Database Connectivity ).
( Oracle, INGRES, Informix
DB2) SQL.
, Oracle API-;
Access API- (ADO ActiveX Data
Objects), ODBC.
21.1. SQL
SQL,
SQL,
, Oracle 8.
SQL,
Oracle ISO.
21.1.1. SQL
SQL ,
, ..
SELECT. INSERT, UPDATE, DELETE CREATE TABLE
( ).
778
V.
http://openlib.org.ua/
VARCHAR2(5)
VARCHAR2{5)
DATE
VARCHAR2 ( 4 0 ) ) ,-
NOT NULL,
NOT NULL,
NOT NULL,
,
21.1.
21.1. SQL,
Viewing,
/* Viewing */
#include <stdio.h>
^include <atdlib.h>
EXEC SQL INCLUDE sqlca;
mainO
EXEC
SECTION;
SQL,
, .
SQL ,
EXEC SQL,
ISO ( MUMPS 'OSQL'}.
, SQL.
/ 21. SQL
779
http://openlib.org.ua/
SQLCA. SQLCODE,
. S QLCODE
, .
SQLCODE , ( sqlwarn
).
SQLCODE
. SQLCODE
, .
SQLCODE ,
, , SELECT
( ).
780
V.
http://openlib.org.ua/
/*
. Oracle SQLCA
SQL.
V
struct sqlca{
char
sqlcaid[8];
/* "SQLCA" */
long
sqlcabc,/* SQLCA */
long
sqlcode;
/* SQL */
struct{
short
sqlerrml;
/* */
char
sqlerrmc[70];
/* */
} sqlerrra;
char sglerrp[8]; /* */
long sglerrdfej,- /* sqlerrd[2] - */
char sqlwarn[8];
/* sqlwarn[0] "W" */
/* sqlwarn[l] "W", */
/* sqlwarn[2] "W",
NULL */
/* sqlwarn[3] "W"
*/
/* sqlwarn[4] "W"
UPDATE/DELETE WHERE */
/* sqlwarn[5J "W"
PL/SQL */
/* sqlwarn[6] */
/* sqlwarn[7] */
char sqlext [8]; /* */
WHENEVER
SQL. , SQL ,
Oracle
. WHENEVER ,
SQL.
WHENEVER :
EXEC SQL WHENEVER <condltion>.
21. SQL
781
http://openlib.org.ua/
WHENEVER (
condition) ,
( action). , ,
, , .
condition .
SQLERROR (SQLCODE < 0).
SQLWARNING (SQLCODE > 0).
NOT FOUND ,
.
action .
CONTINUE .
DO
.
, SQL, (
).
DO BREAK,
break. .
DO CONTINUE,
continue. .
GOTO label
, label.
STOP
.
, SQL:
EXEC SQL WHENEVER SQLERROR GOTO errorl;
EXEC SQL INSERT INTO Viewing VALUES ( ' C R 7 6 ' ,
1
Not enough s p a c e ' ) ;
EXEC SQL INSERT INTO Viewing VALUES { ' C R 7 7 ' ,
'Quite like it 1 ) ;
'PA14',
'12-May-2001',
'PA14',
'13-May-2001',
SQL :
EXEC SQL INSERT INTO Viewing VALUES { ' C R 7 6 ' , ' P A 1 4 ' ,
Not enough s p a c e ' ) ;
if (sqlca.sqlcode < 0} goto errorl;
EXEC SQL INSERT INTO Viewing VALUES ( ' C R 7 7 1 , 'PA14',
'12-May-2001',
'12-May-2Q01',
21.1.3.
,
. .
782
V,
http://openlib.org.ua/
SQL
. , WHERE
SELECT.
, . , , ,
.
SQL
(:). , ,
increment, , 1
'SL21 .
SQL:
EXEC SQL UPDATE S t a f f SET salary salary + :increment
WHERE staffNo = 'SL21';
SQL
, .
SQL BEGIN
DECLARE SECTION ... END DECLARE SECTION.
,
SQL. ,
, , :
EXEC SQL BEGIN DECLARE SECTION;
float increment;
EXEC SQL END DECLARE SECTION;
, SQL, .
SQL Oracle (. 8.2.3)
. 21.1. ,
SQL . ,
,
, .
21.1. Oracle
SQL Oracle
c h a r ( ) , varchar(n)
char [n + 1]
short
integer
int
integer
long
float4
float
float
double
date
char[26]
money
double
21. SQL
783
http://openlib.org.ua/
NULL (, 3.3.1). , NULL
.
SQL . , . .
,
.
, -1, ,
NULL.
,
, , (..
).
, (:). , NULL Address 1
021', :
EXEC SQL BEGIN DECLARE SECTION;
char address[51];
short addresslnd;
EXEC SQL END DECLARE SECTION;
addresslnd = -1;
EXEC SQL UPDATE PrivateOwner SET address = :address:addresslnd
WHERE ownerNo = ' C O 2 1 ' ;
21.1.4.
SQL
21.1.1 SQL,
.
784
V.
http://openlib.org.ua/
SELECT, ,
.
,
, , SQL . (. 24.2).
SQL , ,
.
SQL :
,
;
,
(, ).
SQL ,
SELECT, 5.3,
INTO,
, . INTO
SELECT. SELECT INTO . , 1
'21 :
EXEC SQL SELECT fName, IName, address
INTO :firstName, :lastName, ;address :addresslnd
FROM PrivateOwner
WHERE ownerNo = ' C O 2 1 ' ;
785
http://openlib.org.ua/
21.2.
,
, .
'
21.3. , . PrivateOwner . .
address,
NULL.
21.3.
/* PrivateOwner */
tfinclu.de <stdio.h>
^include <stdlib,h>
EXEC SQL INCLUDE sqlca?
main()
{
786
V.
http://openlib.org.ua/
/* - */
error:
printf("SQL error %d\n", sqlca, sqlcode) ,goto finished;
done:
printf("No owner with specified number\n");
/* or */
finished:
EXEC SQL WHENEVER
SQLERROR
continue;
EXEC
SQL COMMIT
WORK
RELEASE;
, SQL
, . 8.2.5
PL/SQL, Oracle,
.
.
.
, ,
, . , FETCH, SELECT.
DECLARE CURSOR SELECT,
, cursorName
selectstatement. :
ISXEC SQL DECLARE "cursor^ame CURSOR FOR select Statement^'1
,
,
, 'SL41',
EXEC SQL DECLARE propertyCursor CURSOR FOR
SELECT propertyNo, street, city
FROM PropertyPo.rRent
WHERE StaffNo = 'SL41 1 ;
OPEN , , ; . Oracle
, .
SELECT , , , . OPEN
:
f E X E ' S Q L OPEN
21 . SQL
787
http://openlib.org.ua/
, , :
EXEC SQL OPEN propertyCursor FOR READONLY;
FETCH
. , .
[ EXEC /SQL FETCH
INTO {hostVariable,^iindicatorVartable]
[,
cursorName .
INTO
SELECT DECLARE CURSOR. ,
:
EXEC SQL FETCH propertyCursor
INTO :propertyNo, :street,
:city;
FETCH propertyNo
propertyNo, street
street .. FETCH
,
, , . ,
, SQLCODE NOT FOUND
( ).
,
, OPEN
, FETCH, , .
FETCH SQLCODE NOT FOUND.
CLOSE OPEN:
EXEC, SQL CLOSE.cursorName
cursorWame ,
. :
EXEC SQL CLOSE propertyCursor;
.
. 21.3.
21.3.
,
,
.
21.4. .
788
V.
http://openlib.org.ua/
. , , Prope rt ForRent
. ,
. , .
.
21.4.
/*
** ,
**
*/
^include <stdio.h>
^include <stdlib.h>
EXEC SQL INCLUDE sqlca;
main()
*/
/* ,
21. SQL
789
http://openlib.org.ua/
/* */
EXEC SQL FETCH propertyCursor INTO :propertyNo, : street ,
:city;
/* */
printf ("Property number: %s\n", propertyNo) ;
printf ("Street: %s\n" , street);
printf ("City:
%s\n", city);
}
/* - */
error :
printf("SQL error %d\n" , sqlca. sqlcode) ;
done:
/* */
EXEC SQL WHENEVER
SQLERROR
continue;
EXEC SQL CLOSE propertyCursor;
EXEC SQL COMMIT WORK RELEASE;
21 .1.5.
, . (),
, (. 6.1.4), . ,
UPDATE DELETE CURRENT.
. , ,
.
, , ISO,
. Oracle
.
Oracle
DECLARE CURSOR:
' EXEC SQL .DECLARE cu'reorffame CURSOR selectStatement FOR UPDATE .
yOF columnWame' [, . .-;. ] ... .
'
FOR UPDATE OF , selectstatement,
. ,
SELECT. UPDATE,
, :
VEXEC SQL' UPDATE::'TabieName
SET c01unuiWame;== dataValue- !,...]
WHERE CURRENT .OF- curso.rWame
cursorWame
. WHERE ,
.
790
V.
http://openlib.org.ua/
. SET DECLARE
CURSOR. ,
s t a f f t f o ,
property-Cursor. ,
FETCH.
EXEC SQL UPDATE PropertyForRent
SET s t a f f N o = ' S L 2 2 '
WHERE CURRENT OF propertyCursor;
. :
21.1.6. ISO
SQL
,
SQL Oracle ISO.
WHENEVER
ISO SQLWARNING WHENEVER.
SQL
ISO SQL , .
SQLCODE,
. SQLSTATE, ,
; . 21. SQL
791
http://openlib.org.ua/
SQL SQL, 00
: ,
. ) 22012
22 ( )
012, .
Oracle 8 SQLSTATE, DECLARE SECTION :
char SQLSTATE[6];
SQL SQLSTATE, .
, SQL ().
ISO
, . ,
DECLARE CURSOR, ISO, :
EXEC SQL DECLARE cursortfame fIMSENSITIVE)
CURSOR FOR selectStaCement
- ;
INSENSITIVE .
SCROLL
. FETCH :
'EXEC SQL FETCH EIf&tchQrientation} FROM] cursorNarne
INTO hostVarlable I, ... ,\
. .,
fetchOrientation .
NEXT. , .
PRIOR. ,
.
FIRST. .
LAST. .
ABSOLUTE. ,
.
RELATIVE. .
SQL
, ,
FETCH
, .
792
V.
http://openlib.org.ua/
21.2. SQL
SQL, SQL. SQL
, SQL , .
SQL
. , , , , .
.
,
. ,
SQL. ,
SQL. ISO SQL, SQL , SQL
. , SQL , .
EXEC SQL BEGIN DECLARE SECTION;
char TableName.[20] ;
EXEC SQL END DECLARE SECTION;
EXEC SQL INSERT INTO :TableName
'PA14',
'05-May-2001',
, SQL
INSERT , . , . , :
EXEC SQL DECLARE cursorl CURSOR FOR
SELECT *
FROM :TableName;
' *' ,
,
table_name. . ,
. , Branch Staff (. . 3.3 3.4)
, Branch Viewing (. 3.8) , .
, FETCH, , , . , SQL,
, .
21. SQL
793
http://openlib.org.ua/
SQL, ,
host Variable,
stringLiteral. , SQL
EXEC SQL BEGIN DECLARE SECTION;
float increment ;
EXEC SQL END DECLARE SECTION;
EXEC SQL UPDATE Staff SET salary = salary + : increment
WHERE s t a f f N o = ' S L 2 1 1 ;
SQL:
EXEC SQL BEGIN DECLARE SECTION;
char b u f f e r [100] ;
EXEC SQL END DECLARE SECTION;
sprintf ( b u f f e r , "UPDATE S t a f f SET salary = salary + %f
WHERE staff No = ' S L 2 1 ' " , increment);
EXEC SQL EXECUTE IMMEDIATE : b u f f e r ;
UPDATE ,
EXECUTE IMMEDIATE. , increment
SQL,
SQL. , UPDATE
EXEC SQL, (;).
V.
http://openlib.org.ua/
*~4
""1
f.
EXECUTE IMMEDIATE
*EXECUTE
PREPARE
h
H
I-
I#*
. 21.1. : ) SQL;
) SQL
, , . PREPARE :
;;
795
http://openlib.org.ua/
V.
http://openlib.org.ua/
/*
SQLDA (SQLDA
*/
struct SQLDA{
long N,/*
char **V; /*
long *L; /*
short *T; /*
short **I; /*
long F;
/*
DESCRIBE */
char **S,- /* */
short *M; /*
*/
short *C,- /*
*/
char **X; /*
*/
short *Y; /*
*/
short *Z; /*
*/
SQLDA ( N, M )
SQLSQLDAAlloc() Oracle ( ). ( , F, S, , X Z) DESCRIBE. , ( V, L I),
FETCH. .
N. - SELECT, SQLDA.
SQLSQLDAAlloc (). DESCRIBE
N F .
F. - SELECT, DESCRIBE.
V. ,
SELECT.
SQLSQLDAAlloc {)
, ,
. -
OPEN, SELECT
FETCH.
21. SQL
797
http://openlib.org.ua/
.
SELECT. - OPEN,
SELECT DESCRIBE,
. NUMBER
, SQLNumberPrecV6 Oracle.
NUMBER
char ,
2 (
).
. SELECT. Oracle : . Oracle, a
, . , , . , , , STRING.
DESCRIBE -
. OPEN. Oracle . 21.2.
DESCRIBE SELECT
Oracle.
,
FETCH. , Oracle
OPEN ( DESCRIBE
-),
FETCH ( DESCRIBE
SELECT). .
NUMBER . , , 2 1
21.2. Oracle
SQL Oracle
VARCHAR2
char [n]
NUMBER
char []
INTEGER
int
FLOAT
float
STRING
char [n+1]
CHAR
96
char [n]
798
V.
http://openlib.org.ua/
21.2.4, DESCRIBE
DESCRIBE SQL, (.. , PREPARE).
S3LSCT DESCRIBE SQLDA 21. SQL
799
http://openlib.org.ua/
, /-, SQL. ,
SELECT, DESCRIBE F SQLDA
0. DESCRIBE :
EXEC - SQL DESCRIBE BXHD VARIABLES FOR statement
. EXEC -S.QL DESCRIBE SELECT LIST FOR statementttame
selecCDescriptorName
statement Name
SQL, bindDescriptorName selectDescriptorName SQLDA. , SELECT ( , SQLDA ):
sprintf (query, "SELECT propertyNo, rent FROM PropertyForRent") ,EXEC SQL PREPARE stmt FROM -.query;
EXEC SQL DESCRIBE SELECT LIST FOR Stmt INTO sqlda;
sqlda , . 21.2.
SQLDA
DESCRIBE (NUMBER
2
l-fc 1 UH
DESCRIBE
FETCH
-1
DESCRIBE
*1
10
10
10
SQLSQLDAAIIocO
..
DESCRIBE
. 21.2. SQLDA ,
DESCRIBE/FETCH
800
V.
http://openlib.org.ua/
21.2.5.
SQL
21.1
, . SQL
, .
DECLARE, OPEN
FETCH CLOSE, :
|EXSp:;SQL DECLARE cursorName CURSOR"FOR selectStatemerit
v-' SQL -OPEN cursorffarae {USING hostVariable IindicatorVarlablej '.[,..;.} | USING DESCRIPTOR descriptorWame} ..
ijEpCEC SQL FETCH cursorMarae {INTO hostVariable [indicatorVari^bleJ
..[, .'. .] -VI, USING .DESCRIPTOR descriptor-Name}:,. '= . . " / ' - ;; "
/|BXBC" SQL.CLOSE cursorName
OPEN ,
-,
hostVariable USING descriptorName (.. SQLDA), USING DESCRIPTOR. SQL ,
FETCH descriptorWame
hostVariable/indicatorVariable). SQLDA
( )
FETCH.
, I
. ,
SQLDA, , , .
, SQL .
1. DECLARE SECTION
.
2. SQLDA, , SQLDA,
.
3. () SQLDA.
4. SQLDA, , -,
- SQLDA, .
5. .
6. PREPARE,
.
7. DECLARE.
21. SQL
801
http://openlib.org.ua/
8. -, .
) DESCRIBE SQLDA, .
) -
, DESCRIBE.
) , DESCRIBE.
9. OPEN SQLDA, , , SQLDA, .
10. DESCRIBE
SQLDA, .
11. ,
DESCRIBE.
12.
,
13. FETCH
,
SQLDA, ,
.
14. , , -, SQLDA.
15. CLOSE,
SQL Oracle
Web-, (URL
).
21.2.6.
21.1.5
SQL
UPDATE DELETE. SQL.
21.2.7. SQL
ISO
,
SQL Oracle
ISO,
SQLDA
ISO SQL (SQLDA) , - . 802
V.
http://openlib.org.ua/
SQLDA (
). SQLDA
:
UAt,LbCATE. DESCRIPTOR.descriptqrWame "{WITH MAX - occurrences]
' DESCRIPTOR':descript:or#ame .
SQLDA
:
| 'DESCRIPTOR deecrijptorWame. {ho&tVariable' = COUNT j
. VALUE itemWumber- hoBtVari'abiel = i temWaraei [, . . . 3 }
ISET DESCRIPTOR descriptprWame' (fcOUNT *'hostVariable j
VALUE itemjmber. iteinNamel. '''tiostVariablel { , . . . ] }
ISO.
TYPE. ( ISO
. 21.3).
LENGTH. .
INDICATOR. .
DATA. .
21.3. ISO
ISO SQL
ISO SQL
CHARACTER
CHARACTER VARYING
12
NUMERIC
DECIMAL
INTEGER
SMALLIKT
FLOAT
REAL
DOUBLE PRECISION
DATE
ISO, GET DESCRIPTOR.
PRECISION. .
SCALE.
( ).
NAME. .
NULLABLE. ,
NULL ( 1, NULL, a
0, NULL).
, count
EXEC SQL GET DESCRIPTOR :sqlda :count = COUNT;
, :
EXEC SQL SET DESCRIPTOR :sqlda VALUE 1 INDICATOR -1 DATA :data
21. SQL
803
http://openlib.org.ua/
DESCRIBE
ISO DESCRIBE ,
.
DESCRIBE INPUT () SQL, DESCRIBE
OUTPUT SELECT. DESCRIBE
.
SELECT:
char
, () Oracle.
804
V.
http://openlib.org.ua/
. API-
,
, , SQL, ..
, , API-,
.
, , API- .
,
,
,
. , , , ,
.
, Microsoft , Open Database Connectivity (ODBC). ODBC
SQL, SQL . ( )
,
,
, . , , "/",
.
.
ODBC . , .
API- .
SQL
.
.
, .
ODBC '
/ ISO CLI (Call-Level Interface),
ODBC .
28.9.1 JDBC Java,
ODBC.
21. SQL
805
http://openlib.org.ua/
21.3.1. ODBC
ODBC .
,
, SQL .
.
.
.
SQL, /Open ISO CLI.
ODBC .
.
ODBC SQL .
. .
ODBC .
Microsoft DLL (DynamicLink Library ).
. ODBC,
SQL
. , . , .
, . ,
,
ODBC.
, , XBase. , SQL.
ODBC
(. 21.3, ) ODBC, . ODBC (. 21.3, )
,
.
ODBC, . Windows ODBC DLL. (), .
. ,
. , , , , .
806
V.
http://openlib.org.ua/
ODBC
. 21.3. ODBC: ) ; )
21.3.2. ODBC
ODBC ODBC API ODBC SQL.
ODBC SQL. , ODBC API, Microsoft ODBC Reference Guide, ODBC , /Open
[329] ISO CLI [175]. ODBC , .
ODBC 3.0 , , .
ODBC
, ODBC, a
, SQL, .
SQL
DDE) CREATE TABLE DROP TABLE.
(Data
Definition
Language -
(Data
Manipulation
Language DML) SELECT, INSERT, UPDATE
SEARCHED DELETE SEARCHED.
(, > + ).
CHAR, VARCHAR LONG VARCHAR.
21. SQL
807
http://openlib.org.ua/
SQL
SQL .
DDL: ALTER TABLE, CREATE INDEX, DROP INDEX, CREATE
VIEW, DROP VIEW, GRANT REVOKE.
DML: SELECT.
: , , SUM MIN.
: DECIMAL, NUMERIC,
DOUBLE PRECISION,
SMALLINT,
INTEGER,
REAL,
FLOAT,
SQL
SQL .
DML: , UPDATE
DELETE, SELECT FOR UPDATE .
: (, SUBSTRING ABS), , .
: BIT, TINYINT, BIGINT,
VARBINARY, DATE, TIME, TIMESTAMP.
BINARY,
VARBINARY,
LONG
SQL .
.
21.4. ODBC
, ,
SL41.
21.6 ,
ODBC. .
ODBC.
SQLAllocEnv{), ODBC.
ODBC, , .
SQLAllocConnect ) . .
, .
, .
SQLConnect ().
.
808
V.
http://openlib.org.ua/
SQLAllocStmt ( ) . ,
, SQLSTATE , ,
, SQL.
,
.
SQL SELECT
SQLExecDirect () ODBC. SQL
, ODBC
,
.
-. SQLBindParameter ()
ODBC, . SQLBindCol, . SQLFetch.
21.6. , ODBC
^include "SQL.H"
^include <stdio.h>
^include <stdlib.h>
^define MAX_STMT_LEN
main()
HENV
HDBC
HSTMT
RETCODE
UCHAR
UCHAR
UCHAR
UCHAR
SDWORD
100
hEnv,
*/
*/
*/
*/
SELECT */
propertyNo */
street[26];
/*
street */
/*
cityE 16] ;
city */
propertyNoLen, streetLen, cityLen;
hDbc;
hStmt;
;
selStmt [MAX_STMT_LEN]
propertyNo[6];
SQLAllocEnv(&hEnv) ;
l*
/*
/*
/*
/*
/*
SQLAllocConnectfhEnv, SrhDbc) ; /
*/
*/
re = SQLConnect (hDbc,
11
DreamHome " , SQL_NTS ,
/ */
"Manager", SQL_NTS,
/
"Manager", SQL NTS) ;
/ */
. SQL_NTS ,
,
21. SQL
809
http://openlib.org.ua/
*/
if ( == SQL_SUCCESS j | rC == SQL_SUCCESS_WITH_INFO) {
SQLAllocStmt(hDbc, SdiStmt); /*
*/
/* SELECT, */
IstrcpytselStmt, "SELECT propertyNo, street, city FROM
"^Property For Rent where staffNo = 'SL41' ORDER BY propertyNo"};
if (SQLExecDirect(hStmt, selStmt, SQL_NTS) != SQL__SUCCESS)
exit (-1) ;
SQLBindColthStmt, 1, SQL_C_CHAR, propertyNo,
(SDWORD)sizeof(propertyNo), kpropertyNoLen);
SQLBindCoKhStmt, 2, SQL_C_CHAR, street,
(SDWORD)sizeof(street), bstreetLen);
SQLBindCoKhStmt, 3, SQL_C_CHAR, city,
(SDWORD)sizeof(city), fccityLen);
/* */
while ( == SQL_SUCCESS || rC == SQL_SUCCESS_WITH_INFO)
{
rC = SQLFetch(hStmt);
if (rC == SQL_SUCCESS j| rC == SQL_SUCCESS_WITH_INFO)
/* , */
SQLFreeStmt (hStmt, SQL_DROP) ,- /*
*/
SQLDiscormect (hDbc) ,/*
*/
}
SQLFreeConnect(hDbc);
SQLFreeEnv(hEnv);
/*
*/
/*
*/
SQL, .
SQL ,
SQLPrepare ()
SQLExecuteO ODBC (. 21.2.1).
SQL ,
.
, . SQL
, , . SQL , .
SQL ,
.
810
V.
http://openlib.org.ua/
SELECT
,
. .
. DECLARE CURSOR. OPEN . ,
, . FETCH , CLOSE
. UPDATE DELETE.
SQL SQL . SQL
, SQL
,
. SQL, ,
EXECUTE IMMEDIATE.
,
PREPARE EXECUTE. EXECUTE/FETCH -.
SQL (SQL Descriptor Area SQLDA) ,
SQL. DESCRIBE
SQL, SQLDA. F SQLDA
, , SELECT. SELECT, ,
.
ODBC (Open DataBase Connectivity) Microsoft SQL. ODBC SQL .
ODBC ( )
,
, SQL.
ODBC
"/", -
. ODBC.
ODBC .
21. SQL
811
http://openlib.org.ua/
(
21.1. SQL, SQL
SQL?
21.2. .
21.3.
.
21.4. - .
21.5. SQLCA SQLDA?
, , 3.
21.6. SQL
SQLDA DESCRIBE SELECT LIST FOR DESCRIBE BIND VARIABLES FOR:
) "SELECT * FROM Hotel";
) "SELECT hotelNo,
:hn";
) "SELECT MIN(price) FROM Room WHERE hotelNo = :hn AND type = :t".
21.7.
, , .
21.8. ,
, ,
, .
21.9. ,
5%.
21.10. , ,
Grosuenor Hotel .
21.11. ,
, .
21.12. SQL
, . ,
ISO SQL.
812
V.
http://openlib.org.ua/
-
-
-
815
869
927
961
1005
1049
http://openlib.org.ua/
http://openlib.org.ua/
...
.
,
.
.
.
.
,
.
.
,
(, ).
.
.
,
.
.
,
, , .
, Internet, ,
"" . 5' .
.
, .. ,
.
,
, -
http://openlib.org.ua/
, , ,
.
,
.
22.1
, ,
. 22.2
, . 22.3 , . ,
, ANCI-SPARC,
2. 22.4 ,
, IV , . 22,5
,
,
22.6 ,
. ,
DreamHome, 10.4 .
22.1.
, , . , .
. ,
, , , , ..,
, , , [93].
, , , , ,
. , .
. , ,
, . , , .. .
816
VI,
http://openlib.org.ua/
22.1.1.
, ,
, .
. ^ ( ), .
.
, , -
; .
( ) ,
. , .
,
(.. ), , .
.
( )
( ).
, .
.
.
.
.
.
.
.
.
, , , . 22.1.
22.1. DreamHome
, DreamHome . , , , ,
21.
817
http://openlib.org.ua/
,
, ,
. ,
,
, ,
.
, DreamHome ( )
, .
1
.'
. 22.1,
, () .
, , , , , . ,
.
[91]. , , , , 22.5.
818
VI.
http://openlib.org.ua/
.
. .- , .
, , .
, ,
, , .
. 22.2. , 2, , . 22.1, , .
1
. 22.2.
, , .
. ,
,
; ( ) .
21.
819
http://openlib.org.ua/
,
, . , . ,
, , .
. ,
,
, , , . . 22,3. :
;
;
.
, .
, ,
,
.
, ,
. , (SMP), ,
, , RISC- .
, 64.
.
. , .
, . ,
, . , ,
, . .
820
VI.
http://openlib.org.ua/
, 22.3. : )
; ) ; )
21.
821
http://openlib.org.ua/
(
) ,
, , . , , , .
, , .
, .
,
(1012 ), ,
.
.
,
, ,
.
30. ,
.
22.1.2.
, ,
.
, , .
, , ,
. ,
DreamHome
. ,
. DreamHome
, , , ,
, . . , ,
.
!
,
VI.
http://openlib.org.ua/
, .
, , . .
() . , ,
(. 9.15).
. ,
,
. ,
, . , , , .
,
,
.
,
- ,
( ). , , , .
1960- , ,
, .
(Grosch).
,
, . ,
, , , .
,
. - (
) .
21.
823
http://openlib.org.ua/
. .
. -
.
( ) ( ).
; , , , , , .
, , .
,
, , ,
.
( ). ,
. , . , , .
.
,
, . .
, .
.
,
.
, , .
. 23.4.5.
824
VI.
http://openlib.org.ua/
,
,
. . ,
, .
,
.
. , ,
.
.
, , ,
, . 22.4.
.
, , . 22.1.
22.1.
22.1.3.
. .
,
, .. , , - .
21.
825
http://openlib.org.ua/
.
, , .
.
, , .
.
, .
. , :
;
;
.
, ,
.
, ,
. ,
,
. , (, SELECT
SQL FIND GET
). , , . .
, . 3.1 15 ,
. , , , . ,
.
. [124].
, ,
, , .
. -,
. ,
826
VI.
http://openlib.org.ua/
. , , . -,
. , , .
,
,
.
. ,
, .
,
,
. . ,
,
.
.
21.
827
http://openlib.org.ua/
-
, .
, ,
. ( ) .
, . '
[41] [273].
, . ,
. ,
.
. .
, . ,
, . , .
UniSQL Cincom Corporation.
[83].
22.3.3.
22.2.
. , >
^ .
,
.
, .
,
,
828
VI.
http://openlib.org.ua/
, . ,
.
. , : , , . (Local Area Network LAN)
,
. (Wide Area Network WAN)
, . (Metropolitan Area Network MAN), .
.
33,6 / ( ) 45 / ( ).
10 / ( Ethernet) 2500 / ( ATN),
. ,
, ,
, , .
( ), "-" . "-"
. , , -,
.
"-", , , . . 22.2.
(ISO) (
), [168]. ,
, . ,
OSl (Open System Interconnection), , .
, ,
,
.
, ,
, ,
[151] [299].
21.
829
http://openlib.org.ua/
22.2.
(
)
(
)
33,6 /
( )
45 / ( )
2500 / (
ATM)
"-"
1:5
1:10
(CCITT) , .25
.
.25.
, . RDA (Remote Database
Access ISO 9579) DTP (Distribution Transaction Processing ISO 10026). Co X/Open DTP 23.5.
.
!| . , , -'-,
; .
.
TCP/IP
TCP/IP (Transmission Control Protocol/Internet Protocol / )
Internet ( ). TCP
. IP
, (IP-). IP- . , .
830
VI.
http://openlib.org.ua/
IP- . TCP/IP
, , -, , .
TCP/IP ,
, Internet.
SPX/IPX
SPX/IPX (Sequenced Packet Exchange/Internetwork Package
Exchange / ), Novell NetWare.
TCP, SPX ,
IPX NetWare. IP, IPX . IP, IPX 80- , 32 , 48 (
32- , IP).
, IP, IPX
( ).
IPX .
. . NetWare 5 SPX/IPX Novell , Internet, TCP/IP, .
NetBIOS
NetBIOS (Network Basic Input/Output System -) 1984 IBM Sytek
. NetBIOS NetBEUI
(NetBIOS Extended User Interface
NetBIOS) . NetBIOS
,
, NetBIOS NetBEUI, TCP/IP SPX/IPX.
NetBEUI , , Microsoft. , NetBEUI
, TCP/IP .
831
http://openlib.org.ua/
, IBM ( ),
. (Systems Network Architecture) IBM,
LU 6.2, LU 6.2
.
DECnet
DECnet ,
Digital,
Ethernet, , - .
PDF, VAX, Mac, .
AppleTalk
AppleTalk , Apple 1985 ,
LocalTalk Apple, ,
Ethernet Token Ring. AppleTalk LocalTalk
Macintosh , LaserWriter.
WAP
WAP (Wireless Application Protocol ) ,
, Web- . 1997 Phone.com (
Unwired Planet), Ericsson, Motorola, Nokia ,
TCP/IP
, .
, , .
:
_ = 0 -t- (__/_)
0 . , , 1 ,
10 000 / , 100 000
100 , :
_ = 1 + (100 000 * 100/10 000) = 1001
, :
_ = 100 000 * [1 + {100/10 0 0 0 ) 3
= 100 000 * [1.01] = 101 000
,
100 000 , , 832
VI.
http://openlib.org.ua/
. , , , .
22,5.3.
22.3.
2 , . ,
.
22.3.1.
, ,
, ,
2. ,
.
,
.
,
.
, .
, .
, .
,
.
23.
22.3.2.
ANSI-SPARC , 2.1,
. ,
, . - ,
. . 22.4.
:
;
;
;
, ANSI-SPARC.
21.
833
http://openlib.org.ua/
'
. 22.4. ,
,
.
.
, , .
-
834
VI.
http://openlib.org.ua/
ANSI-SPARC , , . . .
, . , .
.
ANSI-SPARC,
.
.
22.3.3.
22.1.3 . . ,
. . 22.5 , , (Global Conceptual Schema
GCS).
. , ,
.
, .
,
[208J.
. .
[208] [273].
22.3.4.
,
, :
;
;
;
.
21.
835
http://openlib.org.ua/
1
/I
. 22.5. ,
, . 22,1, . 22.6. 2
, 1.
, ,
. , ,
.
. , , ,
/ .
,
. .
836
VI.
http://openlib.org.ua/
, 22.6.
,
.
, ,
, .
,
, , . , .
. , R ,
[326]. R
, ,
, .
. ,
( ),
,
.
, . , .
21.
837
http://openlib.org.ua/
.
22.5.1.
.
,
22.5 23.
22.4.
14 15 . , . ,
.
. , , . : . , .
. ,
.
. .
. ,
. , ,
. ,16.2, , 20% 80% . "80/20"
[325].
,
.
,
. :
;
, ;
.
:
, ;
( );
.
838
VI.
http://openlib.org.ua/
.
. , ,
.
, .
.
. , .
. .
,
.
.
.
,
. , ,
.
.
.
.
,
.. , .
, , .
22,4.1.
:
, (),
. , .
, ( " " ). ,
,
.
. , .
()
, .
, , .
21.
839
http://openlib.org.ua/
,
. , ,
, .
, .
. , , .
.
. . , ,
.
,
.
23.6.
,
. ,
, ,
, , . .
, ,
. .
. 22.3.
[244] [301].
22.4.2.
, , .
.
, . , ,
. ,
. , ,
.
840
VI.
http://openlib.org.ua/
. , , . , .. , ,
.
. , ,
, ,
.
,
.
. , ,
, , .
.
, .
22.3.
.
1
21.
841
http://openlib.org.ua/
.
,
.
1. . R ,
R!, R 2 , ..., Rn, ,
R, , , .
, - .
2. . ,
R .
.
3. . di R i(
- .
, , .
.
,
.
: . , (. 22.7).
. 22.7. : ) ; )
, : (. 22.8)
( ).
DreamHomc, . 3.3-3.9.
842
VI.
http://openlib.org.ua/
. 22.8. : )
; )
( )
/ . , -''
| .
,
.
, . (. 4.1.1).
,
, , , ,
, . R,
d p (R)
, .
22.2.
, :
(' Flat') (' House ').
PropertyForRent type :
PI=
2 =
o-cypi.iHouBe. (PropertyForRent)
=,F l a t , (PropertyForRent}
(5 ?2). , . 22.4, ,
type 'House'. (. 22,5) ,
type 'Flat'.
, , .
.
. P l t 2 .
. PropertyForRent
:
u P2 = PropertyForRent
21.
843
http://openlib.org.ua/
. ,
type,
'House' ' F l a t 1 .
22.4. , PropertyForRent
property street
No
14
PG21
city
16 Holhead Aberdeen
18 Dale Rd Glasgow
post
code
type
rooms
rent
owner
No
staffNo
branch
No
AB7 5SU
House
650
C046
SA9
B007
G12
House
600
C087
SG37
BOOS
22.5. 2 PropertyForRent
property street
No
city
postcode
type
rooms rent
owner
No
staff
No
branch
No
PL94
6 Argyll St
London
NW2
Flat
400
C087
SL41
BOOS
PG4
6 Lawrence St
Glasgow
Gil 9QX
Flat
350
C040
SG14
BOOS
PG36
2 Manor Rd
Glasgow
G32 4QX
Flat
375
C093
SG37
B003
PG16
5 Novar Dr
Glasgow
G12 9AX
Flat
450
C093
SG14
B003
, . ( ) , , . ,
, . .
.
(.. ) ,
[51].
, . , , , , -
. ,
, PropertyForRent
, {type =
1
House' , type = ' Flat' } , {type
' House ' } . ,
(city = 'Aberdeen') .
( )
. ,
.
844
VI.
http://openlib.org.ua/
, .
(. 4.1.1). R
a l f ... , R.
I 22.3.
DreamHome , ,
staffNo, position (), sex (), DOB
( ) salary ( ). , , staffNo, fName (), IName ()
branchNo ( ). ,
staff
:
Si :
H a t a E f N o , position, , DOB, s n l a r y ( t a f f
n a t a f f K O i fName, IName, branchNo ( S t a f f )
&2
, . 22.6 22.7. (
staffNo), . ,
, .
, . .
. staff S l f S 2 .
. Staff
:
xi S2
Staff
. , staffNo,
.
22.6. S, Staff
staffNo
position
sex
DOB
salary
SL21
Manager
l-Oct-45
30000
SG37
Assistant
lO-Nov-60
12000
SG14
Supervisor
24-Mar-58
18000
SA9
Assistant
19-Feb-70
9000
SG5
Manager
S-Jun-40
24000
SL41
Assistant
13-Jun-65
9000
21.
845
http://openlib.org.ua/
22.7. 32 Staff
staftNo
fName
IName
branchNo
SL21
John
White
8005
SG37
Ann
Beech
B003
SG14
David
Ford
B003
SA9
Mary
Howe
BOO 7
SG5
Susan
Brand
B003
SL41
Julie
Lee
BOOS
.
,
. , ,
1( 2 4 R, (a l f a 2 , 3 ,
4), :
.^
3 I
I
-2
^4
; ,
. , , , . , ,
.
.
. ,
. , , .
(splitting)
1984 [225].
, . , .
, . , , [244].
846
VI.
http://openlib.org.ua/
, . ( )
.
. . , ;
| '
^ .
. R,
( , ... , a ( R ) )
, R, a l f ... , .
22.4.
22.3 Staff
. :
Si:
S;. :
fName,
IName, bronchNo
S 2 branchNo (
, ):
847
http://openlib.org.ua/
51 txa (S 2 i U 22 U S 2 3 ) = Staff
. ,
, ,
,
5 2 ,
.
22.8. Staff. S,
staffNo
position
sex
DOB
salary
SL21
Manager
Assistant
Supervisor
Assistant
Manager
Assistant
M
F
M
F
F
F
l-Oct-45
30000
lO-Nov-60
12000
24-Mar-58
19-Feb-70
3-Jun-40
13-Jun-65
18000
9000
24000
9000
SG37
SG14
SA9
SG5
SL41
fName
IName
branchNo
SG37
Ann
SG14
David
Susan
Beech
Ford
Brand
BOOS
B003
BOOS
SG5
fName
IName
branchNo
SL21
John
Julie
White
Lee
B005
BOOS
SL41
22.11. Staff. SK
staffNo
fName
IName
branchNo
SA9
Mary
Howe
B007
. ,
.
.
.
. ,
.
848
VI.
http://openlib.org.ua/
"" , , ""
. (.
4.1.3). R S, R :
= R
1 < i < w
w ,
S, F , .
22.5.
, , Staff PropertyForRent. , , Staff
branchNo.
.
SE
ObranchNo='B037' ( S t a f f
, PG4
SG14.
, .
PropertyForRent
:
Pi = PropertyForRent > sCafHo Si,
3 < i < 5
(3, 4 5). ,
' 1 (. 22.12), ,
'005' (. 22.13),
' 0 0 7 1 (. 22.14). , . (
) .
22.12. PropertyForRent
Staff.
property
No
street
city
postcode type
PG4
6 Lawrence St
Glasgow
Gil 9QX
G36
2 Manor Rd
Glasgow
G32 4QX
PG2I
18 Dale Rd
Glasgow
PG16
5 Novar Dr
Glasgow
staff
No
rooms
rent
owner
No
Flat
350
C040
SG14
375
C093
SG37
G12
House
600
CO87
SG37
G129AX
Flat
450
C093
SG14
21.
849
http://openlib.org.ua/
street
city
No
PL94
postcod
type
rooms
rent
e
6 Argyll St
London
NW2
Flat
400
owner
staff
No
No
C087
SL41
street
city
postcode
type
rooms
rent
ownerNo
staffNo
House
650
C046
SA9
No
PA14
16Holhead
,
.
, , , , ,
.
. , Branch
, .
(, ), .
.
1. , 14-16,
.
2. . ,
Dream-Home ,
,
.
. , .
3. ,
.
850
VI.
http://openlib.org.ua/
4. , ;
.
ER- , , , .
5. , ""
" ", . , "" " ",
.
6.
(..
, ,
).
22.5.
, 22.1.1, ,
.
. ,
,
.
. :
. ,
, , .
.
.
.
.
,
,
. , [137],
. , , ,
, , . ,
.
22.5.1.
.
, ( ) ( ).
/21.
851
http://openlib.org.ua/
,
.
.
,, 22.15 S t a f f , ,
22,4.
22.15. Staff 22.4
^2
S
2i
"
n,tMo, position, sex, DOB, salary ( S t a f f }
36 5
!,^0-> (S2)
a br ar.chH 0 =.EOD7. ( S 2 )
. , , .
. ,
( position 'Manager'),
, SQL;
SELECT fName, IName
PROM STAFF
WHERE position = 'Manager 1 , SQL, .
, , . :
SELECT fName,
FROM S21
WHERE staffNo
UNION
SELECT fName,
FROM S2;
WHERE staffNo
UNION
IName
IN (SELECT staffNo FROM Sa WHERE position = 'Manager')
IName
IN {SELECT staffNo FROM S WHERE position = 'Manager')
VI.
http://openlib.org.ua/
.
,
( ), position fName/lName
. ,
,
.
. ,
. . , ,
.
.
, , . :
SELECT fName, IName
FROM S21 SITS 3
WHERE staff No IN (SELECT staffNo FROM 5 AT SITE 5 WHERE
position='Manager')
UNION
SELECT fName, IName
FROM S 2 2 AT SITE 5
WHERE s t a f f N o IN (SELECT s t a f f N c FROM Sj_ AT SITE 5 WHERE
posit i o n = ' M a n a g e r ' )
UNION
SELECT fName, IName
FROM S2, AT SITE 7
WHERE s t a f f N o IN (SELECT s t a f f N o FROM Sj. AT SITE 5 WHERE
position= ' Manager'} ,-
SQL
AT SITE, , . , ,
. , ,
, .
.
,
21.
853
http://openlib.org.ua/
. ,
, . , , .
.:
;
(
);
-
, .
,
, . , Branch, S1(
SI.Branch. , .
Branch, S lt
SI .Branch. F3 .2. .
, , , (
), .
SI .Branch.F3 .2 Sj LocalBranch.
.
R* . , . ,
. .
.
, .
. , .
. , .
. , (
22.3.4).
,
ManagerSLondon.LocalBranchSGlasgow
22.5.2.
,
. 854
VI.
http://openlib.org.ua/
, .
, .
, .
22.6.
, , s l t S2, S 21 , S23 S 23 . , TSj, TSS Ts7, 3, 5 7. . , ,
. . 22.16. , ( ).
22.16.
ti
1
I
begin transaction
t4
end transaction
TSs
begin__transaction
begin transaction
()
, (. 19.1.1).
,
, ,
. ,
.
, .
, ( , ) , ,
, . ,
19.2.2 .
, , ,
21.
855
http://openlib.org.ua/
. ,
.
.
, .
, .
, ,
- ,
,
. ,
.
,
. ,
. , . .
.
19.3.2 ,
, , , ,
. , , .
, : , , , , . :
;
;
;
.
, , ' , . , , ,
. , , , S: S2.
S x , S 2
.
856
VI.
http://openlib.org.ua/
- , S:. .
, (Distributed Relational Database Architecture DRDA)
IBM, DRDA , , .
1. .
2. .
3. .
4. .
SQL, .
. 22.9.
1. .
( SQL) . , .
2. . ()
SQL ()
. SQL ,
. ,
, .
3. . ()
SQL (
) .
SQL
, . SQL .
,
, .
4. . ()
SQL ( ) .
. SQL
, (,
/, ).
22.5.3.
,
, . 21.
857
http://openlib.org.ua/
, , . ,
.
, ,
, . , , . ,
, . :
;
, ;
.
,
.
:
, ;
, ;
, .
,
. -
SELECT'
FROM Staff
WHERE salary > 20000
UPDATE Staff
SET salary = salary*! .05;
UPDATE PropertyForRent
SETrent=rent*1.06;
COMMIT;
UPDATE Staff
SET salary = salary"!.05;
UPDATE PropertyForRent
SET
rent-rent'l.Oe:
COMMIT;
UPDATE Staff
SET salary = salary*1.05;
UPDATE PropertyForRent
SETrenl=rent*1.06;
SELECT*
FROM Staff s, PropertyForRent pfr
WHERE s.staffNo = pfr.staffNo;
COMMIT;
'
858
VI.
http://openlib.org.ua/
, ,
.
, .
- .
, .
.
, [268]. .
[107].
. , [265].
, .
22.7.
DreamHome,
:
Property (propertyNo, city) 10 000 ;
Client (clientNo, maxPrice) 100 000 ;
Viewing (propertyNo, clientNo) 1 000 000 .
, , 200 000 ,
SQL:
SELECT p.propertyNo
FROM Property p INNER JOIN
859
http://openlib.org.ua/
3. Property Viewing ,
, ,
, maxPrice >
200 000 . : .
= 100 000 *
4. ,
maxPrice > 200 000 ,
,
. .
= 10* (1 + 100/10 000) + 10* 1 = 20 .
5. Property Viewing ,
, propertyNo clientNo, maxPrice >
200 000 . ,
100 .
= 1 + (100 000 * 100/10 0 0 0 ) = 16,7 .
22.17.
client
16,7
Property Viewing
28
Property Viewing , ,
,
maxPrice >
200
,
maxPrice > 200 ,
,
860
2,3
20
VI.
http://openlib.org.ua/
. 22.17
1 2,3 ,
! ,
, . 23.7.
22.5.4.
, .
. ,
. ,
, 22.1.3.
22.5.5.
, , , . , " ",
.
, . ,
, ,
, ,
. ,
, .
. .
, , .
, SQL 21.
861
http://openlib.org.ua/
.
,
. DreamHome Lease,
, ,
, ,
,
.
,
.
, , .
, , , .
,
.
22.6. ,
( ),
[91]
. ,
, . , .
jjO , 1.
. :
-;
;
.
2.
,
. , , ,
,
.
862
VI.
http://openlib.org.ua/
3.
:
;
.
4.
. .
, , , , .
5.
.
6.
.
,
.
7.
, ,
.
8.
. , :
, , .
9.
.
10.
, .
11.
,
12.
,
21.
863
http://openlib.org.ua/
. ,
.
.
, .
( ), .
,
.
,
. ,
, ( ) .
,
, , ,
.
, ,
.
. ,
, , , , - .
, .
. ,
. ,
.
,
, . ,
, . ,
.
, ,
864
VI.
http://openlib.org.ua/
,
,
, , ,
.
,
,
. .
: .
, . . , .
: ,
, ,
, .
, .
, : ( ),
( ),
( ) ( ).
, , . -
/ . , . , ^
.
.
21.
865
http://openlib.org.ua/
22.5. ? ?
22.6. ?
22.7.
?
22.8. .
.
22.9.
. ,
, ,
.
22.10. ?
22.11. . ,
?
22.12.
? .
22.13. ,
.
. ?
, .
22.14. ,
DRDA IBM. . , .
,
,
.
:
Employee
, .
Employee. , ;
NIN.
Department. , ; deptNo. managerNIN
, . .
866
VI,
http://openlib.org.ua/
Project. ,
; proj No. projectManagerNIW, , , deptNo.
WorksOn. , ,
;
(NIN, projNo}.
Business. , ; businessAreaNo.
Region. , ;
regionNo.
:
Region I: 'Scotland' ().
Region 2: 'Wales' ().
Region 3: 'England' ().
867
http://openlib.org.ua/
http://openlib.org.ua/
...
.
.
.
:
* (2);
().
-
.
X/Open DTP.
,
.
.
.
.
Oracle.
. . ,
,
,
. , 19
,
.
,
, , -
http://openlib.org.ua/
.
, .
.
23,1 . 23.2 ( 19.2.2),
, , ,
19.2.3 19.2.5, . 23.3 , , , . 23.4
, ,
. 23.5 X/Open DTP,
. 23.6 ,
, . 23.7
. 23.8
.
23.9 Oracle. . DreamHome,
10.4 .
23.1.
22.5.2 , , , ,
, .
19.1.2 ,
, .
, .
- ,
.
,
, . 8/0
V.
http://openlib.org.ua/
. .
- . , , ,
, .
( ).
, s l f ,
1. (,) S:
, ,
.
2. S x S2 S 3 .
3. S2 S3 . TCj . . 23.1.
,
, .
23.2.
,
. , .
'
;
. 23.1.
23.
871
http://openlib.org.ua/
23.2.1.
, ,
. ,
:
;
, ;
;
, ;
[199].
19.2.1 , , . , .
,
, .
, , . ,
. , . , , , . 23.6
, ..
, .
23.2.2.
, 19.2.2, .
,
( ) , , . ,
. ,
! *, , ^ < 1, * < *
Sx, 3 .
872
V.
http://openlib.org.ua/
, 19.2
. , ,
, .
, () .
,
.
, ,
, . ,
. ,
19.2. ,
, , . , , , .
, , , . 23.3.
23.2.3.
, (2PL), . ,
,
.
, [4],
[122]. , , . 5 .
1. 51
, , . . ,
' .
23.
873
http://openlib.org.ua/
, .
. , .
2. , , ,
.
3.
- , , , . ,
, .
, . , .
, . ,
, .
,
.
, . , , .
. , () 2 + 3 , :
;
;
;
;
.
.
.
(primary copy), a
(slave copy).
, ,
,
[293].
874
V.
http://openlib.org.ua/
. , , , .
. , . ,
. . .
, , , .
,
,
. ,
.
, ,
.
,
,
.
, . ,
.
,
" " (Read-One-Write-All
ROWA).
, ,
.
,
,
. ,
(- ) ( ), .
, , 5 , :
;
;
;
23.
875
http://openlib.org.ua/
;
.
4, , . System R* [220].
, . ,
, . , ,
, .
,
. , .
, , .
, [303].
, . , , ,
( + 1} / 2 ]
[ ( + 1)/2] . , . , .
23.2.4.
, , 19.2,5. ,
( ) . , , . ,
( 19.2.5) . ,
.
<_, _> [204].
, .
http://openlib.org.ua/
.
, .
/ , .
-
, , , , . , 1 <10, 1> 2 <15, 2>, 2 .
, 2 <5, 2>, 2
<11, 2>.
23.3.
,
( , s ), (. 19.24). (
),
23.1.
23.1.
, 1( 2 3, :
\ 5 S3;
2 S 2 S 3 ;
3 S3 .
( ) ( ) ,
read_lock{Ti, ^) ^
x j ? a write_lock (Tit KJ ) Tj
Xj .
tj
Si
S2
S)
read_lock(Ti, x j
write_lock(T 2 , )
write_lock (T 2 ,
read_lock (T 3 j :
write
write_lock(T 2 ,
lockfTi, )
Z3)
( . 23.2).
, . ,
, . 23.3, , :
23.
877
http://openlib.org.ua/
, 23.3. Si, S2 S3
, ,
. ,
. : , .
(Deadlock Detection
Coordinator DDC). DDC
.
DDC . DDC
. , DDC , ,
, . DDC , ,
, .
, DDC
, .
. , , .
. , [217]. . 23.4 878
V.
http://openlib.org.ua/
, or Si S8. , .
DDi:j, Si Sj. , .
, , 5 S a .
. 23.4.
,
. , .
, , [229]. ^,
. 1 S t
, Ss, , ^ ^. , S2 , Text TV
, (. . 23.3) s l f S3 S a ,
. 23.5. , Te5tc,
. , ,
TI Slt S a ,
, S2.
, Text.
. ,
.
, 23.
879
http://openlib.org.ua/
S,
S2
S3
. 23.5.
Text .
. , , . ! ,
:
-> Text
->
, .
,
, Sx, Tk, , ,
t s ( T i ) < t s ( T 4 ) . , ts (Ti) < ts (T k ),
51 Sk. s k , Text . , (
), , . .
, ,
.
, . 23,5, :
i:
^2
T! 3 TMt
Sa:
^
, 1( .. S2.
S2 :
, -* ,
880
, ->
V.
http://openlib.org.ua/
, S 2 , , S3. S3 :
Sj:
, .
. ,
, , ,
.
S
23.4.
,
, .
23.4.1.
22.5.2 ,
:
;
;
;
.
.
, ,
.
.
.
,
- . ,
,
, .
. 23.6. ,
. 23.6, , 1 2 : 1, 4, 5 2, 3 (. 23.6, ).
,
, . , , 5
S2
(-). :
23.
881
http://openlib.org.ua/
. 23.6. : ) ; )
S2 ;
;
;
S2 -.
-,
, S-i
S2, .
23.4.2.
,
.
, . ,
,
,
, .
,
.
.
, , .
, .
, , ,
, 5 882
V.
http://openlib.org.ua/
, S2
. .
,
,
, .
, 19.3, , .
, ,
. ,
, ,
. ,
- . , , . ,
: (2) ().
, , ( )
. , . ,
, ( ). ,
, ,
.
23.4.3. (2)
, : (voting phase)
(decision phase). ,
, .
-,
. . ,
. , ,
. . ,
,
, . ,
.
.
-. .
23.
883
http://openlib.org.ua/
.
1
1. begin_commit . PREPARE.
-.
2
2. ABORT, abort
. GLOBAL_ABORT.
-.
3. READY_COMMIT,
, .
,
commit
. GLOBAL_COMMIT. -.
4.
end_transaction.
, .
. ,
(ABORT)
GLOBAL_ABORT. ,
, .
.
1. PREPARE :
) ready_commit
, . READY_COMMIT;
) abort
. ABORT.
.
2.
-.
3. GLOBAL_ABORT,
abort . .
GLOBAL_COMMlTt
commit .
, , .
884
V.
http://openlib.org.ua/
, -
. . , (COMMIT) (ABORT), . 23.7.
GLOBAL_COMMIT GLOBAL_ABORT. -
,
, (termination protocol).
, .
COMMIT:
beg!n_commit
PREPARE
READY_COMMtT:
READY
/?
GLOBAL_COMMIT
.
:
end of transection
PREPARE:
ready^commit
GLOBAL_COMMIT
GLOBAL ABORT
GLpBAT-_COMMFT:
commit
COMMIT:
begin_cornmit
PREPARE
ABORT:
ABORT
abort
PREPARE:
abort
ABORT
. 23,7. : )
; )
23.
885
http://openlib.org.ua/
, -.
, , , .
: INITIAL, WAITING, DECIDED COMPLETED,
, . 23.8, . - .
.
- WAITING.
,
. ,
,
,
- DECIDED.
. , .
=:< |
INITIAL ':'"
PREPARE
1
'
. 23.8.
: ) ; )
886
V.
http://openlib.org.ua/
,
. .
,
: INITIAL, PREPARED, ABORTED COMMITTED,
, . 23.8, . - , .
- INITIAL. PREPARE. ,
, INITIAL. .
PREPARE ( -), ABORT.
- PREPARED, . , .
,
.
.
, . .
, ,
-.
, - ,
, .
(
),
.
.
,
, ,
. , ,
, .
23.
887
http://openlib.org.ua/
-.
1. INITIAL. .
.
2. WAITING. PREPARE
-, , , . .
3. DECIDED. .
,
. ,
.
- , , ,
(.. ).
-.
1. INITIAL. .
,
-
.
2. PREPARED.
.
, .
3. ABORTED/COMMITTED.
. .
( -),
, . ,
. , SL i
( ), ( ). ,
. Si si+1, S i+2 , ... ,
Sn, . Sk , Sk ,
, .
, . 888
V.
http://openlib.org.ua/
, . ,
.
-,
.
. ,
, ,
.
( ),
. , ,
, -
, . 23.9, .
,
, . .
,
(. 23.9, ). 1, 2, ..., , 1
, .
,
, . 2. 3. 2, , 4, ,.
, , , .. . , -1, -2 ..,
.
, .
, ,
,
[30].
, ,
, . 23.9, . PREPARE
,
.
23.
889
http://openlib.org.ua/
.
( ),
, [282].
GC/GA
/
..
' UN-""- 2 "- "- fr>
]
1
PREPARE
RC/ABORT
RC/ABORT
GC/GA
GC/GA
GC/GA
1
6)
2
"
. 23.9. :
) ; ) ; )
. ; PJ ; RC
Ready_Commit; GC Global_Comtnit; GA Global_Abort
890
V.
http://openlib.org.ua/
23.4.4. ()
, , , . , , - ,
, ,
, .
, . ,
[282]. , . ,
, .
.
.
.
(
-).
,
. , . PRE-COMMIT. , , ,
, . . ,
.
, , .
. 23.10. , - , ,
PRE-COMMIT , , .
23.4.5.
, , .
, ,
23.
891
http://openlib.org.ua/
PREPARED
PREPARED
. 23.10. :
) ; )
- , ,
, .
, .
, .
,
.
.
,
, , , . 23.1.
, 1 , 10 . Ik> ' ,
5 . ,
bal x 100 .
bal x 90 . 1, , , .
1 80 .
892
V.
http://openlib.org.ua/
23.1.
ti
,
begin_transaction
2
begin_transaction
t2
balx = balx - 10
bal x = bal K - S
t3
write (bal-J
w r i t e (bal x )
t4
commit
commit
t5
begin_transaction
ts
balx = balx - 5
t?
write (bal x )
te
commit
,
, , ,
. 23.2. , ,
( 1) .
: , 1
60 , 2 ,
bal x 50 . ,
bal x , 100 .
1 40 , 50,
, .
-10 , .
23.2.
ti
begin_transactio
n
begin_transaction
ta
tj
tt
bal x = bal x - 60
balx = balx - 50
write {balx)
write (baly)
commit
commit
, , ,
[95], [96].
, - . ,
,
.
, , ,
[282].
23.
893
http://openlib.org.ua/
, , ,
. .
, , , ,
. ,
, 23.2. , , .
.
, ,
, . ,
,
.
.
, . 19.2.4 . , . , - ,
.
. ,
.
,
.
23.5.
/
Open Group ,
,
. 1996 /
Company Ltd. ( 1984 ) Open Software Foundation
( 1988 ). / Distributed
894
V.
http://openlib.org.ua/
(,
BEGIN, COMMIT,
ABORT
PREPARE, COMMIT, ABORT
. 23,11. X/Open
.
tx_open tx_close. .
tx begin. .
23.
895
http://openlib.org.ua/
tx_commit tx^abort. .
.
_ xa_close. .
xa_start xa_end.
.
xa_rollback.
.
_. / .
xa_commit.
.
xa_recover. ,
, . ,
( , ), .
{ ) , . , ,
, .
xa_forget.
, .
, .
tx_begin();
EXEC SQL UPDATE Staff SET salary = salary*!.05 WHERE
position = 'Manager1 ,EXEC SQL UPDATE Staff SET salary = salary*!.04 WHERE
position <> 'Manager';
tx_commit <);
V.
http://openlib.org.ua/
BEGIN,
COMMIT,
ABORT
' ,"~
'
.i
^.
pecypco&j/i
. - . ;
5
"'
'
"-.
. 23.12. /
, , , . X/Open DTP . 23.12. ,
(Communication Manager ).
,
.
.
. ISO ROSE (Remote Operations
SErvice) RFC (Remote Procedure Call). ( --) /Open OSI-TP (Open Systems Interconnection Transaction Processing).
X/Open DTP , (. 19.4).
.
X/Open
. , , . CICS Encina IBM
( IBM AIX Windows NT, TXSeries IBM),
Tuxedo BEA Systems, Oracle, Informix SQL Server.
23.6.
22.1.2,
,
, , , . , , 23.
897
http://openlib.org.ua/
, -, . , , ,
.
. .
23.6.1.
. ' . .
, ,
. ,
( ,
), ,
"" , .
, ,
.
, .
,
, ,
. , , ,
(. 23.4.3).
.
,
(, ),
, . , , , , , ,
.
, . .
.
.
,
, , ,
.
898
V.
http://openlib.org.ua/
,
. ,
, , [43].
.
, .
. ,
. 22,1.3, , .
. , . ,
( ).
.
, , .
. ,
, .
. , .
.
, .
,
'.
"/", " " " ". ( ) ,
"/"
"/" ,
( )> . (
, )
.
" " , . , , . , .
,
, , .
.
23.
899
http://openlib.org.ua/
(). , ,
. , DreamHome .
,
,
.
. , , , . ,
, ,
, tte . . 23.13, .
.
, ,
, , .
. , ,
DreamHome.
, () , . . 23.13, .
.
.
. .
. . , (, ), .
, ,
. ,
, .
.
DreamHome
PropertyForRent, Client Lease. ,
,
,
, .
900
V.
http://openlib.org.ua/
( )
( )
( )
( )
(-)
(-)
(-)
(-)
(-)
{ )
. 23.13. "/"; ) ; )
23.
901
http://openlib.org.ua/
" "
"/",
. " "
. , . ,
, , , , ..
, , . ;
, , . " "
, , , . 23.14,
" " ( )
: " .
.
.
, .
, .
, , DreamHome
" ", , ,
,
, .. ,
. . ,
. , , , , . . , ,
, .
(
)
Billing
ownerNo leaseNo
087
40.
LN34
LN7B
Billing
status
;
--
ownerNo leaseNo
status "'-.
087
40
, -,
- -'
LN34V;
LN76'-:.
902
V.
http://openlib.org.ua/
,
, , , . 23.15.
,
. .
23.6.2.
, , .
, .
.
.
,
,
(, ),
,
( " "). , .
,
, .
, . ,
. -
Glasgow
(-)
Aberdeen
(-)
London
(-)
Edinburgh
(-)
. 23.15. ,
( )
23.
903
http://openlib.org.ua/
. 23.16, . ,
.
,
.
, , .
, . 23.16, . ,
, .
. ,
, .
,
, , , , ,
, 23:00. , Staff
() , , s t a f f , . S t a f f , , . Oracle
23.9.2.
. .
,
.
,
Transactiorf :;t
Update Relation A-
Update Relation
Update. Relation.!?' ...
Commit : ",
ll
Transaction .,>
Update Relation A
Update Relation ..
Update Relation CJUi
Update Relation D^
Commit
Transaction...
Update Relation A >i|
Update Relation 1
Update Relation If
Update Relation
|
|
Commit .'
B)
. 23.16. : ) ;
)
904
V.
http://openlib.org.ua/
,
,
.
-: , .
. ,
, . .
,
. ,
,
. ,
Oracle staff ,
RENTALS. GLASGOW. NORTH. COM
(. 23.9.1), .
CREATE TRIGGER S t a f f A f t e r l n s R o w
BEFORE INSERT ON S t a f f
FOR EACH ROW
BEGIN
INSERT INTO StaffDuplicate@RENTALS.GLASGOW.NORTH.COM
VALUES (:new.stafNo, :new:fName, :new:IName, mew,position,
:new:sex, t n e w . D O B , :new:salary, :new:branchNo);
END;
Staff ,
,
, .
.
, ( , , ).
.
,
. , .
.
,
. . , , .
23.
905
http://openlib.org.ua/
,
. ,
.
, ,
. , ( ) , .
, . , ,
.
,
.
. , , .
. , .
, . . ,
,
salary = salary + .
. , .
. , . ,
.
.
.
,
.
.
. , .
. .
. -
, .
906
V.
http://openlib.org.ua/
,
, , ,
, ,
. . ,
UTC (Universal
Coordinated Time ) , , .
23.7.
20 , :
;
.
,
, .
20 .
.
22.5.3,
,
. , , , .
, ,
. -
,
,
, .
23.7.1.
20 , ,
, .
. , 20.3.2
,
. - .
, , . . one 23.
907
http://openlib.org.ua/
. ,
, . . .
:
;
;
.
: . , ,
, . , :
(R1 R2) IX R3 = (R1 X R3) U (R2 X R3)
, . >
. , , .
23.2.
23.2,
, ,
.
SQL:
SELECT *
FROM Branch b, PropertyForRent p
WHERE b.branchNo = p.branchNo AND p.type = ' F l a t 1 ;
, PropertyForRent Branch :
PI=
0- brail chNo,'Boo3-
BI:
ObHinchlfo.-' (Branch)
2=
2:
1.-- ='Flat'(PropertyForRent)
ObrwiehMoi.-' (Branch)
.;,-' {PropertyForRent)
..' (PropertyForRent)
. 23.17, .
, , 908
V.
http://openlib.org.ua/
, ,
. 23.17, . , (..
) :
af ( P i )
, 2 , .
, , . 23.17, . , .
, . 23.17, .
. nchNo=p. branch N
nc h No = . chN a
>
'"'b.brancllNo ^ p. branch No
p.typ--Flar
. 23.17. , 23.2: )
; ) , ; ) , ; )
23.
909
http://openlib.org.ua/
,
, .
23.3.
.
SQL:
SELECT fName, INarae
FROM S t a f f ;
Staff, 22.3:
^1: ' 'staff No, position, sex, DOB. salary I b C S t I
&2:
. 23.18, .
, , fName IName . . 23.18, *.
""
Si
"""
?2
. 23.18. 23.3: ) ; )
, . , ,
.
23.4.
,
' ', .
SQL:
910
V.
http://openlib.org.ua/
SELECT *
FROM Branch b, Client
WHERE b.branchNo c.branchNo AND b.branchNo = ' B O Q 3 1 ;
, Branch
, 23.2, Client
Branch:
3 = .'' (Branch)
32 ! , '
R, = Client >branChNo Bi i = 1, 2
(Branch)
. 23.19, .
,
. ,
' '. , , . 23.19, . ! 2 .
. 23.19, .
. 23.19. 23.4: ) ; ) ; )
23.7.2.
. ,
,
(. 4.1.3).
: .
, ,
, .
, , S2
R! >< R 2 , RX Ra ,
S2, R! R2 =( , 3 , ... , aj =( 1 (
23.
911
http://openlib.org.ua/
2 , ... ) . . ,
:
.
1. R' - ( 2 ) S2 ( , S^2. R' S^
3. R" = RI > R' S^
4. R" S2.
5. R" xix R2 S2.
,
RJ R! R 2 .
R!, , .
[29]. ,
- .
23.8.
, ,
.
, , , , . , PDA (Personal Digital Assistant "" ) Internet. ,
,
, .
, , , ,
, .
.
. ,
,
;^ , ^
912
V.
http://openlib.org.ua/
, PDA
Internet, .
. 23.20.
:
, , ;
,
,
;
,
, PDA Internet;
.
,
,
, , , .
.
, .
. 23.20.
23.
913
http://openlib.org.ua/
:
. .
23.8.1.
.
.
, . ,
, .
Internet,
, .
,
.
, ,
Internet.
.
.
,
.
,
,
,
.
SQL; ,
.
,
, , .
23.9.
Oracle
, Oracle 8i [238], [239]. Oracle,
. Oracle
8.2.
914
V.
http://openlib.org.ua/
23.9.1.
Oracle
, Oracle , 22,
.
, ,
. ,
Oracle . ,
, .
Oracle, :
;
;
;
;
;
.
Oracle .
Oracle NetS ( Oracle
SQL*Net). NetS
, . , . NetS
,
, .
, . NetS , TNS
(Transparent Network Substrate ), , , (,
TCP/IP SPX/IPX).
, .
Oracle (Connection
MANager CMAN), Oracle 7
Multiprotocol Interchange.
Oracle Names , .
,
Oracle Names . Oracle Names
tnsnames.ora .
23.
915
http://openlib.org.ua/
,
, .
Oracle
, .
Internet,
,
. , . 23.21
DreamHome.
Rentals, ,
,
LONDON.SOUTH.COM. Rentals
:
RENTALS.LONDON.SOUTH.COM
RENTALS.GLASGOW.NORTH.COM
Oracle ,
Oracle (, Oracle). . , , .
,
, ,
. ,
, :
CREATE PUBLIC DATABASE LINK RENTALS.GLASGOW.NORTH.COM;
. -
. 23.21. DreamHome
916
V.
http://openlib.org.ua/
,
. . , , viewing Supervisor, SQL:
SELECT * FROM Supervisor.ViewingRENTALS.GLASGOW.NORTH.COM;
, Viewing
Supervisor. ,
Viewing Supervisor ,
. , Viewing Viewing , Supervisor:
CREATE SYNONYM Viewing FOR
Supervisor-Viewing@RENTALS.GLASGOW.NORTH.COM;
SELECT * FROM Viewing;
, , .
Oracle ( ,
, ). , ,
.
Oracle ,
, , Oracle. Oracle
, , Oracle.
, Oracle, Oracle. , Oracle, SQL, , , Oracle.
23.
917
http://openlib.org.ua/
.
.
SQL , Oracle,
DB2/400, DB2 OS/390, Informix, Sybase, SQL Server, Rdb, RMS NonStop SQL. ,
Oracle, , Oracle. DRDA (. 22.5.2), SQL DRDA, DB2, SQL/DS SQL/400, Oracle .
.
(RFC Remote Procedure Call) ,
, Oracle. ,
RPC PL/SQL CICS, IMS/TM IDMS/DC, ,
ADABAS, CA-IDBS, IMS, VSAM DB2. Oracle .
.
. Oracle, , Oracle,
(. 23.4.3).
SQL. SQL, , SQL,
, Oracle.
. PL/SQL Oracle 8i , .
. , Oracle, Oracle,
SQL, Oracle, SQL, , Oracle.
SQL .
, Oracle,
SQL, .
, Oracle, SQL, ,
PL/SQL.
.
,
, Oracle, Oracle.
Oracle
,
. .
918
V.
http://openlib.org.ua/
.
, .
Oracle , 20.6.
23.9.2. Oracle
Oracle , ,
. Oracle , , , , , . Oracle ,
. Enterprise Edition ,
.
Oracle. , Oracle.
Oracle .
, . . . ; .
. ,
, , , , .
,
. .
.
,
.
, .
. .
.
Oracle , . ,
, . , .
.
23.
919
http://openlib.org.ua/
Oracle .
. , .
( ). ,
.
. , ,
,
.
,
,
.
.
, , , Oracle .
,
. ,
PL/SQL, DBMS_REFRESH. , , , LocalStaff, LocalClient
LocalOwner :
DECLARE
vSnapshotList DBMS_UTTLITY.UNCL_ARRAY;
BEGIN
vSnapshotList(1) = 'LocalStaff1;
Oracle
.
COMPLETE. , ,
. ; .
Oracle
. , ,
,
, , .
920
V.
http://openlib.org.ua/
FAST. , , ,
, . , , , , .
,
. ,
() .
EORCE. , ,
. , Oracle
.
,
.
1. () (),
, ,
.
2. ()
().
3. ( )
, FAST.
4. CREATE SNAPSHOT. , , ,
:
CREATE SNAPSHOT Staff
REFRESH FAST
START WITH sysdate NEXT sysdate + 7
WITH PRIMARY KEY
AS SELECT * FROM StaffRENTALS.LONDON.SOUTH.COM
WHERE branchNo = ' B 0 0 3 ' ;
SELECT
( RENTALS.LONDON. SOUTH.COM), . START WITH , , .
Oracle SNAP$_Staff, Staff. Oracle
Staff, SNAP$_Staff.
.
5.
.
, , .
CREATE SNAPSHOT LOG. , Staff
:
23.
921
http://openlib.org.ua/
,
, , ,
. ,
,
, .
FOR UPDATE CREATE SNAPSHOT.
s t a f f Oracle , .
1. SNAP$_STAFF , .
2. USLOG$_STAFF , .
.
3. USTRG$_STAFF SNAP$_STAFF,
, USLOG$_STAPF.
4. STAFF$RT SNAP$_STAFF, ,
STAFF$TP.
5. STAFF$TP ,
RPC, STAFFSRP .
6. STAFFSRP, ,
7. STAFF$RR, .
8. s t a f f , SNAP$_STAFF.
9. , DBMS_REFRESH.
23.6.1. Oracle , , .
, .
,
, , , .
922
V.
http://openlib.org.ua/
DBMS_REPCAT, ,
staff
Staff (, salaryTimestamp)
:
EXECUTE DBMS J?EPCAT . MAKE_COLUMN_GROUPS
DBMS_REPCAT
. ,
Oracle Replication
Manager.
,
, . , . ,
. , , ,
.
RPC, . , .
, ,
. ,
, .
, ( KOS) , , . ,
.
: .
, . 23.
923
http://openlib.org.ua/
, . ,
. ,
.
. , , . : , .
, ,
. ,
.
.
. , .
, .
, , .
.
.
.
X/Open DTP , OSI-TP
.
, , ,
.
. ,
,
. , ( , ), , ,
.
,
. ', , .
924
V.
http://openlib.org.ua/
"/", " " " "
( ). . ,
.
.
.
, ,
,
. ,
.
,
.
,
.
, PDA Internet,
.
23.1.
23.2.
23.3.
23.4.
23.5.
23.6.
23.7.
23.8.
, , , .
.
. .
,
.
" " ,
.
?
. .
.
.
' "
'""
- ; ;:;.-- - ; ;; <-
>'
-,' ~ ^"^"
- "'" !
"
"
' - "-
- '
-;-
- . -;;
- "-
"',">,'
23.9. DreamHome ,
,
.
23.
925
http://openlib.org.ua/
, . ,
. ,
.
23.10. . .
23.11.
.
.
23.12. , ,
X/Open DTP .
23.13. : \, 2 , 3, 4 .
TV Sj S 2 .
2 5^
3 S: S3.
4 S3.
5 S3.
,
T1
Xi
X;
^i
Si
3
XT
Si
^5
S2
ST.
Ts
XT
S3
) . , ?
) ,
. ?
926
V.
http://openlib.org.ua/
...
,
.
,
.
- :
, ;
;
;
;
, , ;
;
.
, .
.
- , . - , ,
.
.
, . ()
, - () (), ,
.
.
, -
http://openlib.org.ua/
(-) .
, , ,
.
.
25
, . 26
, ODMG (Object Data Management
Group
), , ObjectStore, 27 ,
. , SQL3, ANSI/ISO SQL; , - Oracle.
, .
24.1 , ,
. 24.2 ,
. 24.3
- , 24.4 ,
.
24.5 ,
- . ,
, DreamHome, 10.4
.
24.1.
1990- . , , , .
,
.
.
.
.
.
928
VI.
http://openlib.org.ua/
.
.
Web-.
(Computer-Aided
Design CAD) ,
, ,
. .
,
. . , DreamHome ,
, PropertyForRent, Client Viewing,
.
, , , .
.
. ,
.
-
, , ..
.
, , , .
.
,
.
. ,
(Computer-Aided
Manufacturing ) , CAD, a
, (, ) (, ). ,
, : , . , , ,
. , 24.
929
http://openlib.org.ua/
, .
.
.
,
, .
, .
, , .
(Computer-Aided Software Engineering CASE) , : , , , ,
, . CASE, CAD, , . , ,
, ,
. ,
,
.
. , , .
, ,
. , ,
, , , :
Node Link <=* Node <=> Link <=> Node <=^ Link <=> Node
Node ,
Link ,
. , , , .
,
, , .
930
VI.
http://openlib.org.ua/
(Office Information System
OIS) , , , , ..
, , ,
. , , , - . , , ,
. , , , , SGML
(Standardized Generalized Markup Language), HTML (HyperText Markup Language)
XML (Extensible Markup Language), 29.
, ,
1
Internet. , ,
. ,
.
ASCII
, . , ,
..
Dreamffome .
. . , . .
, (, ).
. ,
. ,
.
, (, ,
).
. , ' , World Wide Web (
" ")
,
. World
Wide Web 28.
24.
931
http://openlib.org.ua/
, . , , , ,
(, ,
).
. , , .
, ,
,
, .
, ,
. , , , ,
.
, , ,
, - , .
(1015 ), , - .
(Geographic Information
Systems GIS) , .
,
. , , ,
.
, NASA 1990- ,
EOS (Earth Observing System
), ,
,
. ,
. EOSDIS (EOS Data and
Information System). EOSDIS ,
, . ,
EOSDIS .
,
, ,
, .
932
VI.
http://openlib.org.ua/
Web-
Web-,
. Web- ,
:
,
,
, ;
, , ;
, (, , , );
, ,
,
, , ..;
, , , ;
,
;
, ;
.
: (,
, - , ),
. ,
,
. ,
,
-, [198].
28 29, Web , , XML, , .
Forrester Research Group ,
99%
2003 1,3 . , , 2003
3,2 5% . Internet Web
.
.
'rv 24.
933
http://openlib.org.ua/
,
, ,
.
,
, .
,
,
24.2.
3 ,
.
SQL,
. , (OLTP),
.
, , , . 24.1
, - . , .
24.1.
, ,
, " ". " " ,
, . 20, .
. ,
" " (*:*) 934
VI.
http://openlib.org.ua/
: ,
.
, . , " " (1:*)
: Has (), Owns (), Manages () ..
,
. - , .
, .. ,
, . [161] [248]. . ,
(. 3.2),
(. 13).
, , .
3.3 ,
3.2.1 ,
. ,
, .
, ,
, . , ,
.
5 6, SQL , (DDL ),
,
. , , , . , .
" " ,
, , , .
, .
,
, , , ,
, .. 24.
935
http://openlib.org.ua/
, . [17] [179]. .
1. (, ,
, ) .
2. a l f , ..., , 1? o 2t ...,
, [ : : , 2 : 2 , . . ., : _] .
3. o l f 2, ..,., , S={olf 2, ..., } -.
.
, John, Glasgow.
{SG37,
SG14f
SG5}.
[branchNo:BOQ3,
[branchNo: B 0 0 3 ,
city:Glasgow, StaffNo:(SG37, SG14, SG5}].
street:163
Main
St,
{[branchNo:B003,
street:163
Main
St,
city:Glasgow], [branchNo:B5, street:22 Deer Rd, city:London]}.
{ [branch.No:B003,
street:163
c i t y : G l a s g o w f S t a f f : { S G 3 7 , SG14, S G 5 } ] , [branchNo:B5,
Deer Rd, city:London, s t a f f N o : { S L 2 1 , S L 4 l } ] } .
Main
St,
street:22
BLOB (Binary Large Object BLOB).
BLOB , , , - ,
.
BLOB . .
, .
BLOB . , , , BLOB
BLOB, .
, BLOB . , BLOB. ,
.
,
. BLOB . 17.6.
,
, SQL, .
"
". , GIS , , , , .
936
VI.
http://openlib.org.ua/
,
.
, .. ,
( ) .
Staff, , (. 24.2).
24.2. Staff
, ' S 0 0 5 ' ?
:
SELECT managerStaffNo
FROM Staff
WHERE staffNo = 'S005'
UNION
SELECT managerStaffNo
F30M Staff
WHERE staffNo = (SELECT managerStaffNo
FROM Staff
WHERE staffNo = 'S005');
. , . , : " , ",
SQL.
SQL , ,
21. ,
. ,
, , .
(transitive closure)
(recursive closure) [218].
. R (< A 2 ), (
, ; R, , : (,) (,)
^ R, (, ) .
24.
937
http://openlib.org.ua/
. , ,
, .
S t a f f . 24.3.
24.3. Staff
staffNo
managerStaffNo
S005
S004
S003
SOQ4
S003
S002
S002
S001
S001
NULL
S005
S003
SOD5
S002
S005
SCI 01
S004
S002
S004
S001
S003
S001
5.1 , SQL-92 . (DML Data Manipulation Language)
. SQL
SQL, ,
21,
(impedance mismatch),
, .
SQL ,
,
, , ,
.
SQL . , SQL Date Interval, . ,
, ,
. ,
30% [10]. , -
.
-
938
VI.
http://openlib.org.ua/
, [93]. . .
, , , (. 19.4),
,
.
. ,
, , , . . .
, - ,
[300].
, .
, , .. .
, .
, . , .
SQL, .. SQL3, . ,
, , . SQL3 27.4.
24.3.
.
, .
24.
939
http://openlib.org.ua/
24.3.1. ,
.
,
, . , , ,
. .
, ,
, . , , . , - , ,
, . , . ,
,
. " ",
, . ,
Smalltalk, .
, Smalltalk
. ,
- , .
:
- ()
. -
(Abstract Data Types ADT).
. , ,
ADT , . .
, .
, : ADT , ,
ADT [12].
24.3.2.
-
Simula,
1960-
[85], -
940
VI.
http://openlib.org.ua/
DreamHome
, .
: . , 11.1.1.
, .
, (instance variables). ,
1
, '163 Main Street , , . 24.4. .
(, ,
, ..) . , branchNo . 24.4
' ' . /
. , SalesStaff
S t a f f . .
( ), . , SalesStaff, ,
Staff.
. , , ( 24.3.9).
24.4. Branch
branchNo
' '
street
city
'Glasgow'
postcode
'Gil 9QX'
SalesStaff
Manager
'Susan Brand'
"" , , street , .
branchObj ect.street
24.
941
http://openlib.org.ua/
24.3.3.
, - (Object IDentifier OID), :
;
;
, ,
; OID
,
;
(.. ;
,
OID);
( ).
, ,
,
(. 3.3.2). ,
, , ,
.
, , ,
.
OID ,
, .. . ,
DreamHome Staff Branch
Branch Has Staff.
,
,
13.2.
OID ,
- . , ,
(. 3.3.3). 25.7.2.
.
,
..
.
, - . -,
,
,, . -,
,
. ,
, branchNo. ,
942
VI.
http://openlib.org.ua/
. , 1
, ' B O Q l , ' B 0 0 2 ' ' ' , .
, , [186]. , C/C++ OID .
,
,
, , . , ,
, . , , , , , . ,
. . OID
25.2.
OID .
. OID
. ,
.
. OID
, . , ,
: .
. OID , , ,
, . , .
. OID
, , .
,
OID.
,
: ( ),
. OID .
' OID , ? , ,
.
,
, .
() , ; 24.
943
http://openlib.org.ua/
OID,
(=). ,
, (==).
, : ,
, ,
; , , .
24.3.4.
. ,
. 24.1
, .
. 24.1.
.
. , ,
, .
,
, . -
,
. ,
24.1 , .
updateSalary Increment, salary .
944
VI.
http://openlib.org.ua/
24.1.
method void updateSalary{float increment)
. , ()
() , -
. ,
. . ,
updateSalary Staff
1000 :
staffObject.updateSalary(1000)
:
u p d a t e S a l a r y ( s t a f f O b j e c t , 1000}
24.3.5.
Simula . , , , .
, . , Branch. (instance). ,
, . 24.2.
"" "" ,
. ""
[11]. .
, . ,
, .
, "" , .
- , .
, .
, Branch .
.
24.
945
http://openlib.org.ua/
branehNo
street
Branch
branchNo
street
city
postcode
printO
getPostCodef)
numbefOfStaff{ )
tf
branChNo=BOO?
street =16 Argyll St
city = Aberdeen spostcode
\
branchNo BOOS
street =163 Main St
city = Glasgow-.-:-;Jj
postcode
. 24.2. ,
. -
new.
. , . ,
, .
24.3.6. ,
, . ,
(
).
(inheritance) .
, .
(generalization), . . , ,
.
946
VI.
http://openlib.org.ua/
. ,
,
.
, , "-"
12, , - , .
(A Kind Of),
Manager Staff .
-,
Susan Brand Manager IS-A.
: (single),
(multiple), (repeated) (selective). . 24.3
, Manager SalesStaff S t a f f . ,
.
staff Person, ,
, .
. 24.4 ,
SalesManager Manager SalesStaff. , , , .
- .
, , . ,
, .
.
1.
. , bonus () Manager SalesStaff, SalesManager
bonus
SalesManager Manager. bonus SalesStaff .bonus.
. 24.3.
24.
947
http://openlib.org.ua/
2.
.
, . 24.4,
:
Sales_Manager -* Manager - SalesStaff
. 24.4.
,
.
, , Manager SalesStaff Staff, . 24.5. SalesManager S t a f f .
, .
.
, (. 6.4),
.
24.3.7.
, , , . . , , . , Staff
.
method void giveCommiselon(float branchProfit)
948
VI.
http://openlib.org.ua/
. 24,5.
- .
, .
(overloading).
. , , , . , ,
, 24.2 24.3.
24.2. Branch
method void p r i n t ( ) {
printf("Branch number: % s \ n " , branchNo);
printf("Street: %s\n", street);
p r i n t f { " C i t y : %s\n", city);
p r i n t f ( " P o s t c o d e : %s\n", postcode);
24.
949
http://openlib.org.ua/
24.3. Staff
method void print( ) {
p r i n t f { " S t a f f number: %s\n", s t a f f N o ) ;
p r i n t f ( " F i r s t name: %s\n", fName);
printf ("Last name: %s\n", IName) ,p r i n t f ( " P o s i t i o n : %s\n", position);
printf ! "Sex: %c\n", sex) ,printf("Date of birth: %s\n", DOB);
printf("Salary: %f\n", salary);
,
, , . ,
.
(, printBranchDetails p r i n t s t a f f D e t a i l s ) ,
.
24.3.8.
(polymorphism " "). : , [46]. , ,
(operation polymorphism);
. , , (inclusion polymorphism).
(parametric polymorphism), (genericity),
, , .
template <type T>
(:, :) {
if(>)
return x;
else
return ;
}
max,
. .
.
:
int max(int, int)
real max(real, real)
// max
// max
VI.
http://openlib.org.ua/
, , (binding). ( ) ,
(dynamic), (]ate), .
, Staff Manager
SalesStaff, . 24.3. ,
print . , , (, )
.
CASE
IF:
FOR i=l TO n DO
S W I T C H ( l i s t [i] ,
type)
CASE s t a f f :
CASE manager:
CASE salesperson:
break;
}
p r i n t S t a f f D e t a i l s ( l i s t [ i ] . o b j e c t ) ; break;
printSanagerDetails(list [i] . o b j e c t ) ; break;
printSalesStaffDetails(list[i].object);
, CASE , .
,
print, print
CASE :
list [i] .print ()
, , , , - print - . , (.. ).
24.3.9.
, ,
. ,
" ",
A-Part-Of, ().
. -, . . -,
.
,
. (referential
sharing) [187]. , .
, . -
24.
951
http://openlib.org.ua/
, . , BLOB (. 24.2).
24.4.
( ) - , C++
Java, .
(.. ) ,
. , . , , , . 24.6,
Staff : Manager,
SalesPersonnel Secretary.
.
,
.
; ,
:
, ;
* ,
.
.
. 24.6. Staff
952
VI.
http://openlib.org.ua/
24.4.1.
,
. ,
, ,
, . .
. , . 24.6,
( ):
S t a f f (straffNo, fName, IName, position, sex, DOB, salary)
Manager (stafjNg, bonus, mgrStartDate)
SalesPersonnel (stajfNo, salesArea, carAllowance)
Secretary (sjtaffNo, typingSpeed)
, , . ,
.
, : , . , , ,
.
. , . 24.6,
:
Manager ( s t a f f N o , fName, IName, position, sex, DOB, salary, bonus,
mgrStartDate)
SalesPersonnel ( s t a f f N o , fName, IName, position, sex, DOB, salary,
salesArea, carAllowance)
Secretary ( s t a f f N o , fName, IName, position, sex, DOB, salary,
typingSpeed)
, ,
. ,
.
;
:
Staff ( s t a f f N o , fName, IName, position, sex, DOB, salary, bonus,
mgrStartDate, salesArea, carAllowance, typingSpeed, typeFlag)
24.
953
http://openlib.org.ua/
typePlag , ,
(, Manager 1,
SalesPersonnel 2, Secretary 3).
. ,
, , . ,
Manager NULL
salesArea, carAllowance typingSpeed.
24.4.2.
, , . ,
, (.. , ), :
Manager* pManager = new Manager;
// Manager
. . . ...
EXEC SQL INSERT INTO Staff VALUES( : pManager->staffNo, :pManager->fName,
:pManager->lName, :pManager->position, :pManager->sex, :pManager->DOB,
:pManager->salary) ,EXEC SQL INSERT INTO Manager VALUES (:pManager->bonus,
:pManager->mgrStartDate);
, Manager
( ),
-
() :
Manager* pManager = new Manager;
25.3 . (, , , bonus, 1000 ), :
Manager* pManager new Manager;
// Manager
EXEC SQL WHENEVER NOT FOUND GOTO done; //
EXEC SQL DECLARE managerCursor //
SELECT
CURSOR FOR
SELECT staffNo, fName, IName, salary, bonus
FROM Staff s, Kanager m // ,
// Staff Manager
WHERE s.staffNo = .staffNo AND bonus > 1000;
EXEC SQL OPEN managerCursor;
for ( ; ; ) {
//
//
INTO :staffNo, :fName, rlName, :salary, :bonus,pManager->staff No = : staff Mo,- // Manager
954
VI.
http://openlib.org.ua/
//
//
, :
os_Set<Manager*> khighBonus
11
= managerExtent->query! "Manager* , "bonus > 1 0 0 0 " , dbl) ;
Manager
(manage r Ex tent) ( dbl) (bonus > 1000). -
ObjectStore os_Set,
Manager, <Manager*>.
- ObjectStore 26.3.
, -
. , - , , .
, 30% ,
.
24.5.
1960- 1970-
. , IMS (Information
Management System) IBM.
, , Apollo.
, , , ,
. .
.
,
, ,
.
.
.
1970 . 24.
955
http://openlib.org.ua/
,
. ,
1970- 1980- . 100 , . .
* 24.2,
,
.
. 1976 "-", , 14 15 [55]. 1979
RM/T [70], RM/V2
[77].
" " . .
[153].
[274].
[297].
"" : - (Object-Oriented
Data Model OODM) - (Object-Relational
Data Model ORDM),
(Extended Relational Data Model ERDM). ,
, .
, . 24.7.
- ,
1970- . ,
, . ,
,
.
, ,
. ,
,
, .
, - , ,
, ,
, . , , SQL, - 25 26,
- 27.
956
VI.
http://openlib.org.ua/
,
'=
.-;,-.
:
'"-
ER-
- &1
-
;
. 4.7.
'
(Computer-Aided Design CAD), {Computer-Aided Manufacturing ), (Computer-Aided
Software Engineering CASE), (Office
Information System OSI) ,
(Geographic Information Systems GIS), Web-, .
, ,
, "
", , , . ,
,
.
,
, .
,
, .
24.
957
http://openlib.org.ua/
, ,
" ", ( ). .
.
-
( Object IDentifier), .
.
. , .
() (), . .
,
, . ,
, . ,
.
, , , ,
.
. , . ,
.
( ).
. ,
, .
. , , . .
"" : - . , ,
. .
24.1.
.
24.2.
?
958
VI.
http://openlib.org.ua/
24.3. - :
) , ;
) ;
) ;
) ;
) , , ;
) ;
) .
,
DreamHome, . 3.3-3.9.
24.4.
, -
?
24.5. .
24.6. , 24.1, , . ,
,
, .
, - , 24.3.
24.7. , . - , . ?
24.8. Branch, Staff
PropertyForRent DreamHome,
.
24.
959
http://openlib.org.ua/
http://openlib.org.ua/
...
.
.
- .
,
, , .
.
- .
.
.
- ,
, ,
, .
- .
-
.
- .
, , . ,
- ,
. -
.
, ,
,
, , . ,
http://openlib.org.ua/
,
.
.
-
, - (). - .
( 3% 1997 ), , World Wide Web. ,
50% , .
26 , ODMG
(Object Data Management Group),
.
ObjectStore.
. , 27
-
,
.
- , .
25.1 -
, , ,
,
. , . 25.2
, . 25.3 . 25.4 , : ,
, ,
, 25.5 " - ", , .
25,6 ,
25.7
, 14 15, - .
, 24.
DreamHome,
10.4 .
962
VI.
http://openlib.org.ua/
25.1. -
, - . , [188] -
(), - () ().
. () , ,
~ .
. , () .,
.
. () .
,
- , .
. ,
[330] ,
.
1. .
2. .
3. .
4. .
, , ,
, . [186]
- .
1. "- " = " " +
"" + " ".
2. "- " = "- "
+ " ".
, [247].
1. , .
2. , .
3. , ,
.
4. "- " = "- "
+ " 1-3".
25. -
963
http://openlib.org.ua/
, GemStone
Gemstone Systems Inc. ( Servio Logic Corporation),
Itasca IBEX Knowledge Systems SA ( - Itasca
Systems Inc.). Objectivity/DB Objectivity Inc., ObjectStore
eXcelon Corporation ( Objectivity Inc.) Ontos
Ontoa Inc., Poet Poet Software Corporation, Jasmine
Computer Associates/Fujitsu Limited Versant Versant Corporation,
, -
, . 25.1.
26.2 , ODMG, -. ODMG
,
.
25.1.1.
,
,
, .
. , ( ), .
, .
',
":
'
.
;
^
. 25.1. -
964
VI.
http://openlib.org.ua/
[49].
.__
-:
- - ^
<
,> :
:-,
. , , , - ;[
.
, , ,
, , [16]. 21, ISO SQL , SQL ,
, Fortran, Pascal, COBOL, Ada, MUMPS PL/1. , SQL .
. API, . SQL , , SQL2 1
. ,
, (impedance mismatch)
(. 24.2). ,
30%
, [10]. .
, [221].
.
, .
.
. ,
. , PS-algol
NapierSS, . ,
, ,
, . ,
.
.
1
(SQL3) ,
SQL .
25. -
965
http://openlib.org.ua/
, , .
,
, 25.2.
(,
, ) , . ,
,
, , 25.2-25.4,
. (Persistent
Application System PAS) [13].
25.1.2.
, [186].
.
, Smalltalk, C++
Java (. . 25.1). GemStone,
.
- .
- .
, , , , , ,
.. Ontos, Versant
ObjectStore. ObjectStore 26.3.
-
. 21
SQL . . 2,
.
.
SQL -
- .
- . -
SQL (SQL3). ( SQL3 27.4.) , Object Database
966
VI.
http://openlib.org.ua/
Standard ODMG Object SQL, 26.2.4. Ontos Versant Object SQL, - ODMG.
. , , ,
, .
SIM (Semantic Information Manager),
[180].
25.2.
. ,
.
. , , .
. ,
, , .
. (
)
, , .
. ,
.
. .
. , , .
.
,
.
,
,
, .
, ,
, , , .
, 24.1. 1980
, . 25. - 967
http://openlib.org.ua/
,
.
.
, . .
, ().
(,
), . , , . , , 30%
. , .
, .
. , - Java
. , ,
, .
, .
,
(. 25.2). , (. 25.3).
,
.
24.3, (OID Object IDentifier), OID OID,
, OID,
.
. . OID , , . ,
OID
. (pointer
swizzling), (object faulting). :
[223]. .
968
VI.
http://openlib.org.ua/
. 25.2. ()
. 25,3.
25.2.1.
;
. .
. ,
(OID).
-
, , OID
. 25. -
969
http://openlib.org.ua/
, , . .
,
OID .
OID .
,
, .
, , .
,
, OID , , [324]. OID. ,
,
, .
, ,
. ,
,
.
, [223].
,
,
,
( Objectivity/DB), .
OID ,
.
(edge marking) (node marking) [158].
,
( ) ( ),
. (..
1), ,
OID ,
.
,
.
, , .
970
VI.
http://openlib.org.ua/
( ) [203].
,
( ) . , ,
, .
, ObjectStore Texas [280].
,
, , , ,
.
,
( ,
,
). , , ,
. , , .
,
.
, ,
- [324].
, OID , ,
. ,
.
[223] (eager swizzling), OID
. ,
[184], 25. -
971
http://openlib.org.ua/
, .
, (lazy swizzling)
.
,
,
.
, , . . ,
. ,
, ,
25.2.2.
, . ,
, ,
, . 25.4 .
,
,
, (. 20.4). .
. SQL .
.
SQL ,
.
,
, .
,
, . 25.5.
,
, OID , . ,
, .
:
() ;
972
VI.
http://openlib.org.ua/
4.
2.
. 25.4.
,
, ;
, .
.
,
, .
25.3.
(persistent)
,
, . (transient) ,
. ,
, .
, ,
. [11].
25. - 973
http://openlib.org.ua/
3.
2.
..
4.
..
5.
1.
. 25.5.
,
, () . .
, -
. . , ,
. .
25.3.1.
: (checkpointing),
(serialization) (explicit paging).
. , , . ( ) .
. -,
, , , . -,
,
.
974
VI.
http://openlib.org.ua/
, .
, ,
.
.
, (pickling) ( ) (marshaling).
. -, , ,
, ,
. -, , , .
,
. ,
.
/ : .
(reachabilitybased) , ,
. , ,
, . (reachability tree). , , ,
( , , Smalltalk Java).
(allocation-based) ,
. .
. ,
.
. Ontos Objectivity/DB.
.
() , ,
(). ObjectStore. .
25. -
975
http://openlib.org.ua/
, . .
, .
.
.
25.3.2.
(orthogonal
persistence) [10], [63].
.
.
, , , , , .
, , ,
. , ( ) .
. , .
,
. Pascal/R, Amber, Avalon/C++ . , PS-algol, Napier88, Galileo GemStone [81].
. ,
. (persistence identification), ODMG ,
, , .
.
976
VI.
http://openlib.org.ua/
.
,
.
.
.
,
.
.
.
.
, , ,
, , , . ,
, , , .
,
. , . : .
,
, .. , .
, . , . ?
,
, , ,
?
,
.
, .
,
ACID (Atomicity,
Consistency, Isolation, Durability , , , ) (.
19.1.1). ,
, .
,
.
: 25. - 977
http://openlib.org.ua/
? , , , , ?
, - , ,
.
, -
, ? ,
, . ,
-
, .
25.4.
24.2 , , :
;
;
.
. .
25.4.1.
19.1, ,
. , , , . ,
, , , , , .
,
.
. , .
, , , - , .
.
(. 19.2.6).
, , ,
(. 19.4).
978
VI.
http://openlib.org.ua/
25.4.2.
,
. ,
,
. , ,
, [14], [18], [183].
. ,
. ,
. . 25.6
: 0, . , V 1( V 2 V 3 , V1A
V;:, V 2 A V J B V 2 .
, : V 2 B
0; V 2 A V 1B .
Ontos, Versant, ObjectStore, Objectivity/DB Itasca. Itasca
[190].
.
.
,
.
. .
.
. , .
.
. . ,
.
-
. 25.6.
25. -
979
http://openlib.org.ua/
. 25.7.
Itasca ,
. (generic object), , .
25.4.3.
,
.
.
, , . . ,
, , . , [19].
1. :
2. ;
3. .
4. :
5. S ;
6. s ;
7. .
8. , , .
. Itasca GemStone
, ,
. ,
. 25.8.
. , Staff name DOB,
getAge .
.
|
|1|
-fjli
. 25.7. , Itasca
980
VI.
http://openlib.org.ua/
Person
name
fName
I Name
DOB
getAge
staff No (PK)
position
sex
salary
ownerNo {PK)
address
clientNo {PK]
telNo
prefType
maxRent
getMonthlySalary
SalesStaffClient
commission
telNo
addCommission
getMonthlySalary
staffNo {PK}
clientNo (AK)
position
sex
salary
telNo
prefType
maxHent
name
fName
IName
DOB
commission
getMonthlySalary
getMonthlySalarv
addCommission
. 25. ,
25. -
981
http://openlib.org.ua/
1. , ,
1.1 .
/ , / , .
1.2 ,
/
, , / . ,
SalesStaffClient . 25.8,
SalesStaff Client.
telNo, (
Person).
telNo SalesStaf fClient
, SalesStaff.
1.3 .
/
, /
. , . ,
.
,
VI.
http://openlib.org.ua/
2.3 .
.
, .
3. .
3.1 .
cs,
C s . ,
. 1.1-1.3.
3.2 .
CR
, . , cs. , Staff, Manager SalesSCaff
, Person.
3.3 .
, OBJECT ( ).
3.4 .
3.2 .
OBJECT .
4. .
, .
, .
,
[19] [189].
25.4.4.
/
.
/
"/"
,
(. 2.6). "/".
,
, . 25.9 [209].
25. -
983
http://openlib.org.ua/
. 25.9. "/", : )
; ) ; )
. .
, , , , .
. .
.
.
.
. . , .
.
,
,
. , ,
. , .
: (. 25.10, )
(. 25.10, ).
(API) ,
, - . .
.
984
VI.
http://openlib.org.ua/
(
)
<
- -
i.
; - -
;.; "
|<|;
. 25.10. : ) ;
)
. , ,
, .
.
.
. ,
, .
.
, .
.
. , .
. ,
.
GemStone Itasca ,
.
25.4.5.
. , .
,
25. -
985
http://openlib.org.ua/
- ,
,
[138].
, , [33]. ,
, :
, ;
,
, ;
;
.
: Onektup 1000
, Tenktupl/Tenktup2, 10000 .
,
,
.
, 1988 (Transaction
Processing Council ), ,
. ANSI , .
- -
- - . - (OnLine Transaction Processing OLTP); , ,
. -
. :
Account (
Account 100000 );
Teller (
Teller 10 ):
Branch
( Branch 1 );
History,
( History 2592000 );
.
986
VI.
http://openlib.org.ua/
, .
(, ).
-
- -
-, .
-,
. - , , ,
, .
Transaction Processing Council , .
-. ,
, .
TPC-R.
, ; .
TPC-W. , Web,
,
Internet,
Web-,
.
Transaction Processing Council
Web- (www. tpc. org).
1
1 (Object Operations Version 1 ,
1) - [48]. , ,
24.1. , ,
, , , , .., 2. :
2
, (parts explosion).
25. -
987
http://openlib.org.ua/
1000 ( );
100 300 , ;
3280 .
1989 1990 01 GemStone, Ontos, ObjectStore, Object!vity/DB Versant, a
INGRES Sybase. ,
-
30 . ,
, ,
(
, ). , , , .
7
1993
7, . 07
- [47].
,
, ,
. ,
, ,
.
07 , ,
(, ) .
. :
(
, , 1);
( ,
, , , , ,
, );
,
.
, , , , , ,
988
VI.
http://openlib.org.ua/
25.5. "
-
"
" -
" [12] ,
. :
- . .
1.
. SET, TUPLE LIST ( ARRAY).
, . , . , , , ..
!, . ,
SET (TUPLE ( ) ) , LIST (TUPLE () ), TUPLE (SET )
TUPLE (LIST ( ) ) .
2.
,
.
3.
,
, . , ,
. ( 24.3.1 , . , ,
?
,
, . , get,
.
.)
25. - 989
http://openlib.org.ua/
4.
34.3..5 . ,
. -
. ,
, ..
.
, .
5.
.
6.
(). , ().
( ).
7. DML
, (DML)
. , SQL (SQL2) (. 5.1). SQL (SQL3) ( 27.4).
8.
. Tqro, .
.
9.
, (.. ) , .
.
10.
, .
, , .
11.
, ,
.
990
VI.
http://openlib.org.ua/
12.
, ,
.
13.
(..
), (.. )
. , .
: , , , , . ,
, ,
,
25.6.
, .
, .
25.6.1 .
. 25.1.
25.1.
- . , ,
. ,
, " ",
, .
25. -
991
http://openlib.org.ua/
. ,
- .
,
. .
, , - . ,
. , ,
, , , , .. [93].
,
. 27.2.2.
(DML) .
,
, SQL, , .
, DML,
( SQL,
).
, , .
SQL ( , ). , ..
, , , , , .
ODMG ,
- SQL ( 26.2.4).
-
. ,
.
(. 19.2.2)
992
VI.
http://openlib.org.ua/
.
, , . 24.2, , ( ), .
24.1, ,
, (CAD), (CASE), (OIS)
. .
25.4.5, , - . , 1989 1990 1 - GemStone,
Ontos, ObjectStore, Objectivity/DB Versant, INGRES
Sybase. , -
30 .
,
, .
. ,
, -
. , , , ,
(OLTP).
25.6.2. -
, , . 25.2.
25.2. -
25. -
993
http://openlib.org.ua/
25.1, -
, . .
ODMG ,
. ODMG
26.2.
, ,
. ,
, . - , . , .
.
,
.
. , . , - . ODMG
OQL (Object Query
Language), , ,
( 26.2.4).
, .
, ,
- ,
. ( ),
SQL ,
ODBC .
,
, , .
.
. 25.5 , , ,
.
994
VI.
http://openlib.org.ua/
.
,
. , , 19.2.8.
, , , , ,
,
. , .
, , , , , , (. 6.4).
. ,
.
.
25.7.
, 14 15, - . (.. EER- "-")
- . 25.7.2 ,
, . .
25.7.1. -
,
14 15, EER-,
- (Object-Oriented Data Modeling OODM). . 25.3
OODM
25. -
995
http://openlib.org.ua/
14 15 .
, . " ",
( 2.1). - , - . ,
-
. , , . , . -
.
" ".
- ,
, . 25.7,3.
25.7.2.
-
( 24.3.2), OID. 14 15
996
VI.
http://openlib.org.ua/
, (, ),
. : " " (1:1), " " (1:*)
" " (*:*).
Manager; OID6
staff No: SQ5.
f Name;: Susan
(Name: Brand
position :Managftr
sex:
F
DOB:
3-Jgn-4&
salary:; 24000
branch; O1D1
3.3.3
" " " ".
, , . , , 1:1 Manager
Branch (. . 25.11). Branch ( OID1)
Manager ( OID6). Manager
25. -
997
http://openlib.org.ua/
PropertyForRent: 0)
propertyNo: f
street:
:
type: - Flat
rooms:
rent: '
350
staff:
branch: '
branchNo
street:
city:
postcode: GH9QX
staff: i
property:
manager:
propertyNo: PG1I
street:
type:
rooms:
rent:
staff:
branch:
staffNo:
fName:.
(Name:
position
sex:
salary:!
branch;
property; {OID2nOlp
. 25.12. " " (1:*) Branch,
SalesSCaff
PropertyForRent
Branch, .
.
.
. , , .
GemStone.
, . NULL ( ) .
Versant.
,
.
. . , . 25.11
Branch Manager
Manager Branch. Manager
998
VI,
http://openlib.org.ua/
clientNo: CR56
fName: Aline
IName; St
telNo:
0141V&48
pref Type: Flat
maxRent; 350
Viewing
property: OID7
viewDate:28-Apr-Oi
comment: ,
property: OID2
viewDate: 26-May-O t
comment:
PropertyForRa
propertyNo: PG3J3
city:
type:
rooms:
rent: "
staff: I
branch:...
viewers:'
Client: 01
cllentNa: CR74
fName: Mike
IName: Ritctije
telNo:
01475-392178
prefType: House
maxRent: 750
Viewing
property: QIO2,
viewDate: 20-Apr-G1.'
comment:toQ remote
PropertyFbrBent:
propertyNo:
city:
type:
rooms:
rent:
staff:
branch:
viewers;
6 Lawence'St
Rat
3
350
OID4
OID1'
{OID9, OfDJjtf
Branch.
Ontos, Objectivity/DB ObjectStore
( 26.2).
25.7.3.
-
EER- . . , . (Data Flow Diagram DFD)
, , . - ,
, , . , .. (public methods),
25. -
999
http://openlib.org.ua/
Viewing:
Client: OID9
clientNo: CR
fName: Aline
IName: Stews
telNo:
0141
prefType: flat
maxRent: 350
viewlngs: {O|D
client:
OID9
property; OID7*
viewDate: 2S-Api*-jD|
comment.
PropertyForflent! 17;
propertyNo:
street:
type:
rooms:
rent:
staff:
branch:
viewers:
F'G36;
,'Man
Flat
OID1
Viewing: 01D2
client:
O1D3
property: OID2
viewDate: 26
comment: 1
PropertyForRent: OID2
CllenfcC
clientNo: CR74
fName:
Mike
IName:
Ritchte
telNo:
01475-3921
prefType: House
maxRent: 750
viewings: (OJ.
'- '
Viewing: Ot
client:
01D1
property: O1D2
viewDate:
comment: too remc|
propertyNo; PG4
street:
6(awrenceSt
type:
Fkt
rooms:
3
rent:
350 .
staff:
OID4.
branch:
OlDt ,?
viewers:
{0022,0)023}
, .. (private methods).
:
;
;
.
- .
OID. -
. : , . .
. , . ,
salesStaff getsalary, , Person getContactDetails, .
, , , SalesStaff
getAverageSalary,
. , -
1000
VI.
http://openlib.org.ua/
. , Person
getAge, .
. SQL3, - (observer), (get) ( 27.4).
() . , SaleeStaf f incrementSalary,
.
.
SQL3,
-
(miitator), (put) ( 27.4).
,
.
,
.
, .
, DreamHome ,
. ,
, , ( ).
, .
EER-,
, , .
. -
,
[34], [62], [135], [178], [266].
.
,
. , - .
.
, ( )
25. - 1001
http://openlib.org.ua/
, . , , .
.
: -
; ; ;
- ; .
, . , , . :
. , ,
,
, .
OID:
OID, ,
OID, . , . ,
.
OID
, . , ,
.
, , .
: ,
.
,
, , ,
,
, .
,
1002
VI.
http://openlib.org.ua/
, ,
, , , .
25.1.
25.2.
25.3.
25.4.
25.5.
25.6.
25.7.
25.8.
25.9.
25.10.
25.11.
25.12.
-
.
?
,
, ,
?
?
,
.
?
.
, , ?
?
?
.
.
.
25.13. , DreamHome -
. -
,
, . , DreamHome.
25.14. ,
Hotel,
3. - .
25.15. -
DreamHome, .
, .
25.16. -
University Accommodation Office, . , .
25. - 1003
http://openlib.org.ua/
;
) ;
) ;
) S ;
) S ;
) ;
) ;
) .
1004
VI.
http://openlib.org.ua/
!?
...
http://openlib.org.ua/
ODMG ,
OMG (Object Management Group ), 26.1
OMG OMG. 26.2 ODMG ODMG. , 26.3
- , ObjectStore.
, 24 25.
Dreamffome, 10.4 .
26.1. OMG
ODMG
OMG, OMG .
26.1.1. OMG
OMG , 1989 , . 800 -, , , Sun
Microsystems, Compaq, Microsoft, AT&T/NCR, HP, Hitachi, Computer Associates,
Informix Oracle.
, .
OMG -
, ,
, , .
OMG ,
(International Organization
for Standardization ISO) , (American National Standards
Institute ANSI)
(Institute of Electrical and Electronics Engineers IEEE). OMG
,
ISO ANSI. OMG
, OMG.
OMG ,
- ,
.
. ,
.
.
.
1006
VI.
http://openlib.org.ua/
.
,
.
. .
. .
1990 OMG
" " (Object
Management Architecture Guide), [284]-[28].
- , , ; - ;
, - .
:
(Object Model ), (Object Request
Broker ORB), (Object Services) (Common
Facilities), . 26.1.
()
,
, OMG (. 26.2).
( ) (ORB-), . ORB-
; 1
. 26.1.
26. -
1 007
http://openlib.org.ua/
. 26.2. OMG
,
ORB- . ,
OMG ODMG.
(ORB)
ORB- . ORB- (
), () . ORB- , . ORB- ,
.500, , . , ORB
(RFC
Remote Procedure Call), ,
.
, .
- .
(. 26.1).
,
,
. OMG , . :
. , , , , ,
.
1008
VI.
http://openlib.org.ua/
26.1. OMG
.
, , , ,
.
(,
, , ),
, ,
()
()
, ,
, ,
,
,
,
26. -
1009
http://openlib.org.ua/
26.1.2. CORBA
CORBA , ORB-. , OMG,
ORB- . CORBA
CORBA, , , , . GIOP (General
Inter-Object Protocol )
(Internet Inter-Object Protocol ).
GIOP, TCP/IP.
CORBA 1.1 1991 .
IDL (Interface Definition Language)
(API Application Programming
Interface),
ORB-. 1994
CORBA 2.0,
,
ORB-, . 1997 CORBA 2.1,
1998 CORBA 2.2, 1999 CORBA 2.3
[233]. CORBA.
IDL (Interface Definition Language ),
.
, , .
(Interface Repository), IDL.
, ,
, .
.
OID .
. 26.3, CORBA
, :
, ;
.
IDL, CORBA
,
, C++, Smalltalk Java. IDL :
, , ;
1010
VI.
http://openlib.org.ua/
, ,
, IDL;
, , ,
.
,
IDL ,
. , , ,
, .
(Dynamic Invocation Interface
DII),
, , .
.
DII DSI (Dynamic
Skeleton Interface ), ORB- ,
.
DSI
,
IDL. ,
.
, () , ORB-. , ,
26. -
1011
http://openlib.org.ua/
OMG
OMG OMG, CORBA.
: UML (Unified Modeling Language
), MOF (Meta-Object Facility ) XMI (XML Metadata
Interchange XML).
UML IV
ER-.
26.2.1. ODMG
-
Object Database Management Group (ODMG) , . 1012
VI.
http://openlib.org.ua/
ODMG ,
- , , (Object-to-Database Mapping ODM),
.
(Object Data Management System
ODMS). ODMS (-) ,
ODMS () , , , , [50].
26. -
1013
http://openlib.org.ua/
26.2.2. ()
ODMG OMG;
. (
) .
,
.
.
.
. .
, . / .
, .
, . ,
.
ODMS
. , ODL (Object Definition
Language ), ,
.
: , , . .
,
, 26.1,
, .
. (<>) . , , , . , , 26.1, ISO SQL (. 6.1).
26.1. ODMG
Literal_type
Atotnic_literal
long
long long
short
unsigned long
unsigned short
1014
VI.
http://openlib.org.ua/
float
double
boolean
octet
char
string
enum< >
Collectcon_literal
seto
bago
listo
array< >
dictionaryo
Structured_literal
date
time
timestamp
interval
structureo
Object_type
Atonuc_object
Collection__object
Seto
Bago
Listo
Arrayo
Dictionaryo
Structured_object
Date
Time
Timestamp
Interval
//
interface ObjectFactory {
Obj act
new();
I
interface Object {
enum
Lock_Type{read, write, upgrade};
void
lock(in LockjType mode} raises(LockNotGranted); //
// ;
boolean try_lock(in Lock_Type mode); // ;
26. -
1015
http://openlib.org.ua/
// ,
//
boolean same_as(in Object anObject); //
Object copy();
// ;
//
void
deleted;
//
ODMS , , . ,
, , ,
.
"" , . , Database ( ), .
, ,
,
; , ()
(. 25.3.2).
.
.
. , ,
, , (
)
.
.
( ) .
ODMS.
. ,
. ,
;
. , , .
. <, >, . , Address:
struct Address {
string street;
string city;
string postcode;
attribute Address branchAddress;
16
VI.
http://openlib.org.ua/
struct ( record) . ,
.
.
ODMG , , .
, . ,
. , . . ( );
. , 26.3 26.4.
26.3. ODL
interface Iterator {
exception
NoMoreElements{};
exception
InvalidCollectionType{};
boolean
is_stable ();
boolean
at_end() ,void
reset () ;
Object
get_element{) raises(NoMoreElements);
void
next_position() raises(NoMoreElements);
void
replace__element {in Object element)
raises(InvalidCollectionType);
}f
interface BidirectionalIterator : Iterator {
boolean
at_beginning();
void
previous position(} raises(NoMoreElements);
26.4. 1_
interface Collection: Object {
exception
InvalidCollectionj};
exception
ElementNotFound{Object
element;};
//
unsigned long cardinality();
// ,
boolean
is_empty{);
// ,
boolean
is_ordered();
// ,
boolean
allows_duplicates();
//
26. -
1017
http://openlib.org.ua/
boolean
//
void
insert_element{in Object element);
//
void
stable)
Object
Iterator
boolean
raises(InvalidCollectionType);
select_element(in string OQL-predicate);
select{in string OQL-predicate);
queryfin string OQL-predicate, inout Collection
boolean
result);
exists__element (in string OQL-predicate);
, ,
,
. , , . .
(set). ,
.
(bag). , .
(list). , .
(array). .
(dictionary).
"-", -.
. set bag :
, .
set dictionary 26.5.
26.5. ODL set dictionary
interface SetFactory ObjectFactory {
Set
new of size(in long size), // Set
};
1018
VI.
http://openlib.org.ua/
// ,
boolean
is_subset__of {in Set other_set) ;
// ,
//
boolean
is_proper_subset_of{in Set other_set);
// ,
boolean is_superset_of {m Set other_set) ;
// ,
//
boolean
, . , DreamHome
Branch S t a f f . ' , .
, ; . , . ,
/. , ,
, ,
, . , .
.
, ,
,
. , Branch , , .
.
1:1, 1:* *:*. ,
26. -
1019
http://openlib.org.ua/
, .
. , Branch ( ) Staff ( )
Has (), " ",
Staff Branch worJcsAt
(), " ".
:
class Branch {
relationship set <Staff> Has inverse S t a f f : : W o r k s A t ;
class Staff {
relationship Branch WorksAt inverse Branch::Has;
};
"" (
set bag) ( list).
, , ODMS.
, -, (.. ). (form) (drop) , . , Staff WorksAt Branch 1:1 Staff
Branch:
attribute Branch WorksAt;
void form__WorksAt{in Branch aBranch) raises{IntegrityError);
void drop_WorksAt(in Branch aBranch} raises(IntegrityError);
Branch Has Staff 1:* Branch
,
Staff:
readonly attribute set <Staff> Has;
void form_Has(in Staff aStaff) raises(IntegrityError);
void drop_Has(in Staff aStaff} raises(IntegrityError);
void add_Has(in Staff aStaff) raises(IntegrityError);
void remove_Has(in Staff aStaff) raises(IntegrityError);
, .
(operation signature) , , , , , ( ).
.
. , , ,
.
1020
VI.
http://openlib.org.ua/
, ,
ODMG : . , .
, .
;
(:). ( ),
. , , ,
( , C++).
, .
, ( , , ).
extends ().
, ,
. .
.
.
(extent).
ODMS. ,
ODMS ,
.
, .
(key).
( ,
3.2.5). , . , : , ,
.
ODMG . , , , ,
.
, /;
Exception, ODMS.
2.7, "
", .. , , ,
. 26. -
1021
http://openlib.org.ua/
,
, . ODMG
.
, .
, , , , ,
. , , , .
, .
,
.
ODMG , ,
(. 19.1).
. / . , ,
. ,
,
, 26.6.
- .
, , (. 23.5).
26.6. ODL
interface TransactionFactory {
Transaction
new();
Transaction
current()/
};
interface Transaction (
void
begin () raises (TransactionlnProgress, DatabaseClosed) ,void
commit() raises(TransactionNotlnProgress);
void
abort() raises{TransactionNotlnProgress);
void
checkpoint{) raises(TransactionNotlnProgress};
void
join() raises(TransactionNotlnProgress);
void
leave() raises(TransactionNotlnProgress);
boolean
isOpenO ;
1022
VI.
http://openlib.org.ua/
ODMG . ,
. Database () close ,
lookup ( ) , . ,
bind ( ) , unbind ( ) ,
26.7.
26.7. ODL
interface Dat'abaseFactory {
Database n e w ( ) ;
};
interface Database {
exception DatabaseOpen{};
exception DatabaseNotFound{};
exception ObjectNameNotUnique{};
exception QbjectNameNotFound{};
void
open(in string odms_name) raises(DatabaseNotFound,
DatabaseOpen);
void
close{) raises(DaCabaseClosed,
TransactionlnProgress) ,void
bind(in Object an_object, in string name)
raises(DatabaseClosed, ObjectNameNotUnique,
TransactionNotlnProgress);
void
unbind(in string name) raises(DatabaseClosed,
ObjectNameNotFound, TransactionNotlnProgress);
void
lookup(in string object_name) raises(DatabaseClosed,
ObjectNameNotFound, TransactionNotlnProgress};
ODLMetaObjects::Module schema() raises(DatabaseClosed,
TransactionNotlnProgress} ,-
. , :
;
, .
26.2.3. ODL
(Object Definition Language ODL)
, ODMG.
DDL (Data Definition Language )
. 26. -
1023
http://openlib.org.ua/
ODMS . ODL , .
. ODL
IDL CORBA.
ODMG , ODL
, . ODL . 26.1, [50].
26.1. ODL
DreamHome, . 26.4.
ODL 26.8.
{Mandatory, Or}
Staff
PrivateOwner
Client
staffNo {PK}
position
sex
DOB
salary
ownerNo {PK}
address
clientNo {PK}
telNo
maxRent
0..*
^ (Optional, Or
Owns A
IsOwnedBy
Manage
SalesStaff
1. 1
1..*
WorksAt A
Has
Manages A
magedBy
1..I
1..1
Branch
branchNo {PK}
street
city
postcode
1 .
A Views
IsViewedBy
PropertyForRent
propertyNo {PK)
street
city
postcode
type
rooms
rent
1..1 * IsOfferedBy
Offers >
1./
. 26.4.
DreamHome
1024
VI.
http://openlib.org.ua/
26.8. ODL
Dream Home
module DreamHome
class Branch
{
// Branch
(extent branchOffices key branchNo)
/* */
attribute string branchNo;
attribute struct BranchAddress {string street, string city,
string postcode} address;
/* */
relationship Manager ManagedBy inverse Manager::Manages;
relationship set<SalesStaff> inverse SalesStaff:tWorksAt;
relationship set<PropertyForRent> Offers inverse
PropertyForRent::IsOfferedBy,/* */
void takeOnPropertyForRent(in string propertyNo)
raises(propertyAlreadyForRent);
i;
class Person {
// Person
/* */
attribute struct PName {string fName, string IName) name;
class Staff extends Person // Staff,
// Person
(extent staff key staffNo)
(
/* */
attribute string staffNo;
attribute enum SexType {M, F} sex,attribute enum PositionType {Manager, Supervisor, Assistant} position,attribute date DOB;
attribute float salary,
short getAgef); /* */
void increaseSalary(in float increment);
};
};
26. -
1025
http://openlib.org.ua/
26.2.4. OQL
(Object Query Language OQL)
, , SQL.
, , . SQL, OQL
, , , ,
ODMG .
Smalltalk, C++ Java. OQL , .
OQL , . () .
.
, ,
ODMS, .
,
.
.
OQL , ,
. , . ,
SELECT SQL, 5..
DEFINE Q AS e. ( , ),
Q , .
:
, 10, 16.2, ' 1 , "abcde", true, nil,
date'2000-12-01';'
, , Branch (branchOf f ices),
26.8, ,
;
WHERE, :
FROM
SELECT-FROM-
as , , in e,
collection ( ) , ;
( Q).
1026
VI.
http://openlib.org.ua/
. . ., : . . . , ,
T ( P i : e i / -Pn'Sn) . ,
Manager :
Manager{staffNo: "SL21" J fName: "John", IName: " W h i t e " ,
address: "19 Taylor St, London", position: "Manager",
sex: " M " , DOB: d a t e ' 1 9 4 5 - 1 0 - 0 1 ' , salary: 3 0 0 0 0 )
, .
- . , S ,
:
, - , not, abs, +, -, =, >, andthen, and, orelse, or;
(| j +);
Si ( 1 ), (1+1)- ;
S [low. up], S low+1
up+l;
in S ( ), true, S ;
S like pattern, pattern ' ? '
' _ ' , , ' * '
' % ' , , .
true, S .
26. -
1027
http://openlib.org.ua/
(FOR ALL), (EXISTS), (IN), (SELECT FROM WHERE),
(SORT), (MIN,
MAX, COUNT, SUM, AVG) (GROUP), ,
FOR ALL x IN managers: x . s a l a r y > 12000
true managers
salary 12 000 .
EXISTS x IN managers.manage : x.address.city = "London";
true, , , ( managers.manages Branch, , city
London).
SELECT SELECT
SQL (. 5.3.1):
SELECT [DISTINCT]
<expression>
FROM <fromList>
[WHERE <expression>]
[GROUP BY <attributel:expressionl,
[HAVING <predicate>]
[ORDER BY <expression>]
attribute2iexpressions,...>]
<fromList>
:
<fromList> : : = <variableName> IN <expression> \
<variableName> IN < expression:, <fromList> |
<expression> AS <variaJbIeName>
<expression> AS <varia.bIeName>, <romList>
Set,
SELECT DISTINCT, List, ORDER BY, Bag. ORDER BY,
GROUP BY HAVING , SQL (.
5.3.2 5.3.4). OQL
GROUP BY
(
OQL ), 26.6.
: , 2 , 3 , 4 , : [3],
1 [ 3 : 4 ], f i r s t (B!), l a s t f e ^ (^ + 2 ) . ,
first(element(SELECT b FROM b IN branchOffices
WHERE b.branchNo = "B001").Has);
001, .
1028
VI.
http://openlib.org.ua/
elt e2 ,
! 2 , , , .
, element {) ,
, , .
, listtoset () , .
, ,
f l a t t e n ( e ) -- ,
, , .
, , {) , ,
, .
(, )
, .
.
26.2.
. ( ).
, ( , ),
Staff. :
staff
. ( ).
branchOffices.ManagedBy
SELECT b.feranchNo
FROM b IN branchOffices
WHERE b.address.city = "London";
branchOffices
, b
( , 26. -
1029
http://openlib.org.ua/
).
bag<string>,
brcinchNo, .
. , , londonBranches,
( ,
). , ,
.
londonBranches.WorksAt
set<SalesStaf f >. , :
londonBranches.WorksAt.salary
OQL ,
: set<float> bag<float> ( bag , ). :
SELECT [DISTINCT] s.salary
FROM s IN londonBranches.WorksAt;
:
DEFINE Londoners AS
SELECT s
FROM s IN s a l e s S t a f f
WHERE s . W o r k s A t . a d d r e s s . c i t y = "London";
SELECT s.name.lName FROM s IN Londoners;
VI.
http://openlib.org.ua/
FROM s IN s t a f f S t a f f
WHERE s . W o r k s A t . a d d r e s s . c i t y = cityname;
,
, :
CityWorker("London");
CityWorker ("Glasgow") ,-
26.4.
A. ( ),
, , .
:
SELECT struct (IName: s.name.IName, sex: s.sex, age: s.getAge)
FROM s IN saleStaff
WHERE s . W o r k s A t . a d d r e s s . c i t y = "London";
set<struct>. ,
SELECT get Age.
. ( ),
, 60 .
:
class Deputy {attribute string IName; attribute sexType sex,attribute integer age;};
typedef bag<Deputy> Deputies;
Deputies (SELECT Deputy (IName: s.name.Iname, sex: s.sex,
age: s.getAge)
FROM s IN s t a f f S t a f f WHERE position - "Deputy" AND s.getAge > 6 0 ) ;
Deputies.
B. ( ),
, .
,
set<struct>.
SELECT struct (branchNo: x.branchNo, assistants:
IN x.WorksAt WHERE y.position = "Assistant"))
FROM X IN (SELECT b FROM b IN branchOffices
WHERE b.address.city = "London");
(SELECT FROM
26.5.
, .
COUNT
CityWorker :
COUNTts IN C i t y W o r k e r ( " G l a s g o w " ) ;
26. -
1031
http://openlib.org.ua/
OQL
. ,
OQL :
SELECT COUNT(s) FROM s IN salesStaff WHERE s.WorksAt.branchNo = "BOOS";
COUNT{SELECT s FROM s IN salesStaff WHERE s.WorksAt.branchNo = " B 0 0 3 " ) ;
, OQL
, SQL,
. ,
OQL ( SQL):
SELECT s
FROM s IN salesStaff
WHERE COUNT(s.WorksAt) > 10;
set<struct(branchNumber:
string,
partition:
bag<struct(s:
SalesStaff) >) >; ()
: branchNumber
.
SELECT (branchNumber)
( ).
,
partition. :
setotruct(branchNumber: string, numberOfStaff: integer)>
SQL, HAVING. ,
, ,
:
SELECT branchNurnber, averageSalary: AVG(SELECT p . s . s a l a r y FROM p
IN partition)
FROM s IN salesStaff
GROUP BY branchNumber: s.WorksAt.branchNo
HAVING COUNT(partition) > 10;
, SELECT AVG.
(
bag<struct (s : SalesStaf f ) >). p. s. salary
, .
1032
VI.
http://openlib.org.ua/
26.2.5. ODMG
ODMG 3.0:
OIF (Object Interchange Format );
ODMG .
OIF , ODMS . OIF ODMS, , [50].
ODMS, ODMG ODL. NCITS (National Committee for
Information Technology Standards 1
2
) PDES /STEP , .
OIF , ( ) (
). .
John {SalesStaff} SalesStaff,
John.
John (Mary) {SalesStaff} SalesStaff,
John .
" " .
John SalesStaff {WorksAt BOOl} WorksAt
John SalesStaff BOOl.
OIF
[50].
ODMG
ODMG ODL/OML . ODMG C++, Java Smalltalk.
, , ,
, . C++.
C++,
, ODL. ,
' Product Data Exchange using STEP
STEP.
2
STandard f o r the Exchange of Product model data .
26, -
1033
http://openlib.org.ua/
OML (Object Manipulation Language ).
ODL C++ C++ ODL,
C++,
, ODMS. C++, OML,
C++,
. , , ODMS ,
. 26.5. ODL/OML,
ODL OML ,
, ,
, .
;;
C++OOL
- * +*
--
;"
ODMS.;
. 26.5. -
C++ ODL/OML
1034
VI.
http://openlib.org.ua/
C++
ODMG d_. ,
, d__Float, d_String d_Short,
d_List, d_Set d_Bag. ,
d_Iterator, Iterator,
d_Extent . ,
d _ R e f ( T ) ,
, .
(
1:1), ( 1:*). , Has 1:*, Branch :
d_Rel_Set<SalesStaff, _WorksAtb Has;
const char _WorksAt[] = "WorksAt";
a SalesStaff
OML new, . , . ,
d_Ref<SalesStaff> tempSalesStaff = new SalesStaff,-
a :
d_Database *myDB;
dJ?ef<SalesStaff> si = new(myDb,
"John W h i t e " )
SalesStaff;
OQL C++ ODL/OML
:
query d_Collection;
d_OQL_Query.
, (wellPaidStaf f ) 30000
.
d_Bag<d_Ref<SalesStaff w e l l P a i d S t a f f ;
S a l e s S t a f f - > q u e r y ( w e l l P a i d S t a f f , "salary > 3 0 0 0 0 " ) ;
, , , , :
26. -
1035
http://openlib.org.ua/
, $1 , . ,
:
d__Bag<d_Ref<Branch branches;
q 30000;
d_ogl_execute(q, branches);
ODMG [50].
26.3. -
ObjectStore
- ObjectStore.
26.3.1.
- ObjectStore /,
. ( )
, ,
. ObjectStore,
-, ObjectStore,
- . , ,
, .
, . ,
,
, ( )
. ObjectStore . 26.6. .
ObjectStore
ObjectStore :
;
;
.
ObjectStore;
:
1036
VI.
http://openlib.org.ua/
;
;
, ,
;
, ,
.
.
,
, :
;
, ;
,
/.
ObjectStore
, .
, , , , .
,
,
ObjectStore.
.
, , , , .
. 26.6. ObjectStore
26. -
1037
http://openlib.org.ua/
- , ,
. , . (
).
:
,
. , , .
,
.
:
, ;
, ,
, ( )
.
,
, ,
.
, , .
, , .
ObjectStore () .
C++
, ( 25.2.1 , OID), ,
, , .
ObjectStore .
.
, , , ,
. , --+. ,
, .
, ,
, , .
1038
VI.
http://openlib.org.ua/
ObjectStore
.
; , , . ObjectStore ,
, . ObjectStore , . ,
, ObjectStore , .
( ). ObjectStore , ,
. .
,
, ObjectStore ,
,
.
ObjectStore , .
.
26.3.2. ObjectStore
ObjeetStore ,
, C++ Java, .
, , .
C++, -
- ,
.
- ObjectStore C++, ObjectStore
C++. ( ) (. 25.3.2),
new, .
delete C++, .
, .
.
26.9 C++
ObjectStore ( ' .h 1 )
DreamHome. Branch
26. -
1039
http://openlib.org.ua/
1040
VI.
http://openlib.org.ua/
new
, ObjectStore new. 26.9 SalesStaff
Branch. , Branch :
branchNo = new(dreamhoraeDB, os_typespec::get_char(), 4) c h a r [ 4 ] ;
new :
ObjectStore (dreamhomeDB);
, get_char os_typespec
( );
.
, new . , ,
ObjectStore . ,
26.9, ; ,
Branch SalesStaff,
. , new,
:
branchNo = new c h a r [ 4 ] ;
.
( os_typespec) new.
( 26.3.3).
, char, int
Branch*. - ObjectStore .
ObjectStore
26. -
1041
http://openlib.org.ua/
.
;
os__typespec. , 26.9
Branch SalesStaff -
get__os_typespec:
static os_typespec *get_os_typespec();
ObjectStore .
ObjectStore
Branch SalesStaff -, .
ObjectStore .
, ; 26.9 : os_relationship_l_m os_relationship_m_l (
os_relationship_l_l os_relationship_ra_m).
.
() . , .
class. , .
member. .
inv_class. , , .
inv_member. , .
value_type. ; .
"" (body) , ( ). , , 26.9, :
os_rel_m_l __body(Branch, Has, SalesStaff, WorksAt};
os_rel_l_m_body(SalesStaff, WorksAt, Branch, Has);
,
addStaff removeStaff Branch
setBranch getBranch S t a f f . , . ,
addStaff , (, ) (
Has) (, si), WarksAt ( ), .. si WorksAt .
1042
VI.
http://openlib.org.ua/
ObjectStore
26.8 Staff extent,
ODMG. 26.9
SalesStaff, os_Set ObjectStore. SalesStaff
insert ,
remove .
26.3.3. ObjectStore
ObjectStore.
:
;
;
.
26.2.2,
,
.
( -)
, . ( ,
). ,
26.10.
open
os_database.
OS_BEGIN_TXN
OS_END_TXN ( txi, ).
SalesStaff create
os_Set.
(
SalesStaff, ) create_root os_database.
( os_database_root).
set_value , .
Branch, ,
SalesStaff,
SG37 SG14, addStaf f Branch.
26. -
1043
http://openlib.org.ua/
26.10. ObjectStore
os_Set<SalesStaff*> *salesStaffExtent = 0;
main() {
// ObjectStore
//
objectstore: .-initialized ; os_collection: : initialize () ;
os_typespec *WorksAtType = Branch::get_os_typespec(};
os_typespec *salesStaffExtentType =
os_Set<SalesStaff*>::get_os_typespec();
// DreamHome
os_database *dbl = os_database::open("dreamhomeDB");
//
OS_BEGIN_TXN(txl,
0, os_transaction::update)
// SalesStaff,
//
salesStaffExtent = &os_Set<SalesStaff*>::create(dbl);
dbl->create_root("salesStaffExtent_Root")->
4;>set_value( salesStaff Extent, salesStaffExtentType);
//
// , SG37 SG14
Branch* bl("B003"); SalesStaff* sl("SG37"), s2("SG14");
//
/'/ ,
//
dbl->create_root("Branch3_Root")->set_value(, WorksAtType);
bl->addStaff(si); bl->addStaff(s2);
//
OS_END_TXN{txl)
dbl->close{);
- ObjectStore
, , .
, ,
26.11.
.
. (branchNo). f ind_root get_value,
create_root set_value (. 26.10).
. Has
,
( Has 26.9 os_Set).
ObjectStore ,
.
, 1044
VI.
http://openlib.org.ua/
(
SQL, 21.1.4). , ,
, . , ,
os_Cursor
SalesStaff, Has,
aBranch->Has.
f i r s t (
), next ( ) more ( ,
).
,
.
. - ObjectStore
.
SalesStaff,
query_pick,
:
, ( SalesStaff*);
, , (
, staffNo
SG37);
,
( dbl).
. , query ,
( , 30 000
). ,
(staffNo) .
ObjectStore. ObjectStore.
26.11. ObjectStore
os_Set<SalesStaff*> *salesStaffExtent = 0,
main(} {
Branch* aBranch,
SalesStaff* p,
// ObjectStore
//
objectstore::itialize(); os_collection::itialize();
26. -
1045
http://openlib.org.ua/
OMG
1046
VI.
http://openlib.org.ua/
, , , .
1990 OMG "
" ( Object Management
Architecture). - , ,
;
; ;
, - .
: (Object Model ), (Object Request Broker ORB),
.
ODMG (Object Data Management Group
)
- -
. ODMG , .
, , - .
, , -
, ,
ODMG
(Object Model ),
(Object Definition Language ODL), (Object Query Language OQL), C++, Java Smalltalk.
ODMG OMG , - .
,
. . .
, . , .
,
,
(Object Definition Language ODL)
, ODMG, (Data Definition
Language DDL) . ODL
, .
(Object Query Language OQL)
, SQL. ,
, . OQL , , , . OQL
, .
26. -
1047
http://openlib.org.ua/
26.1. ODMG
.
26.2. ODMG?
26.3. ODMG?
26.4. GROUP BY
ODMG GROUP BY SQL? .
26.5. ODMG SQL? .
26.6. (OIF
Object Interchange Format) ODMG?
26.7. C++
ODMG.
26.8.
- Hotel, 25.14,
ODL ODMG, , OQL:
) ;
) , 20 ;
) , ;
) Grosvenor ;
) ,
Grosvenor,
) Grosvenor , , ;
) , Grosvenor,
guestNo, guestName guestAddress.
26.9.
26.10.
26.11.
26.12.
OQL ,
4.12.
- DreamHome, 25.15, ODL ODMG.
- University Accommodation Office, 25.16, ODL ODMG.
- EasyDriue School of Motoring,
25.17, ODL ODMG.
- Wellmeadows, 25.18, ODL ODMG.
1048
VI.
http://openlib.org.ua/
...
.
,
CADF, .
,
Postgres.
- SQL (SQL3):
;
, ;
;
;
;
SQL,
;
;
(Binary Large Object BLOB)
(Character Large Object CLOB);
.
,
.
- ,
Oracle.
- ,
.
http://openlib.org.ua/
24-26
- (). 24 ,
, ,
. 25 26 , . , ,
- , - ().
, ,
, 24.2. , ,
, .
27.1 -
() , . 27.2 ,
, ,
. 27.3
, 27.4
SQL3,
1999 . 27.5
, SQL3. 27.6
- , Oracle.
27.7, .
,
24.
DreamHome, 10.4 .
27.1. -
,
15-20 ( 50
). 25% . ,
25 26, .
( 1996 150 )
3% ( 1997 ), , World Wide Web (
28). 1050
VI.
http://openlib.org.ua/
50%,
. ,
,
, , .
- . -
. , , 24.1, . ,
, .
, ,
- , , , , ,
, ( , ), .
.
,
. , -
,
, . , , (, ) .
. (Extended Relational DBMS ERDBMS).
-
, (Object-Relational DBMS ORDBMS),
. ,
(Universal Server),
, (Universal DBMS). , .
, : Oracle, Informix IBM,
,
. . -
, . ,
50% .
,
SQL. SQL 1991 . 27. -
1051
http://openlib.org.ua/
SQL,
SQL3. SQL3
. SQL 27.4.
[292]
, . 27.1. , . , Word, WordPerfect Framemaker,
, () .
, , . , ,
.
, ,
.
, . , , ,
. 24.1. - .
, ,
. , , ODMG (. 26.2), SQL -
.
. 27.1.
1052
VI.
http://openlib.org.ua/
(. 24.2),
.
, . ,
, , ,
, , ,
, ..
,
. , .
,
, .
, . ,
. ,
. SQL3
SQL2,
, SQL3.
. ,
, ,
, . ,
, .
. , - . ,
- , - , . - , .
- ,
.
27. -
1053
http://openlib.org.ua/
, . ,
. , , SQL, .
,
, .
5 , ,
.
SQL, 1989 , -, . SQL, 1992 , 120 600 , , . , SQL3 , ,
, , , .
27.2.
, 1990 , .
. , .
,
- , , 25.5 [12].
,
(Committee for Advanced DBMS Function CADF)
(Third-Generation Database System Manifesto)
[295], , .
(Third Manifesto) [87],
[88]. .
27.2.1.
, CADF,
, .
1. .
2. .
3. , ,
.
4. ,
.
1054
VI.
http://openlib.org.ua/
5. ( ) . - .
6. , .
7. : ,
.
8. .
9. .
10. .
11. ,
,
.
.
12. , SQL "
".
13. .
27. -
1055
http://openlib.org.ua/
1.
2.
3.
4.
5.
6. TUPLE
7. RELATION
8.
9.
10.
11.
12.
13. (relvar)
14.
15.
16.
17.
18.
19. ,
20. ,
21.
22.
23.
24.
25.
26.
1.
2.
3.
4. (NULL)
5. 1
" , ";
.
, .
1056
VI.
http://openlib.org.ua/
. 27.1
6.
7.
8.
9.
10. SQL
1.
2. ()
3. ()
4.
5.
6.
7.
1. (relvar)
2.
1.
2.
3.
4.
5. (, " ")
6.
7.
8. { )
9. SQL
1.
2.
3.
4.
5.
,
,
. ,
,
27. -
1057
http://openlib.org.ua/
27.3. Postgres
-
Postgres ( Post INGRES). ,
. ,
SQL3 ( , ). Postgres ,
INGRES
, .
1058
VI.
http://openlib.org.ua/
Postgres - INGRES.
, ,
Ilfustra Illustra Information Technologies,
Informix Informix
Software Inc.
27.3.1. Postgres
Postgres
,
INGRES [294]. .
1. .
2. , ,
3. (
) .
4. .
5. , , VLSI (Very Large-Scale Integration
).
6.
( , ).
Postgres :
;
"";
.
- , , , ,
.
27.3.2.
.
Postgres , int2, int4, fIoat4, floats, bool, char
date.
. (Abstract
Data Type ADT). ADT , ,
(
), , . , int4
:
DEFINE TYPE inc4 IS (Internal-Length = 4, InputProc = CharToInt4,
OutputProc = Int4ToChar, Default = " 0 " )
27. -
1059
http://openlib.org.ua/
CharToInt4 Int4ToChar , ,
define procedure. ,
, ,
, .
, ,
(Sort), , (Negator). , +, , :
DEFINE OPERATOR " + "
, , Plus, +, . .
.
. , char [25]
25 .
.
procedure, Postquel, .. , Postgres.
postquel.
27.3.3.
Postgres :
|;CREATE TableNstme -. (columnWamel = type!, coltwnnWarae2 = types
j EKEYUistOfCoIumnNamesH
I {INHERITS
..-.)
, . ,
,
. . , S t a f f
Person, :
CREATE Person (fName = char [15] , INarae = char [15], sex = char/
dateOfBirth = date)
KEY(lName, dateOfBirth)
CREATE Staff ( s t a f f N o = char [5] , position = char [10] , salary =
float4,
branchNo = char [4], manager = postquel}
INHERITS I Person)
1060
VI.
http://openlib.org.ua/
Staff , Person. ()
Person. manager postquel, , Postquel. APPEND, Staff.
APPEND Staff
{s.staffNo,
s.IName,
s.manager.staffNo)
FROM s IN Staff
,
. , manager, ,
.
EXECUTE, , .
EXECUTE
(s.staffNo,
s.IName,
s.manager.staffNo)
FROM s IN Staff
,
. $
, . , , :
DEFINE TYPE Manager IS
RETRIEVE {staffNumber = s . s t a f f N o ) FROM s IN Staff WHERE
position = "Manager" AND branchNo = s.branchNo
.
CREATE S t a f f ( s t a f f N o = char[5], position = char[10], salary =
float4,
branchNo = char [ 4 ] , manager = Manager)
INHERITS(Person)
:
RETRIEVE
Staff
(s.staffNo,
s.IName,
s.manager.staffNumber)
FROM s IN
Postgres . Postgres ,
. . ,
, , .
27. -
1061
http://openlib.org.ua/
27.3.4.
old,
, old Postgres. old , . , old , , - . ,
, Staff.
DEFINE TYPE S t a f f ( i n C 4 ) . I S
RETRIEVE ( S t a f f . a l l ) WHERE S t a f f . o i d = $1
, , .
, Staff
. ,
.
CREATE PropertyForRent(propertyNo = char [5], street = c h a r E 2 5 j ,
city = char [15], postcode = char [ 8 ] , type = c h a r [ l ] ,
rooms = int2, rent = f l o a t 4 , ownerNo = c h a r t s ] ,
branchNo = c h a r [ 4 ] , s t a f f N o = S t a f f )
KEY(propertyNo)
staf fNo , .
:
APPEND PropertyForRent(propertyNo = "14", street = "16 Holhead",
city = "Aberdeen", postcode = "AB7 5SU", type = "H", rooms = 6,
rent = 650, ownerNo = "CO46", branchNo = " B 0 0 7 " ,
staffNo = S t a f f ( s . o i d ) }
FROM s IN Staff
27.4. SQL3
5 6 ISO
SQL 1992 , SQL2, SQL92. SQL, ANSI (X3H2) ISO
(ISO/IEC JTC1/SC21/WG3), SQL (
SQL3), ,
- [176].
, SQL3 ;
.
SQL/Framework. SQL.
SQL/Foundation. SQL, , , , ,
, .
SQL/. API (. 21). -
1062
VI.
http://openlib.org.ua/
27.4.1.
1063
http://openlib.org.ua/
, , . ,
. , .
27.1.
Branch, , .
CREATE TABLE Branch (
branchNo C H A R ( 4 ) ,
address ROW(street VARCHAR{25),
city VARCHARCL5),
postcode R O W f c i t y l d e n t i f i e r VARCHAR(4),
subPart V A R C H A R ( 4 ) ) ) ) ;
INSERT INTO Branch
1
1
VALUES ( ' B O O S , R O W C 2 2 Deer Rd' , 'London , ROW ( ' SW1' , ' 4 E H ' ) ) ) ;
27.4.2. ,
SQL3 ,
UDT (User-Defined Types),
, ADT (Abstract Data Types).
, (, CHAR, INT, FLOAT). UDT
: .
UDT SQL3 (distinct type), , . , :
CREATE TYPE OwnerNumberType AS VARCHAR(S) FINAL;
CREATE TYPE StaffNumberType AS VARCHAR{5) FINAL;
, . ,
SQL , SQL
,
.
UDT , () (
SQL4) . . UDT
,
CREATE ORDERING FOR.
. , , PersonType, fName VARCHAR. fName :
.fName
p.fName = 'A. Smith'
1064
VI.
http://openlib.org.ua/
(observer) get (imitator) set. ; , .
UDT. . ,
fName PersonType :
FUNCTION fName(p PersonType} RETURNS VARCHAR(IS)
RETURN p. fName,a , newValue, :
FUNCTION fName(p PersonType RESULT, newValue VARCHAR(IS))
RETURNS PersonType
BEGIN
p.fName = newValue;
RETURN p;
END;
-
() -.
, UDT, , , .
UDT . ,
, , . PersonType, .
CONSTRUCTOR FUNCTION PersonType (fN VARCHAR{15),
IN VARCHAR(15), sx CHAR)
RETURNS PersonType
DECLARE :p PersonType;
BEGIN
NEW :p;
SET : p . f N a m e e f N ;
SET : p . l N a m e = IN;
UDT
UDT . UDT, , EQUALS
ONLY BY ORDER FULL BY. ,
, .
27. -
1065
http://openlib.org.ua/
RELATIVE. , 0
, , , .
MAP.
,
UDT .
UDT .
STATE.
.
, UDT
CAST. SQL4 .
I 27.2. UDT
UDT PersonType.
CREATE TYPE PersonType AS (
dateOfBirth DATE CHECK (dateOfBirth > DATE 4900-01-01'),
fName VARCHAR(15),
IName VARCHAR(15),
sex CHAR,
FUNCTION age
(p PersonType)
RETURNS INTEGER
RETURN /*
dateOfBirth +/
END,
FUNCTION age (p PersonType RESULT, DOB DATE)
RETURNS PersonType
RETURN /* dateOfBirth */
END)
REF IS SYSTEM GENERATED
INSTANTIATE
NOT FINAL;
. (stored attribute)
.
, UDT. ,
(virtual attribute) , . age, age
( ), age
( ).2 , . UDT.
, age .
SQL
27.4.4.
1066
VI.
http://openlib.org.ua/
INSTANTIABLE , . NOT
INSTANTIABLE, , . NOT FINAL ,
, . REF
IS SYSTEM GENERATED 27.4.5.
27.4.3.
(User-Defined Routine UDR) UDT. , UDR ,
(,
). , .
SQL3 UDR UDT
, . SQL
. , C/C++,
SQL , ( 27.4.10).
SQL
CALL SQL. , (IN), (OUT)
(INOUT). , ,
SQL. , SQL , ( RESULT).
age .
,
(iterative routine), MULTISET ( 27.4.9). , SQL.
(,
ODT).
MULTISET , / ODT.
ODT,
.
,
, . ,
. ,
, .
27. -
1067
http://openlib.org.ua/
, . , .
,
" "
. , , (thumbnail) ,
.
SQL, CREATE FUNCTION EXTERNAL, ,
.
CREATE FUNCTION thumbnail(IN myImage ImageType)
EXTERNAL NAME thumbnail
RETURNS BOOLEAN
LANGUAGE
SQL;
27.4.4.
, ..
, , UDT
, .
.
, .. , ,
.
.
SQL3 ,
. , .
, .
1068
VI.
http://openlib.org.ua/
27.4.5.
,
. , .
, . .
SQL3
" / ",
SQL2 REFERENCES (. 6.2.4).
SQL3 . , (
C++).
, () -
(. 24.3.3). , . ,
. , , , .
REF IS SYSTEM GENERATED CREATE TYPE , REF
, PersonType, 27.2. , ;
REF IS SYSTEM GENERATED. , . ,
.
REF;
REF IS <columnName> SYSTEM GENERATED. .
.
27.4.6.
SQL3 UDT / UNDER. , (
, ).
, ( , UDT), (. 27.3).
27. -
1069
http://openlib.org.ua/
27.3. UNDER
StaffType PersonType
:
CREATE TYPE StaffType UNDER PersonType AS (
staffNo VARCKAR(S),
1
position VARCHAR(IO) DEFAULT ' A s s i s t a n t ,
salary.
DECIMAL{7, 2 } ,
branchNo CHAR(4) ,
CREATE FUNCTION isManager (s StaffType) RETURNS BOOLEAN
BEGIN
IF s.position = 'Manager' THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF
END)
INSTANTIABLE
NOT FINAL;
StaffTypo, ,
CREATE TYPE, PersonType
. ,
, REF IS SYSTEM GENERATED . isManager, , .
27.4.8.
. SQL3 (substitutability), , . - UDT
TYPE. , Udtl :
// , Udtl PersonType
//
TYPE Udtl IS OF {PersonType)
// , Udtl PersonType
TYPE Udtl IS OF (ONLY PersonType)
SQL3, , TJDT
, , . , UDT , , , ,
.
. ,
Person Student Employee;
Student : Undergraduate
(), Postgraduate () PartTimeStudent (),
. 27.2, . Person Student,
1070
VI.
http://openlib.org.ua/
student, , Person.
Pa r t Time Student Employee, PTStudentEmployee,
. 27.2, . - PTStudentEmployee . ,
( , ), FTUGEmployee (,
) FTPGEmployee (, ). , .
, , .
UNDER
, . , USAGE
, .
'
Person^
1071
http://openlib.org.ua/
27.4.7.
SQL2
SQL3 CREATE
TABLE, UDT. , UDT , .
CREATE TABLE, 27.4-27.6.
27.4. UDT
UDT StaffType :
CREATE TABLE Staff (
info StaffType,
PRIMARY KEY {staffNo));
:
CREATE TABLE Staff OF StaffType {
REF IS s t a f f I D SYSTEM GENERATED,
PRIMARY KEY ( s t a f f N o ) } ;
I 27.5.
PropertyForRent
Staff .
CREATE TABLE PropertyForRent(
propertyNo PropertyNumber NOT NULL,
street Street NOT NULL,
city City NOT NULL,
postcode Postcode,
type PropertyType NOT NULL DEFAULT ' F ' ,
rooms PropertyRooms NOT NULL DEFAULT 4,
rent PropertyRent NOT NULL DEFAULT 6 0 0 ,
s t a f f I D R E F ( S t a f f T y p e ) . SCOPE Staff
REFERENCES ARE CHECKED ON DELETE CASCADE,
PRIMARY KEY (propertyNo));
6.1 PropertyForRent
Staff / .
REF (Staf fType). SCOPE
. REFERENCES ARE CHECKED , (
REFERENCES ARE NOT CHECKED). ON
1072
VI.
http://openlib.org.ua/
DELETE CASCADE , ,
SQL2. , ON UPDATE
, s t a f f ID Staff .
SQL3
UDT. , ,
. ,
SQL3, SQL
, . ,
CREATE TABLE Client (
info PersonType,
prefType CHAR,
maxRent DECIMAL(6, 2 ) ,
branchNo VARCHAR(4) NOT NULL);
PersonType : s t a f f
Client. , ,
UNDER. / UDT.
, .
27.6. UNDER
:
CREATE TABLE Manager UNDER Staff {
bonus DECIMAL(5, 2 ) ,
mgrStartDate DATE);
Manager Staff,
. Manager Staff. , Manager
Manager, S t a f f .
staff Manager.
.
Staff
Manager.
Manager S t a f f .
: "" . , INSERT, UPDATE DELETE SQL -
27. -
1073
http://openlib.org.ua/
.
. , . 27.2, , PTStudentEmployee,
Student Employee,
Person.
.
. , .
/ . ,
Student,
Person,
Undergraduate,
Postgraduate,
PartTimeStudent
PTStudentEmployee.
,
,
UNDER , . , USAGE
, .
27.4.8.
SQL3
, SQL2, ,
. (. 27.7-27.10).
27.7.
.
SELECT s.lName
FROM Staff s
WHERE s.position = 'Manager 1 ;
WHERE position position.
1074
VI,
http://openlib.org.ua/
I 27.8.
.
SELECT s.IName, s.age
FROM Staff s
WHERE s . i sManager , isManager
WHERE. TRUE, (. 27.3). , age ( )
SELECT.
....
27.9. ONLY
65 .
SELECT p.IName, p . f N a m e
FROM Person p
WHERE p.age > 65;
B , Person, ,
Person, Staff Client.
, ,
Person, .
, ONLY.
SELECT p.IName, p.fName
FROM ONLY (Person) p
WHERE p.age > 65;
_____
27.10.
, ' P G 4 ' .
SELECT p . s t a f f I D - > f N a m e AS fNaroe, p.staffID->lName AS IName
FROM PropertyForRent p
WHERE p.propertyNo = ' P G 4 ' ;
,
. (->).
SELECT , p. staff ID. , S t a f f , 27. -
1075
http://openlib.org.ua/
,
. SQL2
.
,
PG4, ,
:
SELECT D E R E F ( p . S t a f f l D ) AS Staff
FROM PropertyForRent p
WHERE p.propertyNo = ' PG4 ' ;
___
,
. SQL3 , .
. ,
SQL ,
ODMG. OID, , 26.2.2.
27.4.9.
,
.
,
. , "/".
,
.
SQL3 ARRAY,
SQL4
LIST, SET MULTISET. , , , UDT,
, UDT, . ,
, .. , , .
.
ARRAY (). ,
.
LIST (). ,
.
SET (). ,
.
MULTISET (). , .
, ODMG 3.0 (. 26.2), , Bag MULTISET
SQL. (. 27.11-27.13).
1076
VI.
http://openlib.org.ua/
SET
SET.
MULTISET
MULTISET.
MULTISET SET.
, .
LIST
LIST.
LIST
INTEGER.
LIST
LIST.
ARRAY ARRAY.
ARRAY ARRAY .
I 27.11. SET
staff,
(next of kin),
John White.
SQL3 SET,
.
Staff nextOfKin :
nextOfKin SET(PersonType)
:
SELECT n.fName, n.lName
FROM S t a f f s, TABLE (s.nextOfKin) n
WHERE s.lName = ' W h i t e ' AND s . f N a m e = ' J o h n ' ;
, FROM
s. nextOfKin.
27.12. COUNT
SET
.
SELECT s t a f f N o , fName,
FROM S t a f f ;
IName, COUNT{nextOfKin}
nextOfKin , , COUNT.
27. -
1077
http://openlib.org.ua/
27.13. ARRAY
, ,
ARRAY.
nextOfKin PersonType ARRAY(3)
27,11, , :
SELECT s.nextOfKin[1].fName, s.nextOfKin[1].IName
FROM Staff s
,
, SELECT
.
27.4.10.
SQL3
SQL,
( )
[177]. ()
. SQL3.
,
SQL ,
UDT, , .
DECLARE b BOOLEAN;
DECLARE staffMember StaffType;
b = staffMember.isManager;
* 1;
* 2;
= 0;
SET x 3;
1078
VI.
http://openlib.org.ua/
END FOR;
CALL, ,
RETURN, SQL , SQL.
SQL4 (PSM Persistent Stored Module) , . , ,
, ,
( SQL). SIGNAL/RESIGNAL.
DECLARE ... HANDLER.
DECLARE {CONTINUE | EXIT | UNDO}
HANDLER
FOR SQLSTATE { sqlstateValue \ conditionName
SQLWARNING | NOT FOUND} handlerAct ion;
SQLEXCEPTION
SQLSTATE
;
DECLARE conditionWame CONDITION
[FOR SQLSTATE sglstateValue]
:
SIGNAL sglstateValue;
RESIGNAL sglstateValue;
, ,
. , ,
SQL. CONTINUE, , . EXIT,
. UNDO, , , , , .
27. -
1079
http://openlib.org.ua/
, , , .
27.4.11.
8.2.7, () SQL,
. SQL ,
SQL , . , ,
, . (firing),
* . :
, , , ,
;
(, ), ;
, ;
(. 23.6).
CREATE TRIGGER .
CREATE TRIGGER TriggerNaiue
:.BEFORE,-j AFTER <triggerEvent> ON <Ta.ble.Wame>
..[REFERENCING <oldOrtfewValueaAliasZiist>3
[FQR'.EACH {ROW [STATEMENT} 3
JWHEN
. (triggerCondition) 3
:h
:
'<triggerBody>
Iff-: --',
, . .
BEFORE AFTER:
BEFORE ,
AFTER .
SQL,
:
(FOR EACH ROW), ( );
(FOR EACH STATEMENT);
(
),
<oldOrNewValuesAliasList> :
(OLD/NEW OLD ROW/NEW ROW), . ;
1080
VI.
http://openlib.org.ua/
1081
http://openlib.org.ua/
. FOR EACH
, .. FOR EACH STATEMENT,
INSERT .
INSERT, , .
VI.
http://openlib.org.ua/
,
,
.
.
.
. ,
,
, . .
TRIGGER
, SELECT ,
WHEN, SQL .
27.4.12.
(Large OBject LOB) ,
,
. SQL3 .
, BLOB {Binary Large OBject), .. .
, CLOB (Character Large OBject),
, NCLOB
(National Character Large OBject), .
SQL3 BLOB,
.
BLOB , BLOB .
, , , , Web-.
,
BLOB . SQL3,
,
. ,
.
(<stringl> \ <string2>),
, .
SUBSTRING (<string> FROM
<startpos> FOR <Iength>),
length, string startpos.
OBERLAY {<stringl> PLACING
<string2> FROM <startpos> FOR <length>), <stringl>
27. -
1083
http://openlib.org.ua/
<string2>. :
SUBSTRING{<stringl> FROM I FOR <lengthl>)
\ \
SUBSTRING(<stringl> FROM <startpos + length*) .
<string2>
\ \
27.16.
staff .
ALTER TABLE Staff
ADD COLUMN resume CLOB{50K);
ALTER TABLE Staff
ADD COLUMN picture BLOB(12M);
Staff : resume,
CLOB 50 , picture, BLOB
12 .
( ) , .. , G
. ,
.
1084
VI.
http://openlib.org.ua/
27.4.13.
24.2 ,
. SQL3
, ,
(linear recursion). , 24.2, Staff, 24.2; ,
. , , , SQL3:
WITH RECURSIVE
AllManagers ( s t a f f N o , managerStaffNo) AS
(SELECT s t a f f N o , managerStaffNo
FROM S t a f f
UNION
SELECT i n . s t a f f N o , out.managerStaffNo
FROM AllManagers in. Staff out
WHERE in.managerStaffNo = out.staffNo}
SELECT * FROM AllManagers
ORDER BY StaffNo, managerStaffNo;
AllManagers {staffNo managerStaf fNo), , .
UNION ,
, , .
, UNION
ALL, .
1085
http://openlib.org.ua/
(, , ODMG)
, ODMG. SQL3
, , ,
.
( ) SQL OQL; , SQL2.
27.5.
SQL, . , 24.2. , SQL3 ,
,
, .
, SQL3. , .
27.17.
, ' '.
, :
CREATE FUNCTION f l a t T y p e s ( ) RETURNS SET(PropertyForRent)
SELECT * FROM PropertyForRent WHERE type = ' F l a t ' ;
,
.
SELECT propertyNo, street,
FROM TABLE { f l a t T y p e s { ) }
WHERE branchNo = ' 1 , -
c i t y , postcode
, :
1. SELECT propertyNo, street, city, postcode
FROM TABLE (SELECT * FROM PropertyForRent WHERE type = ' F l a t ' )
WHERE branchNo = ' B 0 0 3 ' ;
2. SELECT propertyNo, street, city, postcode
FROM PropertyForRent
1086
VI.
http://openlib.org.ua/
, , PropertyForRent -
branchNo, branchNo
(. 20.4).
,
.
, SQL.
, .
, ?
. ,
ADT ,
. , Illustra,
Informix, () .
().
( ) , (). ,
, .
().
+ * ( * ;.},
- ( * <
>).
, . , . , ,
.
27.18.
,
'Ann Beech'.
1087
http://openlib.org.ua/
CT
p.dty-'Giasgow'
CT
i.f
Name-'Ann1
*.IN ame-'Beech'
)
Op.rvtarPrlmarySchooI(p. poMeode | : 2 0
p.ctty= Glasgow"
6)
"p.nearPrtmarySchoollp.poKcodeliJ.D
.INme-'AnnVm.lHame-'BeeclV
<V city'Glasgow'
. nearPrimarySchool
, Staff
staff No , .
- ,
( ),
. 27.3, . , (nearPrimarySchool () < 2 . 0 AND city =
1
Glasgow') , .. , - , ,
(city = 'Glasgow')
{nearPrimarySchool () < 2 . 0 ) ,
. 27.3, .
-"""---"-"""
1088
. VI.
http://openlib.org.ua/
27.18
nearPrimarySchool , .
, , . , Illustra SQL:
CREATE INDEX nearPrimarySchoolIndex
ON PropertyForRent USING B-tree (nearPrimarySchool(postcode));
PropertyForRent
postcode
nearPrimarySchool .
PropertyForRent
.
Illustra
.
, .
,
, ( , , ).
,
.
, . ,
, . ,
. ,
, SQL JavaScript. ,
, SQL3 , C/C++, . ,
; (IPC). ,
, .
27.5.1.
27.18 , , ( ).
( ). (-Tree) ,
27. -
1089
http://openlib.org.ua/
, , . , .
, .
, - , .
[114].
K-D-B [260].
R- (region trees), -
[147].
[226].
D-, .
.
,
,
. , ,
, ,
, , .
, , . , (Generalized Search Tree GiST) ,
[155].
27.6. -
Oracle
8.2 Oracle,
, ,
PL/SQL, ,
. , Oracle
- , SQL3.
Oracle.
27.6.1. ,
Oracle
(. 8.2.3), , :
;
.
1090
V!.
http://openlib.org.ua/
, , , , , ,
,
SQL3. , Address, staff
Branch :
CREATE TYPE AddressType AS OBJECT (
street VARCHAR2(25) ,
city VARCHAR2(15),
postcode V A R C H A R 2 ( 8 ) } ;
CREATE TYPE StaffType AS OBJECT (
StaffNo VARCHAR2(5) ,
fName VARCHAR2(15) ,
IName V A R C H A R 2 ( 1 5 ) ,
position VARCHAR2(10) ,
sex CHAR,
DOB DATE,
salary DECIMAL(7, 2J ,
()
Branch:
CREATE TABLE Branch OF BranchType (branchNo PRIMARY K E Y ) ;
-, . - , SELF, . ,
, object .method ( ) ; method object. 27. -
1091
http://openlib.org.ua/
BranchType getbranchNo, .
,
SELF.
,
typename.method().
.
Oracle .
Oracle
.
BranchType,
branchNo. .
. , . , -1,
( ), 0, , 1, .
, , . , Oracle
. ,
, :
NULL ,
;
,
;
, Oracle ,
( NULL).
PL/SQL, Java ; , , . -,
BranchType Staf fType, :
CREATE OR REPLACE TYPE BODY BranchType AS
MAP MEMBER FUNCTION getbranchNo RETURN V A R C H A R 2 ( 4 ) ,IS
BEGIN
RETURN branchNo;
END;
END;
CREATE OR REPLACE TYPE BODY StaffType AS
MAP MEMBER FUNCTION age RETURN INTEGER IS
var NUMBER;
BEGIN
1092
Vf.
http://openlib.org.ua/
var := TRUNC{MONTHS_BETWEEN(SYSDATE,
RETURN var;
END;
END;
DOB)/12);
- getbranchNo , branchNo, ()
. . SQL3,
CREATE TYPE. , ,
, :
SELECT;
WHERE;
VALUES INSERT;
SET UPDATE.
Oracle , , CREATE OPERATOR. ,
, ,
.
SQL .
-
-,
. - , ,
, , .
, BranchType :
BranchType('', AddressType('163 Main S t ' , 'Glasgow 1 , 'Gil 9 Q X ' } ) ;
, AddressType ( ' 163 Main S t ' ,
'Glasgow', 'Gil 9 Q X ' ) AddressType.
(OID object identifier), , . OID
. Oracle
. , .
OID ,
. , ,
, (row object), a
,
, (column object).
27. -
1093
http://openlib.org.ua/
Oracle ,
. , OID
;
CREATE TABLE OBJECT IDENTIFIER PRIMARY KEY
OBJECT IDENTIFIER SYSTEM GENERATED (
). , OID
Branch :
CREATE TABLE Branch OF BranchType
OBJECT IDENTIFIER PRIMARY KEY;
REF
Oracle REF,
.
REF . REF , , . REF . REF
. Oracle REF .
SQL3, REF
, ; SCOPE.
, , REF, , , SQL Oracle IS DANGLING, REF . Oracle DEREF, , REF. ,
, ,
BranchType :
CREATE TYPE BranchType AS OBJECT (
branchNo V A R C H A R 2 ( 4 ) ,
address AddressType,
manager REF StaffType,
MAP MEMBER FUNCTION getbranchNo RETURN V A R C H A R 2 ( 4 ) ,
PRAGMA RESTRICT_REFERENCES{getbranchNo, WNDS, WNPS, RNDS, R N P S ) } j
REF StaffType. .
Oracle :
.
1094
VI.
http://openlib.org.ua/
,
. , , .
, . ,
, Oracle, :
CREATE TYPE TelNoArrayType AS VARRAY(3) OF VARCHAR2(13);
,
, :
;
;
PL/SQL, .
, BranchType :
phoneList TelNoArrayType,
, , ,
, . ,
Oracle BLOB.
, .
.
,
,
. ,
:
CREATE TYPE NextOfKinType AS OBJECT (
fName VARCHAR2(15),
IName VARCHAR2(15),
telNo VARCHAR2(13) };
CREATE TYPE NextOfKinNestedType AS TABLE OF NextOfKinType;
StaffType :
nextOfKin NextOfKinNestedType,
CREATE TABLE Staff OF StaffType (
PRIMARY KEY staffNo)
OBJECT IDENTIFIER PRIMARY KEY
NESTED TABLE nextOfKin STORE AS NextOfKinStorageTable {
(PRIMARY KEY{Nested_Table_Id, IName, telNo))
ORGANIZATION INDEX COMPRESS)
RETURN AS LOCATOR;
27. -
1095
http://openlib.org.ua/
, ,
DDL .
Nested_Table_Id,
. Staff
Nested_Table__Id, ,
S t a f f , Nested_Table_Id.
, nextOfKin
NextOfKinStorageTable. STORE AS ,
- (ORGANIZATION INDEX),
, .
COMPRESS, Nested_Table_ld,
,
.
Nested_Table_Id
:
(iName, telNo)
.
, .
Oracle . , ,
Oracle. , , Oracle .
, Oracle ,
, . RETURN AS LOCATOR ,
. , VALUE, , , ,
.
.
,
.
,
,
, .
Oracle
, ( ), -
1096
VI.
http://openlib.org.ua/
, ,
.
, ,
27.6.2.
. , . , s t a f f :
INSERT INTO S t a f f VALUES ( ' S G 3 7 ' , ' A n n ' , ' B e e c h 1 , ' A s s i s t a n t ' , ' F 1 ,
1
l O - N o v - 1 9 6 0 ' , 12000, NextOfKinNestedType());
INSERT INTO S t a f f VALUES ( ' S G 5 ' , ' S u s a n ' , ' B r a n d ' , 'Manager', ' F 1 ,
' 3 - J u n - 1 9 4 0 ' , 24000, N e x t O f K i n N e s t e d T y p e ( ) ) ;
NextOf KinNestedType () -
nextOfKin.
:
INSERT INTO TABLE (SELECT s . n e x t O f K i n
FROM S t a f f s
WHERE s . s t a f f N o = ' S G 5 ' )
VALUES ( ' J o h n 1 , ' B r a n d ' , ' 0 1 4 1 - 8 4 8 - 2 0 0 0 ' ) ;
TABLE
;
nextOfKin Staff,
staffNo, SG5. Branch :
INSERT INTO Branch
SELECT ' B 0 0 3 ' , AddressType('163 Main S t ' , ' G l a s g o w ' , 'Gil 9 Q X } ,
R E F ( s ) , TelNoArrayType('0141-339-2178', ' 0 1 4 1 - 3 3 9 - 4 4 3 9 ' ]
FROM S t a f f s
WHERE s . s t a f f N o = ' S G 5 ' ;
:
INSERT INTO Branch VALUES ( ' B 0 0 3 ' , AddressType('163 Main S t ' , ' G l a s g o w ' ,
'Gil 9 Q X ' } , (SELECT R E F ( s ) FROM Staff s WHERE s . s t a f f N o ^ ' S G 5 ' ) ,
TelNoArrayType('0141-339-2178', '0141-339-4439'));
Oracle
SELECT b.branchNo
FROM Branch b
ORDER BY VALUE(b);
1097
http://openlib.org.ua/
branchNo. :
SELECT b.branchNo, b.address, DEREF{b.manager), b.phoneList
FROM Branch b
1
WHERE b.address.city = 'Glasgow
ORDER BY VALUE{b);
, DEREF. branchNo, , (
StaffType) .
:
SELECT b.branchNo, b.manager.staffNo, .*
FROM Branch b, TABLE(b.manager.nextOfKin) n
1
WHERE b.branchNo = ' B 0 0 3 ;
,
. ( )
TABLE. , b. manager, staff No . staf f No,
= DEREF(b.manager).
27.6.3.
3.4 6.4. , ,
.
. , Staff,
. Oracle ,
, , .
, -
.
, , ,
27.6.1,
DreamHome:
Branch (branchNo, street, city, postcode, mgrStaffNo)
Telephone (telNo, branchNo)
S t a f f [ s t a f f N o , fName, IName, position, sex, DOB, salary, branchNo)
NextOfKin ( s t a f f N o , fName, IName, telNo)
-
:
1098
VI.
http://openlib.org.ua/
(staffNo)
AS
FROM Branch b;
phoneList
27.6.4.
Oracle , .
CREATE TYPE.
.
CREATE ANY TYPE.
.
ALTER ANY TYPE. .
DROP ANY TYPE. .
EXECUTE ANY TYPE.
.
, EXECUTE
, ,
.
27. -
1099
http://openlib.org.ua/
27.7.
- -
: (. 27.2),
(. 27.3) (. 27.4). ,
SQL3/SQL4.
27.2.
(OID)
REF
(
)
(
)
,
-
(,
)
27.3.
ODMG 3.0
REF
1100
VI.
http://openlib.org.ua/
27.4.
ACID-
. ,
. , "", / ,
.
, , . ,
. - , , ,
"".
, , .
SQL3 ,
( UDT), ( UDR), , , , (ARRAY), , SQL
, (BLOB) (
CLOB), .
,
, , .
,
.
- ( ).
.
27. -
1101
http://openlib.org.ua/
- , , - R-
( ). .
27.1.
27.2.
27.3.
27.4.
27.5.
?
?
SQL?
?
,
, .
27.6.
. - , .
?
27.7. Hotel, 3. , , SQL3. , .
27.8. SQL3 SQL3, 5.7-5.28.
27.9. , ,
.
27.10. 27.7 , 22, - .
27.11. - DreamHome,
. . , ,
, SQL3.
27.12. - University
Accommodation Office, .
.
27.13. - EasyDrive
School of Motoring, .
.
1102
VI.
http://openlib.org.ua/
27.14.
-
Wellmeadows, . .
27.15. , DreamHome
. -
,
.
- ,
DreamHome. ,
DreamHome.
27. -
1103
http://openlib.org.ua/
http://openlib.org.ua/
Web-
XML
OLAP
1107
1173
1263
1289
http://openlib.org.ua/
http://openlib.org.ua/
WEB-
...
( 15
1989 ) World Wide Web (
Web) , , . ,
, . World Wide Web .
Web (data-centric)
. Web
. Web , .
,
http://openlib.org.ua/
Web
,
Web.
, Internet ( Web)
, ,
. Internet / ,
.
Web- ,
. Web- , Web- . ,
, .
,
.
,
Web- ,
. HTML- ( 28.2.2)
, . Web
,
Web.
Web , .
Web
.
,
, ,
,
28.1 28.2
Internet Web. 28.3 Web .
28.4-28.10
Web.
DreamHome,
10.4 .
3.
1108
VII.
http://openlib.org.ua/
1109
http://openlib.org.ua/
, Internet
[125].
Internet NSF . Internet ,
, . 1990- , .
Archie, Gopher, Veronica
WAIS (Wide Area Information Service).
, . , World Wide Web .
ARPANET,
Internet , 1997
1
100 .
270 100 , 2001
390 . , 2003 640 .
, Internet 2,5 ,
7,5 .
,
2003
550 .
28.1.1.
. Web- , .
Web-
Internet, , . Internet (. 18.5.2), Internet
. ,
Web-,
Web-, .
Internet, , .
1110
VII.
http://openlib.org.ua/
. , .
, ,
.
; , .
.
. , (Electronic
Data Exchange EDI)
/. , (Just-In-Time JIT)
,
. EDI
.
,
(Value-Added
Network VAN), , Internet.
EDI
. EDI : , .
, , Internet: Web-, ,
Internet . ,
. , Federal Express ,
.
, ,
Web,
, , . , , .
, Internet.
28.1.2.
, Internet (electronic commerce)
(electronic business). ,
. Cisco Systems,
28. Web-
1111
http://openlib.org.ua/
, Internet, .
1.
, Internet
.
.
2. Web-
Web-,
, .
Web- , .
3.
. ,
Web- .
Web- , Web-
.
,
, 18.5.7. , 24 ,
,
, .
4.
. Internet
^ .
Internet . , ,
Web. , , , , .
5.
Internet.
, ,
.
VII.
http://openlib.org.ua/
, ,
.
Forrester Research Group,
(Business-To-Business 2)
99% 2003 1,3
. , , 2003 3,2 5% .
, , 34
350-500 2002 ,
.
28.2. Web
World Wide Web. , -"
Internet .
World Wide Web ( Web)
" " , Internet [25], [26]. Web Web-, , , , - . , Web-
Web-, ,
.
Web
, ,
. ,
.
Web : Gopher, FTP (File Transfer Protocol), NNTP (Network News Transfer
Protocol) Telnet ( ).
Web ,
, , (
), . Web , HTTP- Apache,
IIS (Internet Information Server) Microsoft, Netscape Enterprise Server,
WebLogic Server NCSA HTTPd, Microsoft
Internet Explorer, Netscape Navigator NCSA Mosaic.
Web ,
HTML (HyperText Markup Language ), . ,
Web- , HTTP (HyperText
Transfer Protocol ). , URL (Uniform
Resource Locator ).
Web . 28.1.
HTTP, HTML URL .
28. Web-
1113
http://openlib.org.ua/
HTTP
TCP/IP
HTTP
TCP/IP
. 28.1. Web
28.2.1. HTTP
HTTP. , Web- Internet.
HTTP .
, -
[25]. Web /0.9. 1995
/1.0
RFC 19452, [28]. (/1.1) .
HTTP -, HTTP .
. Web-.
. Web- .
. Web- (, HTML-).
. Web- .
2
1114
VII.
http://openlib.org.ua/
HTTP ; ,
. ,
Web- . , , (,
), , Web-
.
,
. HTTP
, "" . , ,
. HTTP
, Web- , , Web- , , .
Web, .
Internet
MIME (Multipurpose Internet Mail Extensions
Internet)
ASCII, , .
,
MIME Web ,
. MIME "/", , ,
. , GIF image/gif. ( ) . 28.1.
HTTP
HTTP , , HTTP; , . . HTTP.
GET. ,
( get) ,
.
POST. ,
( post) . HTML, ,
Internet
.
28. Web-
1115
http://openlib.org.ua/
28.1. MIME
MIME
MIME
text
html
plain
ASCII (* .txt)
image
video
application
gif
x-bitmap
x-msvideo
quicktitne
rnpeg
postscript
Postscript (* .ps)
Java
Java (* .class)
HEAD. GET,
HTTP, .
PUT ( /1.1). ,
DELETE ( HTTP/1.1). ,
OPTIONS ( HTTP/1.1). .
HTTP
HTTP ,
HTTP, , , . .
28.2.2. HTML
HTML. , -,
I Web-.
HTML , Web.
HTML , .
,
[27]. HTML (Tim Berners-Lee) CERN, 1995 IETF (Internet Engineering Task
Force Internet) RFC 1866.
HTML 2. 1116
VII.
http://openlib.org.ua/
W3C ,
Web.
28. Web-
1117
http://openlib.org.ua/
If you have any comments, we irou^d be more than happy to hear from you.
1118
VII.
http://openlib.org.ua/
28.2.3. URL-
URL-. - ,
I Internet, .
URL- (Uniform Resource Locator) ( ) Internet. URI URN. URI
(Uniform Resource Identifiers
) /,
Internet. URN (Uniform Resource Name ) Internet,
, . URN
,
, [287].
, URL- Internet, , .
HTTP-
Web.
URL- : , , , . ,
URL- , ( HTTP- 80),
,
(, CGI).
URL- .
<> : //<:> [: <:>] /_ [?]
<> ,
. HTTP, S ( HTTP), f i l e (..
), FTP, mailto (..
), Gopher, NNTP Telnet. , URL-.
http://www.w3.org/MarkUp/MarkUp.html
HTML. HTTP, Internet W W W . W 3 .org,
HTML /MarkUp/MarkUp. html. URL 28.5.
28.2.4. Web-
HTML, , Web-, .. , . , Web . Web- ,
Web-.
28. Web-
1119
http://openlib.org.ua/
,
. , ,
.
. ,
Web- Web- (, ),
.
(, ),
.
,
HTML- . ,
HTML, , - (, ).
, ,
, ,
, Web- , Web-.
Web-
28.4-28.10.
28.3. Web
Web ,
. , Web, , .
, Web,
28.3.1. ,
Web
Web, ,
- .
,
Web.
. ,
. .
1120
VII.
http://openlib.org.ua/
.
, ,
, .
, Web-.
, , .
, , :
Web-;
DCOM COM ((Distributed) Common Object Model)
Microsoft;
CORBA (Internet Inter-Object Protocol );
Java Remote Method Invocation (RMI).
, ,
, .
, HTTP.
.
.
.
, , .
28.3.2. Web
2.6.3 "/"
, "/". ,
Web.
"/"
: , ,
. , .
, , "/". "/" . ,
( 1),
, , ( 2),
(. 28.3).
.
28. Web-
1121
http://openlib.org.ua/
( - ),
. , , - ,
.
.
. 28.3. "/"
"/". 1990-
.
,
.
"" , , , .
.
1995
"/", .
, .
1. , ().
1122
VII.
http://openlib.org.ua/
2. .
, ,
3. , ,
.
, .
. 28.4, , , ,
, "" . ,
(Local Area Network LAN) (Wide Area Network WAN) . , .
- . .
"" ,
,
, , .
,
"/".
.
II II ^
. 28.4.
28. Web-
1123
http://openlib.org.ua/
,
.
.
, Web,
"" , Web- - .
,
. , ,
Web-, .
28.3.3.
Web
Web, ,
. ,
. .
Web . 28.2.
, Web-
,
. ,
, " " (World Wide Web)
-
. 1 (. . 1.8). Web. ,
28.2. ,
Web
'
1124
VII.
http://openlib.org.ua/
,
HTML, HTML- , . , HTML
,
.
HTML , ,
.
, HTML- . HTML , , .
Web , Web- ( ) . ,
HTML/Java ,
. ,
( ) . , ,
Microsoft Netscape, , .
. , , ,
SQL (. 21). . ,
(Graphic User Interface GUI)
. , , , -. , ,
, ,
( ) . ,
.
HTML , , HTML, , , 28. Web-
1125
http://openlib.org.ua/
, , Internet
.
HTML, . , , ,
,
.
.
. , , , .
Web
, URL-. Web-.
, , .
"/" "" ,
, . , Web , .
, Web
, .
, .
, . , .
Web Internet
.
"/"
.
Web . 28.3.
1126
VII.
http://openlib.org.ua/
28.3. ,
Web
HTML
Internet
. Internet (, ,
- ). ,
, . Internet , . ,
, Internet.
, ,
, .
, ,
Web. -
. ( Web . 18.5.)
,
Web- Internet ,
. ,
Forrester Research, Web-
300 000 3 400 000 , ,
. ,
50-200% .
Web-, . 20% , 24% , 28. Web-
1127
http://openlib.org.ua/
56% Web-. ,
Web.
Web-.
Web- . , . Web-,
. HTTP
,
.
.
HTML
HTML
, , Web . 28.4,
Web- , JavaScript VBScript, ActiveX Java. . ,
.
w,
28.2.1,
Web
,
.
Ethernet
10 /, ATM
2500 /.
Internet 1,544 /.
Internet ,
(
).
Web-
.
VII.
http://openlib.org.ua/
. , ,
. , HTML-
; JavaScript
VBScript , HTML ; Java
-, ,
. .
,
.
Web
, . Intertnet , .
Internet ,
.
Web ,
,
. , , .
,
. 22, , 25, , Web ,
, Web. , , .
. - (, HTML
).
(, Web ). ,
Web.
28.3.4. Web
World Wide Web.
, JavaScript VBScript.
CGI (Common Gateway Interface ) , ,
.
Cookie- HTTP.
Web-: Netscape Server API (NSAPI) Internet
Information Server API (ISAPI) Microsoft.
28. Web-
1129
http://openlib.org.ua/
28.4.
Web- , . , HTML ,
. .
HTML-,
. Web- .
, HTML.
. ,
, .
HTML ; HTML- ,
.
, Web-.
Java,
28.8. ,
, : JavaScript, VBScript, PERL PHP.
, ""
. , ,
.
1130
VII.
http://openlib.org.ua/
28.4.2. VBScript
VBScript
Microsoft, JavaScript/JScript.
VBScript , Visual
Basic, Java.
HTML. JavaScript JScript, .
VBScript ,
. Visual
Basic, . Visual
Basic Microsoft Office (
Word, Access, Excel PowerPoint). , .. Visual Basic
28. Web-
1131
http://openlib.org.ua/
28.4. JavaScript
Java
JavaScript
Java
( )
.
,
,
-.
HTML
HTML
( HTML-)
( )
( )
. .
28.4.3. Perl
Perl (Practical Extraction and Report Language)
. Perl sed, awk
sh UNIX,
UNIX. Perl
, ,
.
,
, -
, . Perl UNIX, VII.
http://openlib.org.ua/
,
Perl Windows { ActivePerl). Perl 3.3.
PHP (PHP Hypertext Preprocessor ) , HTML. Web-, HTTP- Apache Internet
Information Server Microsoft,
Web- Linux.
, Perl, , Java Active Server Pages ( 28.9.2). , . , Web
. ,
,
, , XML.
, HTTP- Apache,
mySQL PostgreSQL.
PostgreSQL 3
3.2.
1133
http://openlib.org.ua/
,
. . 28.5 CGI, Web-, ,
HTML, .
. 28.5. CGI
, , , .. , , .. (STDIN).
(STDOUT). , MIME, . CGI , ,
. , , UNIX PHP, Java, , Forth . Windows DOS ,
Visual Basic, C/C++, Delphi ActivePerl.
CGI
, .
1134
VII.
http://openlib.org.ua/
CGI
.
1. CGI, . , CGI HTML.
2. Web- CGI.
3. , CGI .
4. .
5. , STDIN.
6. STDOUT MIME,
, .
7. STDOUT .
8. .
CGI
,
HTML, . , . , .
CGI
, ,
(. 28.2.1).
28.5.1.
CGI
CGI :
;
;
;
.
.
CGI " ",
.
28. Web-
1135
http://openlib.org.ua/
CGI HTML
< ISINDEX>,
<HEAD> HTML.
Web- , , . , CGI HTML <ISINDEX>,
.
CGI .
CGI. ,
CGI,
QUERY_STRING.
QUERY_STRING , HTML
GET (. 28.2.1). ,
HTML. , HTML,
HTML 28.2, . 28.6,
LOGON URL, ( ,
Password "TMCPASS").
http://www.dreair.home.co.uk/cgi-bin quote.pl?symboll=Thomas+Connolly
^&symbol2=TMCPASS
QUERY_STRING
:
symboll=Thomas+Connolly&symbol2TMCPASS
28.2. HTML
<FORM METHOD="GET" ACTION="http://WWW.dreamhome..uk/cgi-bin/
^quote.pl">
Name:<INPUT TYPE="text" NAME="symboll" SIZE=15xBR>
Password:<INPUT TYPE="password" NAME="symbol 11 SIZE = 8xHR>
<INPUT T Y P E = " s u b m i t " Value="LOGON">
<INPUT T Y P E = " r e s e t " Value="CLEAR"><FORM>
"-"
(&), . , (,
""). CGI QUERY_STRING . 3.3
3 , CGI
Perl.
1136
VII.
http://openlib.org.ua/
jThomns Connolly
Password: F"^
28.5.2. CGI
CGI ,
Web- .
, ,
Web- . Web CGI Web- , . CGI , Web-,
. , , CGI .
,
Web-, . Web- ,
, . Web- Web-
HTML. , ,
.
CGI, , , , HTTP.
, CGI,
, ,
. CGI ,
, .
28. Web-
1137
http://openlib.org.ua/
HTTP
, . , ,
CGI .
CGI :
HTML- ;
, ,
.
,
. .
, , ,
. Web,
Web-, .
,
CGI. Web- ,
.
,
, , .
, CGI .
,
, CGI. ,
CGI, (, system grep). ,
, ,
.
//
rm - f r
//
mail hacker@hacker.com </etc/passwd
, , .
VII.
http://openlib.org.ua/
HTTP.
cookie-, Web- Web-. ,
, cookie-
HTTP. Web- ,
cookie- Web- .
Web- cookie-,
.
cookie- . cookie- ,
cookie- . , cookie-, ,
.
cookie- , , .
, ,
cookie- . cookie- cookie-, , , .
, , , , .
Cookie-
. , , ,
, cookie- , cookie-
. Cookie- :
Set-CooKie: NAME=VALUE; expires=DATE; path=PATH;
[domain=DOMAIN_NAME; secure]
cookie- UNIX, 28.3 (
). , cookie-,
cookie-, .
28.7. Web-
CGI ,
, , .
, CGI .
.
28. Web-
1139
http://openlib.org.ua/
28.3. UNIX,
cookie-
$!/bin/sh
echo "Content -type: text/html"
echo "Set-cookie: UserID=conn-ciO; expires = Friday 30-Apr-Ol
^12:00:00 GMT"
echo ""
, , CGI,
, (Inter-Process
Communication IPC).
, .
(Application Programming Interface API), . ,
CGI (non-CGI gateways). API:
Netscape Server API (NSAPI) Microsoft Internet Information Server API (ISAPI).
CGI, API-
. ,
- .
,
.
CGI
.
Web- Web- "" ,
, .
Web-,
, , Web-.
-, ,
Web- ( ).
, CGI.
Web- , , , .
. API- 1140
VII.
http://openlib.org.ua/
, CGI, , API
, API- CGI.
Web- , ,
. API . API- , , , Web-.
, API- , .
. Web- CGI,
CGI - Web-. API-
Web- . ,
API- Web-
. API-
Netscape JavaScript.
28. Web-
1141
http://openlib.org.ua/
: next ( ) , ;
insertRow ; updateRow/deleteRow / . ,
,
. , 28.4 myCursor,
myCursor.salary.
1142
VII.
http://openlib.org.ua/
, Web-.
API-
. API- , , , Web- .
, API- , Web , , ,
. API-
Web-, ,
CGI. Web- .
, Web- HTTP,
API-,
, ,
HTTP .
, API-
, Web-, CGI,
. API-
, CGI, .
28.8. Java
Java , Sun Microsystems.
. Java , Internet
Web. Java Web.
Java . Java [132] -
, , , Web () (). Java,
C++
. Java , -, , , , , , , , [298].
Java
Java , , Java
Virtual Machine (JVM) [8]. Java , " ".
Java . 28.7, Java
.Java .class, -, -
. -
.
JVM - Java 28. Web-
1143
http://openlib.org.ua/
-!
Java
. 28.7. Java
1144
VII.
http://openlib.org.ua/
Java 2
1990- Sun -
Java (JDK
Java Development Kit), . Sun
JDK Internet. JDK 1.0 1996 , JDK 1.1, , 1997 . Sun
Java (Java Platform for the Enterprise
JPE), Java, API- Enterprise Java. JPE .
. ,
. .
JPE . , , JPE, a API-, JPE, , .
1999 Sun , , Java .
J2ME (Java 2 Platform, Micro Edition).
. J2ME
API-, ,
.
J2SE (Java 2 Platform, Standard Edition).
. J2SE
Java 2 ( JDK 1.2).
J2EE (Java 2 Platform, Enterprise Edition).
, , .
J2EE ,
. J2EE3 , Sun Microsystems
, J2EE, IBM, Oracle BEA Systems.
J2EE
Java Enterprise JavaBeans (EJB).
J2EE ,
" ",
. J2EE:
JDBC Java Server Pages ( Java).
, J2EE, . 28.8. ,
,
28. Web-
1145
http://openlib.org.ua/
RMI/IIOP
Bean-
Bean-
()
. 28.8, J2EE
1146
VII.
http://openlib.org.ua/
TOPLink
28.8.1. JDBC
JDBC4, , Java [152]. ODBC (Open Database Connectivity
), 21.3, JDBC API ,
SQL .
JDBC Java
. JDBC
API- . API , JDBC,
* , JDBC , Java
D&tabase Connectivity, JDBC .
28. Web-
1147
http://openlib.org.ua/
VII.
http://openlib.org.ua/
,
.
JDBC-ODBC.
3. Java JDBC
.
JDBC ,
. . JDBC. ,
, . Internet 28. Web-
1149
http://openlib.org.ua/
. 28.10. JDBC
Java
(, ),
Web. -
JDBC .
,
,
. .
4. Java JDBC . JDBC , .
, .
Internet .
Java,
.
1150
VII.
http://openlib.org.ua/
.
, , -
.
ODBC ,
,
.
.
JDBC, Java, .
( )
Internet ,
, (
. 18.5.8).
-
, , (. 28.3).
, JDBC, Java, . 3.4
JDBC.
SQL
SQL, , , , . ,
. ,
. JDBC
API SQL.
JDBC API
.
, SQL,
.
SQL,
SQL,
. , JDBC ODBC. JDBC
SQL. , ,
.
JDBC
SQL . DatabaseMetaData,
.
28. Web-
1151
http://openlib.org.ua/
28.8.2. SQLJ
, JDBC, Java SQL. (Oracle, IBM Tandem)
Java SQL, SQLJ [234]. ISO/ANSI SQL, , Fortran,
COBOL, ADA, Mumps, Pascal PL/1 (. 21).
SQLJ ,
Java SQL,
. SQLJ SQLJ
Java,
. SQLJ .5.
28.8.3.
JDBC SQLJ
SQLJ
SQL, JDBC SQL
. SQLJ
, , ,
. ,
, . JDBC,
SQL, SQL .
JDBC
, ,
Java . JDBC , Java.
Java Java (.
24.4). Java . :
(
);
,
;
1152
VII.
http://openlib.org.ua/
, , , ,
.
,
ODBC.
28.S.4. Java
, Web Java Web-,
CGI, 28.5.
CGI, .
. CGI
. , (lightweight thread), JVM. , , CGI ( ,
, , ) ,
CGI. CGI.
. Java , " ", Java. , CGI Web-.
. Java , - . Java Java
, API-, Java, JDBC,
, , CORBA,
RMI Enterprise JavaBeans.
. CGI
cookie- ( ) .
cookie- ""
CGI ,
.
, ,
Web- ( destroy). / ,
. Session, ,
,
28. Web-
1153
http://openlib.org.ua/
- .
, . -,
-, .
. , Java Java
,
.
Java (Java Servlet
Development Kit JSDK) javax. servlet javax. servlet .http,
.
, , , [39], [150] [328].
28.8.5. Java
Java (Java Server Pages JSP)
, Java,
Web-, HTML
HTML.
Web- (, FrontPage
Microsoft Dreamweaver Macromedia), HTML . JSP Web-, HTTP- Apache Internet
Information Server Microsoft (
WebSphere IBM, JRun LiveSoftware ServletExec
New Atlanta). JSP Java Web- Java.
, HTML, JSP.
. (
scriptlet) Java,
.
. JSP
.
().
, ( bean Java). , JSP
JSP XML.
JSP ,
jsp:bean ( bean- Java), j s p : setProperty ( bean-) j sp igetProperty ( bean-,
' out').
1154
VII.
http://openlib.org.ua/
1155
http://openlib.org.ua/
, , OLE ,
. OLE , , ,
, .
.
, , . OLE Microsoft Access . 17.
VII.
http://openlib.org.ua/
28.9.1.
ODBC (Open DataBase Connectivity
) Microsoft
, SQL (. 21.3).
ODBC
SQL. ( )
: , SQL, . "/"
. ODBC ,
.
. , Microsoft Access Visual C++ Data
Access Objects (DAO), (Database), (TableDef), (QueryDef),
(Recordset), , .. DAO
Access Microsoft, JET, ,
Microsoft Access ODBC.
Microsoft, Visual FoxPro
SQL Server, DAO
Access Microsoft
Remote Data Object (RDO),- Visual Basic 4.0
Enterprise Edition.
Microsoft OLE DB (Object Linking and Embedding for Databases), OLE . OLE DB
,
, , ,
(. 28.11). OLE DB
- C++ API. 28. Web-
1157
http://openlib.org.ua/
. 28.11. OLE DB
, , .
OLE DB,
OLE DB.
1158
VII.
http://openlib.org.ua/
Internet
. 28.12. ASP
ASP CGI, , .
CGI, ASP , ,
. , ,
.asp :
;
HTML, ( >);
, <%
%>.
ASP ,
.asp Web-. Web-
ASP, , ,
HTML- . HTML ,
ASP.
1159
http://openlib.org.ua/
;
, .
ADO OLE DB.
ADO OLE-,
, , ADO RDO
, , . ADO , , .
ASP ADO 3.7.
Internet Explorer
DataControl, ADC,
1160
VII.
http://openlib.org.ua/
.
. ,
DataControl
Staff HTML :
<TABLE DATASRC="#ADC" border=l>
<TRxTDxSPAN DATAFLD= "Staf fNo" ></SPANx/TDx/TR>
</TABLE>
28.9.4.
ASP JSP
28.8.5 Java
(JavaServer Pages JSP), ASP.
, CGI,
Web-.
, .
. JSP
" ",
Java. JSP Web- Java,
. , ASP , Windows Microsoft.
Java
, , .
.
Web- , JSP JSP. ,
. .
. JSP (bean-
Java, bean- EJB ) . ,
EJB
28. Web-
1161
http://openlib.org.ua/
, (,
UNIX Windows).
. JSP
Java
Java , JSP ASP.
1162
VII.
http://openlib.org.ua/
1163
http://openlib.org.ua/
.
ADO.NET ActiveX Data Objects,
,
.
ADO.NET , : (
ADO) ( , , RDS, ).
, RDS, ( , ).
,
. ADO.NET
XML, , XML.
1164
VII.
http://openlib.org.ua/
Oracle
HTTP
Oracle
Apache
Oracle iFS
Oracle XML
Oracle
Oracle LDAP
Oracle Enterprise Manager
28. Web-
1165
http://openlib.org.ua/
,
iAS. Oracle HTTP
Server,
iAS. Oracle HTTP Server HTTP Apache , Web-.
Oracle Universal Application
Server,
Apache, ,
, , ,
,
. HTTP- Apache
, , ;
, Apache JServ.
HTTP- Oracle
HTTP- Apache. Oracle
,
Oracle, .
mod_s s 1, S-HTTP
Oracle
SSL (Secure Sockets Layer ),
18.5.6.
mod_plsql. PL/SQL Oracle
PL/SQL, PL/SQL.
mod_perl. Perl Perl,
, ,
.
mod_j serv.
Apache JServ.
mod_ose. URL- Java PL/SQL
,
Oracle (Oracle Servlet Engine OSE), Oracle.
cookie URL-, OSE
OSE SQL*Net.
1166
VII.
http://openlib.org.ua/
, .
Oracle BC4J (Business Components for Java
Java). , Java XML, , , .
,
, , SQL,
Java (JSP) "" Java Swing. iAS bean-
EJB, CORBA.
Oracle JVM. Java,
bean Java (Enterprise JavaBean EJB), CORBA . Oracle JVM
Java Java iAS Oracle.
- .
Oracle PLSQL. , Oracle Cache Oracle.
Oracle PLSQL , PL/SQL, Oracle.
HTML-, , , ASP JSP.
Oracle Forms. Internet , Oracle
Forms, .
, JSP, Perl/CGI, PL/SQL, .
Apache JServ. Java. HTTP-
mod_jserv, ,
, Apache JServ.
Oracle JSP. JSP Sun,
, SQLJ, JML (JSP Markup Language JSP), (National Language
Support NLS) ,
Oracle PSP (PL/SQL Server Pages PL/SQL). , JSP,
PL/SQL, Java.
28. Web-
1167
http://openlib.org.ua/
Oracle Database Cache ,
, Oracle,
. Oracle Database Cache
, JSP, EJB CORBA
Oracle JVM. Oracle Web Cache
, TJRL-,
,
URL- Web-. , ,
, Oracle Web Cache HTTP, .
, , , , , Microsoft Windows FTP. , ,
, .
Oracle Oracle Internet
File System (iFS). iFS
,
Microsoft Windows, , FTP . ,
, .
Oracle Portal
Oracle Portal ,
. Web,
Web-. , Oracle Portal
, Web1168
VII.
http://openlib.org.ua/
, , , , Internet .
, Oracle Portal-to-Go ,
. Portal-to-Go ,
Web-, Java XML.
.
( Portal-to-Go XML),
. Portal-to-Go XML (Document Type Definition DTD) XML, Oracle Portal-to-Go.
XML DTD .
,
Oracle Reports Internet
, Oracle Reports Developer.
Oracle
,
iAS, , . .
Oracle XML Developer's Kit (XDK).
Web- XML.
Oracle DB Client Developer's Kit.
Oracle Java:
Oracle Java Messaging Service (JMS), Oracle SQLJ Oracle JDBC.
Oracle LDAP Developer's Kit. , OID (Oracle Internet Directory
Internet Oracle). LDAP,
,
.
Internet
. World Wide Web , Internet.
, Web, , HTML (HyperText Markup Language
), .
28. Web-
1169
http://openlib.org.ua/
170
VII.
http://openlib.org.ua/
28.1.
28.2.
28.3.
28.4.
28.5.
28.6.
28.7.
:
) Internet, , ;
) World Wide Web;
) HyperText Transfer Protocol (HTTP);
r) HyperText Markup Language (HTML);
) Uniform Resource Locator (URL).
"/"
"/".
Web?
Web ?
CGI
Web.
cookie-
.
JDBC and SQLJ?
ASP JSP?
28.8. Web,
.
, 28.4-28.10.
28.9. , Web- . , 18.5.
28.10. Web,
, DreamHome.
28. Web-
1171
http://openlib.org.ua/
28.11. , 28.10, .
282. Web- , DreamHome.
28.13. 28.10 28.12 Wellmeadows.
28.14. Web- , 5.7-5.28.
28.15. Web-
:
W3C http://www.w3.org;
Microsoft http://www.microsoft.com;
Oracle http://www.oracle.com;
Informix http://www.informix.com;
IBM http: //www. ibm. com;
.Sybase h t t p : / / w w w . sybase.com;
Sun (Java) http://java.sun.com;
Gemstone http://www.gemstone.com;
Objectivity http://www.objectivity.com;
ObjectStore http://www.odi.com;
Poet http://www.poet.com;
Apache http://www.apache.org;
mySQL http ://www.mysql. com;
PostgreSQL http://www.postgresql.com;
Perl http: //www.perl .com;
PHP http://www.php.net.
28.16. , DreamHome DreamHome no Internet. ,
,
.
DreamHome.
1172
VII.
http://openlib.org.ua/
1_
...
.
(Object
Exchange Model OEM),
.
Lore Lorel.
XML.
XML.
(Document Type
Definitions DTD)
XML.
(Document Object Model DOM)
OEM.
XML: Namespaces, XSL
XSLT, XPath, XPointer, XLink XHTML.
DTD
XML Schema W3C.
RDF
RDF Schema.
W3C Query Language.
XML 1.0 W3C (World Wide Web
Consortium) 1998 ,
XML .
, ,
, ,
, .
EDI (Electronic Data Interchange )
. , XML Internet, .
, Web, , , XML. ,
http://openlib.org.ua/
, XML, ; , ,
,
,
- . XML, a
. , XML, ,
, XML.
29.1 , (Object Exchange Model OEM).
Lore, , Lorel. 29.2 XML
,
Web. 29.3 XML, Namespaces,
XSL, XPath, XPointer XLink.
XML Schema
XML RDF (Resource Description Framework
) . 29.4
W3C XML. ,
, DreamHome, 10.4 .
29.1.
, ' , .
,
, , . , - ,
(schema-less) (self-describing).
, , ,
.
, , . , ,
, , ,
. - ,
, (1174
VII.
http://openlib.org.ua/
) . , , .
. .
, Web,
, .
,
,
, .
XML (extensible Markup Language ) Web
, XML .
,
,
. ,
, . ,
.
, , .
I 29.1.
, 29.1, ,
DreamHome.
, . 29.1.
( 22 Deer Rd), (John White
Ann Beech) ,
( , , 2 Manor Rd 18 Dale Rd);
. , , :
John White ,
Ann Beech ,
;
, 2 Manor Rd,
, ,
18 Dale Rd, ;
2 Manor Rd (flat) , 16 Dale Rd (house)
.
29. 1_
1175
http://openlib.org.ua/
29.1 .
DreamHome
DreamHome (&1)
Branch (&2)
street (&7) "22 Deer Rd"
Manager &3
Staff (&3)
name ( &8 )
fName (&17) "John"
IName (8) "White
ManagerOf &2
Staff (&4)
name (&9) "Ann Beech"
salary (&10) 12000
Oversees &5
Oversees &6
PropertyForRent ( &5 )
street (&11) "2 Manor Rd"
type (2) "Flat"
monthlyRent
()
375
OverseenBy &4
PropertyForRent ( &6 )
Street (&14) "18 Dale Rd"
type (&15) 1
annualRent
( 6 )
7200
OverseenBy &4
DreamHome
Branch
name/
street
IName
John'
"Ann
Beech"
\salary street/type
12000
"Flat"
\monthlyRentstreet
375
type\ annualRent
720C
Manor Rd'
"White"
. 29.1. , 29.1
VII.
http://openlib.org.ua/
29.1.1. (OEM)
(Object Exchange Model OEM).
,
TSIMMIS (The Stanford-IBM Manager of Multiple
Information Sources) ,
[246]. OEM
.
, ( . 29.1).
OEM
(, &7), (street), ()
("22 Deer Rd"). . (
). , . .
, , . OEM
OEM. OEM .
.
(label) , ( , OEM, ); ,
. . ,
(, DreamHome , &1).
OEM {label, old, type,
value). , , Staff
( &4), name salary, name ( &9),
"Ann Beech", salary ( &1Q),
12000.
(Staff,
&4, ,
{&9,
&10}}
OEM , ,
.
1177
http://openlib.org.ua/
(OEM) Lore
1
XML.
Lore ,
, ,
( XML) . Lore , .
Lore Lorel (Lore language
Lore);
(Object Query Language), 26.2.4 [1].
Lorel :
,
;
,
, ;
, ;
, ;
, .
Lorel ,
( ),
. (path expression) (La. L 2 . . . Ln), . ,
. 29.1 DreatnHome .PropertyForRent (&5, }. ,
DreamHome. PropertyFarRent. street , {"2 Manor Rd", "18 Dale Rd 11 }.
Lorel , : "|" , "?" , , "+" ,
, ***** , . ,
DreamHome. {Branch | PropertyForRent.) .street , DreamHome, Branch
PropertyForRent, street. ,
. Lorel . "%"
, "#" (%)*. , DreamHome .#. street , DreamHome
street; . 1
1178
VII.
http://openlib.org.ua/
grep UNIX.
, :
DreamHome.#. (name | name,11 [fF]Name")
, DreamHome name, name,
fName, .
Lorel ,
SQL, Lorel :
SELECT a FROM WHERE p
, , b , ,
,
. , FROM , ,
FROM. Lorel , 29.1.
I 29.2. Lore!
. , Ann Beech.
SELECT s.Oversees
FROM DreamHome.Staff s
WHERE s.name = "Ann Beech"
FROM &3 &4.
WHERE &4.
SELECT ,
Answer
PropertyForRent &5
street &11 "2 Manor Rd"
type &12 "Flat"
monthlyRent 375
OverseenBy &4
PropertyForRent &6
street &14 "13 Dale Rd"
type 5 1
annualRent &16 7200
OverseenBy &4
Answer. Answer , .
- , FROM.
. , .
SELECT DreamHome.PropertyForRent
WHERE DreamHome,PropertyForRent.annualRent
29. XML
1179
http://openlib.org.ua/
FROM
annualRent (DreamHome. PropertyForRent. annualRent).
:
Answer
PropertyForRent &6
street &14 "16 Dale Rd"
type &15 1
annualRent &16 7200
OverseenBy &4
. ,
.
SELECT DreamHome.Staff.Name
WHERE DreamHome.Staff SATISFIES
2 <= COUNT (SELECT DrearaHome.Staff
WHERE DreamHome.Staff.Oversees)
Lorel SQL (COUNT, SUM,
MIN, MAX, AVG)
SELECT, WHERE.
COUNT WHERE. :
Answer
DataGuide
1
. , . , , , .
Lore DataGuide ,
[130], [131]. DataGuide
:
DataGuide ;
, QataGuide,
;
DataGuide OEM ( XML),
1
, .
DataGuide, , . 29.1,
. 29.2. ,
.
DataGuide . , , . 29.1 Staff .Oversees. annualRent, VII.
http://openlib.org.ua/
Branch
street
29. 1_
1181
http://openlib.org.ua/
DreamHome
Dream Home
PropertyForRent
PropertyForRent
Branch
street
street
number
number
a)
n)
29.2. XML
,
Web, HTML. ,
HTML , . ,
, . , HTML ,
,
HTML
. ,
HTML, . , , Web HTML.
HTML
W3C XML (extensible Markup Language ). , HTML
, [313].
F XML. ( ), ,
| ; HTML
XML SGML (Standard
Generalized Markup Language );
Web. XML -
1182
VII.
http://openlib.org.ua/
, , HTML. , XML
, ,
HTML .
SGML
, [169].
SGML ,
.
; , . (Document Type Definition DTD). SGML
, ,
.
,
.
XML ,
. , XML
SGML: , . XML SGML, , SGML, XML ( ).
XML SGML.
HTML, SGML
. XML HTML Web . XML
,
, .. . , XML, MathML
(Mathematics Markup Language ), SMIL
(Synchronized Multimedia Integration Language ) CML (Chemistry Markup
Language ).
XML
( , XML 1.0
W3C 1998 ),
, , , . ,
XML ,
. XML , ,
Oracle, Informix Sybase.
XML
EDI (Electronic
Data Interchange ), .
29. 1_
1183
http://openlib.org.ua/
, XML
Internet, .
XML XML. XML, XML.
XML
XML Web
. 29.1.
29.1. XML
;
,
. XML , 50 .
, ,
.
; . XML .
SGML, ISO. XML (ISO 10646), Unicode, , , .
. HTML, XML ; .
. XML XML .
.
XML (, ). . , ,
184
VII.
http://openlib.org.ua/
, , , . ,
, Java,
, " ". XML , "
", , ,
XML , .
. XML ( ) ;
.
. . XML
. ,
,
,
.
,
. XML ,
,
. , XML
, , - .
.
, HTML, . XML .
. -,
XML , .
29.2.1. XML
XML , 29.2, .
29.2. XML,
<?xml version= " 1 . 0 " encoding= "UTF-8" standalone= "yes"?>
<?xml:stylesheet type = "text/xsl" href = " s t a f f _ l i s t . x s l " ? >
29. XML
1185
http://openlib.org.ua/
<STAFFNO>SL2K/STAFFNO>
<>
<FNAME>John</FNAME><LNAME>White</LNAME>
</NAME>
<POSITION>Manager</POSITION>
<DOB>l-Oct-45</DOB>
<SALARY>3 </SALARY>
</STAFF>
<STAFF branchNo = "B003">
<STAFFNO>SG37</STAFFNO>
<KAME>
<FNAME>Ann</FMAMExLNAME>Beech</LNAME>
</NAME>
<POSITION>Assistant</POSITION>
<SALARY>12000</SALARY>
</STAFF>
:/STAFFLIST>
XML
XML XML,
XML, (1.0), (UTF-8 Unicode), a
,
(standalone = 'yes' , ). XML,
29.2, DTD,
.
XML, , .
,
(). XML
, <STAFFLIST>. (, <STAFF>) (, </STAFF>). XML , <STAFF>
< s t a f f > ( , HTML ).
,
, <EMPTYELEMENT />.
, 29.2:
<STAFF>
<NAME>
<FNAME>John</FNAMExLNAME>White</LNAME>
</NAME>
</STAFF>
NAME STAFF,
FNAME LNAME NAME.
1186
VII.
http://openlib.org.ua/
"-", .
, . ,
, , branchNo STAFF:
<STAFF branchNo = " 0 0 5 " >
, STAFF. ,
:
<SEX gender = "M"/>
,
. , :
?
, :
;
Unicode
(, , );
. , (<) .
,
, XML It,
<.
,
XML .
(&) (;), <.
29. XML
1187
http://openlib.org.ua/
CDATA
CDATA XML ,
.
. <? pidata?>,
name .
, XML , , , , .
, 29.1, , ,
XML . ,
XML FNAME LNAME
:
<FNAME>John</FNAME>
<LNAME>White</LNAME>
</NAME> .
<LNAME>White</LNAME>
<FNAME>John</FNAME>
</NAME>
, XML ,
XML :
<NAME FNAME = "John" LNAME * " W h i t e " / >
<NAME LNAME = "White" FNAME = "John"/>
29.2.2. (DTD)
: DTD. [.
:;>:.
..
..
'
. .'.' ; - '
VII.
http://openlib.org.ua/
, XML. , 29.3
( )
STAFFLIST:
<'ELEMENT
STAFFLIST
(STAFF)*>
29.3. ,
29.2
<\ELEMENT
<1ELEMENT
<!ELEMENT
<<ELEMENT
<IELEMENT
<!ELEMENT
<!ELEMENT
<!ELEMENT
<1ATTLIST
STAFFLIST (STAFF)*>
STAFF (NAME, POSITION, DOB?, SALARY)>
NAME (FNAME, LNAME}>
FNAME (#PCDATA)>
LNAME (#PCDATA)>
POSITION (ftPCDATA)>
DOB (#PCDATA)>
SALARY {#PCDATA)>
STAFF branchNo CDATA ft!MPLIED>
, STAFFLIST STAFF,
. :
(*) ,
;
"" (+) , ;
(?) ,
, .
, , . , , , .
, STAFF :
<'ELEMENT STAFF (NAME, POSITION, DOB?, SALARY)>
1189
http://openlib.org.ua/
, , ,
, ,, : ,
. .
CDATA. , . , , XML .
ID. ,
. ID ,
ID, , .
IDREF IDREFS. , ID
. IDREFS IDREF, .
ENTITY ENTITIES, , . ENTITIES
ENTITY, .
NMTOKEN NMTOKENS. , , . NMTOKENS
NMTOKEN, .
. , (
, ).
, branchNo STAFF:
< LATTLIST STAFF branchNo CDATA #IMPLIED>
, branchNo
(CDATA character data) (^IMPLIED), a
. ^IMPLIED, #REQUIRED, , .
, . ,
, ,
ttFIXED. , SEX
gender (), ( ),
F, :
<!ATTLIST SEX gender ( | F } "">
, , DTD , . ,
1190
VII.
http://openlib.org.ua/
XML . ,
"DreamHome Estate Agents" :
<1ENTITY DH "DreamHome Estate Agents">
. ,
,
, , :
<!ENTITY dreamHomeLogo SYSTEM "dreamhome.jpg" NDATA JPEGFormat>
<!NOTATION JPEGFormat SYSTEM " h t t p : / / w w w . j p e g . o r g " >
NDATA ,
; , , . , .
, ID
ID
, XML
ID, .
, IDREF
, IDREFS . , Branch Has Staff,
BRANCH STAFF:
<!ATTLIST STAFF s t a f f N o ID #REQUIRED>
<!ATTLIST BRANCH s t a f f IDREFS #IMPLIED>
, 29.4.
29.4. IDREFS
<STAFF staffNo = "SL21">
<NAME>
<FNAME>John</FNAME><LNAME>White</LNAME>
</NAME>
</STAFF>
<STAFF staffNo = "SL41">
<NAME>
<FNAME>Julie</FNAMExLNAME>Lee</LNAME>
</NAME>
</STAFF>
BRANCH staff = "SL21 SL41">
<BRANCHNO>B005</BRANCHNO>
</BRANCH>
XML 1 : . , , 29.
1191
http://openlib.org.ua/
XML ,
. XML, ,
XML. , XML
:
XML <?xml version
"l.0"?>;
;
, - ;
.
, , , XML , ,
DTD; XML . ,
DTD XML
. W3C
, DTD XML Schema.
XML Schema, , XML, XML Schema.
29.3. XML
, XML,
XML,
(Document Object Model DOM)
API- XML (Simple API for XML SAX),
Namespaces, (extensible Stylesheet
Language XSL) (extensible Stylesheet Language for Transformations XSLT), XML (XML Path Language XPath), XML
(XML Pointer Language XPointer), XML (XML Linking
Language XLink), XHTML, XML Schema
(Resource Description Framework RDF).
VII.
http://openlib.org.ua/
John
White
29. XML
1193
http://openlib.org.ua/
29.3.2. Namespaces
Namespaces
, XML.
, , .
,
. ,
.
W3C [309].
URI.
, , .
("http: //www. dreamhome. co.uk/branch5/")
, , , ,
, . ("http://www.dreamhome.co.uk/HQ/") (hq), SALARY , :
<STAFFLIST xmlns = "http://www.dreamhome.co.uk/branch5/ 1 1
xmlns:hq = "http://www.dreamhome.co.uk/HQ/">
<STAFF branchNo = " B 0 0 5 " >
<STAFFNO>SL21</STAFFNO>
<hq:SALARY>30000</hq:SALARY>
</STAFF>
</STAFFLIST>
(Cascading
Stylesheet
Specification CSS). HTML, XML , . XML
CSS, . W3C
, (extensible
Stylesheet Language XSL), XML, XML . CSS, .
(extensible
Stylesheet Language for Transformations XSLT) XSL. , ,
XML XML, HTML
( SQL). XSLT
1194
VII.
http://openlib.org.ua/
Web- , ,
,
CSS.
XSLT ,
.
,
.
( ).
XSLT ( , XSLT)
XSLT. 29.5 XSL,
XML, 29.2.
29.5. XSL,
XML, 29.2
<?xml version="l.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl .-template match="/">
<html>
<body background ="sky.jpg">
<center><h2xi>DreamHome</i>Estate Agents</h2></center>
<table border-"I bgcolor="#ffffff ">
<tr>
<th bgcolor= "ftcOcOcO" bordercolor= "#000000">staffNo</th>
<[-- -->
</tr>
<XSl:for-each select= "STAFFLIST/STAFF">
<tr>
<td bordercolor="#ctjcOcQ"><xsl: value-of
select="STAFFNO"/>
</td>
<td
border-color ="#cOcOcO"xxsl rvalue-of select=
11
NAME/FNAME"/x/td>
<!-- -->
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
1195
http://openlib.org.ua/
, , .
.
XPath , , XML, XPath XML, URI.
XPath XML
() , , , , , ,
. ( ) (
XML
XML). XPointer. , (/),
, / (
).
.
(basis) ,
.
. ,
, t e x t ( ) ( , ) node () ( ).
XPath 13 , ancestor (), attribute
() child (). , . 29.4,
STAFF child, (STAFFNO, NAME,
POSITION, DOB SALARY).
. ,
[positionO = positionNumber], positionNumber , 1. XPath . . 29.2.
29.2.
()
//
()
/child:: STAFF
STAFF,
child:: STAFF
( STAFF)
STAFF,
attribute : branchNo
{ branchNo)
branchNo
attribute: : *
( *)
1196
VII.
http://openlib.org.ua/
. 29.2
STAFF,
STAFF,
branchHo, BOOS
STAFF,
branchNo, BOOS
[position () =1]
1197
http://openlib.org.ua/
29.3.7. XHTML
XHTML (extensible HTML HTML) 1.0
HTML 4.01, XML 1.0.
HTML
HTML. , :
;
XHTML ;
,
;
name ID;
XML.
, XML
. , ,
complexType. ,
STAFFLIST, , complexType.
STAFFLIST
sequence. - (compositor), :
1198
VII.
http://openlib.org.ua/
(Next-OfKin NOK)
<xsd:element name="NOK" type="xsd:string" minOccurs="0"
naxOccurs="3"/>
, ( ), ,
, . 29. XML
1199
http://openlib.org.ua/
(reference) ,
, . ,
STAFFNO :
<xsd:element name="STAFFNO" type="xsd:string"/>
,
STAFFNO, .
<xsd:element ref="STAFFNO"/>
XML - ,
STAFFNO,
.
XML Schema . ,