File: dml158.out

package info (click to toggle)
derby 10.14.2.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 79,056 kB
  • sloc: java: 691,961; sql: 42,686; xml: 20,512; sh: 3,373; sed: 96; makefile: 60
file content (111 lines) | stat: -rw-r--r-- 3,776 bytes parent folder | download | duplicates (4)
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
ij> AUTOCOMMIT OFF;
ij> -- MODULE  DML158  

-- SQL Test Suite, V6.0, Interactive SQL, dml158.sql
-- 59-byte ID
-- TEd Version #

-- AUTHORIZATION HU
   set schema HU;
0 rows inserted/updated/deleted
ij> --O   SELECT USER FROM HU.ECCO;
  VALUES USER;
1                                                                                                                               
--------------------------------------------------------------------------------------------------------------------------------
HU                                                                                                                              
ij> -- RERUN if USER value does not match preceding AUTHORIZATION comment
   ROLLBACK WORK;
ij> -- date_time print

-- TEST:0857 <join condition> set function, outer reference! Error

   DELETE FROM WORKS
     WHERE EXISTS 
     (SELECT * FROM PROJ JOIN STAFF
      ON PROJ.CITY <> STAFF.CITY
      AND EMPNUM = WORKS.EMPNUM
      AND PNUM = WORKS.PNUM);
ERROR 42X04: Column 'WORKS.EMPNUM' is either not in any table in the FROM list or appears within a join specification and is outside the scope of the join specification or appears in a HAVING clause and is not in the GROUP BY list. If this is a CREATE or ALTER TABLE  statement then 'WORKS.EMPNUM' is not a column in the target table.
ij> -- PASS:0857 If ERROR OR SQLSTATE = 42X04

   SELECT EMPNUM, PNUM FROM WORKS
       ORDER BY EMPNUM, PNUM;
EM&|PN&
-------
E1 |P1 
E1 |P2 
E1 |P3 
E1 |P4 
E1 |P5 
E1 |P6 
E2 |P1 
E2 |P2 
E3 |P2 
E4 |P2 
E4 |P4 
E4 |P5 
ij> -- PASS:0857 If 12 rows are returned in the following order?
--                 empnum    pnum
--                 ======    ====
-- PASS:0857 If    E1        P1  ?
-- PASS:0857 If    E1        P2  ?
-- PASS:0857 If    E1        P3  ?
-- PASS:0857 If    E1        P4  ?
-- PASS:0857 If    E1        P5  ?
-- PASS:0857 If    E1        P6  ?
-- PASS:0857 If    E2        P1  ?
-- PASS:0857 If    E2        P2  ?
-- PASS:0857 If    E3        P2  ?
-- PASS:0857 If    E4        P2  ?
-- PASS:0857 If    E4        P4  ?
-- PASS:0857 If    E4        P5  ?

   ROLLBACK WORK;
ij> SELECT EMPNUM, SUM (HOURS) FROM WORKS OWORKS
       GROUP BY EMPNUM
       HAVING EMPNUM IN (
--O       SELECT WORKS.EMPNUM FROM WORKS JOIN STAFF
--O       ON WORKS.EMPNUM = STAFF.EMPNUM
       SELECT a.EMPNUM FROM WORKS a, STAFF
       where a.EMPNUM = STAFF.EMPNUM
--O       AND HOURS < SUM (OWORKS.HOURS) / 3
       AND a.HOURS < (select SUM (b.HOURS) / 3 from works b  where a.empnum = b.empnum)
       AND GRADE > 10)
       ORDER BY EMPNUM;
EM&|2          
---------------
E1 |184        
E4 |140        
ij> -- PASS:0857 If 2 rows are returned in the following order?
--               empnum    sum(hours)
--               ======    ==========
-- PASS:0857 If  E1        184       ?
-- PASS:0857 If  E4        140       ?

   SELECT EMPNUM, SUM (HOURS) FROM WORKS OWORKS
       GROUP BY EMPNUM
       HAVING EMPNUM IN (
--O       SELECT WORKS.EMPNUM FROM WORKS JOIN STAFF
--O       ON WORKS.EMPNUM = STAFF.EMPNUM
       SELECT a.EMPNUM FROM WORKS a, STAFF
       where a.EMPNUM = STAFF.EMPNUM
--O       AND HOURS >= 10 + AVG (OWORKS.HOURS)
       AND a.HOURS >= (select 10 + AVG (b.HOURS) from works b where a.empnum = b.empnum)
       AND CITY = 'Deale')
       ORDER BY EMPNUM;
EM&|2          
---------------
E1 |184        
E4 |140        
ij> -- PASS:0857 If 2 rows are returned in the following order?
--               empnum    sum(hours)
--               ======    ==========
-- PASS:0857 If  E1        184       ?
-- PASS:0857 If  E4        140       ?

   COMMIT WORK;
ij> -- END TEST >>> 0857 <<< END TEST
-- *********************************************
-- *************************************************////END-OF-MODULE
;
ij>