1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571
|
ij> AUTOCOMMIT OFF;
ij> -- MODULE DML104
-- SQL Test Suite, V6.0, Interactive SQL, dml104.sql
-- 59-byte ID
-- TEd Version #
-- AUTHORIZATION FLATER
set schema FLATER;
0 rows inserted/updated/deleted
ij> --O SELECT USER FROM HU.ECCO;
VALUES USER;
1
--------------------------------------------------------------------------------------------------------------------------------
FLATER
ij> -- RERUN if USER value does not match preceding AUTHORIZATION comment
ROLLBACK WORK;
ij> -- date_time print
-- TEST:0591 NATURAL JOIN (feature 4) (static)!
CREATE TABLE GROUPS1
(EMPNUM INT, GRP INT);
0 rows inserted/updated/deleted
ij> -- PASS:0591 If table is created?
CREATE TABLE NAMES1
(EMPNUM INT, NAME CHAR(5));
0 rows inserted/updated/deleted
ij> -- PASS:0591 If table is created?
SELECT * FROM NAMES1 JOIN GROUPS1 ON (NAMES1.EMPNUM=GROUPS1.EMPNUM);
EMPNUM |NAME |EMPNUM |GRP
-----------------------------------------
ij> CREATE VIEW NAMGRP1 (EMPNUM, NAME, NEMPNUM, GRP) AS
--O SELECT * FROM NAMES1 NATURAL JOIN GROUPS1;
SELECT * FROM NAMES1 JOIN GROUPS1 ON (NAMES1.EMPNUM=GROUPS1.EMPNUM);
0 rows inserted/updated/deleted
ij> -- PASS:0591 If view is created?
COMMIT WORK;
ij> INSERT INTO GROUPS1 VALUES (0, 10);
1 row inserted/updated/deleted
ij> -- PASS:0591 If 1 row is inserted?
INSERT INTO GROUPS1 VALUES (1, 20);
1 row inserted/updated/deleted
ij> -- PASS:0591 If 1 row is inserted?
INSERT INTO GROUPS1 VALUES (2, 30);
1 row inserted/updated/deleted
ij> -- PASS:0591 If 1 row is inserted?
INSERT INTO GROUPS1 VALUES (3, 40);
1 row inserted/updated/deleted
ij> -- PASS:0591 If 1 row is inserted?
INSERT INTO NAMES1 VALUES (5, 'HARRY');
1 row inserted/updated/deleted
ij> -- PASS:0591 If 1 row is inserted?
INSERT INTO NAMES1 VALUES (1, 'MARY');
1 row inserted/updated/deleted
ij> -- PASS:0591 If 1 row is inserted?
INSERT INTO NAMES1 VALUES (7, 'LARRY');
1 row inserted/updated/deleted
ij> -- PASS:0591 If 1 row is inserted?
INSERT INTO NAMES1 VALUES (0, 'KERI');
1 row inserted/updated/deleted
ij> -- PASS:0591 If 1 row is inserted?
INSERT INTO NAMES1 VALUES (9, 'BARRY');
1 row inserted/updated/deleted
ij> -- PASS:0591 If 1 row is inserted?
SELECT EMPNUM
FROM NAMGRP1
WHERE NAME = 'KERI'
AND GRP = 10;
EMPNUM
-----------
0
ij> -- PASS:0591 If 1 row is selected and EMPNUM = 0?
SELECT EMPNUM
FROM NAMGRP1
WHERE NAME = 'MARY'
AND GRP = 20;
EMPNUM
-----------
1
ij> -- PASS:0591 If 1 row is selected and EMPNUM = 1?
SELECT COUNT(*)
FROM NAMGRP1
WHERE (NAME <> 'MARY'
AND NAME <> 'KERI')
OR GRP <> 20
AND GRP <> 10
OR EMPNUM <> 0
AND EMPNUM <> 1
OR NAME IS NULL
OR GRP IS NULL
OR EMPNUM IS NULL;
1
-----------
0
ij> -- PASS:0591 If count = 0?
ROLLBACK WORK;
ij> --O DROP TABLE NAMES1 CASCADE;
DROP VIEW NAMGRP1 ;
0 rows inserted/updated/deleted
ij> DROP TABLE NAMES1 ;
0 rows inserted/updated/deleted
ij> -- PASS:0591 If table and view are dropped?
--O DROP TABLE GROUPS1 CASCADE;
DROP TABLE GROUPS1 ;
0 rows inserted/updated/deleted
ij> -- PASS:0591 If table is dropped?
COMMIT WORK;
ij> -- END TEST >>> 0591 <<< END TEST
-- *********************************************
-- TEST:0592 INNER JOIN (feature 4) (static)!
CREATE TABLE GROUPS2
(EMPNUM SMALLINT, GRP INT);
0 rows inserted/updated/deleted
ij> -- PASS:0592 If table is created?
CREATE TABLE NAMES2
(EMPNUM INT, NAME CHAR(5));
0 rows inserted/updated/deleted
ij> -- PASS:0592 If table is created?
CREATE VIEW NAMGRP2 (EMPNUM, NAME, NEMPNUM, GRP) AS
SELECT * FROM NAMES2 INNER JOIN GROUPS2 ON (NAMES2.EMPNUM=GROUPS2.EMPNUM);
0 rows inserted/updated/deleted
ij> -- PASS:0592 If view is created?
CREATE VIEW NMGRP2 (EMPNUM, NAME, NEMPNUM, GRP) AS
SELECT * FROM NAMES2 JOIN GROUPS2
ON (NAMES2.EMPNUM=GROUPS2.EMPNUM) WHERE NAMES2.EMPNUM > 0;
0 rows inserted/updated/deleted
ij> -- PASS:0592 If view is created?
COMMIT WORK;
ij> INSERT INTO GROUPS2 VALUES (0, 10);
1 row inserted/updated/deleted
ij> -- PASS:0592 If 1 row is inserted?
INSERT INTO GROUPS2 VALUES (1, 20);
1 row inserted/updated/deleted
ij> -- PASS:0592 If 1 row is inserted?
INSERT INTO GROUPS2 VALUES (2, 30);
1 row inserted/updated/deleted
ij> -- PASS:0592 If 1 row is inserted?
INSERT INTO GROUPS2 VALUES (3, 40);
1 row inserted/updated/deleted
ij> -- PASS:0592 If 1 row is inserted?
INSERT INTO NAMES2 VALUES (5, 'HARRY');
1 row inserted/updated/deleted
ij> -- PASS:0592 If 1 row is inserted?
INSERT INTO NAMES2 VALUES (1, 'MARY');
1 row inserted/updated/deleted
ij> -- PASS:0592 If 1 row is inserted?
INSERT INTO NAMES2 VALUES (7, 'LARRY');
1 row inserted/updated/deleted
ij> -- PASS:0592 If 1 row is inserted?
INSERT INTO NAMES2 VALUES (0, 'KERI');
1 row inserted/updated/deleted
ij> -- PASS:0592 If 1 row is inserted?
INSERT INTO NAMES2 VALUES (9, 'BARRY');
1 row inserted/updated/deleted
ij> -- PASS:0592 If 1 row is inserted?
SELECT EMPNUM
FROM NAMGRP2
WHERE NAME = 'KERI'
AND GRP = 10;
EMPNUM
-----------
0
ij> -- PASS:0592 If 1 row is selected and EMPNUM = 0?
SELECT EMPNUM
FROM NAMGRP2
WHERE NAME = 'MARY'
AND GRP = 20;
EMPNUM
-----------
1
ij> -- PASS:0592 If 1 row is selected and EMPNUM = 1?
SELECT COUNT(*)
FROM NAMGRP2
WHERE NAME <> 'MARY'
AND NAME <> 'KERI'
OR GRP <> 20
AND GRP <> 10
OR EMPNUM <> 0
AND EMPNUM <> 1
OR NAME IS NULL
OR GRP IS NULL
OR EMPNUM IS NULL;
1
-----------
0
ij> -- PASS:0592 If count = 0?
SELECT EMPNUM
FROM NMGRP2
WHERE NAME = 'MARY'
AND GRP = 20;
EMPNUM
-----------
1
ij> -- PASS:0592 If 1 row is selected and EMPNUM = 1?
SELECT COUNT(*)
FROM NMGRP2
WHERE NAME <> 'MARY'
OR GRP <> 20
OR EMPNUM <> 1
OR NAME IS NULL
OR GRP IS NULL
OR EMPNUM IS NULL;
1
-----------
0
ij> -- PASS:0592 If count = 0?
ROLLBACK WORK;
ij> --O DROP TABLE NAMES2 CASCADE;
DROP VIEW NMGRP2 ;
0 rows inserted/updated/deleted
ij> DROP VIEW NAMGRP2 ;
0 rows inserted/updated/deleted
ij> DROP TABLE NAMES2 ;
0 rows inserted/updated/deleted
ij> -- PASS:0592 If table and 2 views are dropped?
--O DROP TABLE GROUPS2 CASCADE;
DROP TABLE GROUPS2 ;
0 rows inserted/updated/deleted
ij> -- PASS:0592 If table is dropped?
COMMIT WORK;
ij> -- END TEST >>> 0592 <<< END TEST
-- *********************************************
-- TEST:0593 LEFT OUTER JOIN (feature 4) (static)!
CREATE TABLE GROUPS3
(EMPNUM INT, GRP INT);
0 rows inserted/updated/deleted
ij> -- PASS:0593 If table is created?
CREATE TABLE NAMES3
(EMPNUM INT, NAME CHAR(5));
0 rows inserted/updated/deleted
ij> -- PASS:0593 If table is created?
CREATE VIEW NAMGRP3 (EMPNUM, NAME, NEMPNUM, GRP) AS
SELECT * FROM NAMES3 LEFT OUTER JOIN GROUPS3 ON (NAMES3.EMPNUM=GROUPS3.EMPNUM);
0 rows inserted/updated/deleted
ij> -- PASS:0593 If view is created?
CREATE VIEW NMGRP3 (NAME, GRP) AS
SELECT NAME, GRP FROM NAMES3 LEFT OUTER JOIN GROUPS3
ON NAMES3.EMPNUM < GROUPS3.EMPNUM
WHERE NAME <> 'KERI';
0 rows inserted/updated/deleted
ij> -- PASS:0593 If view is created?
COMMIT WORK;
ij> INSERT INTO GROUPS3 VALUES (0, 10);
1 row inserted/updated/deleted
ij> -- PASS:0593 If 1 row is inserted?
INSERT INTO GROUPS3 VALUES (1, 20);
1 row inserted/updated/deleted
ij> -- PASS:0593 If 1 row is inserted?
INSERT INTO GROUPS3 VALUES (2, 30);
1 row inserted/updated/deleted
ij> -- PASS:0593 If 1 row is inserted?
INSERT INTO GROUPS3 VALUES (3, 40);
1 row inserted/updated/deleted
ij> -- PASS:0593 If 1 row is inserted?
INSERT INTO NAMES3 VALUES (5, 'HARRY');
1 row inserted/updated/deleted
ij> -- PASS:0593 If 1 row is inserted?
INSERT INTO NAMES3 VALUES (1, 'MARY');
1 row inserted/updated/deleted
ij> -- PASS:0593 If 1 row is inserted?
INSERT INTO NAMES3 VALUES (7, 'LARRY');
1 row inserted/updated/deleted
ij> -- PASS:0593 If 1 row is inserted?
INSERT INTO NAMES3 VALUES (0, 'KERI');
1 row inserted/updated/deleted
ij> -- PASS:0593 If 1 row is inserted?
INSERT INTO NAMES3 VALUES (9, 'BARRY');
1 row inserted/updated/deleted
ij> -- PASS:0593 If 1 row is inserted?
SELECT COUNT(*)
FROM NAMGRP3
WHERE EMPNUM = 0
AND NAME = 'KERI'
AND GRP = 10;
1
-----------
1
ij> -- PASS:0593 If count = 1?
SELECT COUNT(*)
FROM NAMGRP3
WHERE EMPNUM = 1
AND NAME = 'MARY'
AND GRP = 20;
1
-----------
1
ij> -- PASS:0593 If count = 1?
SELECT COUNT(*)
FROM NAMGRP3
WHERE EMPNUM = 5
AND NAME = 'HARRY'
AND GRP IS NULL;
1
-----------
1
ij> -- PASS:0593 If count = 1?
SELECT COUNT(*)
FROM NAMGRP3
WHERE EMPNUM = 7
AND NAME = 'LARRY'
AND GRP IS NULL;
1
-----------
1
ij> -- PASS:0593 If count = 1?
SELECT COUNT(*)
FROM NAMGRP3
WHERE EMPNUM = 9
AND NAME = 'BARRY'
AND GRP IS NULL;
1
-----------
1
ij> -- PASS:0593 If count = 1?
SELECT COUNT(*)
FROM NAMGRP3;
1
-----------
5
ij> -- PASS:0593 If count = 5?
SELECT COUNT(*)
FROM NMGRP3
WHERE NAME = 'HARRY'
AND GRP IS NULL;
1
-----------
1
ij> -- PASS:0593 If count = 1?
SELECT COUNT(*)
FROM NMGRP3
WHERE NAME = 'MARY'
AND GRP = 30;
1
-----------
1
ij> -- PASS:0593 If count = 1?
SELECT COUNT(*)
FROM NMGRP3
WHERE NAME = 'MARY'
AND GRP = 40;
1
-----------
1
ij> -- PASS:0593 If count = 1?
SELECT COUNT(*)
FROM NMGRP3
WHERE NAME = 'BARRY'
AND GRP IS NULL;
1
-----------
1
ij> -- PASS:0593 If count = 1?
SELECT COUNT(*)
FROM NMGRP3
WHERE NAME = 'LARRY'
AND GRP IS NULL;
1
-----------
1
ij> -- PASS:0593 If count = 1?
SELECT COUNT(*)
FROM NMGRP3;
1
-----------
5
ij> -- PASS:0593 If count = 5?
ROLLBACK WORK;
ij> --O DROP TABLE NAMES3 CASCADE;
DROP VIEW NMGRP3 ;
0 rows inserted/updated/deleted
ij> DROP VIEW NAMGRP3 ;
0 rows inserted/updated/deleted
ij> DROP TABLE NAMES3 ;
0 rows inserted/updated/deleted
ij> -- PASS:0593 If table and 2 views are dropped?
--O DROP TABLE GROUPS3 CASCADE;
DROP TABLE GROUPS3 ;
0 rows inserted/updated/deleted
ij> -- PASS:0593 If table is dropped?
COMMIT WORK;
ij> -- END TEST >>> 0593 <<< END TEST
-- *********************************************
-- TEST:0594 RIGHT OUTER JOIN (feature 4) (static)!
CREATE TABLE GROUPS4
(EMPNUM INT, GRP INT);
0 rows inserted/updated/deleted
ij> -- PASS:0594 If table is created?
CREATE TABLE NAMES4
(EMPNUM DECIMAL (4, 2), NAME CHAR(5));
0 rows inserted/updated/deleted
ij> -- PASS:0594 If table is created?
CREATE VIEW NAMGRP4 (NEMPNUM, NAME, EMPNUM, GRP) AS
SELECT * FROM NAMES4 RIGHT OUTER JOIN GROUPS4 ON (NAMES4.EMPNUM=GROUPS4.EMPNUM);
0 rows inserted/updated/deleted
ij> -- PASS:0594 If view is created?
COMMIT WORK;
ij> INSERT INTO GROUPS4 VALUES (0, 10);
1 row inserted/updated/deleted
ij> -- PASS:0594 If 1 row is inserted?
INSERT INTO GROUPS4 VALUES (1, 20);
1 row inserted/updated/deleted
ij> -- PASS:0594 If 1 row is inserted?
INSERT INTO GROUPS4 VALUES (2, 30);
1 row inserted/updated/deleted
ij> -- PASS:0594 If 1 row is inserted?
INSERT INTO GROUPS4 VALUES (3, 40);
1 row inserted/updated/deleted
ij> -- PASS:0594 If 1 row is inserted?
INSERT INTO NAMES4 VALUES (5.0, 'HARRY');
1 row inserted/updated/deleted
ij> -- PASS:0594 If 1 row is inserted?
INSERT INTO NAMES4 VALUES (1.0, 'MARY');
1 row inserted/updated/deleted
ij> -- PASS:0594 If 1 row is inserted?
INSERT INTO NAMES4 VALUES (7.0, 'LARRY');
1 row inserted/updated/deleted
ij> -- PASS:0594 If 1 row is inserted?
INSERT INTO NAMES4 VALUES (0.0, 'KERI');
1 row inserted/updated/deleted
ij> -- PASS:0594 If 1 row is inserted?
INSERT INTO NAMES4 VALUES (9.0, 'BARRY');
1 row inserted/updated/deleted
ij> -- PASS:0594 If 1 row is inserted?
SELECT COUNT(*)
FROM NAMGRP4
WHERE EMPNUM = 0
AND NAME = 'KERI'
AND GRP = 10;
1
-----------
1
ij> -- PASS:0594 If count = 1?
SELECT COUNT(*)
FROM NAMGRP4
WHERE EMPNUM = 1
AND NAME = 'MARY'
AND GRP = 20;
1
-----------
1
ij> -- PASS:0594 If count = 1?
SELECT COUNT(*)
FROM NAMGRP4
WHERE EMPNUM = 2
AND NAME IS NULL
AND GRP = 30;
1
-----------
1
ij> -- PASS:0594 If count = 1?
SELECT COUNT(*)
FROM NAMGRP4
WHERE EMPNUM = 3
AND NAME IS NULL
AND GRP = 40;
1
-----------
1
ij> -- PASS:0594 If count = 1?
SELECT COUNT(*)
FROM NAMGRP4;
1
-----------
4
ij> -- PASS:0594 If count = 4?
ROLLBACK WORK;
ij> --O DROP TABLE NAMES4 CASCADE;
DROP VIEW NAMGRP4 ;
0 rows inserted/updated/deleted
ij> DROP TABLE NAMES4 ;
0 rows inserted/updated/deleted
ij> -- PASS:0594 If table and view are dropped?
--O DROP TABLE GROUPS4 CASCADE;
DROP TABLE GROUPS4 ;
0 rows inserted/updated/deleted
ij> -- PASS:0594 If table is dropped?
COMMIT WORK;
ij> -- END TEST >>> 0594 <<< END TEST
-- *************************************************////END-OF-MODULE
;
ij>
|