📄 outerjoin.out
字号:
ij> -- qualfied * will return all of the columns of the qualified table-- including join columnsselect x.* from x join y on x.c3 = y.c3;C1 |C2 |C3 -----------------------------------1 |2 |3 ij> select x.* from x left outer join y on x.c3 = y.c3;C1 |C2 |C3 -----------------------------------1 |2 |3 4 |5 |6 ij> select x.* from x right outer join y on x.c3 = y.c3;C1 |C2 |C3 -----------------------------------1 |2 |3 NULL |NULL |NULL ij> select y.* from x join y on x.c3 = y.c3;C3 |C4 |C5 -----------------------------------3 |4 |5 ij> select y.* from x left outer join y on x.c3 = y.c3;C3 |C4 |C5 -----------------------------------3 |4 |5 NULL |NULL |NULL ij> select y.* from x right outer join y on x.c3 = y.c3;C3 |C4 |C5 -----------------------------------3 |4 |5 666 |7 |8 ij> -- * will return all of the columns of all joined tablesselect * from x join y on x.c3 = y.c3;C1 |C2 |C3 |C3 |C4 |C5 -----------------------------------------------------------------------1 |2 |3 |3 |4 |5 ij> select * from x left outer join y on x.c3 = y.c3;C1 |C2 |C3 |C3 |C4 |C5 -----------------------------------------------------------------------1 |2 |3 |3 |4 |5 4 |5 |6 |NULL |NULL |NULL ij> select * from x right outer join y on x.c3 = y.c3;C1 |C2 |C3 |C3 |C4 |C5 -----------------------------------------------------------------------1 |2 |3 |3 |4 |5 NULL |NULL |NULL |666 |7 |8 ij> commit;ij> -- test outer join -> inner join xformdelete from tt1;5 rows inserted/updated/deletedij> delete from tt2;5 rows inserted/updated/deletedij> delete from tt3;5 rows inserted/updated/deletedij> insert into tt1 values (1, 2, 3), (2, 3, 4), (3, 4, 5);3 rows inserted/updated/deletedij> insert into tt2 values (1, 2, 3), (2, 3, 4), (3, 4, 5);3 rows inserted/updated/deletedij> insert into tt3 values (1, 2, 3), (2, 3, 4), (3, 4, 5);3 rows inserted/updated/deletedij> call SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(1);0 rows inserted/updated/deletedij> maximumdisplaywidth 4500;ij> -- no xform, predicate on outer tableselect * from tt1 left outer join tt2 on tt1.c1 = tt2.c2 where tt1.c1 = 3;C1 |C2 |C3 |C1 |C2 |C3 -----------------------------------------------------------------------3 |4 |5 |2 |3 |4 ij> -- various predicates on inner tableselect * from tt1 left outer join tt2 on tt1.c1 = tt2.c2 where tt2.c2 = 3;C1 |C2 |C3 |C1 |C2 |C3 -----------------------------------------------------------------------3 |4 |5 |2 |3 |4 ij> values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS();1 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Statement Name: nullStatement Text: -- various predicates on inner tableselect * from tt1 left outer join tt2 on tt1.c1 = tt2.c2 where tt2.c2 = 3Parse Time: 0Bind Time: 0Optimize Time: 0Generate Time: 0Compile Time: 0Execute Time: 0Begin Compilation Timestamp : nullEnd Compilation Timestamp : nullBegin Execution Timestamp : nullEnd Execution Timestamp : nullStatement Execution Plan Text: Nested Loop Join ResultSet:Number of opens = 1Rows seen from the left = 1Rows seen from the right = 1Rows filtered = 0Rows returned = 1 constructor time (milliseconds) = 0 open time (milliseconds) = 0 next time (milliseconds) = 0 close time (milliseconds) = 0Left result set: Table Scan ResultSet for TT1 at read committed isolation level using instantaneous share row locking chosen by the optimizer Number of opens = 1 Rows seen = 1 Rows filtered = 0 Fetch Size = 16 constructor time (milliseconds) = 0 open time (milliseconds) = 0 next time (milliseconds) = 0 close time (milliseconds) = 0 next time in milliseconds/row = 0 scan information: Bit set of columns fetched=All Number of columns fetched=3 Number of pages visited=1 Number of rows qualified=1 Number of rows visited=8 Scan type=heap start position: null stop position: null qualifiers:Column[0][0] Id: 0Operator: =Ordered nulls: falseUnknown return value: falseNegate comparison result: falseRight result set: Table Scan ResultSet for TT2 at read committed isolation level using instantaneous share row locking chosen by the optimizer Number of opens = 1 Rows seen = 1 Rows filtered = 0 Fetch Size = 16 constructor time (milliseconds) = 0 open time (milliseconds) = 0 next time (milliseconds) = 0 close time (milliseconds) = 0 next time in milliseconds/row = 0 scan information: Bit set of columns fetched=All Number of columns fetched=3 Number of pages visited=1 Number of rows qualified=1 Number of rows visited=8 Scan type=heap start position: null stop position: null qualifiers:Column[0][0] Id: 1Operator: =Ordered nulls: falseUnknown return value: falseNegate comparison result: falseij> select * from tt1 left outer join tt2 on tt1.c1 = tt2.c2 where tt2.c1 + 1= tt2.c2;C1 |C2 |C3 |C1 |C2 |C3 -----------------------------------------------------------------------2 |3 |4 |1 |2 |3 3 |4 |5 |2 |3 |4 ij> values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS();1 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Statement Name: nullStatement Text: select * from tt1 left outer join tt2 on tt1.c1 = tt2.c2 where tt2.c1 + 1= tt2.c2Parse Time: 0Bind Time: 0Optimize Time: 0Generate Time: 0Compile Time: 0Execute Time: 0Begin Compilation Timestamp : nullEnd Compilation Timestamp : nullBegin Execution Timestamp : nullEnd Execution Timestamp : nullStatement Execution Plan Text: Project-Restrict ResultSet (5):Number of opens = 1Rows seen = 2Rows filtered = 0restriction = falseprojection = true constructor time (milliseconds) = 0 open time (milliseconds) = 0 next time (milliseconds) = 0 close time (milliseconds) = 0 restriction time (milliseconds) = 0 projection time (milliseconds) = 0Source result set: Nested Loop Join ResultSet: Number of opens = 1 Rows seen from the left = 3 Rows seen from the right = 2 Rows filtered = 0 Rows returned = 2 constructor time (milliseconds) = 0 open time (milliseconds) = 0 next time (milliseconds) = 0 close time (milliseconds) = 0 Left result set: Project-Restrict ResultSet (3): Number of opens = 1 Rows seen = 3 Rows filtered = 0 restriction = true projection = false constructor time (milliseconds) = 0 open time (milliseconds) = 0 next time (milliseconds) = 0 close time (milliseconds) = 0 restriction time (milliseconds) = 0 projection time (milliseconds) = 0 Source result set: Table Scan ResultSet for TT2 at read committed isolation level using instantaneous share row locking chosen by the optimizer Number of opens = 1 Rows seen = 3 Rows filtered = 0 Fetch Size = 16 constructor time (milliseconds) = 0 open time (milliseconds) = 0 next time (milliseconds) = 0 close time (milliseconds) = 0 next time in milliseconds/row = 0 scan information: Bit set of columns fetched=All Number of columns fetched=3 Number of pages visited=1 Number of rows qualified=3 Number of rows visited=8 Scan type=heap start position: null stop position: null qualifiers:None Right result set: Table Scan ResultSet for TT1 at read committed isolation level using instantaneous share row locking chosen by the optimizer Number of opens = 3 Rows seen = 2 Rows filtered = 0 Fetch Size = 16 constructor time (milliseconds) = 0 open time (milliseconds) = 0 next time (milliseconds) = 0 close time (milliseconds) = 0 next time in milliseconds/row = 0 scan information: Bit set of columns fetched=All Number of columns fetched=3 Number of pages visited=1 Number of rows qualified=2 Number of rows visited=24 Scan type=heap start position: null stop position: null qualifiers:Column[0][0] Id: 0Operator: =Ordered nulls: falseUnknown return value: falseNegate comparison result: falseij> select * from tt1 left outer join tt2 on tt1.c1 = tt2.c2 where tt2.c1 + 1= 3;C1 |C2 |C3 |C1 |C2 |C3 -----------------------------------------------------------------------3 |4 |5 |2 |3 |4 ij> values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS();1 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Statement Name: nullStatement Text: select * from tt1 left outer join tt2 on tt1.c1 = tt2.c2 where tt2.c1 + 1= 3Parse Time: 0Bind Time: 0Optimize Time: 0Generate Time: 0Compile Time: 0Execute Time: 0Begin Compilation Timestamp : nullEnd Compilation Timestamp : nullBegin Execution Timestamp : nullEnd Execution Timestamp : nullStatement Execution Plan Text: Project-Restrict ResultSet (5):Number of opens = 1Rows seen = 1Rows filtered = 0restriction = falseprojection = true constructor time (milliseconds) = 0 open time (milliseconds) = 0 next time (milliseconds) = 0 close time (milliseconds) = 0 restriction time (milliseconds) = 0 projection time (milliseconds) = 0Source result set:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -