From 3ec34e40b7f27feb2ba79b3657d31c6dc3f446b5 Mon Sep 17 00:00:00 2001 From: prabatuty Date: Sat, 6 Nov 2010 05:55:35 +0000 Subject: [PATCH] adding test scripts --- test/performance/DMLTest.c | 169 ++++ test/performance/DMLThreadTest.c | 378 +++++++++ test/performance/DMLThroughput.c | 114 +++ test/performance/Makefile | 69 ++ test/performance/ODBCConTest.c | 679 ++++++++++++++++ test/performance/ODBCTest.c | 352 ++++++++ test/performance/SQLAdapterTest.c | 121 +++ test/performance/SQLGWTest.c | 121 +++ test/performance/SQLTest.c | 144 ++++ test/performance/loadtest/Makefile | 47 ++ test/performance/loadtest/ODBCLoad.c | 216 +++++ test/performance/loadtest/ODBCLoadWiscSchema.c | 215 +++++ test/performance/loadtest/ODBCTest.c | 347 ++++++++ test/performance/loadtest/ODBCTestWiscSchema.c | 346 ++++++++ test/performance/loadtest/README | 12 + test/performance/loadtest/runsuite.ksh | 57 ++ test/performance/loadtest/runsuiteWiscSchema.ksh | 57 ++ test/performance/perf.php | 161 ++++ test/performance/throughput/Makefile | 7 + test/performance/throughput/connect.java | 284 +++++++ test/performance/throughput/hashIndexTest.java | 80 ++ test/performance/throughput/noIndexTest.java | 82 ++ test/performance/throughput/treeIndexTest.java | 83 ++ test/performance/wisc/JDBCBench.java | 679 ++++++++++++++++ test/performance/wisc/JDBCPopulate.java | 164 ++++ test/performance/wisc/Makefile | 19 + test/performance/wisc/README | 30 + test/performance/wisc/odbcBench.c | 864 ++++++++++++++++++++ test/sql/Aggregate/TODO | 3 + test/sql/Aggregate/agg1.sql | 1 + test/sql/Aggregate/aggmin4.sql | 1 + test/sql/Aggregate/aggregate1.sql | 17 + test/sql/Aggregate/aggregate2.sql | 23 + test/sql/Aggregate/aggregate4.sql | 11 + test/sql/Aggregate/aggregate5.sql | 15 + test/sql/Aggregate/aggregate6.sql | 17 + test/sql/Aggregate/aggregate7.sql | 28 + test/sql/Aggregate/aggregate_groupby1.sql | 30 + test/sql/Aggregate/aggsum3.sql | 1 + test/sql/Aggregate/all_agg.sql | 5 + test/sql/Aggregate/alldatatype.sql | 19 + test/sql/Aggregate/alldatatype_aggregate_count.sql | 32 + test/sql/Aggregate/alldatatype_aggregate_max.sql | 32 + test/sql/Aggregate/alldatatype_aggregate_min.sql | 32 + test/sql/Aggregate/alldatatype_aggregate_sum.sql | 32 + test/sql/Aggregate/bigtable.sql | 9 + test/sql/Aggregate/char_datetypes_count.sql | 38 + test/sql/Aggregate/char_datetypes_max.sql | 38 + test/sql/Aggregate/char_datetypes_min.sql | 38 + test/sql/Aggregate/createt1.sql | 6 + test/sql/Aggregate/createt1t2.sql | 13 + test/sql/Aggregate/dropemp.sql | 1 + test/sql/Aggregate/dropt1.sql | 2 + test/sql/Aggregate/dropt1t2.sql | 2 + test/sql/Aggregate/exp.test001.ksh | 32 + test/sql/Aggregate/exp.test002.ksh | 48 ++ test/sql/Aggregate/exp.test003.ksh | 6 + test/sql/Aggregate/exp.test004.ksh | 17 + test/sql/Aggregate/exp.test005.ksh | 54 ++ test/sql/Aggregate/exp.test006.ksh | 36 + test/sql/Aggregate/exp.test007.ksh | 6 + test/sql/Aggregate/exp.test008.ksh | 2 + test/sql/Aggregate/exp.test009.ksh | 2 + test/sql/Aggregate/exp.test010.ksh | 116 +++ test/sql/Aggregate/exp.test011.ksh | 189 +++++ test/sql/Aggregate/exp.test012.ksh | 81 ++ test/sql/Aggregate/exp.test013.ksh | 72 ++ test/sql/Aggregate/exp.test014.ksh | 110 +++ test/sql/Aggregate/exp.test015.ksh | 39 + test/sql/Aggregate/exp.test016.ksh | 66 ++ test/sql/Aggregate/exp.test025.ksh | 250 ++++++ test/sql/Aggregate/exp.test026.ksh | 193 +++++ test/sql/Aggregate/exp.test028.ksh | 224 ++++++ test/sql/Aggregate/exp.test029.ksh | 220 +++++ test/sql/Aggregate/exp.test030.ksh | 223 ++++++ test/sql/Aggregate/exp.test031.ksh | 221 +++++ test/sql/Aggregate/exp.test032.ksh | 30 + test/sql/Aggregate/exp.test033.ksh | 281 +++++++ test/sql/Aggregate/exp.test034.ksh | 285 +++++++ test/sql/Aggregate/exp.test035.ksh | 275 +++++++ test/sql/Aggregate/exp.test036.ksh | 63 ++ test/sql/Aggregate/exp.test037.ksh | 84 ++ test/sql/Aggregate/exp.testnw001.ksh | 33 + test/sql/Aggregate/exp.testnw002.ksh | 49 ++ test/sql/Aggregate/exp.testnw004.ksh | 18 + test/sql/Aggregate/exp.testnw005.ksh | 55 ++ test/sql/Aggregate/exp.testnw006.ksh | 37 + test/sql/Aggregate/exp.testnw007.ksh | 7 + test/sql/Aggregate/exp.testnw008.ksh | 3 + test/sql/Aggregate/exp.testnw009.ksh | 3 + test/sql/Aggregate/exp.testnw010.ksh | 118 +++ test/sql/Aggregate/exp.testnw011.ksh | 191 +++++ test/sql/Aggregate/exp.testnw012.ksh | 82 ++ test/sql/Aggregate/exp.testnw013.ksh | 73 ++ test/sql/Aggregate/exp.testnw014.ksh | 111 +++ test/sql/Aggregate/exp.testnw015.ksh | 41 + test/sql/Aggregate/exp.testnw016.ksh | 68 ++ test/sql/Aggregate/exp.testnw025.ksh | 252 ++++++ test/sql/Aggregate/exp.testnw026.ksh | 195 +++++ test/sql/Aggregate/exp.testnw027.ksh | 195 +++++ test/sql/Aggregate/exp.testnw028.ksh | 226 ++++++ test/sql/Aggregate/exp.testnw029.ksh | 222 +++++ test/sql/Aggregate/exp.testnw030.ksh | 225 ++++++ test/sql/Aggregate/exp.testnw031.ksh | 223 ++++++ test/sql/Aggregate/exp.testnw032.ksh | 32 + test/sql/Aggregate/exp.testnw033.ksh | 283 +++++++ test/sql/Aggregate/exp.testnw034.ksh | 287 +++++++ test/sql/Aggregate/exp.testnw035.ksh | 277 +++++++ test/sql/Aggregate/exp.testnw036.ksh | 64 ++ test/sql/Aggregate/groupby1.sql | 34 + test/sql/Aggregate/having1.sql | 34 + test/sql/Aggregate/innerjoin_aggregate.sql | 25 + test/sql/Aggregate/nulltest1.sql | 15 + test/sql/Aggregate/nulltest2.sql | 11 + test/sql/Aggregate/projfield.sql | 6 + test/sql/Aggregate/quit.sql | 1 + test/sql/Aggregate/sales_join_aggregate.sql | 20 + test/sql/Aggregate/sales_join_aggregate1.sql | 8 + test/sql/Aggregate/sales_join_aggregate2.sql | 5 + test/sql/Aggregate/sales_table_drop.sql | 10 + test/sql/Aggregate/sales_tables.sql | 98 +++ test/sql/Aggregate/selfjoin_aggregate.sql | 23 + test/sql/Aggregate/test001.ksh | 30 + test/sql/Aggregate/test002.ksh | 29 + test/sql/Aggregate/test004.ksh | 32 + test/sql/Aggregate/test005.ksh | 30 + test/sql/Aggregate/test006.ksh | 33 + test/sql/Aggregate/test007.ksh | 32 + test/sql/Aggregate/test008.ksh | 35 + test/sql/Aggregate/test009.ksh | 36 + test/sql/Aggregate/test010.ksh | 31 + test/sql/Aggregate/test011.ksh | 31 + test/sql/Aggregate/test012.ksh | 24 + test/sql/Aggregate/test013.ksh | 24 + test/sql/Aggregate/test014.ksh | 25 + test/sql/Aggregate/test015.ksh | 85 ++ test/sql/Aggregate/test016.ksh | 41 + test/sql/Aggregate/test025.ksh | 35 + test/sql/Aggregate/test026.ksh | 35 + test/sql/Aggregate/test027.ksh | 35 + test/sql/Aggregate/test028.ksh | 48 ++ test/sql/Aggregate/test029.ksh | 38 + test/sql/Aggregate/test030.ksh | 38 + test/sql/Aggregate/test031.ksh | 38 + test/sql/Aggregate/test032.ksh | 37 + test/sql/Aggregate/test033.ksh | 48 ++ test/sql/Aggregate/test034.ksh | 34 + test/sql/Aggregate/test035.ksh | 34 + test/sql/Aggregate/test036.ksh | 34 + test/sql/Aggregate/test037.ksh | 25 + test/sql/Aggregate/test038.ksh | 44 + test/sql/Aggregate/testnw001.ksh | 30 + test/sql/Aggregate/testnw002.ksh | 29 + test/sql/Aggregate/testnw004.ksh | 32 + test/sql/Aggregate/testnw005.ksh | 30 + test/sql/Aggregate/testnw006.ksh | 33 + test/sql/Aggregate/testnw007.ksh | 32 + test/sql/Aggregate/testnw008.ksh | 35 + test/sql/Aggregate/testnw009.ksh | 36 + test/sql/Aggregate/testnw010.ksh | 31 + test/sql/Aggregate/testnw011.ksh | 31 + test/sql/Aggregate/testnw012.ksh | 24 + test/sql/Aggregate/testnw013.ksh | 24 + test/sql/Aggregate/testnw014.ksh | 25 + test/sql/Aggregate/testnw015.ksh | 85 ++ test/sql/Aggregate/testnw016.ksh | 31 + test/sql/Aggregate/testnw025.ksh | 35 + test/sql/Aggregate/testnw026.ksh | 35 + test/sql/Aggregate/testnw027.ksh | 35 + test/sql/Aggregate/testnw028.ksh | 38 + test/sql/Aggregate/testnw029.ksh | 38 + test/sql/Aggregate/testnw030.ksh | 38 + test/sql/Aggregate/testnw031.ksh | 38 + test/sql/Aggregate/testnw032.ksh | 37 + test/sql/Aggregate/testnw033.ksh | 38 + test/sql/Aggregate/testnw034.ksh | 34 + test/sql/Aggregate/testnw035.ksh | 34 + test/sql/Aggregate/testnw036.ksh | 29 + test/sql/Aggregate/testnw037.ksh | 25 + test/sql/Aggregate/testnw038.ksh | 44 + test/sql/Aggregate/wher_grp_having_limit.sql | 34 + test/sql/Aggregate/writer.sql | 16 + test/sql/Alter/TODO | 1 + test/sql/Alter/csql.conf | 147 ++++ test/sql/Alter/exp.test001.ksh | 8 + test/sql/Alter/exp.test002.ksh | 5 + test/sql/Alter/exp.test003.ksh | 9 + test/sql/Alter/exp.test004.ksh | 6 + test/sql/Alter/exp.test005.ksh | 6 + test/sql/Alter/exp.test006.ksh | 5 + test/sql/Alter/exp.test008.ksh | 5 + test/sql/Alter/test001.ksh | 63 ++ test/sql/Alter/test002.ksh | 79 ++ test/sql/Alter/test003.ksh | 67 ++ test/sql/Alter/test004.ksh | 72 ++ test/sql/Alter/test005.ksh | 72 ++ test/sql/Alter/test006.ksh | 76 ++ test/sql/Alter/test007.ksh | 72 ++ test/sql/Alter/test008.ksh | 72 ++ test/sql/Alter/test009.ksh | 69 ++ test/sql/Alter/test010.ksh | 71 ++ test/sql/DDL/Makefile | 42 + test/sql/DDL/aucommitoff_truncate_rollback.sql | 15 + test/sql/DDL/droptest4.c | 50 ++ test/sql/DDL/exp.test001.ksh | 21 + test/sql/DDL/exp.test002.ksh | 24 + test/sql/DDL/exp.test003.ksh | 51 ++ test/sql/DDL/test001.ksh | 34 + test/sql/DDL/test002.ksh | 36 + test/sql/DDL/test003.ksh | 42 + test/sql/DDL/truncate_primary.sql | 26 + test/sql/DDL/truncatet1.sql | 11 + test/sql/Datatype/TODO | 3 + test/sql/Datatype/csql.conf | 147 ++++ test/sql/Datatype/exp.test001.ksh | 74 ++ test/sql/Datatype/exp.test002.ksh | 51 ++ test/sql/Datatype/exp.test003.ksh | 11 + test/sql/Datatype/exp.test004.ksh | 105 +++ test/sql/Datatype/exp.test005.ksh | 78 ++ test/sql/Datatype/exp.test006.ksh | 78 ++ test/sql/Datatype/exp.test007.ksh | 36 + test/sql/Datatype/exp.test008.ksh | 84 ++ test/sql/Datatype/exp.test009.ksh | 164 ++++ test/sql/Datatype/exp.test010.ksh | 71 ++ test/sql/Datatype/test001.ksh | 47 ++ test/sql/Datatype/test002.ksh | 61 ++ test/sql/Datatype/test003.ksh | 49 ++ test/sql/Datatype/test004.ksh | 78 ++ test/sql/Datatype/test005.ksh | 49 ++ test/sql/Datatype/test006.ksh | 49 ++ test/sql/Datatype/test007.ksh | 54 ++ test/sql/Datatype/test008.ksh | 53 ++ test/sql/Datatype/test009.ksh | 54 ++ test/sql/Datatype/test010.ksh | 62 ++ test/sql/Datatype/varchar_compindex.sql | 23 + test/sql/Datatype/varchar_default.sql | 22 + test/sql/Datatype/varchar_hash.sql | 15 + test/sql/Datatype/varchar_tree.sql | 15 + test/sql/Distinct/alldatatype.sql | 18 + test/sql/Distinct/alldatatype_t1_t2_t3.sql | 24 + test/sql/Distinct/alldatatype_with_null.sql | 18 + test/sql/Distinct/distinct1.sql | 21 + test/sql/Distinct/distinct_alltypes.sql | 34 + test/sql/Distinct/distinct_alltypes_innerjoin.sql | 56 ++ test/sql/Distinct/distinct_alltypes_leftjoin.sql | 56 ++ test/sql/Distinct/drop_t1_t2_t3.sql | 3 + test/sql/Distinct/dropt1.sql | 2 + test/sql/Distinct/exp.test001.ksh | 51 ++ test/sql/Distinct/exp.test002.ksh | 277 +++++++ test/sql/Distinct/exp.test003.ksh | 288 +++++++ test/sql/Distinct/exp.test004.ksh | 300 +++++++ test/sql/Distinct/exp.test005.ksh | 327 ++++++++ test/sql/Distinct/test001.ksh | 24 + test/sql/Distinct/test002.ksh | 31 + test/sql/Distinct/test003.ksh | 31 + test/sql/Distinct/test004.ksh | 31 + test/sql/Distinct/test005.ksh | 31 + test/sql/Join/alldatatype.sql | 24 + test/sql/Join/composite1.sql | 6 + test/sql/Join/composite10.sql | 8 + test/sql/Join/composite11.sql | 8 + test/sql/Join/composite12.sql | 10 + test/sql/Join/composite2.sql | 6 + test/sql/Join/composite3.sql | 6 + test/sql/Join/composite4.sql | 6 + test/sql/Join/composite5.sql | 8 + test/sql/Join/composite6.sql | 8 + test/sql/Join/composite7.sql | 8 + test/sql/Join/composite8.sql | 8 + test/sql/Join/composite9.sql | 10 + test/sql/Join/createt1.sql | 6 + test/sql/Join/createt1t2.sql | 14 + test/sql/Join/createt1t2t3.sql | 12 + test/sql/Join/createt1t2t3t4t5.sql | 27 + test/sql/Join/crosjoin_t1_t2_t3.sql | 6 + test/sql/Join/drop_emp_dept.sql | 4 + test/sql/Join/drop_t1_t2.sql | 2 + test/sql/Join/drop_t1_t2_t3.sql | 3 + test/sql/Join/dropt1.sql | 1 + test/sql/Join/dropt11.sql | 1 + test/sql/Join/dropt11t12.sql | 2 + test/sql/Join/dropt11t12t13.sql | 4 + test/sql/Join/dropt11t13.sql | 2 + test/sql/Join/dropt1t2.sql | 2 + test/sql/Join/dropt1t2t3.sql | 3 + test/sql/Join/dropt1t2t3t4t5.sql | 5 + test/sql/Join/equijoin1_with_and_t1_t2_t3.sql | 6 + test/sql/Join/equijoin2_with_and_t1_t2_t3.sql | 6 + test/sql/Join/equijoin3_with_and_t1_t2_t3.sql | 6 + test/sql/Join/equijoin4_with_and_t1_t2_t3.sql | 6 + test/sql/Join/equijoin_t1_t2_t3.sql | 6 + test/sql/Join/exp.test001.ksh | 15 + test/sql/Join/exp.test002.ksh | 37 + test/sql/Join/exp.test003.ksh | 892 +++++++++++++++++++++ test/sql/Join/exp.test004.ksh | 25 + test/sql/Join/exp.test005.ksh | 21 + test/sql/Join/exp.test006.ksh | 2 + test/sql/Join/exp.test007.ksh | 14 + test/sql/Join/exp.test008.ksh | 42 + test/sql/Join/exp.test009.ksh | 27 + test/sql/Join/exp.test010.ksh | 19 + test/sql/Join/exp.test011.ksh | 13 + test/sql/Join/exp.test012.ksh | 102 +++ test/sql/Join/exp.test013.ksh | 87 ++ test/sql/Join/exp.test014.ksh | 82 ++ test/sql/Join/exp.test015.ksh | 76 ++ test/sql/Join/exp.test016.ksh | 60 ++ test/sql/Join/exp.test017.ksh | 60 ++ test/sql/Join/exp.test018.ksh | 60 ++ test/sql/Join/exp.test019.ksh | 129 +++ test/sql/Join/exp.test020.ksh | 133 +++ test/sql/Join/exp.test021.ksh | 133 +++ test/sql/Join/exp.test022.ksh | 133 +++ test/sql/Join/exp.test023.ksh | 133 +++ test/sql/Join/exp.test024.ksh | 131 +++ test/sql/Join/exp.test025.ksh | 131 +++ test/sql/Join/exp.test026.ksh | 133 +++ test/sql/Join/exp.test027.ksh | 133 +++ test/sql/Join/exp.test028.ksh | 123 +++ test/sql/Join/exp.test029.ksh | 60 ++ test/sql/Join/exp.test030.ksh | 48 ++ test/sql/Join/exp.test031.ksh | 51 ++ test/sql/Join/exp.test032.ksh | 45 ++ test/sql/Join/exp.test033.ksh | 45 ++ test/sql/Join/exp.test034.ksh | 129 +++ test/sql/Join/exp.test035.ksh | 66 ++ test/sql/Join/exp.test036.ksh | 54 ++ test/sql/Join/exp.test037.ksh | 57 ++ test/sql/Join/exp.test038.ksh | 51 ++ test/sql/Join/exp.test039.ksh | 51 ++ test/sql/Join/exp.test040.ksh | 129 +++ test/sql/Join/exp.test041.ksh | 66 ++ test/sql/Join/exp.test042.ksh | 54 ++ test/sql/Join/exp.test043.ksh | 57 ++ test/sql/Join/exp.test044.ksh | 51 ++ test/sql/Join/exp.test045.ksh | 51 ++ test/sql/Join/exp.test046.ksh | 127 +++ test/sql/Join/exp.test047.ksh | 64 ++ test/sql/Join/exp.test048.ksh | 52 ++ test/sql/Join/exp.test049.ksh | 55 ++ test/sql/Join/exp.test050.ksh | 49 ++ test/sql/Join/exp.test051.ksh | 49 ++ test/sql/Join/exp.test052.ksh | 127 +++ test/sql/Join/exp.test053.ksh | 64 ++ test/sql/Join/exp.test054.ksh | 52 ++ test/sql/Join/exp.test055.ksh | 55 ++ test/sql/Join/exp.test056.ksh | 49 ++ test/sql/Join/exp.test057.ksh | 49 ++ test/sql/Join/exp.test058.ksh | 135 ++++ test/sql/Join/exp.test059.ksh | 72 ++ test/sql/Join/exp.test060.ksh | 60 ++ test/sql/Join/exp.test061.ksh | 63 ++ test/sql/Join/exp.test062.ksh | 57 ++ test/sql/Join/exp.test063.ksh | 57 ++ test/sql/Join/exp.test064.ksh | 135 ++++ test/sql/Join/exp.test065.ksh | 72 ++ test/sql/Join/exp.test066.ksh | 60 ++ test/sql/Join/exp.test067.ksh | 63 ++ test/sql/Join/exp.test068.ksh | 57 ++ test/sql/Join/exp.test069.ksh | 57 ++ test/sql/Join/exp.test070.ksh | 206 +++++ test/sql/Join/exp.test071.ksh | 206 +++++ test/sql/Join/exp.test072.ksh | 206 +++++ test/sql/Join/exp.test073.ksh | 206 +++++ test/sql/Join/exp.test074.ksh | 208 +++++ test/sql/Join/exp.test075.ksh | 208 +++++ test/sql/Join/exp.test076.ksh | 208 +++++ test/sql/Join/exp.test077.ksh | 208 +++++ test/sql/Join/exp.test078.ksh | 210 +++++ test/sql/Join/exp.test079.ksh | 208 +++++ test/sql/Join/exp.test080.ksh | 208 +++++ test/sql/Join/exp.test081.ksh | 210 +++++ test/sql/Join/exp.test082.ksh | 186 +++++ test/sql/Join/exp.test083.ksh | 138 ++++ test/sql/Join/exp.test084.ksh | 139 ++++ test/sql/Join/exp.test085.ksh | 69 ++ test/sql/Join/exp.test086.ksh | 113 +++ test/sql/Join/exp.test130.ksh | 26 + test/sql/Join/exp.test131.ksh | 172 ++++ test/sql/Join/exp1.test004.ksh | 8 + test/sql/Join/hash_t1f1_tree_t2f1.sql | 4 + test/sql/Join/hashon_t1f1_t2f1_t3f1.sql | 7 + ...hashon_t1f1_t2f1_t3f1_treeon_t1f2_t2f1_t3f1.sql | 12 + test/sql/Join/hashon_t1f2_t2f2.sql | 3 + test/sql/Join/hashonboth.sql | 4 + test/sql/Join/hashtree_mix1.sql | 5 + test/sql/Join/hashtree_mix2.sql | 4 + test/sql/Join/hashtreeonboth.sql | 4 + test/sql/Join/inner_t1_t2.sql | 18 + test/sql/Join/inner_t1_t2_t3.sql | 18 + test/sql/Join/inner_t1_t2_t3_t1.sql | 18 + test/sql/Join/innerjoin_in_between_like.sql | 6 + test/sql/Join/insert_t1_t2.sql | 20 + test/sql/Join/insert_t1_t2_t3.sql | 21 + test/sql/Join/join1.sql | 11 + test/sql/Join/join10.sql | 6 + test/sql/Join/join11.sql | 6 + test/sql/Join/join2.sql | 5 + test/sql/Join/join3.sql | 7 + test/sql/Join/join31.sql | 41 + test/sql/Join/join32.sql | 18 + test/sql/Join/join33.sql | 11 + test/sql/Join/join34.sql | 16 + test/sql/Join/join35.sql | 18 + test/sql/Join/join36.sql | 44 + test/sql/Join/join4.sql | 7 + test/sql/Join/join5.sql | 4 + test/sql/Join/join6.sql | 2 + test/sql/Join/join7.sql | 5 + test/sql/Join/join8.sql | 15 + test/sql/Join/join9.sql | 11 + test/sql/Join/join_between.sql | 9 + test/sql/Join/join_between_notexist.sql | 4 + test/sql/Join/join_in.sql | 12 + test/sql/Join/join_in_notexist.sql | 4 + test/sql/Join/join_like.sql | 10 + test/sql/Join/join_like_notexist1.sql | 2 + test/sql/Join/join_like_notexist2.sql | 2 + test/sql/Join/noindex_t1_t2.sql | 20 + test/sql/Join/noindex_t1_t2_t3.sql | 6 + test/sql/Join/nulltest1.sql | 24 + test/sql/Join/quit.sql | 2 + test/sql/Join/sales_join.sql | 2 + test/sql/Join/sales_table_drop.sql | 10 + test/sql/Join/sales_tables.sql | 98 +++ test/sql/Join/select_t1_t2_t3.sql | 6 + test/sql/Join/selfjoin1.sql | 9 + test/sql/Join/tablet11.sql | 5 + test/sql/Join/tablet11t12.sql | 10 + test/sql/Join/tablet11t12t13.sql | 15 + test/sql/Join/tablet11t13.sql | 9 + test/sql/Join/tablet12.sql | 6 + test/sql/Join/tablet13.sql | 4 + test/sql/Join/test001.ksh | 34 + test/sql/Join/test002.ksh | 33 + test/sql/Join/test003.ksh | 32 + test/sql/Join/test004.ksh | 35 + test/sql/Join/test005.ksh | 32 + test/sql/Join/test006.ksh | 33 + test/sql/Join/test007.ksh | 36 + test/sql/Join/test008.ksh | 40 + test/sql/Join/test009.ksh | 42 + test/sql/Join/test010.ksh | 34 + test/sql/Join/test011.ksh | 39 + test/sql/Join/test012.ksh | 23 + test/sql/Join/test013.ksh | 33 + test/sql/Join/test014.ksh | 33 + test/sql/Join/test015.ksh | 33 + test/sql/Join/test016.ksh | 30 + test/sql/Join/test017.ksh | 25 + test/sql/Join/test018.ksh | 32 + test/sql/Join/test019.ksh | 24 + test/sql/Join/test020.ksh | 29 + test/sql/Join/test021.ksh | 29 + test/sql/Join/test022.ksh | 29 + test/sql/Join/test023.ksh | 29 + test/sql/Join/test024.ksh | 29 + test/sql/Join/test025.ksh | 29 + test/sql/Join/test026.ksh | 29 + test/sql/Join/test027.ksh | 29 + test/sql/Join/test028.ksh | 29 + test/sql/Join/test029.ksh | 29 + test/sql/Join/test030.ksh | 29 + test/sql/Join/test031.ksh | 29 + test/sql/Join/test032.ksh | 29 + test/sql/Join/test033.ksh | 29 + test/sql/Join/test034.ksh | 34 + test/sql/Join/test035.ksh | 34 + test/sql/Join/test036.ksh | 34 + test/sql/Join/test037.ksh | 34 + test/sql/Join/test038.ksh | 34 + test/sql/Join/test039.ksh | 34 + test/sql/Join/test040.ksh | 34 + test/sql/Join/test041.ksh | 34 + test/sql/Join/test042.ksh | 34 + test/sql/Join/test043.ksh | 34 + test/sql/Join/test044.ksh | 34 + test/sql/Join/test045.ksh | 34 + test/sql/Join/test046.ksh | 34 + test/sql/Join/test047.ksh | 34 + test/sql/Join/test048.ksh | 34 + test/sql/Join/test049.ksh | 34 + test/sql/Join/test050.ksh | 34 + test/sql/Join/test051.ksh | 34 + test/sql/Join/test052.ksh | 34 + test/sql/Join/test053.ksh | 34 + test/sql/Join/test054.ksh | 34 + test/sql/Join/test055.ksh | 34 + test/sql/Join/test056.ksh | 34 + test/sql/Join/test057.ksh | 34 + test/sql/Join/test058.ksh | 34 + test/sql/Join/test059.ksh | 34 + test/sql/Join/test060.ksh | 34 + test/sql/Join/test061.ksh | 34 + test/sql/Join/test062.ksh | 34 + test/sql/Join/test063.ksh | 34 + test/sql/Join/test064.ksh | 34 + test/sql/Join/test065.ksh | 34 + test/sql/Join/test066.ksh | 34 + test/sql/Join/test067.ksh | 34 + test/sql/Join/test068.ksh | 34 + test/sql/Join/test069.ksh | 34 + test/sql/Join/test070.ksh | 29 + test/sql/Join/test071.ksh | 29 + test/sql/Join/test072.ksh | 29 + test/sql/Join/test073.ksh | 29 + test/sql/Join/test074.ksh | 29 + test/sql/Join/test075.ksh | 29 + test/sql/Join/test076.ksh | 29 + test/sql/Join/test077.ksh | 29 + test/sql/Join/test078.ksh | 29 + test/sql/Join/test079.ksh | 29 + test/sql/Join/test080.ksh | 29 + test/sql/Join/test081.ksh | 29 + test/sql/Join/test082.ksh | 23 + test/sql/Join/test083.ksh | 31 + test/sql/Join/test084.ksh | 31 + test/sql/Join/test085.ksh | 32 + test/sql/Join/test086.ksh | 31 + test/sql/Join/test130.ksh | 27 + test/sql/Join/test131.ksh | 29 + test/sql/Join/tree_t1f1_hash_t2f1.sql | 4 + test/sql/Join/treehashonboth.sql | 4 + test/sql/Join/treeon_t1f1_t2f1_t3f1.sql | 7 + ...treeon_t1f1_t2f1_t3f1_hashon_t1f2_t2f1_t3f1.sql | 12 + test/sql/Join/treeon_t1f2_t2f2.sql | 2 + test/sql/Join/treeonboth.sql | 4 + test/sql/Limit/TODO | 30 + test/sql/Limit/drop2.sql | 2 + test/sql/Limit/dropt1.sql | 2 + test/sql/Limit/exp.test001.ksh | 94 +++ test/sql/Limit/exp.test002.ksh | 143 ++++ test/sql/Limit/exp.test003.ksh | 158 ++++ test/sql/Limit/exp.test004.ksh | 72 ++ test/sql/Limit/exp.test005.ksh | 41 + test/sql/Limit/groupby.sql | 27 + test/sql/Limit/join.sql | 46 ++ test/sql/Limit/limit1.sql | 31 + test/sql/Limit/orderby.sql | 37 + test/sql/Limit/selfjoin1.sql | 14 + test/sql/Limit/test001.ksh | 27 + test/sql/Limit/test002.ksh | 24 + test/sql/Limit/test003.ksh | 29 + test/sql/Limit/test004.ksh | 29 + test/sql/Limit/test005.ksh | 27 + test/sql/Makefile | 18 + test/sql/Optimizer/TODO | 0 test/sql/Optimizer/big_composite.sql | 27 + test/sql/Optimizer/char_composite.sql | 27 + test/sql/Optimizer/composite_mixdatatype.sql | 18 + test/sql/Optimizer/createt1t2t3.sql | 21 + test/sql/Optimizer/date_composite.sql | 27 + test/sql/Optimizer/drop.sql | 3 + test/sql/Optimizer/exp.test001.ksh | 107 +++ test/sql/Optimizer/exp.test002.ksh | 156 ++++ test/sql/Optimizer/exp.test003.ksh | 189 +++++ test/sql/Optimizer/exp.test004.ksh | 189 +++++ test/sql/Optimizer/exp.test005.ksh | 336 ++++++++ test/sql/Optimizer/exp.test006.ksh | 444 ++++++++++ test/sql/Optimizer/exp.test007.ksh | 552 +++++++++++++ test/sql/Optimizer/exp.test008.ksh | 441 ++++++++++ test/sql/Optimizer/exp.test009.ksh | 441 ++++++++++ test/sql/Optimizer/exp.test010.ksh | 441 ++++++++++ test/sql/Optimizer/exp.test011.ksh | 441 ++++++++++ test/sql/Optimizer/exp.test012.ksh | 435 ++++++++++ test/sql/Optimizer/exp.test013.ksh | 435 ++++++++++ test/sql/Optimizer/exp.test014.ksh | 441 ++++++++++ test/sql/Optimizer/exp.test015.ksh | 441 ++++++++++ test/sql/Optimizer/exp.test016.ksh | 334 ++++++++ test/sql/Optimizer/exp.test017.ksh | 127 +++ test/sql/Optimizer/exp.test018.ksh | 93 +++ test/sql/Optimizer/exp.test019.ksh | 93 +++ test/sql/Optimizer/exp.test020.ksh | 93 +++ test/sql/Optimizer/exp.test021.ksh | 93 +++ test/sql/Optimizer/exp.test022.ksh | 93 +++ test/sql/Optimizer/exp.test023.ksh | 93 +++ test/sql/Optimizer/exp.test024.ksh | 28 + test/sql/Optimizer/exp.test025.ksh | 28 + .../sql/Optimizer/explainplan_isnull_isnotnull.sql | 14 + test/sql/Optimizer/hash_inbetweenlike.sql | 56 ++ test/sql/Optimizer/hash_multiplepredicate.sql | 56 ++ test/sql/Optimizer/hash_singleprrdicate.sql | 57 ++ test/sql/Optimizer/innerjoin_hash_int.sql | 20 + test/sql/Optimizer/innerjoin_tree_int.sql | 20 + test/sql/Optimizer/int_composite.sql | 27 + test/sql/Optimizer/join_hash_int.sql | 20 + test/sql/Optimizer/join_tree_int.sql | 20 + test/sql/Optimizer/leftjoin_hash_int.sql | 20 + test/sql/Optimizer/leftjoin_tree_int.sql | 20 + test/sql/Optimizer/selfjoin_hash_int.sql | 8 + test/sql/Optimizer/selfjoin_tree_int.sql | 8 + test/sql/Optimizer/singletabletest1.sql | 35 + test/sql/Optimizer/singletabletest2.sql | 23 + test/sql/Optimizer/small_composite.sql | 27 + test/sql/Optimizer/test001.ksh | 40 + test/sql/Optimizer/test002.ksh | 35 + test/sql/Optimizer/test003.ksh | 33 + test/sql/Optimizer/test004.ksh | 33 + test/sql/Optimizer/test005.ksh | 33 + test/sql/Optimizer/test006.ksh | 33 + test/sql/Optimizer/test007.ksh | 33 + test/sql/Optimizer/test008.ksh | 33 + test/sql/Optimizer/test009.ksh | 33 + test/sql/Optimizer/test010.ksh | 33 + test/sql/Optimizer/test011.ksh | 33 + test/sql/Optimizer/test012.ksh | 33 + test/sql/Optimizer/test013.ksh | 33 + test/sql/Optimizer/test014.ksh | 33 + test/sql/Optimizer/test015.ksh | 33 + test/sql/Optimizer/test016.ksh | 34 + test/sql/Optimizer/test017.ksh | 37 + test/sql/Optimizer/test018.ksh | 42 + test/sql/Optimizer/test019.ksh | 42 + test/sql/Optimizer/test020.ksh | 42 + test/sql/Optimizer/test021.ksh | 42 + test/sql/Optimizer/test022.ksh | 42 + test/sql/Optimizer/test023.ksh | 42 + test/sql/Optimizer/test024.ksh | 36 + test/sql/Optimizer/test025.ksh | 36 + test/sql/Optimizer/time_composite.sql | 27 + test/sql/Optimizer/tiny_composite.sql | 27 + test/sql/Optimizer/tree_inbetweenlike.sql | 74 ++ test/sql/Optimizer/tree_singleprrdicate.sql | 57 ++ test/sql/Optimizer/varchar_composite.sql | 27 + test/sql/Order/alldatatype.sql | 18 + .../Order/drop_Articles_Authors_AuthorArticle.sql | 6 + test/sql/Order/drop_t1_t2_t3.sql | 3 + test/sql/Order/dropemp.sql | 1 + test/sql/Order/dropt1.sql | 2 + test/sql/Order/exp.test001.ksh | 57 ++ test/sql/Order/exp.test002.ksh | 130 +++ test/sql/Order/exp.test003.ksh | 374 +++++++++ test/sql/Order/exp.test004.ksh | 374 +++++++++ test/sql/Order/exp.test005.ksh | 133 +++ test/sql/Order/exp.test006.ksh | 77 ++ test/sql/Order/exp.test007.ksh | 282 +++++++ test/sql/Order/exp.test008.ksh | 282 +++++++ test/sql/Order/exp.test009.ksh | 343 ++++++++ test/sql/Order/exp.test010.ksh | 196 +++++ test/sql/Order/exp.test011.ksh | 101 +++ test/sql/Order/leftjoin2.sql | 66 ++ test/sql/Order/order1.sql | 21 + test/sql/Order/order_alldatatypes.sql | 33 + test/sql/Order/order_desc_alldatatypes.sql | 33 + test/sql/Order/order_group.sql | 8 + test/sql/Order/order_inner.sql | 18 + test/sql/Order/order_inner_left.sql | 6 + test/sql/Order/order_join.sql | 18 + test/sql/Order/order_left.sql | 18 + test/sql/Order/order_self.sql | 24 + test/sql/Order/order_single_multiple.sql | 16 + test/sql/Order/table_self.sql | 10 + test/sql/Order/table_t1.sql | 15 + test/sql/Order/table_t1_t2_t3.sql | 46 ++ test/sql/Order/test001.ksh | 24 + test/sql/Order/test002.ksh | 24 + test/sql/Order/test003.ksh | 32 + test/sql/Order/test004.ksh | 32 + test/sql/Order/test005.ksh | 33 + test/sql/Order/test006.ksh | 31 + test/sql/Order/test007.ksh | 31 + test/sql/Order/test008.ksh | 31 + test/sql/Order/test009.ksh | 31 + test/sql/Order/test010.ksh | 31 + test/sql/Order/test011.ksh | 32 + test/sql/OuterJoin/alldatatype.sql | 24 + .../drop_Articles_Authors_AuthorArticle.sql | 6 + test/sql/OuterJoin/drop_t1_t2_t3.sql | 3 + test/sql/OuterJoin/dropt1t2.sql | 3 + test/sql/OuterJoin/exp.test001.ksh | 13 + test/sql/OuterJoin/exp.test002.ksh | 116 +++ test/sql/OuterJoin/exp.test003.ksh | 152 ++++ test/sql/OuterJoin/exp.test004.ksh | 170 ++++ test/sql/OuterJoin/exp.test005.ksh | 69 ++ test/sql/OuterJoin/exp.test006.ksh | 117 +++ test/sql/OuterJoin/leftjoin2.sql | 64 ++ test/sql/OuterJoin/leftjoin_in_between_like.sql | 6 + test/sql/OuterJoin/leftjoin_t1_t2.sql | 18 + test/sql/OuterJoin/leftjoin_t1_t2_t3.sql | 18 + test/sql/OuterJoin/leftjoin_t1_t2_t3_t1.sql | 18 + test/sql/OuterJoin/simpleleft.sql | 6 + test/sql/OuterJoin/test001.ksh | 24 + test/sql/OuterJoin/test002.ksh | 24 + test/sql/OuterJoin/test003.ksh | 31 + test/sql/OuterJoin/test004.ksh | 31 + test/sql/OuterJoin/test005.ksh | 32 + test/sql/OuterJoin/test006.ksh | 31 + test/sql/Predicate/TODO | 0 test/sql/Predicate/csql.conf | 147 ++++ test/sql/Predicate/exp.test001.ksh | 73 ++ test/sql/Predicate/exp.test002.ksh | 73 ++ test/sql/Predicate/exp.test003.ksh | 42 + test/sql/Predicate/exp.test004.ksh | 96 +++ test/sql/Predicate/test001.ksh | 51 ++ test/sql/Predicate/test002.ksh | 52 ++ test/sql/Predicate/test003.ksh | 45 ++ test/sql/Predicate/test004.ksh | 55 ++ test/sql/Predicate/test005.ksh | 54 ++ test/sql/Predicate/test006.ksh | 48 ++ test/sql/Predicate/test007.ksh | 46 ++ test/sql/Predicate/test008.ksh | 54 ++ test/sql/Predicate/test009.ksh | 54 ++ test/sql/Predicate/test010.ksh | 48 ++ test/sql/Predicate/test011.ksh | 46 ++ test/sql/Predicate/test012.ksh | 49 ++ test/sql/Predicate/varchar_NULL.sql | 21 + test/sql/Predicate/varchar_NULL_del.sql | 18 + test/sql/Predicate/varchar_NULL_upd.sql | 18 + test/sql/Predicate/varchar_like_in.sql | 25 + test/sql/Predicate/varchar_like_in_del.sql | 23 + test/sql/Predicate/varchar_like_in_upd.sql | 23 + test/sql/Predicate/varchar_logical.sql | 30 + test/sql/Predicate/varchar_logical_del.sql | 24 + test/sql/Predicate/varchar_logical_upd.sql | 44 + test/sql/Predicate/varchar_relational.sql | 23 + test/sql/Predicate/varchar_relational_del.sql | 38 + test/sql/Predicate/varchar_relational_upd.sql | 38 + test/sql/ScalarFunction/Date_with_now.sql | 37 + test/sql/ScalarFunction/TODO | 0 test/sql/ScalarFunction/csql.conf | 147 ++++ test/sql/ScalarFunction/date_add_day.sql | 23 + test/sql/ScalarFunction/date_add_month.sql | 16 + test/sql/ScalarFunction/date_add_year.sql | 17 + test/sql/ScalarFunction/date_diff.sql | 39 + test/sql/ScalarFunction/date_sub_day.sql | 25 + test/sql/ScalarFunction/date_sub_month.sql | 21 + test/sql/ScalarFunction/date_sub_year.sql | 17 + test/sql/ScalarFunction/exp.test001.ksh | 125 +++ test/sql/ScalarFunction/exp.test002.ksh | 125 +++ test/sql/ScalarFunction/exp.test003.ksh | 47 ++ test/sql/ScalarFunction/exp.test004.ksh | 39 + test/sql/ScalarFunction/exp.test005.ksh | 70 ++ test/sql/ScalarFunction/exp.test006.ksh | 49 ++ test/sql/ScalarFunction/exp.test007.ksh | 62 ++ test/sql/ScalarFunction/exp.test008.ksh | 82 ++ test/sql/ScalarFunction/exp.test009.ksh | 71 ++ test/sql/ScalarFunction/exp.test010.ksh | 69 ++ test/sql/ScalarFunction/exp.test011.ksh | 69 ++ test/sql/ScalarFunction/exp.test012.ksh | 71 ++ test/sql/ScalarFunction/exp.test013.ksh | 70 ++ test/sql/ScalarFunction/exp.test014.ksh | 70 ++ test/sql/ScalarFunction/exp.test015.ksh | 48 ++ test/sql/ScalarFunction/exp.test016.ksh | 78 ++ test/sql/ScalarFunction/exp.test017.ksh | 69 ++ test/sql/ScalarFunction/exp.test018.ksh | 96 +++ test/sql/ScalarFunction/exp.test019.ksh | 63 ++ test/sql/ScalarFunction/exp.test020.ksh | 63 ++ test/sql/ScalarFunction/exp.test021.ksh | 48 ++ test/sql/ScalarFunction/exp.test022.ksh | 78 ++ test/sql/ScalarFunction/exp.test023.ksh | 69 ++ test/sql/ScalarFunction/exp.test024.ksh | 96 +++ test/sql/ScalarFunction/exp.test025.ksh | 68 ++ test/sql/ScalarFunction/exp.test026.ksh | 68 ++ test/sql/ScalarFunction/exp.test027.ksh | 59 ++ test/sql/ScalarFunction/exp.test028.ksh | 67 ++ test/sql/ScalarFunction/exp.test029.ksh | 80 ++ test/sql/ScalarFunction/exp.test030.ksh | 83 ++ test/sql/ScalarFunction/exp.test031.ksh | 100 +++ test/sql/ScalarFunction/exp.test032.ksh | 86 ++ test/sql/ScalarFunction/exp.test033.ksh | 72 ++ test/sql/ScalarFunction/exp.test034.ksh | 62 ++ test/sql/ScalarFunction/exp.test035.ksh | 63 ++ test/sql/ScalarFunction/exp.test036.ksh | 63 ++ test/sql/ScalarFunction/exp.test037.ksh | 63 ++ test/sql/ScalarFunction/exp.test038.ksh | 63 ++ test/sql/ScalarFunction/exp.test039.ksh | 107 +++ test/sql/ScalarFunction/exp.test040.ksh | 107 +++ test/sql/ScalarFunction/extract_day_from_date.sql | 21 + test/sql/ScalarFunction/extract_hour_from_time.sql | 21 + .../extract_hourminutesecond_from_timestamp.sql | 33 + .../ScalarFunction/extract_minute_from_time.sql | 21 + .../sql/ScalarFunction/extract_month_from_date.sql | 20 + .../ScalarFunction/extract_second_from_time.sql | 21 + test/sql/ScalarFunction/extract_year_from_date.sql | 22 + .../extract_yearmonthday_from_timestamp.sql | 33 + test/sql/ScalarFunction/test001.ksh | 57 ++ test/sql/ScalarFunction/test002.ksh | 56 ++ test/sql/ScalarFunction/test003.ksh | 47 ++ test/sql/ScalarFunction/test004.ksh | 45 ++ test/sql/ScalarFunction/test005.ksh | 49 ++ test/sql/ScalarFunction/test006.ksh | 46 ++ test/sql/ScalarFunction/test007.ksh | 48 ++ test/sql/ScalarFunction/test008.ksh | 50 ++ test/sql/ScalarFunction/test009.ksh | 49 ++ test/sql/ScalarFunction/test010.ksh | 49 ++ test/sql/ScalarFunction/test011.ksh | 50 ++ test/sql/ScalarFunction/test012.ksh | 49 ++ test/sql/ScalarFunction/test013.ksh | 49 ++ test/sql/ScalarFunction/test014.ksh | 49 ++ test/sql/ScalarFunction/test015.ksh | 46 ++ test/sql/ScalarFunction/test016.ksh | 50 ++ test/sql/ScalarFunction/test017.ksh | 49 ++ test/sql/ScalarFunction/test018.ksh | 53 ++ test/sql/ScalarFunction/test019.ksh | 49 ++ test/sql/ScalarFunction/test020.ksh | 49 ++ test/sql/ScalarFunction/test021.ksh | 46 ++ test/sql/ScalarFunction/test022.ksh | 50 ++ test/sql/ScalarFunction/test023.ksh | 49 ++ test/sql/ScalarFunction/test024.ksh | 53 ++ test/sql/ScalarFunction/test025.ksh | 49 ++ test/sql/ScalarFunction/test026.ksh | 49 ++ test/sql/ScalarFunction/test027.ksh | 50 ++ test/sql/ScalarFunction/test028.ksh | 50 ++ test/sql/ScalarFunction/test029.ksh | 51 ++ test/sql/ScalarFunction/test030.ksh | 51 ++ test/sql/ScalarFunction/test031.ksh | 55 ++ test/sql/ScalarFunction/test032.ksh | 53 ++ test/sql/ScalarFunction/test033.ksh | 49 ++ test/sql/ScalarFunction/test034.ksh | 48 ++ test/sql/ScalarFunction/test035.ksh | 48 ++ test/sql/ScalarFunction/test036.ksh | 48 ++ test/sql/ScalarFunction/test037.ksh | 48 ++ test/sql/ScalarFunction/test038.ksh | 48 ++ test/sql/ScalarFunction/test039.ksh | 56 ++ test/sql/ScalarFunction/test040.ksh | 58 ++ test/sql/ScalarFunction/test041.ksh | 47 ++ test/sql/ScalarFunction/test042.ksh | 30 + test/sql/ScalarFunction/test043.ksh | 30 + test/sql/ScalarFunction/time_add_hour.sql | 23 + test/sql/ScalarFunction/time_add_minute.sql | 23 + test/sql/ScalarFunction/time_add_second.sql | 23 + test/sql/ScalarFunction/time_diff.sql | 39 + test/sql/ScalarFunction/time_sub_hour.sql | 23 + test/sql/ScalarFunction/time_sub_minute.sql | 23 + test/sql/ScalarFunction/time_sub_second.sql | 23 + test/sql/ScalarFunction/time_with_now.sql | 37 + test/sql/ScalarFunction/timestamp_add_day.sql | 23 + test/sql/ScalarFunction/timestamp_add_hour.sql | 31 + test/sql/ScalarFunction/timestamp_add_minute.sql | 23 + test/sql/ScalarFunction/timestamp_add_month.sql | 25 + test/sql/ScalarFunction/timestamp_add_second.sql | 23 + test/sql/ScalarFunction/timestamp_add_year.sql | 17 + test/sql/ScalarFunction/timestamp_diff_day.sql | 26 + test/sql/ScalarFunction/timestamp_diff_hour.sql | 26 + test/sql/ScalarFunction/timestamp_diff_minute.sql | 32 + test/sql/ScalarFunction/timestamp_diff_month.sql | 22 + test/sql/ScalarFunction/timestamp_diff_second.sql | 29 + test/sql/ScalarFunction/timestamp_diff_year.sql | 20 + test/sql/ScalarFunction/timestamp_sub_day.sql | 23 + test/sql/ScalarFunction/timestamp_sub_hour.sql | 31 + test/sql/ScalarFunction/timestamp_sub_minute.sql | 23 + test/sql/ScalarFunction/timestamp_sub_month.sql | 25 + test/sql/ScalarFunction/timestamp_sub_second.sql | 23 + test/sql/ScalarFunction/timestamp_sub_year.sql | 17 + test/sql/ScalarFunction/timestamp_with_now.sql | 37 + test/sql/StmtCache/Makefile | 69 ++ test/sql/StmtCache/csql.conf | 157 ++++ test/sql/StmtCache/csqlInsert.c | 89 ++ test/sql/StmtCache/exp.test001.ksh | 19 + test/sql/StmtCache/exp.test002 | 21 + test/sql/StmtCache/exp.test003.ksh | 43 + test/sql/StmtCache/exp.test004 | 33 + test/sql/StmtCache/exp.test005.ksh | 12 + test/sql/StmtCache/exp.test006.ksh | 25 + test/sql/StmtCache/exp.test007.ksh | 35 + test/sql/StmtCache/exp.test008.ksh | 1 + test/sql/StmtCache/exp.test009.ksh | 1 + test/sql/StmtCache/exp.test010.ksh | 30 + test/sql/StmtCache/exp.test011.ksh | 1 + test/sql/StmtCache/sel.sql | 2 + test/sql/StmtCache/stmtTest10.c | 62 ++ test/sql/StmtCache/stmtTest11.c | 59 ++ test/sql/StmtCache/stmtTest12.c | 64 ++ test/sql/StmtCache/stmtTest13.c | 84 ++ test/sql/StmtCache/stmtTest13a.c | 84 ++ test/sql/StmtCache/stmtTest13b.c | 84 ++ test/sql/StmtCache/stmtTest2.c | 65 ++ test/sql/StmtCache/stmtTest3.c | 77 ++ test/sql/StmtCache/stmtTest4.c | 106 +++ test/sql/StmtCache/stmtTest5.c | 46 ++ test/sql/StmtCache/stmtTest6.c | 63 ++ test/sql/StmtCache/stmtTest7.c | 63 ++ test/sql/StmtCache/stmtTest8.c | 59 ++ test/sql/StmtCache/stmtTest9.c | 71 ++ test/sql/StmtCache/t1.sql | 6 + test/sql/StmtCache/t1idx.sql | 7 + test/sql/StmtCache/t2.sql | 6 + test/sql/StmtCache/test001.ksh | 98 +++ test/sql/StmtCache/test003.ksh | 32 + test/sql/StmtCache/test005.ksh | 35 + test/sql/StmtCache/test006.ksh | 34 + test/sql/StmtCache/test007.ksh | 35 + test/sql/StmtCache/test008.ksh | 39 + test/sql/StmtCache/test009.ksh | 38 + test/sql/StmtCache/test010.ksh | 39 + test/sql/StmtCache/test011.ksh | 39 + 886 files changed, 55147 insertions(+) create mode 100644 test/performance/DMLTest.c create mode 100644 test/performance/DMLThreadTest.c create mode 100644 test/performance/DMLThroughput.c create mode 100644 test/performance/Makefile create mode 100644 test/performance/ODBCConTest.c create mode 100644 test/performance/ODBCTest.c create mode 100644 test/performance/SQLAdapterTest.c create mode 100644 test/performance/SQLGWTest.c create mode 100644 test/performance/SQLTest.c create mode 100644 test/performance/loadtest/Makefile create mode 100644 test/performance/loadtest/ODBCLoad.c create mode 100644 test/performance/loadtest/ODBCLoadWiscSchema.c create mode 100644 test/performance/loadtest/ODBCTest.c create mode 100644 test/performance/loadtest/ODBCTestWiscSchema.c create mode 100644 test/performance/loadtest/README create mode 100755 test/performance/loadtest/runsuite.ksh create mode 100755 test/performance/loadtest/runsuiteWiscSchema.ksh create mode 100644 test/performance/perf.php create mode 100644 test/performance/throughput/Makefile create mode 100644 test/performance/throughput/connect.java create mode 100644 test/performance/throughput/hashIndexTest.java create mode 100644 test/performance/throughput/noIndexTest.java create mode 100644 test/performance/throughput/treeIndexTest.java create mode 100644 test/performance/wisc/JDBCBench.java create mode 100644 test/performance/wisc/JDBCPopulate.java create mode 100644 test/performance/wisc/Makefile create mode 100644 test/performance/wisc/README create mode 100644 test/performance/wisc/odbcBench.c create mode 100644 test/sql/Aggregate/TODO create mode 100644 test/sql/Aggregate/agg1.sql create mode 100644 test/sql/Aggregate/aggmin4.sql create mode 100644 test/sql/Aggregate/aggregate1.sql create mode 100644 test/sql/Aggregate/aggregate2.sql create mode 100644 test/sql/Aggregate/aggregate4.sql create mode 100644 test/sql/Aggregate/aggregate5.sql create mode 100644 test/sql/Aggregate/aggregate6.sql create mode 100644 test/sql/Aggregate/aggregate7.sql create mode 100644 test/sql/Aggregate/aggregate_groupby1.sql create mode 100644 test/sql/Aggregate/aggsum3.sql create mode 100644 test/sql/Aggregate/all_agg.sql create mode 100644 test/sql/Aggregate/alldatatype.sql create mode 100644 test/sql/Aggregate/alldatatype_aggregate_count.sql create mode 100644 test/sql/Aggregate/alldatatype_aggregate_max.sql create mode 100644 test/sql/Aggregate/alldatatype_aggregate_min.sql create mode 100644 test/sql/Aggregate/alldatatype_aggregate_sum.sql create mode 100644 test/sql/Aggregate/bigtable.sql create mode 100644 test/sql/Aggregate/char_datetypes_count.sql create mode 100644 test/sql/Aggregate/char_datetypes_max.sql create mode 100644 test/sql/Aggregate/char_datetypes_min.sql create mode 100644 test/sql/Aggregate/createt1.sql create mode 100644 test/sql/Aggregate/createt1t2.sql create mode 100644 test/sql/Aggregate/dropemp.sql create mode 100644 test/sql/Aggregate/dropt1.sql create mode 100644 test/sql/Aggregate/dropt1t2.sql create mode 100644 test/sql/Aggregate/exp.test001.ksh create mode 100644 test/sql/Aggregate/exp.test002.ksh create mode 100644 test/sql/Aggregate/exp.test003.ksh create mode 100644 test/sql/Aggregate/exp.test004.ksh create mode 100644 test/sql/Aggregate/exp.test005.ksh create mode 100644 test/sql/Aggregate/exp.test006.ksh create mode 100644 test/sql/Aggregate/exp.test007.ksh create mode 100644 test/sql/Aggregate/exp.test008.ksh create mode 100644 test/sql/Aggregate/exp.test009.ksh create mode 100644 test/sql/Aggregate/exp.test010.ksh create mode 100644 test/sql/Aggregate/exp.test011.ksh create mode 100644 test/sql/Aggregate/exp.test012.ksh create mode 100644 test/sql/Aggregate/exp.test013.ksh create mode 100644 test/sql/Aggregate/exp.test014.ksh create mode 100644 test/sql/Aggregate/exp.test015.ksh create mode 100644 test/sql/Aggregate/exp.test016.ksh create mode 100644 test/sql/Aggregate/exp.test025.ksh create mode 100644 test/sql/Aggregate/exp.test026.ksh create mode 100644 test/sql/Aggregate/exp.test028.ksh create mode 100644 test/sql/Aggregate/exp.test029.ksh create mode 100644 test/sql/Aggregate/exp.test030.ksh create mode 100644 test/sql/Aggregate/exp.test031.ksh create mode 100644 test/sql/Aggregate/exp.test032.ksh create mode 100644 test/sql/Aggregate/exp.test033.ksh create mode 100644 test/sql/Aggregate/exp.test034.ksh create mode 100644 test/sql/Aggregate/exp.test035.ksh create mode 100644 test/sql/Aggregate/exp.test036.ksh create mode 100644 test/sql/Aggregate/exp.test037.ksh create mode 100644 test/sql/Aggregate/exp.testnw001.ksh create mode 100644 test/sql/Aggregate/exp.testnw002.ksh create mode 100644 test/sql/Aggregate/exp.testnw004.ksh create mode 100644 test/sql/Aggregate/exp.testnw005.ksh create mode 100644 test/sql/Aggregate/exp.testnw006.ksh create mode 100644 test/sql/Aggregate/exp.testnw007.ksh create mode 100644 test/sql/Aggregate/exp.testnw008.ksh create mode 100644 test/sql/Aggregate/exp.testnw009.ksh create mode 100644 test/sql/Aggregate/exp.testnw010.ksh create mode 100644 test/sql/Aggregate/exp.testnw011.ksh create mode 100644 test/sql/Aggregate/exp.testnw012.ksh create mode 100644 test/sql/Aggregate/exp.testnw013.ksh create mode 100644 test/sql/Aggregate/exp.testnw014.ksh create mode 100644 test/sql/Aggregate/exp.testnw015.ksh create mode 100644 test/sql/Aggregate/exp.testnw016.ksh create mode 100644 test/sql/Aggregate/exp.testnw025.ksh create mode 100644 test/sql/Aggregate/exp.testnw026.ksh create mode 100644 test/sql/Aggregate/exp.testnw027.ksh create mode 100644 test/sql/Aggregate/exp.testnw028.ksh create mode 100644 test/sql/Aggregate/exp.testnw029.ksh create mode 100644 test/sql/Aggregate/exp.testnw030.ksh create mode 100644 test/sql/Aggregate/exp.testnw031.ksh create mode 100644 test/sql/Aggregate/exp.testnw032.ksh create mode 100644 test/sql/Aggregate/exp.testnw033.ksh create mode 100644 test/sql/Aggregate/exp.testnw034.ksh create mode 100644 test/sql/Aggregate/exp.testnw035.ksh create mode 100644 test/sql/Aggregate/exp.testnw036.ksh create mode 100644 test/sql/Aggregate/groupby1.sql create mode 100644 test/sql/Aggregate/having1.sql create mode 100644 test/sql/Aggregate/innerjoin_aggregate.sql create mode 100644 test/sql/Aggregate/nulltest1.sql create mode 100644 test/sql/Aggregate/nulltest2.sql create mode 100644 test/sql/Aggregate/projfield.sql create mode 100644 test/sql/Aggregate/quit.sql create mode 100644 test/sql/Aggregate/sales_join_aggregate.sql create mode 100644 test/sql/Aggregate/sales_join_aggregate1.sql create mode 100644 test/sql/Aggregate/sales_join_aggregate2.sql create mode 100644 test/sql/Aggregate/sales_table_drop.sql create mode 100644 test/sql/Aggregate/sales_tables.sql create mode 100644 test/sql/Aggregate/selfjoin_aggregate.sql create mode 100755 test/sql/Aggregate/test001.ksh create mode 100755 test/sql/Aggregate/test002.ksh create mode 100755 test/sql/Aggregate/test004.ksh create mode 100755 test/sql/Aggregate/test005.ksh create mode 100755 test/sql/Aggregate/test006.ksh create mode 100755 test/sql/Aggregate/test007.ksh create mode 100755 test/sql/Aggregate/test008.ksh create mode 100755 test/sql/Aggregate/test009.ksh create mode 100755 test/sql/Aggregate/test010.ksh create mode 100755 test/sql/Aggregate/test011.ksh create mode 100755 test/sql/Aggregate/test012.ksh create mode 100755 test/sql/Aggregate/test013.ksh create mode 100755 test/sql/Aggregate/test014.ksh create mode 100755 test/sql/Aggregate/test015.ksh create mode 100755 test/sql/Aggregate/test016.ksh create mode 100755 test/sql/Aggregate/test025.ksh create mode 100755 test/sql/Aggregate/test026.ksh create mode 100755 test/sql/Aggregate/test027.ksh create mode 100755 test/sql/Aggregate/test028.ksh create mode 100755 test/sql/Aggregate/test029.ksh create mode 100755 test/sql/Aggregate/test030.ksh create mode 100755 test/sql/Aggregate/test031.ksh create mode 100755 test/sql/Aggregate/test032.ksh create mode 100755 test/sql/Aggregate/test033.ksh create mode 100755 test/sql/Aggregate/test034.ksh create mode 100755 test/sql/Aggregate/test035.ksh create mode 100755 test/sql/Aggregate/test036.ksh create mode 100755 test/sql/Aggregate/test037.ksh create mode 100755 test/sql/Aggregate/test038.ksh create mode 100755 test/sql/Aggregate/testnw001.ksh create mode 100755 test/sql/Aggregate/testnw002.ksh create mode 100755 test/sql/Aggregate/testnw004.ksh create mode 100755 test/sql/Aggregate/testnw005.ksh create mode 100755 test/sql/Aggregate/testnw006.ksh create mode 100755 test/sql/Aggregate/testnw007.ksh create mode 100755 test/sql/Aggregate/testnw008.ksh create mode 100755 test/sql/Aggregate/testnw009.ksh create mode 100755 test/sql/Aggregate/testnw010.ksh create mode 100755 test/sql/Aggregate/testnw011.ksh create mode 100755 test/sql/Aggregate/testnw012.ksh create mode 100755 test/sql/Aggregate/testnw013.ksh create mode 100755 test/sql/Aggregate/testnw014.ksh create mode 100755 test/sql/Aggregate/testnw015.ksh create mode 100755 test/sql/Aggregate/testnw016.ksh create mode 100755 test/sql/Aggregate/testnw025.ksh create mode 100755 test/sql/Aggregate/testnw026.ksh create mode 100755 test/sql/Aggregate/testnw027.ksh create mode 100755 test/sql/Aggregate/testnw028.ksh create mode 100755 test/sql/Aggregate/testnw029.ksh create mode 100755 test/sql/Aggregate/testnw030.ksh create mode 100755 test/sql/Aggregate/testnw031.ksh create mode 100755 test/sql/Aggregate/testnw032.ksh create mode 100755 test/sql/Aggregate/testnw033.ksh create mode 100755 test/sql/Aggregate/testnw034.ksh create mode 100755 test/sql/Aggregate/testnw035.ksh create mode 100755 test/sql/Aggregate/testnw036.ksh create mode 100755 test/sql/Aggregate/testnw037.ksh create mode 100755 test/sql/Aggregate/testnw038.ksh create mode 100644 test/sql/Aggregate/wher_grp_having_limit.sql create mode 100644 test/sql/Aggregate/writer.sql create mode 100644 test/sql/Alter/TODO create mode 100644 test/sql/Alter/csql.conf create mode 100644 test/sql/Alter/exp.test001.ksh create mode 100644 test/sql/Alter/exp.test002.ksh create mode 100644 test/sql/Alter/exp.test003.ksh create mode 100644 test/sql/Alter/exp.test004.ksh create mode 100644 test/sql/Alter/exp.test005.ksh create mode 100644 test/sql/Alter/exp.test006.ksh create mode 100644 test/sql/Alter/exp.test008.ksh create mode 100755 test/sql/Alter/test001.ksh create mode 100755 test/sql/Alter/test002.ksh create mode 100755 test/sql/Alter/test003.ksh create mode 100755 test/sql/Alter/test004.ksh create mode 100755 test/sql/Alter/test005.ksh create mode 100755 test/sql/Alter/test006.ksh create mode 100755 test/sql/Alter/test007.ksh create mode 100755 test/sql/Alter/test008.ksh create mode 100755 test/sql/Alter/test009.ksh create mode 100755 test/sql/Alter/test010.ksh create mode 100644 test/sql/DDL/Makefile create mode 100644 test/sql/DDL/aucommitoff_truncate_rollback.sql create mode 100644 test/sql/DDL/droptest4.c create mode 100644 test/sql/DDL/exp.test001.ksh create mode 100644 test/sql/DDL/exp.test002.ksh create mode 100644 test/sql/DDL/exp.test003.ksh create mode 100755 test/sql/DDL/test001.ksh create mode 100755 test/sql/DDL/test002.ksh create mode 100755 test/sql/DDL/test003.ksh create mode 100644 test/sql/DDL/truncate_primary.sql create mode 100644 test/sql/DDL/truncatet1.sql create mode 100644 test/sql/Datatype/TODO create mode 100644 test/sql/Datatype/csql.conf create mode 100644 test/sql/Datatype/exp.test001.ksh create mode 100644 test/sql/Datatype/exp.test002.ksh create mode 100644 test/sql/Datatype/exp.test003.ksh create mode 100644 test/sql/Datatype/exp.test004.ksh create mode 100644 test/sql/Datatype/exp.test005.ksh create mode 100644 test/sql/Datatype/exp.test006.ksh create mode 100644 test/sql/Datatype/exp.test007.ksh create mode 100644 test/sql/Datatype/exp.test008.ksh create mode 100644 test/sql/Datatype/exp.test009.ksh create mode 100644 test/sql/Datatype/exp.test010.ksh create mode 100755 test/sql/Datatype/test001.ksh create mode 100755 test/sql/Datatype/test002.ksh create mode 100755 test/sql/Datatype/test003.ksh create mode 100755 test/sql/Datatype/test004.ksh create mode 100755 test/sql/Datatype/test005.ksh create mode 100755 test/sql/Datatype/test006.ksh create mode 100755 test/sql/Datatype/test007.ksh create mode 100755 test/sql/Datatype/test008.ksh create mode 100755 test/sql/Datatype/test009.ksh create mode 100755 test/sql/Datatype/test010.ksh create mode 100644 test/sql/Datatype/varchar_compindex.sql create mode 100644 test/sql/Datatype/varchar_default.sql create mode 100644 test/sql/Datatype/varchar_hash.sql create mode 100644 test/sql/Datatype/varchar_tree.sql create mode 100644 test/sql/Distinct/alldatatype.sql create mode 100644 test/sql/Distinct/alldatatype_t1_t2_t3.sql create mode 100644 test/sql/Distinct/alldatatype_with_null.sql create mode 100644 test/sql/Distinct/distinct1.sql create mode 100644 test/sql/Distinct/distinct_alltypes.sql create mode 100644 test/sql/Distinct/distinct_alltypes_innerjoin.sql create mode 100644 test/sql/Distinct/distinct_alltypes_leftjoin.sql create mode 100644 test/sql/Distinct/drop_t1_t2_t3.sql create mode 100644 test/sql/Distinct/dropt1.sql create mode 100644 test/sql/Distinct/exp.test001.ksh create mode 100644 test/sql/Distinct/exp.test002.ksh create mode 100644 test/sql/Distinct/exp.test003.ksh create mode 100644 test/sql/Distinct/exp.test004.ksh create mode 100644 test/sql/Distinct/exp.test005.ksh create mode 100755 test/sql/Distinct/test001.ksh create mode 100755 test/sql/Distinct/test002.ksh create mode 100755 test/sql/Distinct/test003.ksh create mode 100755 test/sql/Distinct/test004.ksh create mode 100755 test/sql/Distinct/test005.ksh create mode 100644 test/sql/Join/alldatatype.sql create mode 100644 test/sql/Join/composite1.sql create mode 100644 test/sql/Join/composite10.sql create mode 100644 test/sql/Join/composite11.sql create mode 100644 test/sql/Join/composite12.sql create mode 100644 test/sql/Join/composite2.sql create mode 100644 test/sql/Join/composite3.sql create mode 100644 test/sql/Join/composite4.sql create mode 100644 test/sql/Join/composite5.sql create mode 100644 test/sql/Join/composite6.sql create mode 100644 test/sql/Join/composite7.sql create mode 100644 test/sql/Join/composite8.sql create mode 100644 test/sql/Join/composite9.sql create mode 100644 test/sql/Join/createt1.sql create mode 100644 test/sql/Join/createt1t2.sql create mode 100644 test/sql/Join/createt1t2t3.sql create mode 100644 test/sql/Join/createt1t2t3t4t5.sql create mode 100644 test/sql/Join/crosjoin_t1_t2_t3.sql create mode 100644 test/sql/Join/drop_emp_dept.sql create mode 100644 test/sql/Join/drop_t1_t2.sql create mode 100644 test/sql/Join/drop_t1_t2_t3.sql create mode 100644 test/sql/Join/dropt1.sql create mode 100644 test/sql/Join/dropt11.sql create mode 100644 test/sql/Join/dropt11t12.sql create mode 100644 test/sql/Join/dropt11t12t13.sql create mode 100644 test/sql/Join/dropt11t13.sql create mode 100644 test/sql/Join/dropt1t2.sql create mode 100644 test/sql/Join/dropt1t2t3.sql create mode 100644 test/sql/Join/dropt1t2t3t4t5.sql create mode 100644 test/sql/Join/equijoin1_with_and_t1_t2_t3.sql create mode 100644 test/sql/Join/equijoin2_with_and_t1_t2_t3.sql create mode 100644 test/sql/Join/equijoin3_with_and_t1_t2_t3.sql create mode 100644 test/sql/Join/equijoin4_with_and_t1_t2_t3.sql create mode 100644 test/sql/Join/equijoin_t1_t2_t3.sql create mode 100644 test/sql/Join/exp.test001.ksh create mode 100644 test/sql/Join/exp.test002.ksh create mode 100644 test/sql/Join/exp.test003.ksh create mode 100644 test/sql/Join/exp.test004.ksh create mode 100644 test/sql/Join/exp.test005.ksh create mode 100644 test/sql/Join/exp.test006.ksh create mode 100644 test/sql/Join/exp.test007.ksh create mode 100644 test/sql/Join/exp.test008.ksh create mode 100644 test/sql/Join/exp.test009.ksh create mode 100644 test/sql/Join/exp.test010.ksh create mode 100644 test/sql/Join/exp.test011.ksh create mode 100644 test/sql/Join/exp.test012.ksh create mode 100644 test/sql/Join/exp.test013.ksh create mode 100644 test/sql/Join/exp.test014.ksh create mode 100644 test/sql/Join/exp.test015.ksh create mode 100644 test/sql/Join/exp.test016.ksh create mode 100644 test/sql/Join/exp.test017.ksh create mode 100644 test/sql/Join/exp.test018.ksh create mode 100644 test/sql/Join/exp.test019.ksh create mode 100644 test/sql/Join/exp.test020.ksh create mode 100644 test/sql/Join/exp.test021.ksh create mode 100644 test/sql/Join/exp.test022.ksh create mode 100644 test/sql/Join/exp.test023.ksh create mode 100644 test/sql/Join/exp.test024.ksh create mode 100644 test/sql/Join/exp.test025.ksh create mode 100644 test/sql/Join/exp.test026.ksh create mode 100644 test/sql/Join/exp.test027.ksh create mode 100644 test/sql/Join/exp.test028.ksh create mode 100644 test/sql/Join/exp.test029.ksh create mode 100644 test/sql/Join/exp.test030.ksh create mode 100644 test/sql/Join/exp.test031.ksh create mode 100644 test/sql/Join/exp.test032.ksh create mode 100644 test/sql/Join/exp.test033.ksh create mode 100644 test/sql/Join/exp.test034.ksh create mode 100644 test/sql/Join/exp.test035.ksh create mode 100644 test/sql/Join/exp.test036.ksh create mode 100644 test/sql/Join/exp.test037.ksh create mode 100644 test/sql/Join/exp.test038.ksh create mode 100644 test/sql/Join/exp.test039.ksh create mode 100644 test/sql/Join/exp.test040.ksh create mode 100644 test/sql/Join/exp.test041.ksh create mode 100644 test/sql/Join/exp.test042.ksh create mode 100644 test/sql/Join/exp.test043.ksh create mode 100644 test/sql/Join/exp.test044.ksh create mode 100644 test/sql/Join/exp.test045.ksh create mode 100644 test/sql/Join/exp.test046.ksh create mode 100644 test/sql/Join/exp.test047.ksh create mode 100644 test/sql/Join/exp.test048.ksh create mode 100644 test/sql/Join/exp.test049.ksh create mode 100644 test/sql/Join/exp.test050.ksh create mode 100644 test/sql/Join/exp.test051.ksh create mode 100644 test/sql/Join/exp.test052.ksh create mode 100644 test/sql/Join/exp.test053.ksh create mode 100644 test/sql/Join/exp.test054.ksh create mode 100644 test/sql/Join/exp.test055.ksh create mode 100644 test/sql/Join/exp.test056.ksh create mode 100644 test/sql/Join/exp.test057.ksh create mode 100644 test/sql/Join/exp.test058.ksh create mode 100644 test/sql/Join/exp.test059.ksh create mode 100644 test/sql/Join/exp.test060.ksh create mode 100644 test/sql/Join/exp.test061.ksh create mode 100644 test/sql/Join/exp.test062.ksh create mode 100644 test/sql/Join/exp.test063.ksh create mode 100644 test/sql/Join/exp.test064.ksh create mode 100644 test/sql/Join/exp.test065.ksh create mode 100644 test/sql/Join/exp.test066.ksh create mode 100644 test/sql/Join/exp.test067.ksh create mode 100644 test/sql/Join/exp.test068.ksh create mode 100644 test/sql/Join/exp.test069.ksh create mode 100644 test/sql/Join/exp.test070.ksh create mode 100644 test/sql/Join/exp.test071.ksh create mode 100644 test/sql/Join/exp.test072.ksh create mode 100644 test/sql/Join/exp.test073.ksh create mode 100644 test/sql/Join/exp.test074.ksh create mode 100644 test/sql/Join/exp.test075.ksh create mode 100644 test/sql/Join/exp.test076.ksh create mode 100644 test/sql/Join/exp.test077.ksh create mode 100644 test/sql/Join/exp.test078.ksh create mode 100644 test/sql/Join/exp.test079.ksh create mode 100644 test/sql/Join/exp.test080.ksh create mode 100644 test/sql/Join/exp.test081.ksh create mode 100644 test/sql/Join/exp.test082.ksh create mode 100644 test/sql/Join/exp.test083.ksh create mode 100644 test/sql/Join/exp.test084.ksh create mode 100644 test/sql/Join/exp.test085.ksh create mode 100644 test/sql/Join/exp.test086.ksh create mode 100644 test/sql/Join/exp.test130.ksh create mode 100644 test/sql/Join/exp.test131.ksh create mode 100644 test/sql/Join/exp1.test004.ksh create mode 100644 test/sql/Join/hash_t1f1_tree_t2f1.sql create mode 100644 test/sql/Join/hashon_t1f1_t2f1_t3f1.sql create mode 100644 test/sql/Join/hashon_t1f1_t2f1_t3f1_treeon_t1f2_t2f1_t3f1.sql create mode 100644 test/sql/Join/hashon_t1f2_t2f2.sql create mode 100644 test/sql/Join/hashonboth.sql create mode 100644 test/sql/Join/hashtree_mix1.sql create mode 100644 test/sql/Join/hashtree_mix2.sql create mode 100644 test/sql/Join/hashtreeonboth.sql create mode 100644 test/sql/Join/inner_t1_t2.sql create mode 100644 test/sql/Join/inner_t1_t2_t3.sql create mode 100644 test/sql/Join/inner_t1_t2_t3_t1.sql create mode 100644 test/sql/Join/innerjoin_in_between_like.sql create mode 100644 test/sql/Join/insert_t1_t2.sql create mode 100644 test/sql/Join/insert_t1_t2_t3.sql create mode 100644 test/sql/Join/join1.sql create mode 100644 test/sql/Join/join10.sql create mode 100644 test/sql/Join/join11.sql create mode 100644 test/sql/Join/join2.sql create mode 100644 test/sql/Join/join3.sql create mode 100644 test/sql/Join/join31.sql create mode 100644 test/sql/Join/join32.sql create mode 100644 test/sql/Join/join33.sql create mode 100644 test/sql/Join/join34.sql create mode 100644 test/sql/Join/join35.sql create mode 100644 test/sql/Join/join36.sql create mode 100644 test/sql/Join/join4.sql create mode 100644 test/sql/Join/join5.sql create mode 100644 test/sql/Join/join6.sql create mode 100644 test/sql/Join/join7.sql create mode 100644 test/sql/Join/join8.sql create mode 100644 test/sql/Join/join9.sql create mode 100644 test/sql/Join/join_between.sql create mode 100644 test/sql/Join/join_between_notexist.sql create mode 100644 test/sql/Join/join_in.sql create mode 100644 test/sql/Join/join_in_notexist.sql create mode 100644 test/sql/Join/join_like.sql create mode 100644 test/sql/Join/join_like_notexist1.sql create mode 100644 test/sql/Join/join_like_notexist2.sql create mode 100644 test/sql/Join/noindex_t1_t2.sql create mode 100644 test/sql/Join/noindex_t1_t2_t3.sql create mode 100644 test/sql/Join/nulltest1.sql create mode 100644 test/sql/Join/quit.sql create mode 100644 test/sql/Join/sales_join.sql create mode 100644 test/sql/Join/sales_table_drop.sql create mode 100644 test/sql/Join/sales_tables.sql create mode 100644 test/sql/Join/select_t1_t2_t3.sql create mode 100644 test/sql/Join/selfjoin1.sql create mode 100644 test/sql/Join/tablet11.sql create mode 100644 test/sql/Join/tablet11t12.sql create mode 100644 test/sql/Join/tablet11t12t13.sql create mode 100644 test/sql/Join/tablet11t13.sql create mode 100644 test/sql/Join/tablet12.sql create mode 100644 test/sql/Join/tablet13.sql create mode 100755 test/sql/Join/test001.ksh create mode 100755 test/sql/Join/test002.ksh create mode 100755 test/sql/Join/test003.ksh create mode 100755 test/sql/Join/test004.ksh create mode 100755 test/sql/Join/test005.ksh create mode 100755 test/sql/Join/test006.ksh create mode 100755 test/sql/Join/test007.ksh create mode 100755 test/sql/Join/test008.ksh create mode 100755 test/sql/Join/test009.ksh create mode 100755 test/sql/Join/test010.ksh create mode 100755 test/sql/Join/test011.ksh create mode 100755 test/sql/Join/test012.ksh create mode 100755 test/sql/Join/test013.ksh create mode 100755 test/sql/Join/test014.ksh create mode 100755 test/sql/Join/test015.ksh create mode 100755 test/sql/Join/test016.ksh create mode 100755 test/sql/Join/test017.ksh create mode 100755 test/sql/Join/test018.ksh create mode 100755 test/sql/Join/test019.ksh create mode 100755 test/sql/Join/test020.ksh create mode 100755 test/sql/Join/test021.ksh create mode 100755 test/sql/Join/test022.ksh create mode 100755 test/sql/Join/test023.ksh create mode 100755 test/sql/Join/test024.ksh create mode 100755 test/sql/Join/test025.ksh create mode 100755 test/sql/Join/test026.ksh create mode 100755 test/sql/Join/test027.ksh create mode 100755 test/sql/Join/test028.ksh create mode 100755 test/sql/Join/test029.ksh create mode 100755 test/sql/Join/test030.ksh create mode 100755 test/sql/Join/test031.ksh create mode 100755 test/sql/Join/test032.ksh create mode 100755 test/sql/Join/test033.ksh create mode 100755 test/sql/Join/test034.ksh create mode 100755 test/sql/Join/test035.ksh create mode 100755 test/sql/Join/test036.ksh create mode 100755 test/sql/Join/test037.ksh create mode 100755 test/sql/Join/test038.ksh create mode 100755 test/sql/Join/test039.ksh create mode 100755 test/sql/Join/test040.ksh create mode 100755 test/sql/Join/test041.ksh create mode 100755 test/sql/Join/test042.ksh create mode 100755 test/sql/Join/test043.ksh create mode 100755 test/sql/Join/test044.ksh create mode 100755 test/sql/Join/test045.ksh create mode 100755 test/sql/Join/test046.ksh create mode 100755 test/sql/Join/test047.ksh create mode 100755 test/sql/Join/test048.ksh create mode 100755 test/sql/Join/test049.ksh create mode 100755 test/sql/Join/test050.ksh create mode 100755 test/sql/Join/test051.ksh create mode 100755 test/sql/Join/test052.ksh create mode 100755 test/sql/Join/test053.ksh create mode 100755 test/sql/Join/test054.ksh create mode 100755 test/sql/Join/test055.ksh create mode 100755 test/sql/Join/test056.ksh create mode 100755 test/sql/Join/test057.ksh create mode 100755 test/sql/Join/test058.ksh create mode 100755 test/sql/Join/test059.ksh create mode 100755 test/sql/Join/test060.ksh create mode 100755 test/sql/Join/test061.ksh create mode 100755 test/sql/Join/test062.ksh create mode 100755 test/sql/Join/test063.ksh create mode 100755 test/sql/Join/test064.ksh create mode 100755 test/sql/Join/test065.ksh create mode 100755 test/sql/Join/test066.ksh create mode 100755 test/sql/Join/test067.ksh create mode 100755 test/sql/Join/test068.ksh create mode 100755 test/sql/Join/test069.ksh create mode 100755 test/sql/Join/test070.ksh create mode 100755 test/sql/Join/test071.ksh create mode 100755 test/sql/Join/test072.ksh create mode 100755 test/sql/Join/test073.ksh create mode 100755 test/sql/Join/test074.ksh create mode 100755 test/sql/Join/test075.ksh create mode 100755 test/sql/Join/test076.ksh create mode 100755 test/sql/Join/test077.ksh create mode 100755 test/sql/Join/test078.ksh create mode 100755 test/sql/Join/test079.ksh create mode 100755 test/sql/Join/test080.ksh create mode 100755 test/sql/Join/test081.ksh create mode 100755 test/sql/Join/test082.ksh create mode 100755 test/sql/Join/test083.ksh create mode 100755 test/sql/Join/test084.ksh create mode 100755 test/sql/Join/test085.ksh create mode 100755 test/sql/Join/test086.ksh create mode 100755 test/sql/Join/test130.ksh create mode 100755 test/sql/Join/test131.ksh create mode 100644 test/sql/Join/tree_t1f1_hash_t2f1.sql create mode 100644 test/sql/Join/treehashonboth.sql create mode 100644 test/sql/Join/treeon_t1f1_t2f1_t3f1.sql create mode 100644 test/sql/Join/treeon_t1f1_t2f1_t3f1_hashon_t1f2_t2f1_t3f1.sql create mode 100644 test/sql/Join/treeon_t1f2_t2f2.sql create mode 100644 test/sql/Join/treeonboth.sql create mode 100644 test/sql/Limit/TODO create mode 100644 test/sql/Limit/drop2.sql create mode 100644 test/sql/Limit/dropt1.sql create mode 100644 test/sql/Limit/exp.test001.ksh create mode 100644 test/sql/Limit/exp.test002.ksh create mode 100644 test/sql/Limit/exp.test003.ksh create mode 100644 test/sql/Limit/exp.test004.ksh create mode 100644 test/sql/Limit/exp.test005.ksh create mode 100644 test/sql/Limit/groupby.sql create mode 100644 test/sql/Limit/join.sql create mode 100644 test/sql/Limit/limit1.sql create mode 100644 test/sql/Limit/orderby.sql create mode 100644 test/sql/Limit/selfjoin1.sql create mode 100755 test/sql/Limit/test001.ksh create mode 100755 test/sql/Limit/test002.ksh create mode 100755 test/sql/Limit/test003.ksh create mode 100755 test/sql/Limit/test004.ksh create mode 100755 test/sql/Limit/test005.ksh create mode 100644 test/sql/Makefile create mode 100644 test/sql/Optimizer/TODO create mode 100644 test/sql/Optimizer/big_composite.sql create mode 100644 test/sql/Optimizer/char_composite.sql create mode 100644 test/sql/Optimizer/composite_mixdatatype.sql create mode 100644 test/sql/Optimizer/createt1t2t3.sql create mode 100644 test/sql/Optimizer/date_composite.sql create mode 100644 test/sql/Optimizer/drop.sql create mode 100644 test/sql/Optimizer/exp.test001.ksh create mode 100644 test/sql/Optimizer/exp.test002.ksh create mode 100644 test/sql/Optimizer/exp.test003.ksh create mode 100644 test/sql/Optimizer/exp.test004.ksh create mode 100644 test/sql/Optimizer/exp.test005.ksh create mode 100644 test/sql/Optimizer/exp.test006.ksh create mode 100644 test/sql/Optimizer/exp.test007.ksh create mode 100644 test/sql/Optimizer/exp.test008.ksh create mode 100644 test/sql/Optimizer/exp.test009.ksh create mode 100644 test/sql/Optimizer/exp.test010.ksh create mode 100644 test/sql/Optimizer/exp.test011.ksh create mode 100644 test/sql/Optimizer/exp.test012.ksh create mode 100644 test/sql/Optimizer/exp.test013.ksh create mode 100644 test/sql/Optimizer/exp.test014.ksh create mode 100644 test/sql/Optimizer/exp.test015.ksh create mode 100644 test/sql/Optimizer/exp.test016.ksh create mode 100644 test/sql/Optimizer/exp.test017.ksh create mode 100644 test/sql/Optimizer/exp.test018.ksh create mode 100644 test/sql/Optimizer/exp.test019.ksh create mode 100644 test/sql/Optimizer/exp.test020.ksh create mode 100644 test/sql/Optimizer/exp.test021.ksh create mode 100644 test/sql/Optimizer/exp.test022.ksh create mode 100644 test/sql/Optimizer/exp.test023.ksh create mode 100644 test/sql/Optimizer/exp.test024.ksh create mode 100644 test/sql/Optimizer/exp.test025.ksh create mode 100644 test/sql/Optimizer/explainplan_isnull_isnotnull.sql create mode 100644 test/sql/Optimizer/hash_inbetweenlike.sql create mode 100644 test/sql/Optimizer/hash_multiplepredicate.sql create mode 100644 test/sql/Optimizer/hash_singleprrdicate.sql create mode 100644 test/sql/Optimizer/innerjoin_hash_int.sql create mode 100644 test/sql/Optimizer/innerjoin_tree_int.sql create mode 100644 test/sql/Optimizer/int_composite.sql create mode 100644 test/sql/Optimizer/join_hash_int.sql create mode 100644 test/sql/Optimizer/join_tree_int.sql create mode 100644 test/sql/Optimizer/leftjoin_hash_int.sql create mode 100644 test/sql/Optimizer/leftjoin_tree_int.sql create mode 100644 test/sql/Optimizer/selfjoin_hash_int.sql create mode 100644 test/sql/Optimizer/selfjoin_tree_int.sql create mode 100644 test/sql/Optimizer/singletabletest1.sql create mode 100644 test/sql/Optimizer/singletabletest2.sql create mode 100644 test/sql/Optimizer/small_composite.sql create mode 100755 test/sql/Optimizer/test001.ksh create mode 100755 test/sql/Optimizer/test002.ksh create mode 100755 test/sql/Optimizer/test003.ksh create mode 100755 test/sql/Optimizer/test004.ksh create mode 100755 test/sql/Optimizer/test005.ksh create mode 100755 test/sql/Optimizer/test006.ksh create mode 100755 test/sql/Optimizer/test007.ksh create mode 100755 test/sql/Optimizer/test008.ksh create mode 100755 test/sql/Optimizer/test009.ksh create mode 100755 test/sql/Optimizer/test010.ksh create mode 100755 test/sql/Optimizer/test011.ksh create mode 100755 test/sql/Optimizer/test012.ksh create mode 100755 test/sql/Optimizer/test013.ksh create mode 100755 test/sql/Optimizer/test014.ksh create mode 100755 test/sql/Optimizer/test015.ksh create mode 100755 test/sql/Optimizer/test016.ksh create mode 100755 test/sql/Optimizer/test017.ksh create mode 100755 test/sql/Optimizer/test018.ksh create mode 100755 test/sql/Optimizer/test019.ksh create mode 100755 test/sql/Optimizer/test020.ksh create mode 100755 test/sql/Optimizer/test021.ksh create mode 100755 test/sql/Optimizer/test022.ksh create mode 100755 test/sql/Optimizer/test023.ksh create mode 100755 test/sql/Optimizer/test024.ksh create mode 100755 test/sql/Optimizer/test025.ksh create mode 100644 test/sql/Optimizer/time_composite.sql create mode 100644 test/sql/Optimizer/tiny_composite.sql create mode 100644 test/sql/Optimizer/tree_inbetweenlike.sql create mode 100644 test/sql/Optimizer/tree_singleprrdicate.sql create mode 100644 test/sql/Optimizer/varchar_composite.sql create mode 100644 test/sql/Order/alldatatype.sql create mode 100644 test/sql/Order/drop_Articles_Authors_AuthorArticle.sql create mode 100644 test/sql/Order/drop_t1_t2_t3.sql create mode 100644 test/sql/Order/dropemp.sql create mode 100644 test/sql/Order/dropt1.sql create mode 100644 test/sql/Order/exp.test001.ksh create mode 100644 test/sql/Order/exp.test002.ksh create mode 100644 test/sql/Order/exp.test003.ksh create mode 100644 test/sql/Order/exp.test004.ksh create mode 100644 test/sql/Order/exp.test005.ksh create mode 100644 test/sql/Order/exp.test006.ksh create mode 100644 test/sql/Order/exp.test007.ksh create mode 100644 test/sql/Order/exp.test008.ksh create mode 100644 test/sql/Order/exp.test009.ksh create mode 100644 test/sql/Order/exp.test010.ksh create mode 100644 test/sql/Order/exp.test011.ksh create mode 100644 test/sql/Order/leftjoin2.sql create mode 100644 test/sql/Order/order1.sql create mode 100644 test/sql/Order/order_alldatatypes.sql create mode 100644 test/sql/Order/order_desc_alldatatypes.sql create mode 100644 test/sql/Order/order_group.sql create mode 100644 test/sql/Order/order_inner.sql create mode 100644 test/sql/Order/order_inner_left.sql create mode 100644 test/sql/Order/order_join.sql create mode 100644 test/sql/Order/order_left.sql create mode 100644 test/sql/Order/order_self.sql create mode 100644 test/sql/Order/order_single_multiple.sql create mode 100644 test/sql/Order/table_self.sql create mode 100644 test/sql/Order/table_t1.sql create mode 100644 test/sql/Order/table_t1_t2_t3.sql create mode 100755 test/sql/Order/test001.ksh create mode 100755 test/sql/Order/test002.ksh create mode 100755 test/sql/Order/test003.ksh create mode 100755 test/sql/Order/test004.ksh create mode 100755 test/sql/Order/test005.ksh create mode 100755 test/sql/Order/test006.ksh create mode 100755 test/sql/Order/test007.ksh create mode 100755 test/sql/Order/test008.ksh create mode 100755 test/sql/Order/test009.ksh create mode 100755 test/sql/Order/test010.ksh create mode 100755 test/sql/Order/test011.ksh create mode 100644 test/sql/OuterJoin/alldatatype.sql create mode 100644 test/sql/OuterJoin/drop_Articles_Authors_AuthorArticle.sql create mode 100644 test/sql/OuterJoin/drop_t1_t2_t3.sql create mode 100644 test/sql/OuterJoin/dropt1t2.sql create mode 100644 test/sql/OuterJoin/exp.test001.ksh create mode 100644 test/sql/OuterJoin/exp.test002.ksh create mode 100644 test/sql/OuterJoin/exp.test003.ksh create mode 100644 test/sql/OuterJoin/exp.test004.ksh create mode 100644 test/sql/OuterJoin/exp.test005.ksh create mode 100644 test/sql/OuterJoin/exp.test006.ksh create mode 100644 test/sql/OuterJoin/leftjoin2.sql create mode 100644 test/sql/OuterJoin/leftjoin_in_between_like.sql create mode 100644 test/sql/OuterJoin/leftjoin_t1_t2.sql create mode 100644 test/sql/OuterJoin/leftjoin_t1_t2_t3.sql create mode 100644 test/sql/OuterJoin/leftjoin_t1_t2_t3_t1.sql create mode 100644 test/sql/OuterJoin/simpleleft.sql create mode 100755 test/sql/OuterJoin/test001.ksh create mode 100755 test/sql/OuterJoin/test002.ksh create mode 100755 test/sql/OuterJoin/test003.ksh create mode 100755 test/sql/OuterJoin/test004.ksh create mode 100755 test/sql/OuterJoin/test005.ksh create mode 100755 test/sql/OuterJoin/test006.ksh create mode 100644 test/sql/Predicate/TODO create mode 100644 test/sql/Predicate/csql.conf create mode 100644 test/sql/Predicate/exp.test001.ksh create mode 100644 test/sql/Predicate/exp.test002.ksh create mode 100644 test/sql/Predicate/exp.test003.ksh create mode 100644 test/sql/Predicate/exp.test004.ksh create mode 100755 test/sql/Predicate/test001.ksh create mode 100755 test/sql/Predicate/test002.ksh create mode 100755 test/sql/Predicate/test003.ksh create mode 100755 test/sql/Predicate/test004.ksh create mode 100755 test/sql/Predicate/test005.ksh create mode 100755 test/sql/Predicate/test006.ksh create mode 100755 test/sql/Predicate/test007.ksh create mode 100755 test/sql/Predicate/test008.ksh create mode 100755 test/sql/Predicate/test009.ksh create mode 100755 test/sql/Predicate/test010.ksh create mode 100755 test/sql/Predicate/test011.ksh create mode 100755 test/sql/Predicate/test012.ksh create mode 100644 test/sql/Predicate/varchar_NULL.sql create mode 100644 test/sql/Predicate/varchar_NULL_del.sql create mode 100644 test/sql/Predicate/varchar_NULL_upd.sql create mode 100644 test/sql/Predicate/varchar_like_in.sql create mode 100644 test/sql/Predicate/varchar_like_in_del.sql create mode 100644 test/sql/Predicate/varchar_like_in_upd.sql create mode 100644 test/sql/Predicate/varchar_logical.sql create mode 100644 test/sql/Predicate/varchar_logical_del.sql create mode 100644 test/sql/Predicate/varchar_logical_upd.sql create mode 100644 test/sql/Predicate/varchar_relational.sql create mode 100644 test/sql/Predicate/varchar_relational_del.sql create mode 100644 test/sql/Predicate/varchar_relational_upd.sql create mode 100644 test/sql/ScalarFunction/Date_with_now.sql create mode 100644 test/sql/ScalarFunction/TODO create mode 100644 test/sql/ScalarFunction/csql.conf create mode 100644 test/sql/ScalarFunction/date_add_day.sql create mode 100644 test/sql/ScalarFunction/date_add_month.sql create mode 100644 test/sql/ScalarFunction/date_add_year.sql create mode 100644 test/sql/ScalarFunction/date_diff.sql create mode 100644 test/sql/ScalarFunction/date_sub_day.sql create mode 100644 test/sql/ScalarFunction/date_sub_month.sql create mode 100644 test/sql/ScalarFunction/date_sub_year.sql create mode 100644 test/sql/ScalarFunction/exp.test001.ksh create mode 100644 test/sql/ScalarFunction/exp.test002.ksh create mode 100644 test/sql/ScalarFunction/exp.test003.ksh create mode 100644 test/sql/ScalarFunction/exp.test004.ksh create mode 100644 test/sql/ScalarFunction/exp.test005.ksh create mode 100644 test/sql/ScalarFunction/exp.test006.ksh create mode 100644 test/sql/ScalarFunction/exp.test007.ksh create mode 100644 test/sql/ScalarFunction/exp.test008.ksh create mode 100644 test/sql/ScalarFunction/exp.test009.ksh create mode 100644 test/sql/ScalarFunction/exp.test010.ksh create mode 100644 test/sql/ScalarFunction/exp.test011.ksh create mode 100644 test/sql/ScalarFunction/exp.test012.ksh create mode 100644 test/sql/ScalarFunction/exp.test013.ksh create mode 100644 test/sql/ScalarFunction/exp.test014.ksh create mode 100644 test/sql/ScalarFunction/exp.test015.ksh create mode 100644 test/sql/ScalarFunction/exp.test016.ksh create mode 100644 test/sql/ScalarFunction/exp.test017.ksh create mode 100644 test/sql/ScalarFunction/exp.test018.ksh create mode 100644 test/sql/ScalarFunction/exp.test019.ksh create mode 100644 test/sql/ScalarFunction/exp.test020.ksh create mode 100644 test/sql/ScalarFunction/exp.test021.ksh create mode 100644 test/sql/ScalarFunction/exp.test022.ksh create mode 100644 test/sql/ScalarFunction/exp.test023.ksh create mode 100644 test/sql/ScalarFunction/exp.test024.ksh create mode 100644 test/sql/ScalarFunction/exp.test025.ksh create mode 100644 test/sql/ScalarFunction/exp.test026.ksh create mode 100644 test/sql/ScalarFunction/exp.test027.ksh create mode 100644 test/sql/ScalarFunction/exp.test028.ksh create mode 100644 test/sql/ScalarFunction/exp.test029.ksh create mode 100644 test/sql/ScalarFunction/exp.test030.ksh create mode 100644 test/sql/ScalarFunction/exp.test031.ksh create mode 100644 test/sql/ScalarFunction/exp.test032.ksh create mode 100644 test/sql/ScalarFunction/exp.test033.ksh create mode 100644 test/sql/ScalarFunction/exp.test034.ksh create mode 100644 test/sql/ScalarFunction/exp.test035.ksh create mode 100644 test/sql/ScalarFunction/exp.test036.ksh create mode 100644 test/sql/ScalarFunction/exp.test037.ksh create mode 100644 test/sql/ScalarFunction/exp.test038.ksh create mode 100644 test/sql/ScalarFunction/exp.test039.ksh create mode 100644 test/sql/ScalarFunction/exp.test040.ksh create mode 100644 test/sql/ScalarFunction/extract_day_from_date.sql create mode 100644 test/sql/ScalarFunction/extract_hour_from_time.sql create mode 100644 test/sql/ScalarFunction/extract_hourminutesecond_from_timestamp.sql create mode 100644 test/sql/ScalarFunction/extract_minute_from_time.sql create mode 100644 test/sql/ScalarFunction/extract_month_from_date.sql create mode 100644 test/sql/ScalarFunction/extract_second_from_time.sql create mode 100644 test/sql/ScalarFunction/extract_year_from_date.sql create mode 100644 test/sql/ScalarFunction/extract_yearmonthday_from_timestamp.sql create mode 100755 test/sql/ScalarFunction/test001.ksh create mode 100755 test/sql/ScalarFunction/test002.ksh create mode 100755 test/sql/ScalarFunction/test003.ksh create mode 100755 test/sql/ScalarFunction/test004.ksh create mode 100755 test/sql/ScalarFunction/test005.ksh create mode 100755 test/sql/ScalarFunction/test006.ksh create mode 100755 test/sql/ScalarFunction/test007.ksh create mode 100755 test/sql/ScalarFunction/test008.ksh create mode 100755 test/sql/ScalarFunction/test009.ksh create mode 100755 test/sql/ScalarFunction/test010.ksh create mode 100755 test/sql/ScalarFunction/test011.ksh create mode 100755 test/sql/ScalarFunction/test012.ksh create mode 100755 test/sql/ScalarFunction/test013.ksh create mode 100755 test/sql/ScalarFunction/test014.ksh create mode 100755 test/sql/ScalarFunction/test015.ksh create mode 100755 test/sql/ScalarFunction/test016.ksh create mode 100755 test/sql/ScalarFunction/test017.ksh create mode 100755 test/sql/ScalarFunction/test018.ksh create mode 100755 test/sql/ScalarFunction/test019.ksh create mode 100755 test/sql/ScalarFunction/test020.ksh create mode 100755 test/sql/ScalarFunction/test021.ksh create mode 100755 test/sql/ScalarFunction/test022.ksh create mode 100755 test/sql/ScalarFunction/test023.ksh create mode 100755 test/sql/ScalarFunction/test024.ksh create mode 100755 test/sql/ScalarFunction/test025.ksh create mode 100755 test/sql/ScalarFunction/test026.ksh create mode 100755 test/sql/ScalarFunction/test027.ksh create mode 100755 test/sql/ScalarFunction/test028.ksh create mode 100755 test/sql/ScalarFunction/test029.ksh create mode 100755 test/sql/ScalarFunction/test030.ksh create mode 100755 test/sql/ScalarFunction/test031.ksh create mode 100755 test/sql/ScalarFunction/test032.ksh create mode 100755 test/sql/ScalarFunction/test033.ksh create mode 100755 test/sql/ScalarFunction/test034.ksh create mode 100755 test/sql/ScalarFunction/test035.ksh create mode 100755 test/sql/ScalarFunction/test036.ksh create mode 100755 test/sql/ScalarFunction/test037.ksh create mode 100755 test/sql/ScalarFunction/test038.ksh create mode 100755 test/sql/ScalarFunction/test039.ksh create mode 100755 test/sql/ScalarFunction/test040.ksh create mode 100755 test/sql/ScalarFunction/test041.ksh create mode 100755 test/sql/ScalarFunction/test042.ksh create mode 100755 test/sql/ScalarFunction/test043.ksh create mode 100644 test/sql/ScalarFunction/time_add_hour.sql create mode 100644 test/sql/ScalarFunction/time_add_minute.sql create mode 100644 test/sql/ScalarFunction/time_add_second.sql create mode 100644 test/sql/ScalarFunction/time_diff.sql create mode 100644 test/sql/ScalarFunction/time_sub_hour.sql create mode 100644 test/sql/ScalarFunction/time_sub_minute.sql create mode 100644 test/sql/ScalarFunction/time_sub_second.sql create mode 100644 test/sql/ScalarFunction/time_with_now.sql create mode 100644 test/sql/ScalarFunction/timestamp_add_day.sql create mode 100644 test/sql/ScalarFunction/timestamp_add_hour.sql create mode 100644 test/sql/ScalarFunction/timestamp_add_minute.sql create mode 100644 test/sql/ScalarFunction/timestamp_add_month.sql create mode 100644 test/sql/ScalarFunction/timestamp_add_second.sql create mode 100644 test/sql/ScalarFunction/timestamp_add_year.sql create mode 100644 test/sql/ScalarFunction/timestamp_diff_day.sql create mode 100644 test/sql/ScalarFunction/timestamp_diff_hour.sql create mode 100644 test/sql/ScalarFunction/timestamp_diff_minute.sql create mode 100644 test/sql/ScalarFunction/timestamp_diff_month.sql create mode 100644 test/sql/ScalarFunction/timestamp_diff_second.sql create mode 100644 test/sql/ScalarFunction/timestamp_diff_year.sql create mode 100644 test/sql/ScalarFunction/timestamp_sub_day.sql create mode 100644 test/sql/ScalarFunction/timestamp_sub_hour.sql create mode 100644 test/sql/ScalarFunction/timestamp_sub_minute.sql create mode 100644 test/sql/ScalarFunction/timestamp_sub_month.sql create mode 100644 test/sql/ScalarFunction/timestamp_sub_second.sql create mode 100644 test/sql/ScalarFunction/timestamp_sub_year.sql create mode 100644 test/sql/ScalarFunction/timestamp_with_now.sql create mode 100644 test/sql/StmtCache/Makefile create mode 100644 test/sql/StmtCache/csql.conf create mode 100644 test/sql/StmtCache/csqlInsert.c create mode 100644 test/sql/StmtCache/exp.test001.ksh create mode 100644 test/sql/StmtCache/exp.test002 create mode 100644 test/sql/StmtCache/exp.test003.ksh create mode 100644 test/sql/StmtCache/exp.test004 create mode 100644 test/sql/StmtCache/exp.test005.ksh create mode 100644 test/sql/StmtCache/exp.test006.ksh create mode 100644 test/sql/StmtCache/exp.test007.ksh create mode 100644 test/sql/StmtCache/exp.test008.ksh create mode 100644 test/sql/StmtCache/exp.test009.ksh create mode 100644 test/sql/StmtCache/exp.test010.ksh create mode 100644 test/sql/StmtCache/exp.test011.ksh create mode 100644 test/sql/StmtCache/sel.sql create mode 100644 test/sql/StmtCache/stmtTest10.c create mode 100644 test/sql/StmtCache/stmtTest11.c create mode 100644 test/sql/StmtCache/stmtTest12.c create mode 100644 test/sql/StmtCache/stmtTest13.c create mode 100644 test/sql/StmtCache/stmtTest13a.c create mode 100644 test/sql/StmtCache/stmtTest13b.c create mode 100644 test/sql/StmtCache/stmtTest2.c create mode 100644 test/sql/StmtCache/stmtTest3.c create mode 100644 test/sql/StmtCache/stmtTest4.c create mode 100644 test/sql/StmtCache/stmtTest5.c create mode 100644 test/sql/StmtCache/stmtTest6.c create mode 100644 test/sql/StmtCache/stmtTest7.c create mode 100644 test/sql/StmtCache/stmtTest8.c create mode 100644 test/sql/StmtCache/stmtTest9.c create mode 100644 test/sql/StmtCache/t1.sql create mode 100644 test/sql/StmtCache/t1idx.sql create mode 100644 test/sql/StmtCache/t2.sql create mode 100755 test/sql/StmtCache/test001.ksh create mode 100755 test/sql/StmtCache/test003.ksh create mode 100755 test/sql/StmtCache/test005.ksh create mode 100755 test/sql/StmtCache/test006.ksh create mode 100755 test/sql/StmtCache/test007.ksh create mode 100755 test/sql/StmtCache/test008.ksh create mode 100755 test/sql/StmtCache/test009.ksh create mode 100755 test/sql/StmtCache/test010.ksh create mode 100755 test/sql/StmtCache/test011.ksh diff --git a/test/performance/DMLTest.c b/test/performance/DMLTest.c new file mode 100644 index 00000000..314d035d --- /dev/null +++ b/test/performance/DMLTest.c @@ -0,0 +1,169 @@ +#include +#include +#include +#define ITERATIONS 100 +//#define LOAD 1000000 +//Note: Set following parameters in csql.conf for this test +//MAX_SYS_DB_SIZE=10485760 +//MAX_DB_SIZE=335544320 +//you may have to set the kernel.shmmax kernel paremeter(login as root) using +//$sysctl -w kernel.shmmax=1000000000 +#define LOAD 0 +int main() +{ + + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) + { + printf("Error during connection %d\n", rv); + return -1; + } + + + DatabaseManager *dbMgr = conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return -1;} + TableDef tabDef; + tabDef.addField("f1", typeInt, 0, NULL, true ); + tabDef.addField("f2", typeString, 196); + rv = dbMgr->createTable("t1", tabDef); + if (rv != OK) { printf("Table creation failed\n"); return -1; } + printf("Table created\n"); + HashIndexInitInfo *idxInfo = new HashIndexInitInfo(); + strcpy(idxInfo->tableName, "t1"); + idxInfo->list.append("f1"); + idxInfo->indType = hashIndex; + if (LOAD >0 ) + idxInfo->bucketSize = 100007; + else + idxInfo->bucketSize = 10007; + rv = dbMgr->createIndex("indx1", idxInfo); + if (rv != OK) { printf("Index creation failed\n"); return -1; } + printf("Index created\n"); + delete idxInfo; + Table *table = dbMgr->openTable("t1"); + if (table == NULL) { printf("Unable to open table\n"); return -1; } + int id = 0; + char name[196] = "PRABAKARAN"; + table->bindFld("f1", &id); + table->bindFld("f2", name); + char *tuple; + int ret; + int i; + int icount =0; + if (LOAD > 0) { + TableImpl *impl = (TableImpl*)table; + impl->setUndoLogging(false); + strcpy(name, "PRABAKARAN0123456750590"); + rv = conn.startTransaction(); + if (rv != OK) exit(1); + for(i = 0; i< LOAD; i++) + { + id= i; + ret = table->insertTuple(); + if (ret != 0) break; + icount++; + if (i % 100 == 0 ) { rv = conn.commit(); + if (rv != OK) exit(1); + rv = conn.startTransaction(); + if (rv != OK) exit(1); + } + if (i %50000 == 0) printf("%d rows inserted\n", i); + } + conn.commit(); + impl->setUndoLogging(true); + printf("Loaded %d records\n", icount); + } + + //TableImpl *impl = (TableImpl*)table; + //impl->setUndoLogging(false); + i = 0; + NanoTimer timer; + icount =0; + for(i = LOAD; i< LOAD+ITERATIONS; i++) + { + timer.start(); + rv = conn.startTransaction(); + if (rv != OK) exit(1); + id= i; + strcpy(name, "PRABAKARAN0123456750590"); + ret = table->insertTuple(); + if (ret != 0) break; + // printf("%d\n ", i); + icount++; + conn.commit(); + timer.stop(); + } + printf("%d rows inserted %lld %lld %lld\n",icount, timer.min(), timer.max(), timer.avg()); + + int offset1= os::align(sizeof(int)); + Condition p1; + int val1 = 0; + p1.setTerm("f1", OpEquals, &val1); + table->setCondition(&p1); + icount=0; + + + timer.reset(); + for(i = LOAD; i< LOAD+ITERATIONS; i++) + { + timer.start(); + rv =conn.startTransaction(); + if (rv != OK) exit(1); + val1 = i; + table->execute(); + tuple = (char*)table->fetch() ; + if (tuple == NULL) {printf("loop break in %d\n", i);table->closeScan();break;} + // printf(" %d tuple value is %d %s \n", i, *((int*)tuple), tuple+offset1); + table->closeScan(); + icount++; + conn.commit(); + timer.stop(); + } + printf("%d rows selected %lld %lld %lld\n", icount, timer.min(), timer.max(), timer.avg()); + timer.reset(); + + for(i = LOAD; i< LOAD+ITERATIONS; i++) + { + timer.start(); + rv = conn.startTransaction(); + if (rv != OK) exit (1); + val1 = i; + table->execute(); + tuple = (char*)table->fetch() ; + if (tuple == NULL) {printf("loop break in %d\n", i);table->closeScan();break;} + strcpy(name, "PRABAKARAN0950576543210"); + table->updateTuple(); + table->closeScan(); + conn.commit(); + timer.stop(); + } + printf("%d rows updated %lld %lld %lld\n", i- LOAD, timer.min(), timer.max(), timer.avg()); + + + icount=0; + for(i = LOAD; i< LOAD+ITERATIONS; i++) + { + timer.start(); + rv = conn.startTransaction(); + if (rv != OK) exit (1); + val1 = i; + table->execute(); + tuple = (char*)table->fetch() ; + if (tuple == NULL) {printf("No record for %d\n", i);table->closeScan();break;} + table->deleteTuple(); + icount++; + table->closeScan(); + conn.commit(); + timer.stop(); + } + printf("%d rows deleted %lld %lld %lld\n", icount, timer.min(), timer.max(), timer.avg()); + + + dbMgr->closeTable(table); + dbMgr->dropTable("t1"); + printf("Table dropped\n"); + + conn.close(); + return 0; +} diff --git a/test/performance/DMLThreadTest.c b/test/performance/DMLThreadTest.c new file mode 100644 index 00000000..120da372 --- /dev/null +++ b/test/performance/DMLThreadTest.c @@ -0,0 +1,378 @@ +#include +#include +#define THREADS 5 +#define RECORDS 100000 +#define isoLevel READ_REPEATABLE +void* runInsTest(void *p); +void* runSelTest(void *p); +void* runDelTest(void *p); +int main() +{ + + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) + { + printf("Error during connection %d\n", rv); + return -1; + } + DatabaseManager *dbMgr = conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return -1;} + TableDef tabDef; + tabDef.addField("f1", typeInt, 0, NULL, true); + tabDef.addField("f2", typeString, 16); + rv = dbMgr->createTable("t1", tabDef); + if (rv != OK) { printf("Table creation failed\n"); return -1; } + HashIndexInitInfo *idxInfo = new HashIndexInitInfo(); + strcpy(idxInfo->tableName, "t1"); + idxInfo->list.append("f1"); + idxInfo->indType = treeIndex; + rv = dbMgr->createIndex("indx1", idxInfo); + if (rv != OK) { printf("Index creation failed\n"); return -1; } + delete idxInfo; + pthread_t thr[THREADS]; + int message[THREADS]; + int status; + for (int i=0; i openTable("t1"); + if (table == NULL) { printf("Unable to open table\n"); return -1; } + table->setCondition(NULL); + rv = conn.startTransaction(); + if (rv != OK) while (rv !=OK) rv = conn.startTransaction(); + table->execute(); + int count=0; + void *tuple = NULL; + while ((tuple = (char*) table->fetch())) { + count++; + } + printf("Tuples found: %d\n", count); + table->closeScan(); + conn.commit(); + + + Condition p1; + int valTerm = 0; + p1.setTerm("f1", OpEquals, &valTerm); + table->setCondition(&p1); + int icount=0; + for(int i = 0; i< THREADS * RECORDS; i++) + { + rv = conn.startTransaction(); + if (rv != OK) while (rv !=OK) rv = conn.startTransaction(); + valTerm = i; + rv = table->execute(); + tuple = (char*)table->fetch() ; + //if (tuple == NULL) printf(" %d ", i); else icount++; + if (tuple == NULL) break; else icount++; + table->closeScan(); + conn.commit(); + } + printf("\nIndex Tuples found: %d\n", icount); + + + + dbMgr->closeTable(table); + + for (int i=0; i dropTable("t1"); + conn.close(); + return 0; +} +void* runInsTest(void *message) +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) + { + printf("Error during connection %d\n", rv); + return NULL; + } + DatabaseManager *dbMgr = conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return NULL;} + Table *table = dbMgr->openTable("t1"); + if (table == NULL) { printf("Unable to open table\n"); return NULL; } + int id = 0; + char name[200] = "PRABAKARAN"; + table->bindFld("f1", &id); + table->bindFld("f2", name); + char *tuple; + int ret; + int i; + int icount =0; + NanoTimer timer; + int val = *(int*)message; + int retrycnt=0; + timer.start(); + for(i = val * RECORDS; i< (val *RECORDS) +RECORDS; i++) + { + rv = conn.startTransaction(); + if (rv != OK) while (rv !=OK) rv = conn.startTransaction(); + id= i; + strcpy(name, "PRABAKARAN0123456750590"); + ret = table->insertTuple(); + retrycnt=0; + while (ret == ErrLockTimeOut) + { + rv = conn.rollback(); + if (rv != OK) { + while (rv == ErrLockTimeOut) + { + printf("retrying abort\n"); + rv = conn.rollback(); + } + } + if (retrycnt == 10) { ret = 1; break;} + rv = conn.startTransaction(); + if (rv != OK) { + while (rv == ErrLockTimeOut) + { + printf("retrying startTransaction\n"); + rv = conn.startTransaction(); + } + } + ret = table->insertTuple(); + retrycnt++; + //ret =1; break; //temp to analyse issue + } + if (ret != 0) { printf("RETURNING EARLY: %d with i:%d\n", ret, i); break;} + icount++; + rv = conn.commit(); + if (rv != OK) { + printf("COMMIT returned %d for record %d\n", rv, i); + if (rv != ErrLockTimeOut) + { + printf("RETURNING EARLY: with i:%d\n", i); + break; + } + + os::usleep(500); + while (rv == ErrLockTimeOut) { + printf("retrying commit\n"); + rv = conn.commit(); + } + } + //if (icount %RECORDS ==0) printf("%d\n", i); + } + timer.stop(); + char msgBuf[1024]; + sprintf(msgBuf,"Insert: Thread %lu %d: Total rows :%d Time taken:%lld ms\n",os::getthrid(), val, icount, timer.avg()/1000/1000); + os::write(1,msgBuf,strlen(msgBuf)); + dbMgr->closeTable(table); + rv = conn.close(); + return NULL; +} +void* runSelTest(void *message) +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) + { + printf("Error during connection %d\n", rv); + return NULL; + } + DatabaseManager *dbMgr = conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return NULL;} + Table *table = dbMgr->openTable("t1"); + if (table == NULL) { printf("Unable to open table\n"); return NULL; } + int id = 0; + char name[20] = "PRABAKARAN"; + table->bindFld("f1", &id); + table->bindFld("f2", name); + char *tuple; + int i; + int icount =0; + NanoTimer timer; + int val = *(int*)message; + + Condition p1; + int valTerm = 0; + p1.setTerm("f1", OpEquals, &valTerm); + table->setCondition(&p1); + + timer.start(); + for(i = val * RECORDS; i< (val *RECORDS) +RECORDS; i++) + { + rv = conn.startTransaction(isoLevel); + if (rv != OK) while (rv !=OK) rv = conn.startTransaction(isoLevel); + valTerm = i; + rv = table->execute(); + if (rv != OK) { + printf("Execute returned %d\n", rv); + os::usleep(500); + int retry=5; + while (rv == ErrLockTimeOut) { + if (retry == 0) break; + printf("retrying execute\n"); + rv = table->execute(); + retry--; + } + } + tuple = (char*)table->fetch() ; + if (tuple == NULL) break; + icount++; + table->closeScan(); + rv = conn.commit(); + if (rv != OK) { + printf("Commit returned rv:%d for record:%d\n",rv, i); + while (rv == ErrLockTimeOut) { + printf("retrying commit\n"); + rv = conn.commit(); + } + } + } + + timer.stop(); + char msgBuf[1024]; + sprintf(msgBuf,"Select: Thread %lu %d: Total rows :%d Time taken:%lld ms\n",os::getthrid(), val, icount, timer.avg()/1000/1000); + os::write(1,msgBuf,strlen(msgBuf)); + dbMgr->closeTable(table); + rv = conn.close(); + return NULL; +} + + +void* runDelTest(void *message) +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) + { + printf("Error during connection %d\n", rv); + return NULL; + } + DatabaseManager *dbMgr = conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return NULL;} + Table *table = dbMgr->openTable("t1"); + if (table == NULL) { printf("Unable to open table\n"); return NULL; } + int id = 0; + char name[20] = "PRABAKARAN"; + table->bindFld("f1", &id); + table->bindFld("f2", name); + char *tuple; + int i; + int ret; + int retrycnt=0; + int icount =0; + NanoTimer timer; + int val = *(int*)message; + + Condition p1; + int valTerm = 0; + p1.setTerm("f1", OpEquals, &valTerm); + table->setCondition(&p1); + + timer.start(); + for(i = val * RECORDS; i< (val *RECORDS) +RECORDS; i++) + { + rv = conn.startTransaction(); + if (rv != OK) while (rv !=OK) rv = conn.startTransaction(); + id= i; + valTerm = i; + rv = table->execute(); + if (rv != OK) { + printf("Execute returned %d\n", rv); + os::usleep(500); + int retry=5; + while (rv == ErrLockTimeOut) { + if (retry == 0) { printf("DELETE:execute failed\n"); break;} + printf("retrying execute\n"); + rv = table->execute(); + retry--; + } + } + tuple = (char*)table->fetch() ; + if (tuple == NULL) { printf("DELETE:fetch failed\n");break;} + ret = table->deleteTuple(); + retrycnt=0; + while (ret == ErrLockTimeOut) + { + table->closeScan(); + rv = conn.rollback(); + if (rv != OK) { + while (rv == ErrLockTimeOut) + { + printf("retrying abort\n"); + rv = conn.rollback(); + } + } + if (retrycnt == 10) { ret = 1; break;} + rv = conn.startTransaction(); + if (rv != OK) { + while (rv == ErrLockTimeOut) + { + printf("retrying startTransaction\n"); + rv = conn.startTransaction(); + } + } + rv = table->execute(); + if (rv != OK) { + printf("Execute returned %d\n", rv); + os::usleep(500); + int retry=5; + while (rv == ErrLockTimeOut) { + if (retry == 0) { printf("DELETE:execute failed\n"); break;} + printf("retrying execute\n"); + rv = table->execute(); + retry--; + } + } + tuple = (char*)table->fetch() ; + if (tuple == NULL) { printf("DELETE:fetch failed\n");break;} + ret = table->deleteTuple(); + retrycnt++; + //ret =1; break; //temp to analyse issue + } + if (ret != 0) { printf("RETURNING EARLY: %d with i:%d\n", ret, i); break;} + table->closeScan(); + rv = conn.commit(); + if (rv != OK) { + printf("COMMIT returned %d for record %d\n", rv, i); + if (rv != ErrLockTimeOut) + { + printf("RETURNING EARLY: with i:%d\n", i); + break; + } + + os::usleep(500); + while (rv == ErrLockTimeOut) { + printf("retrying commit\n"); + rv = conn.commit(); + } + } + icount++; + //if (icount %RECORDS ==0) printf("%d\n", i); + } + timer.stop(); + char msgBuf[1024]; + sprintf(msgBuf,"Delete: Thread %lu %d: Total rows :%d Time taken:%lld ms\n",os::getthrid(), val, icount, timer.avg()/1000/1000); + os::write(1,msgBuf,strlen(msgBuf)); + dbMgr->closeTable(table); + rv = conn.close(); + return NULL; +} + diff --git a/test/performance/DMLThroughput.c b/test/performance/DMLThroughput.c new file mode 100644 index 00000000..fb4e5c58 --- /dev/null +++ b/test/performance/DMLThroughput.c @@ -0,0 +1,114 @@ +#include +#include +#include +//MAX_SYS_DB_SIZE=10485760 +//MAX_DB_SIZE=335544320 +//you may have to set the kernel.shmmax kernel paremeter(login as root) using +//$sysctl -w kernel.shmmax=1000000000 +#define LOAD 0 +int main() +{ + + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) + { + printf("Error during connection %d\n", rv); + return -1; + } + + + DatabaseManager *dbMgr = conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return -1;} + TableDef tabDef; + tabDef.addField("f1", typeInt, 0, NULL, true ); + tabDef.addField("f2", typeString, 6); + rv = dbMgr->createTable("t1", tabDef); + if (rv != OK) { printf("Table creation failed\n"); return -1; } + printf("Table created\n"); + HashIndexInitInfo *idxInfo = new HashIndexInitInfo(); + strcpy(idxInfo->tableName, "t1"); + idxInfo->list.append("f1"); + idxInfo->indType = hashIndex; + idxInfo->bucketSize = 100007; + rv = dbMgr->createIndex("indx1", idxInfo); + if (rv != OK) { printf("Index creation failed\n"); return -1; } + printf("Index created\n"); + delete idxInfo; + Table *table = dbMgr->openTable("t1"); + if (table == NULL) { printf("Unable to open table\n"); return -1; } + int id = 0; + char name[6] = "PRABA"; + table->bindFld("f1", &id); + table->bindFld("f2", name); + char *tuple; + int ret; + int i; + int icount =0; + i = 0; + NanoTimer timer; + icount =0; + for(i = 0; i < 20; i++) + { + timer.start(); + for (int j =0; j < 100000; j++) + { + rv = conn.startTransaction(); + //if (rv != OK) exit(1); + if (rv != OK) { + dbMgr->closeTable(table); + dbMgr->dropTable("t1"); + conn.close(); + return 1; + } + id= i*100000+j; + strcpy(name, "KARAN"); + ret = table->insertTuple(); + if (ret != 0) break; + icount++; + conn.commit(); + } + timer.stop(); + printf("Insert: %d %lld\n", icount, timer.last()); + } + printf("%d rows inserted %lld %lld %lld\n",icount, timer.min(), timer.max(), timer.avg()); + + int offset1= os::align(sizeof(int)); + Condition p1; + int val1 = 0; + p1.setTerm("f1", OpEquals, &val1); + table->setCondition(&p1); + icount=0; + + + timer.reset(); + for(i = 0; i< 20; i++) + { + timer.start(); + for (int j=0 ; j <100000; j++) + { + rv =conn.startTransaction(); + if (rv != OK) exit(1); + val1 = i *100000 + j; + table->execute(); + tuple = (char*)table->fetch() ; + if (tuple == NULL) {printf("loop break in %d\n", i);table->closeScan();break;} + // printf(" %d tuple value is %d %s \n", i, *((int*)tuple), tuple+offset1); + table->closeScan(); + icount++; + conn.commit(); + } + timer.stop(); + printf("Select: %d %lld\n", icount, timer.last()); + } + printf("%d rows selected %lld %lld %lld\n", icount, timer.min(), timer.max(), timer.avg()); + timer.reset(); + + dbMgr->closeTable(table); + dbMgr->dropTable("t1"); + printf("Table dropped\n"); + + + conn.close(); + return 0; +} diff --git a/test/performance/Makefile b/test/performance/Makefile new file mode 100644 index 00000000..d5f3f53f --- /dev/null +++ b/test/performance/Makefile @@ -0,0 +1,69 @@ + +OSNAME = $(shell uname -s) + +PlatForm=notsupported +ifeq ($(OSNAME), SunOS) + CPlus = CC + CPlusFlags = -O2 -w $(COMPILER_FLAG) + SYSLIBS=-ldl -lnsl -lsocket -lposix4 + PlatForm=supported +endif +ifeq ($(OSNAME), Linux) + CPlus = g++ + CPlusFlags = -g -w + SYSLIBS= -rdynamic -lrt -lpthread -lcrypt + PlatForm=supported +endif +ifeq ($(OSNAME), FreeBSD) + CPlus = g++ + CPlusFlags = -g -w + SYSLIBS= -rdynamic -lrt -lpthread -lcrypt + PlatForm=supported +endif + +JAVAC = javac -g:none +INCL= -I$(CSQL_INSTALL_ROOT)/include -I../../include +LIBS= -L/home/prabatuty/myroot/lib -L$(CSQL_INSTALL_ROOT)/lib -lcsqlodbc -lcsqlsql -lcsqlsqllog -lcsql -lcsqlnw -lodbc -lcsqlgw -lcacheload + +TARGETS = \ + SQLGWTest \ + SQLAdapterTest \ + SQLTest \ + DMLTest \ + DMLThroughput \ + DMLThreadTest \ + ODBCTest \ + ODBCConTest\ + JDBCTest + +ifeq ($(PlatForm), supported) +all: $(TARGETS) +else +all: + echo "CSQL is not supported on $(OSNAME) platform" +endif + +DMLTest: DMLTest.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +DMLThroughput: DMLThroughput.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +SQLTest: SQLTest.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +SQLGWTest: SQLGWTest.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +SQLAdapterTest: SQLAdapterTest.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +DMLThreadTest: DMLThreadTest.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) + +ODBCConTest: ODBCConTest.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) + +ODBCTest: ODBCTest.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +JDBCTest: JDBCTest.java + $(JAVAC) JDBCTest.java + +clean: + rm -f $(TARGETS) *.class + diff --git a/test/performance/ODBCConTest.c b/test/performance/ODBCConTest.c new file mode 100644 index 00000000..7398305d --- /dev/null +++ b/test/performance/ODBCConTest.c @@ -0,0 +1,679 @@ +/* This program has two different aspect + * 1. Use ($./ODBCConTest conn) command to get the timer result + * which starts from Connection and goes through pprepare, execute, commit + * and ends at Disconnect for each iteration. + * + * 2. Use ($./ODBCConTest prepare) command to get the timer result + * + * which starts at prepare and ends after commit for each iteration. + * + * Author: Jitendra Lenka + */ +#include +#include +#include +#include +#include +#include +#include +#include "NanoTimer.h" +#define ITERATION 100 +using namespace std; +#define DSN "test" +//#define DSN "DSN=mycsql;MODE=CSQL;SERVER=192.168.1.103;PORT=5678;""DSN=mycsql;MODE=CSQL;SERVER=192.168.1.103;PORT=5678;" + +NanoTimer timer; + +void extract_error( + char *fn, + SQLHANDLE handle, + SQLSMALLINT type) +{ + SQLINTEGER i = 0; + SQLINTEGER native; + SQLCHAR state[ 7 ]; + SQLCHAR text[256]; + SQLSMALLINT len; + SQLRETURN ret; + + fprintf(stderr, + "\n" + "The driver reported the following diagnostics whilst running " + "%s\n\n", + fn); + + do + { + ret = SQLGetDiagRec(type, handle, ++i, state, &native, text, + sizeof(text), &len ); + if (SQL_SUCCEEDED(ret)) + printf("%s:%ld:%ld:%s\n", state, i, native, text); + } + while( ret == SQL_SUCCESS ); +} + +inline void +check_error (SQLSMALLINT handleType, SQLHANDLE handle, int rc, int line) +{ + if (rc) + { + cout << "Error " << rc << " at line: " << line << endl; + SQLCHAR state[10]; + SQLINTEGER native; + SQLCHAR mesg[300]; + int i=0; + while (SQLGetDiagRec (handleType, handle, i++, state, &native, mesg, 300, + NULL) == SQL_SUCCESS) + { + mesg[299] = '\0'; + cout << "state: " << state << endl; + cout << "native: " << native << endl; + cout << "mesg: " << mesg << endl; + } + exit (1); + } +} + + +inline void +checkrc (int rc, int line) +{ + if (rc) + { + cout << "Error " << rc << " at line: " << line << endl; + exit (1); + } +} + +void +readWriteTrans (SQLHDBC hdbc) +{ + int rc = SQLSetConnectAttr (hdbc, SQL_ATTR_ACCESS_MODE, + (SQLPOINTER) SQL_MODE_READ_WRITE, 0); + checkrc (rc, __LINE__); + rc = SQLEndTran (SQL_HANDLE_DBC, hdbc, SQL_COMMIT); + checkrc (rc, __LINE__); +} + +void +readOnlyTrans (SQLHDBC hdbc) +{ + int rc = SQLSetConnectAttr (hdbc, SQL_ATTR_ACCESS_MODE, + (SQLPOINTER) SQL_MODE_READ_ONLY, 0); + checkrc (rc, __LINE__); + rc = SQLEndTran (SQL_HANDLE_DBC, hdbc, SQL_COMMIT); + checkrc (rc, __LINE__); +} + +int +runInsertTest (SQLHANDLE henv, SQLHANDLE hdbc, SQLHANDLE hstmt) +{ + + int rc,i; + int iHolder; + char sHolder[200]; + char sData[200]; + + timer.reset(); + for(i=0;i +#include +#include +#include +#include +#include +#include +#include "NanoTimer.h" +#define ITERATION 100 +using namespace std; + +#define DSN + +NanoTimer timer; + +void extract_error( + char *fn, + SQLHANDLE handle, + SQLSMALLINT type) +{ + SQLINTEGER i = 0; + SQLINTEGER native; + SQLCHAR state[ 7 ]; + SQLCHAR text[256]; + SQLSMALLINT len; + SQLRETURN ret; + + fprintf(stderr, + "\n" + "The driver reported the following diagnostics whilst running " + "%s\n\n", + fn); + + do + { + ret = SQLGetDiagRec(type, handle, ++i, state, &native, text, + sizeof(text), &len ); + if (SQL_SUCCEEDED(ret)) + printf("%s:%ld:%ld:%s\n", state, i, native, text); + } + while( ret == SQL_SUCCESS ); +} + +inline void +check_error (SQLSMALLINT handleType, SQLHANDLE handle, int rc, int line) +{ + if (rc) + { + cout << "Error " << rc << " at line: " << line << endl; + SQLCHAR state[10]; + SQLINTEGER native; + SQLCHAR mesg[300]; + int i=0; + while (SQLGetDiagRec (handleType, handle, i++, state, &native, mesg, 300, + NULL) == SQL_SUCCESS) + { + mesg[299] = '\0'; + cout << "state: " << state << endl; + cout << "native: " << native << endl; + cout << "mesg: " << mesg << endl; + } + exit (1); + } +} + + +inline void +checkrc (int rc, int line) +{ + if (rc) + { + cout << "Error " << rc << " at line: " << line << endl; + exit (1); + } +} + +void +readWriteTrans (SQLHDBC hdbc) +{ + int rc = SQLSetConnectAttr (hdbc, SQL_ATTR_ACCESS_MODE, + (SQLPOINTER) SQL_MODE_READ_WRITE, 0); + checkrc (rc, __LINE__); + rc = SQLEndTran (SQL_HANDLE_DBC, hdbc, SQL_COMMIT); + checkrc (rc, __LINE__); +} + +void +readOnlyTrans (SQLHDBC hdbc) +{ + int rc = SQLSetConnectAttr (hdbc, SQL_ATTR_ACCESS_MODE, + (SQLPOINTER) SQL_MODE_READ_ONLY, 0); + checkrc (rc, __LINE__); + rc = SQLEndTran (SQL_HANDLE_DBC, hdbc, SQL_COMMIT); + checkrc (rc, __LINE__); +} + +int +runInsertTest (SQLHANDLE henv, SQLHANDLE hdbc, SQLHANDLE hstmt) +{ + int rc; + int iHolder; + char sHolder[200]; + char sData[200]; + + iHolder = 0; + strcpy (sData, "0123456789012345678901234567890123456789"); + rc = SQLPrepare (hstmt, (unsigned char *) "INSERT INTO t1 VALUES (?, ?)", + SQL_NTS); + checkrc (rc, __LINE__); + rc = SQLBindParameter (hstmt, 1, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, + 0, 0, &iHolder, 0, NULL); + checkrc (rc, __LINE__); + SQLINTEGER sLen = SQL_NTS; + rc = SQLBindParameter (hstmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, + 196, 0, (void *) sHolder, 0, &sLen); + checkrc (rc, __LINE__); + int i, j, k; + int tCount; + + timer.reset (); + + /* Run 1per Test */ + for (i = 0; i < ITERATION; i++) + { + timer.start (); + iHolder = i ; + strcpy (sHolder, sData); + rc = SQLExecute (hstmt); + checkrc (rc, __LINE__); + rc = SQLTransact (henv, hdbc, SQL_COMMIT); + checkrc (rc, __LINE__); + timer.stop (); + } + + printf ("Insert: 1 %lld %lld %lld\n", timer.min (), timer.max (), + timer.avg ()); + + return 0; + +} + +int +runReadTest (SQLHANDLE henv, SQLHANDLE hdbc, SQLHANDLE hstmt) +{ + int iHolder; + char sHolder[200]; + char sData[200]; + + int tempTermVar = 0; + int tempTermVal = 0; + int rc; + + /* Set read-only transaction type */ + readOnlyTrans (hdbc); + rc = SQLPrepare (hstmt, (unsigned char *) + "SELECT f1, f2 FROM t1 where f1 = ?", SQL_NTS); + checkrc (rc, __LINE__); + long sz = 0; + rc = SQLBindParameter (hstmt, 1, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, + 0, 0, &tempTermVar, 0, NULL); + checkrc (rc, __LINE__); + rc = SQLBindCol (hstmt, 1, SQL_INTEGER, &iHolder, 0, NULL); + checkrc (rc, __LINE__); + rc = SQLBindCol (hstmt, 2, SQL_C_CHAR, sHolder, sizeof (sHolder), NULL); + checkrc (rc, __LINE__); + iHolder = 0; + strcpy (sData, "0123456789012345678901234567890123456789"); + + int i, j, k; + int tCount; + + timer.reset (); + + /* Run 1per Test */ + for (i = 0; i < ITERATION; i++) + { + timer.start (); + tempTermVar = i ; + rc = SQLExecute (hstmt); + checkrc (rc, __LINE__); + rc = SQLFetch (hstmt); + checkrc (rc, __LINE__); + tempTermVal = iHolder; + strcpy (sData, sHolder); + rc = SQLCloseCursor (hstmt); + checkrc (rc, __LINE__); + rc = SQLTransact (henv, hdbc, SQL_COMMIT); + checkrc (rc, __LINE__); + timer.stop (); + } + printf ("Read: 1 %lld %lld %lld\n", timer.min (), timer.max (), + timer.avg ()); + /* Set read-write transaction type */ + readWriteTrans (hdbc); + return rc; +} + +int +runUpdateTest (SQLHANDLE henv, SQLHANDLE hdbc, SQLHANDLE hstmt) +{ + int rc; + int iHolder; + char sHolder[200]; + char sData[200]; + + rc = SQLPrepare (hstmt, + (unsigned char *) "UPDATE t1 SET f2 = ? WHERE f1 = ?", + SQL_NTS); + checkrc (rc, __LINE__); + SQLINTEGER sLen = SQL_NTS; + rc = SQLBindParameter (hstmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, + 196, 0, (void *) sHolder, 0, &sLen); + checkrc (rc, __LINE__); + rc = SQLBindParameter (hstmt, 2, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, + 0, 0, &iHolder, 0, NULL); + checkrc (rc, __LINE__); + iHolder = 0; + strcpy (sData, "9876543210987654321098765432109876543210"); + + int i, j, k; + int tCount; + + timer.reset (); + + /* Run 1per Test */ + for (i = 0; i < ITERATION; i++) + { + timer.start (); + iHolder = i ; + strcpy (sHolder, sData); + rc = SQLExecute (hstmt); + checkrc (rc, __LINE__); + rc = SQLTransact (henv, hdbc, SQL_COMMIT); + checkrc (rc, __LINE__); + timer.stop (); + } + printf ("Update: 1 %lld %lld %lld\n", timer.min (), timer.max (), + timer.avg ()); + + return 0; +} + +int +runDeleteTest (SQLHANDLE henv, SQLHANDLE hdbc, SQLHANDLE hstmt) +{ + int rc; + int iHolder; + + rc = SQLPrepare (hstmt, (unsigned char *) + "DELETE FROM t1 WHERE f1 = ?", SQL_NTS); + checkrc (rc, __LINE__); + rc = SQLBindParameter (hstmt, 1, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, + 0, 0, &iHolder, 0, NULL); + checkrc (rc, __LINE__); + iHolder = 0; + int i, j, k; + int tCount; + timer.reset (); + /* Run 1per Test */ + for (i = 0; i < ITERATION; i++) + { + timer.start (); + iHolder = i ; + rc = SQLExecute (hstmt); + checkrc (rc, __LINE__); + rc = SQLTransact (henv, hdbc, SQL_COMMIT); + checkrc (rc, __LINE__); + timer.stop (); + } + printf ("Delete: 1 %lld %lld %lld\n", timer.min (), timer.max (), + timer.avg ()); + return 0; + +} + +int +main (int ac, char **av) +{ + int rc; + char *dsn; + //SQLHANDLE henv, hdbc, hstmt; +SQLHENV henv; +SQLHDBC hdbc; +SQLHSTMT hstmt; + + dsn = (char *) "DSN=test;"; + //dsn = (char *)"DSN=mycsql;MODE=CSQL;SERVER=192.168.1.103;PORT=5678;"; + + rc = SQLAllocHandle (SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv); + checkrc (rc, __LINE__); + SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (void *) SQL_OV_ODBC3, 0); + + rc = SQLAllocHandle (SQL_HANDLE_DBC, henv, &hdbc); + checkrc (rc, __LINE__); + rc = SQLConnect (hdbc, + (SQLCHAR *) dsn, SQL_NTS, + (SQLCHAR *) "root", + (SQLSMALLINT) strlen ("root"), + (SQLCHAR *) "manager", + (SQLSMALLINT) strlen ("")); + + SQLCHAR outstr[1024]; + SQLSMALLINT outstrlen; + + /* + rc = SQLDriverConnect(hdbc, NULL, (SQLCHAR*)"DSN=myodbc3;", SQL_NTS, + outstr, sizeof(outstr), &outstrlen, + SQL_DRIVER_NOPROMPT); + */ + + if (SQL_SUCCEEDED(rc)) { + printf("Connected\n"); + //printf("Returned connection string was:\n\t%s\n", outstr); + if (rc == SQL_SUCCESS_WITH_INFO) { + printf("Driver reported the following diagnostics\n"); + extract_error("SQLDriverConnect", hdbc, SQL_HANDLE_DBC); + } + } else { + fprintf(stderr, "Failed to connect\n"); + extract_error("SQLDriverConnect", hdbc, SQL_HANDLE_DBC); + } + + //check_error (SQL_HANDLE_DBC, hdbc, rc, __LINE__); + checkrc (rc, __LINE__); + rc = SQLSetConnectOption (hdbc, SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF); + checkrc (rc, __LINE__); + rc = SQLAllocHandle (SQL_HANDLE_STMT, hdbc, &hstmt); + checkrc (rc, __LINE__); + rc = SQLExecDirect(hstmt, (SQLCHAR*) "CREATE TABLE t1 (f1 INTEGER, f2 char(196), primary key (f1));", SQL_NTS ); + checkrc (rc, __LINE__); + + runInsertTest (henv, hdbc, hstmt); + runReadTest (henv, hdbc, hstmt); + runUpdateTest (henv, hdbc, hstmt); + runDeleteTest (henv, hdbc, hstmt); + + rc = SQLExecDirect(hstmt, (SQLCHAR*) "DROP TABLE t1;", SQL_NTS ); + checkrc (rc, __LINE__); + rc = SQLEndTran(SQL_HANDLE_DBC, hdbc, SQL_COMMIT ); + checkrc (rc, __LINE__); + + rc = SQLFreeHandle (SQL_HANDLE_STMT, hstmt); + checkrc (rc, __LINE__); + rc = SQLDisconnect (hdbc); + checkrc (rc, __LINE__); + rc = SQLFreeHandle (SQL_HANDLE_DBC, hdbc); + checkrc (rc, __LINE__); + rc = SQLFreeHandle (SQL_HANDLE_ENV, henv); + checkrc (rc, __LINE__); + exit (0); +} diff --git a/test/performance/SQLAdapterTest.c b/test/performance/SQLAdapterTest.c new file mode 100644 index 00000000..ebc37240 --- /dev/null +++ b/test/performance/SQLAdapterTest.c @@ -0,0 +1,121 @@ +#include +#include +#include +#define ITERATIONS 100 +//NOTE CREATE TABLE t1 (f1 int, f2 char(196), primary key(f1)); +//add 1:t1 in csqltable.conf and do csqlserver -c +int main() +{ + DbRetVal rv = OK; + AbsSqlConnection *con = SqlFactory::createConnection(CSqlAdapter); + rv = con->connect("root", "manager"); + if (rv != OK) return 1; + AbsSqlStatement *stmt = SqlFactory::createStatement(CSqlAdapter); + stmt->setConnection(con); + char statement[1024]; + + strcpy(statement, "INSERT INTO t1 (f1, f2) VALUES (?, ?);"); + int id1 =10; + char name[196]; + strcpy(name, "Rithish"); + NanoTimer timer; + rv = stmt->prepare(statement); + if (rv != OK) {delete stmt; delete con; return -1; } + int count =0, rows=0; + for (int i = 0 ; i < ITERATIONS ; i++) + { + timer.start(); + rv = con->beginTrans(); + if (rv != OK) break; + id1 = i; + stmt->setIntParam(1, id1); + strcpy(name, "Gopika"); + stmt->setStringParam(2, name); + rv = stmt->execute(rows); + if (rv != OK) break; + rv = con->commit(); + if (rv != OK) break; + timer.stop(); + count++; + } + printf("Total Rows Inserted %d %lld %lld %lld\n", count, timer.min(), + timer.max(), timer.avg()); + stmt->free(); + + strcpy(statement, "SELECT * FROM t1 where f1 = ?;"); + rv = stmt->prepare(statement); + if (rv != OK) {delete stmt; delete con; return -1; } + stmt->bindField(1, &id1); + stmt->bindField(2, name); + timer.reset(); + count =0; + for (int i = 0 ; i < ITERATIONS ; i++) + { + timer.start(); + rv = con->beginTrans(); + if (rv != OK) break; + stmt->setIntParam(1, i); + stmt->execute(rows); + if (stmt->fetch() == NULL) { printf("unable to read record\n"); break; } + stmt->close(); + rv = con->commit(); + if (rv != OK) break; + timer.stop(); + count++; + } + stmt->free(); + printf("Total Rows Selected %d %lld %lld %lld\n", count, timer.min(), + timer.max(), timer.avg()); + + strcpy(statement, "UPDATE t1 set f2=? where f1=?;"); + rv = stmt->prepare(statement); + if (rv != OK) {delete stmt; delete con; return -1; } + stmt->bindField(1, &id1); + stmt->bindField(2, name); + timer.reset(); + count =0; + for (int i = 0 ; i < ITERATIONS ; i++) + { + timer.start(); + rv = con->beginTrans(); + if (rv != OK) break; + stmt->setIntParam(2, i); + stmt->setStringParam(1, "ChangedValue"); + rv = stmt->execute(rows); + if (rv != OK && rows !=1) break; + rv = con->commit(); + if (rv != OK) break; + timer.stop(); + count++; + } + stmt->free(); + printf("Total Rows Updated %d %lld %lld %lld\n", count, timer.min(), + timer.max(), timer.avg()); + + strcpy(statement, "DELETE FROM t1 where f1=?;"); + rv = stmt->prepare(statement); + if (rv != OK) {delete stmt; delete con; return -1; } + stmt->bindField(1, &id1); + timer.reset(); + count =0; + for (int i = 0 ; i < ITERATIONS ; i++) + { + timer.start(); + rv = con->beginTrans(); + if (rv != OK) break; + stmt->setIntParam(1, i); + rv = stmt->execute(rows); + if (rv != OK && rows != 1) break; + rv = con->commit(); + if (rv != OK) break; + timer.stop(); + count++; + } + stmt->free(); + printf("Total Rows Deleted %d %lld %lld %lld\n", count, timer.min(), + timer.max(), timer.avg()); + + delete stmt; + delete con; + return 0; +} diff --git a/test/performance/SQLGWTest.c b/test/performance/SQLGWTest.c new file mode 100644 index 00000000..7490c2c4 --- /dev/null +++ b/test/performance/SQLGWTest.c @@ -0,0 +1,121 @@ +#include +#include +#include +#define ITERATIONS 100 +//NOTE CREATE TABLE t1 (f1 int, f2 char(196), primary key(f1)); +//add 1:t1 in csqltable.conf and do csqlserver -c +int main() +{ + DbRetVal rv = OK; + AbsSqlConnection *con = SqlFactory::createConnection(CSqlGateway); + rv = con->connect("root", "manager"); + if (rv != OK) return 1; + AbsSqlStatement *stmt = SqlFactory::createStatement(CSqlGateway); + stmt->setConnection(con); + char statement[1024]; + + strcpy(statement, "INSERT INTO t1 (f1, f2) VALUES (?, ?);"); + int id1 =10; + char name[196]; + strcpy(name, "Rithish"); + NanoTimer timer; + rv = stmt->prepare(statement); + if (rv != OK) {delete stmt; delete con; return -1; } + int count =0, rows=0; + for (int i = 0 ; i < ITERATIONS ; i++) + { + timer.start(); + rv = con->beginTrans(); + if (rv != OK) break; + id1 = i; + stmt->setIntParam(1, id1); + strcpy(name, "Gopika"); + stmt->setStringParam(2, name); + rv = stmt->execute(rows); + if (rv != OK) break; + rv = con->commit(); + if (rv != OK) break; + timer.stop(); + count++; + } + printf("Total Rows Inserted %d %lld %lld %lld\n", count, timer.min(), + timer.max(), timer.avg()); + stmt->free(); + + strcpy(statement, "SELECT * FROM t1 where f1 = ?;"); + rv = stmt->prepare(statement); + if (rv != OK) {delete stmt; delete con; return -1; } + stmt->bindField(1, &id1); + stmt->bindField(2, name); + timer.reset(); + count =0; + for (int i = 0 ; i < ITERATIONS ; i++) + { + timer.start(); + rv = con->beginTrans(); + if (rv != OK) break; + stmt->setIntParam(1, i); + stmt->execute(rows); + if (stmt->fetch() == NULL) { printf("unable to read record\n"); break; } + stmt->close(); + rv = con->commit(); + if (rv != OK) break; + timer.stop(); + count++; + } + stmt->free(); + printf("Total Rows Selected %d %lld %lld %lld\n", count, timer.min(), + timer.max(), timer.avg()); + + strcpy(statement, "UPDATE t1 set f2=? where f1=?;"); + rv = stmt->prepare(statement); + if (rv != OK) {delete stmt; delete con; return -1; } + stmt->bindField(1, &id1); + stmt->bindField(2, name); + timer.reset(); + count =0; + for (int i = 0 ; i < ITERATIONS ; i++) + { + timer.start(); + rv = con->beginTrans(); + if (rv != OK) break; + stmt->setIntParam(2, i); + stmt->setStringParam(1, "ChangedValue"); + rv = stmt->execute(rows); + if (rv != OK && rows !=1) break; + rv = con->commit(); + if (rv != OK) break; + timer.stop(); + count++; + } + stmt->free(); + printf("Total Rows Updated %d %lld %lld %lld\n", count, timer.min(), + timer.max(), timer.avg()); + + strcpy(statement, "DELETE FROM t1 where f1=?;"); + rv = stmt->prepare(statement); + if (rv != OK) {delete stmt; delete con; return -1; } + stmt->bindField(1, &id1); + timer.reset(); + count =0; + for (int i = 0 ; i < ITERATIONS ; i++) + { + timer.start(); + rv = con->beginTrans(); + if (rv != OK) break; + stmt->setIntParam(1, i); + rv = stmt->execute(rows); + if (rv != OK && rows != 1) break; + rv = con->commit(); + if (rv != OK) break; + timer.stop(); + count++; + } + stmt->free(); + printf("Total Rows Deleted %d %lld %lld %lld\n", count, timer.min(), + timer.max(), timer.avg()); + + delete stmt; + delete con; + return 0; +} diff --git a/test/performance/SQLTest.c b/test/performance/SQLTest.c new file mode 100644 index 00000000..db8dc5b8 --- /dev/null +++ b/test/performance/SQLTest.c @@ -0,0 +1,144 @@ +#include +#include +#include +#define ITERATIONS 100 +int main() +{ + DbRetVal rv = OK; + AbsSqlConnection *con = SqlFactory::createConnection(CSql); + rv = con->connect("root", "manager"); + if (rv != OK) return 1; + AbsSqlStatement *stmt = SqlFactory::createStatement(CSql); + stmt->setConnection(con); + char statement[1024]; + strcpy(statement, "CREATE TABLE t1 (f1 int, f2 char(196));"); + int rows =0; + rv = stmt->prepare(statement); + if (rv != OK) {delete stmt; delete con; return -1; } + rv = stmt->execute(rows); + if (rv != OK) {delete stmt; delete con; return -1; } + stmt->free(); + printf("Table t1 created\n"); + + strcpy(statement, "CREATE INDEX t1idx on t1 (f1);"); + rv = stmt->prepare(statement); + if (rv != OK) {delete stmt; delete con; return -1; } + rv = stmt->execute(rows); + if (rv != OK) {delete stmt; delete con; return -1; } + stmt->free(); + printf("Index created on t1(f1) \n"); + + strcpy(statement, "INSERT INTO t1 (f1, f2) VALUES (?, ?);"); + int id1 =10; + char name[196]; + strcpy(name, "Rithish"); + NanoTimer timer; + rv = stmt->prepare(statement); + if (rv != OK) {delete stmt; delete con; return -1; } + int count =0; + for (int i = 0 ; i < ITERATIONS ; i++) + { + timer.start(); + rv = con->beginTrans(); + if (rv != OK) break; + id1 = i; + stmt->setIntParam(1, id1); + strcpy(name, "Gopika"); + stmt->setStringParam(2, name); + rv = stmt->execute(rows); + if (rv != OK) break; + rv = con->commit(); + if (rv != OK) break; + timer.stop(); + count++; + } + printf("Total Rows Inserted %d %lld %lld %lld\n", count, timer.min(), + timer.max(), timer.avg()); + stmt->free(); + + strcpy(statement, "SELECT * FROM t1 where f1 = ?;"); + rv = stmt->prepare(statement); + if (rv != OK) {delete stmt; delete con; return -1; } + stmt->bindField(1, &id1); + stmt->bindField(2, name); + timer.reset(); + count =0; + for (int i = 0 ; i < ITERATIONS ; i++) + { + timer.start(); + rv = con->beginTrans(); + if (rv != OK) break; + stmt->setIntParam(1, i); + stmt->execute(rows); + if (stmt->fetch() == NULL) { printf("unable to read record\n"); break; } + stmt->close(); + rv = con->commit(); + if (rv != OK) break; + timer.stop(); + count++; + } + stmt->free(); + printf("Total Rows Selected %d %lld %lld %lld\n", count, timer.min(), + timer.max(), timer.avg()); + + strcpy(statement, "UPDATE t1 set f2=? where f1=?;"); + rv = stmt->prepare(statement); + if (rv != OK) {delete stmt; delete con; return -1; } + stmt->bindField(1, &id1); + stmt->bindField(2, name); + timer.reset(); + count =0; + for (int i = 0 ; i < ITERATIONS ; i++) + { + timer.start(); + rv = con->beginTrans(); + if (rv != OK) break; + stmt->setIntParam(2, i); + stmt->setStringParam(1, "ChangedValue"); + rv = stmt->execute(rows); + if (rv != OK && rows !=1) break; + rv = con->commit(); + if (rv != OK) break; + timer.stop(); + count++; + } + stmt->free(); + printf("Total Rows Updated %d %lld %lld %lld\n", count, timer.min(), + timer.max(), timer.avg()); + + strcpy(statement, "DELETE FROM t1 where f1=?;"); + rv = stmt->prepare(statement); + if (rv != OK) {delete stmt; delete con; return -1; } + stmt->bindField(1, &id1); + timer.reset(); + count =0; + for (int i = 0 ; i < ITERATIONS ; i++) + { + timer.start(); + rv = con->beginTrans(); + if (rv != OK) break; + stmt->setIntParam(1, i); + rv = stmt->execute(rows); + if (rv != OK && rows != 1) break; + rv = con->commit(); + if (rv != OK) break; + timer.stop(); + count++; + } + stmt->free(); + printf("Total Rows Deleted %d %lld %lld %lld\n", count, timer.min(), + timer.max(), timer.avg()); + + strcpy(statement, "DROP TABLE t1;"); + rv = stmt->prepare(statement); + if (rv != OK) {delete stmt; delete con; return -1; } + rv = stmt->execute(rows); + if (rv != OK) {delete stmt; delete con; return -1; } + stmt->free(); + printf("Table dropped\n"); + + + delete stmt; + delete con; + return 0; +} diff --git a/test/performance/loadtest/Makefile b/test/performance/loadtest/Makefile new file mode 100644 index 00000000..79ebdabb --- /dev/null +++ b/test/performance/loadtest/Makefile @@ -0,0 +1,47 @@ + +OSNAME = $(shell uname -s) +PlatForm=supported + +ifeq ($(OSNAME), SunOS) +CPlus = CC +CPlusFlags = -O2 -w -mt -xarch=v8 +SYSLIBS=-ldl -lnsl -lsocket -lposix4 +JAVAC = javac +else +ifeq ($(OSNAME), Linux) +CPlus = g++ +CPlusFlags = -O2 -w +JAVAC = javac -g:none +SYSLIBS= -rdynamic -lrt -lpthread -lcrypt +else +PlatForm=notsupported +all: + echo "CSQL is not supported on $(OSNAME) platform" +endif +endif + +INCL= -I$(CSQL_INSTALL_ROOT)/include -I../../include +LIBS= -L/home/prabatuty/myroot/lib -L$(CSQL_INSTALL_ROOT)/lib -lcsqlodbc -lcsqlsql -lcsqlsqllog -lcsql -lcsqlnw -lodbc -lcsqlgw -lcacheload +#LIBS= -L/home/prabatuty/myroot/lib -L$(CSQL_INSTALL_ROOT)/lib -lodbc + +TARGETS = \ + ODBCTest \ + ODBCLoad ODBCLoadWiscSchema ODBCTestWiscSchema + + +ifeq ($(PlatForm), supported) +all: $(TARGETS) +endif + + +ODBCTest: ODBCTest.c + $(CPlus) $(CPlusFlags)-o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +ODBCLoad: ODBCLoad.c + $(CPlus) $(CPlusFlags)-o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +ODBCTestWiscSchema:ODBCTestWiscSchema.c + $(CPlus) $(CPlusFlags)-o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +ODBCLoadWiscSchema:ODBCLoadWiscSchema.c + $(CPlus) $(CPlusFlags)-o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +clean: + rm -f $(TARGETS) *.class + diff --git a/test/performance/loadtest/ODBCLoad.c b/test/performance/loadtest/ODBCLoad.c new file mode 100644 index 00000000..db73923b --- /dev/null +++ b/test/performance/loadtest/ODBCLoad.c @@ -0,0 +1,216 @@ + +#include +#include +#include +#include +#include +#include +#include +#include "NanoTimer.h" +//#define START 70000001 +//#define END 1010000000 +using namespace std; + +int START=0; +int END=0; + +NanoTimer timer; + +void extract_error( + char *fn, + SQLHANDLE handle, + SQLSMALLINT type) +{ + SQLINTEGER i = 0; + SQLINTEGER native; + SQLCHAR state[ 7 ]; + SQLCHAR text[256]; + SQLSMALLINT len; + SQLRETURN ret; + + fprintf(stderr, + "\n" + "The driver reported the following diagnostics whilst running " + "%s\n\n", + fn); + + do + { + ret = SQLGetDiagRec(type, handle, ++i, state, &native, text, + sizeof(text), &len ); + if (SQL_SUCCEEDED(ret)) + printf("%s:%ld:%ld:%s\n", state, i, native, text); + } + while( ret == SQL_SUCCESS ); +} + +inline void +check_error (SQLSMALLINT handleType, SQLHANDLE handle, int rc, int line) +{ + if (rc) + { + cout << "Error " << rc << " at line: " << line << endl; + SQLCHAR state[10]; + SQLINTEGER native; + SQLCHAR mesg[300]; + int i=0; + while (SQLGetDiagRec (handleType, handle, i++, state, &native, mesg, 300, + NULL) == SQL_SUCCESS) + { + mesg[299] = '\0'; + cout << "state: " << state << endl; + cout << "native: " << native << endl; + cout << "mesg: " << mesg << endl; + } + exit (1); + } +} + + +inline void +checkrc (int rc, int line) +{ + if (rc) + { + cout << "Error " << rc << " at line: " << line << endl; + exit (1); + } +} + +void +readWriteTrans (SQLHDBC hdbc) +{ + int rc = SQLSetConnectAttr (hdbc, SQL_ATTR_ACCESS_MODE, + (SQLPOINTER) SQL_MODE_READ_WRITE, 0); + checkrc (rc, __LINE__); + rc = SQLEndTran (SQL_HANDLE_DBC, hdbc, SQL_COMMIT); + checkrc (rc, __LINE__); +} + +void +readOnlyTrans (SQLHDBC hdbc) +{ + int rc = SQLSetConnectAttr (hdbc, SQL_ATTR_ACCESS_MODE, + (SQLPOINTER) SQL_MODE_READ_ONLY, 0); + checkrc (rc, __LINE__); + rc = SQLEndTran (SQL_HANDLE_DBC, hdbc, SQL_COMMIT); + checkrc (rc, __LINE__); +} + +int +runInsertTest (SQLHANDLE henv, SQLHANDLE hdbc, SQLHANDLE hstmt) +{ + int rc; + int iHolder; + char sHolder[200]; + char sData[200]; + iHolder = 0; + strcpy (sData, "0123456789012345678901234567890123456789"); + rc = SQLPrepare (hstmt, (unsigned char *) "INSERT INTO t1 VALUES (?, 1212)",SQL_NTS); + checkrc (rc, __LINE__); + rc = SQLBindParameter (hstmt, 1, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, + 0, 0, &iHolder, 0, NULL); + checkrc (rc, __LINE__); + SQLINTEGER sLen = SQL_NTS; +/* rc = SQLBindParameter (hstmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, + 196, 0, (void *) sHolder, 0, &sLen);*/ + checkrc (rc, __LINE__); + int i, j, k; + int tCount=0; + + + /* Run 1per Test */ + int commit=0; + for (i = START; i <= END; i++) + { + iHolder = i ; + strcpy (sHolder, sData); + rc = SQLExecute (hstmt); + checkrc (rc, __LINE__); + if(commit==1000){ + rc = SQLTransact (henv, hdbc, SQL_COMMIT); + checkrc (rc, __LINE__); + commit=0; + }else {commit++;} + tCount++; + } + printf("Total Record Inserted %d\n",tCount); + return 0; + +} + +int +main (int ac, char **av) +{ + int rc; + char *dsn; + START = atoi(getenv("START")); + END = atoi(getenv("END")); + SQLHENV henv; + SQLHDBC hdbc; + SQLHSTMT hstmt; + bool ddl=false; + if (ac ==2) ddl = true; + + dsn = (char *) "DSN=myodbc3;"; + + rc = SQLAllocHandle (SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv); + checkrc (rc, __LINE__); + SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (void *) SQL_OV_ODBC3, 0); + + rc = SQLAllocHandle (SQL_HANDLE_DBC, henv, &hdbc); + checkrc (rc, __LINE__); + rc = SQLConnect (hdbc, + (SQLCHAR *) "test", (SQLSMALLINT) strlen ("test"), + (SQLCHAR *) "root", + (SQLSMALLINT) strlen ("root"), + (SQLCHAR *) "manager", + (SQLSMALLINT) strlen ("manager")); + + SQLCHAR outstr[1024]; + SQLSMALLINT outstrlen; +/* rc = SQLDriverConnect(hdbc, NULL, (SQLCHAR*)"DSN=myodbc3;UID=root;PWD=root123;", SQL_NTS, outstr, sizeof(outstr), &outstrlen, SQL_DRIVER_NOPROMPT); +*/ + if (SQL_SUCCEEDED(rc)) { + printf("Connected\n"); + //printf("Returned connection string was:\n\t%s\n", outstr); + if (rc == SQL_SUCCESS_WITH_INFO) { + printf("Driver reported the following diagnostics\n"); + extract_error("SQLDriverConnect", hdbc, SQL_HANDLE_DBC); + } + } else { + fprintf(stderr, "Failed to connect\n"); + extract_error("SQLDriverConnect", hdbc, SQL_HANDLE_DBC); + } + + //check_error (SQL_HANDLE_DBC, hdbc, rc, __LINE__); + checkrc (rc, __LINE__); + rc = SQLSetConnectOption (hdbc, SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF); + checkrc (rc, __LINE__); + rc = SQLAllocHandle (SQL_HANDLE_STMT, hdbc, &hstmt); + checkrc (rc, __LINE__); + if(ddl){ + rc = SQLExecDirect(hstmt, (SQLCHAR*) "CREATE TABLE t1 (f1 INTEGER,f2 INTEGER);", SQL_NTS ); + checkrc (rc, __LINE__); + rc = SQLExecDirect(hstmt, (SQLCHAR*)"create index idx1 on t1(f1) tree unique;" +,SQL_NTS ); + checkrc (rc, __LINE__); + +} + runInsertTest (henv, hdbc, hstmt); + /* + rc = SQLExecDirect(hstmt, (SQLCHAR*) "DROP TABLE t1;", SQL_NTS ); + checkrc (rc, __LINE__); + rc = SQLEndTran(SQL_HANDLE_DBC, hdbc, SQL_COMMIT ); + checkrc (rc, __LINE__); +*/ + rc = SQLFreeHandle (SQL_HANDLE_STMT, hstmt); + checkrc (rc, __LINE__); + rc = SQLDisconnect (hdbc); + checkrc (rc, __LINE__); + rc = SQLFreeHandle (SQL_HANDLE_DBC, hdbc); + checkrc (rc, __LINE__); + rc = SQLFreeHandle (SQL_HANDLE_ENV, henv); + checkrc (rc, __LINE__); + exit (0); +} diff --git a/test/performance/loadtest/ODBCLoadWiscSchema.c b/test/performance/loadtest/ODBCLoadWiscSchema.c new file mode 100644 index 00000000..eb99d70e --- /dev/null +++ b/test/performance/loadtest/ODBCLoadWiscSchema.c @@ -0,0 +1,215 @@ + +#include +#include +#include +#include +#include +#include +#include +#include "NanoTimer.h" +//#define START 70000001 +//#define END 1010000000 +using namespace std; + +int START=0; +int END=0; + +NanoTimer timer; + +void extract_error( + char *fn, + SQLHANDLE handle, + SQLSMALLINT type) +{ + SQLINTEGER i = 0; + SQLINTEGER native; + SQLCHAR state[ 7 ]; + SQLCHAR text[256]; + SQLSMALLINT len; + SQLRETURN ret; + + fprintf(stderr, + "\n" + "The driver reported the following diagnostics whilst running " + "%s\n\n", + fn); + + do + { + ret = SQLGetDiagRec(type, handle, ++i, state, &native, text, + sizeof(text), &len ); + if (SQL_SUCCEEDED(ret)) + printf("%s:%ld:%ld:%s\n", state, i, native, text); + } + while( ret == SQL_SUCCESS ); +} + +inline void +check_error (SQLSMALLINT handleType, SQLHANDLE handle, int rc, int line) +{ + if (rc) + { + cout << "Error " << rc << " at line: " << line << endl; + SQLCHAR state[10]; + SQLINTEGER native; + SQLCHAR mesg[300]; + int i=0; + while (SQLGetDiagRec (handleType, handle, i++, state, &native, mesg, 300, + NULL) == SQL_SUCCESS) + { + mesg[299] = '\0'; + cout << "state: " << state << endl; + cout << "native: " << native << endl; + cout << "mesg: " << mesg << endl; + } + exit (1); + } +} + + +inline void +checkrc (int rc, int line) +{ + if (rc) + { + cout << "Error " << rc << " at line: " << line << endl; + exit (1); + } +} + +void +readWriteTrans (SQLHDBC hdbc) +{ + int rc = SQLSetConnectAttr (hdbc, SQL_ATTR_ACCESS_MODE, + (SQLPOINTER) SQL_MODE_READ_WRITE, 0); + checkrc (rc, __LINE__); + rc = SQLEndTran (SQL_HANDLE_DBC, hdbc, SQL_COMMIT); + checkrc (rc, __LINE__); +} + +void +readOnlyTrans (SQLHDBC hdbc) +{ + int rc = SQLSetConnectAttr (hdbc, SQL_ATTR_ACCESS_MODE, + (SQLPOINTER) SQL_MODE_READ_ONLY, 0); + checkrc (rc, __LINE__); + rc = SQLEndTran (SQL_HANDLE_DBC, hdbc, SQL_COMMIT); + checkrc (rc, __LINE__); +} + +int +runInsertTest (SQLHANDLE henv, SQLHANDLE hdbc, SQLHANDLE hstmt) +{ + int rc; + int iHolder; + char sHolder[200]; + char sData[200]; + iHolder = 0; + strcpy (sData, "0123456789012345678901234567890123456789"); + rc = SQLPrepare (hstmt, (unsigned char *) "insert into t1 values(?,12,13,14,15,16,17,18,19,20,21,100,100,'AXXXXXXXXXXXXXXXXXXXXXXXXXCXXXXXXXXXXXXXXXXXXXXXXXX','GXXXXXXXXXXXXXXXXXXXXXXXXXCXXXXXXXXXXXXXXXXXXXXXXXXA','OXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXO')",SQL_NTS); + checkrc (rc, __LINE__); + rc = SQLBindParameter (hstmt, 1, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, + 0, 0, &iHolder, 0, NULL); + checkrc (rc, __LINE__); + SQLINTEGER sLen = SQL_NTS; +/* rc = SQLBindParameter (hstmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, + 196, 0, (void *) sHolder, 0, &sLen);*/ + checkrc (rc, __LINE__); + int i, j, k; + int tCount=0; + + + /* Run 1per Test */ + int commit=0; + for (i = START; i <= END; i++) + { + iHolder = i ; + strcpy (sHolder, sData); + rc = SQLExecute (hstmt); + checkrc (rc, __LINE__); + if(commit==1000){ + rc = SQLTransact (henv, hdbc, SQL_COMMIT); + checkrc (rc, __LINE__); + commit=0; + }else {commit++;} + tCount++; + } + printf("Total Record Inserted %d\n",tCount); + return 0; + +} + +int +main (int ac, char **av) +{ + int rc; + char *dsn; + START = atoi(getenv("START")); + END = atoi(getenv("END")); + SQLHENV henv; + SQLHDBC hdbc; + SQLHSTMT hstmt; + bool ddl=false; + if (ac ==2) ddl = true; + + dsn = (char *) "DSN=myodbc3;"; + + rc = SQLAllocHandle (SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv); + checkrc (rc, __LINE__); + SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (void *) SQL_OV_ODBC3, 0); + + rc = SQLAllocHandle (SQL_HANDLE_DBC, henv, &hdbc); + checkrc (rc, __LINE__); + rc = SQLConnect (hdbc, + (SQLCHAR *) "test", (SQLSMALLINT) strlen ("test"), + (SQLCHAR *) "root", + (SQLSMALLINT) strlen ("root"), + (SQLCHAR *) "manager", + (SQLSMALLINT) strlen ("manager")); + + SQLCHAR outstr[1024]; + SQLSMALLINT outstrlen; +/* rc = SQLDriverConnect(hdbc, NULL, (SQLCHAR*)"DSN=myodbc3;UID=root;PWD=root123;", SQL_NTS, outstr, sizeof(outstr), &outstrlen, SQL_DRIVER_NOPROMPT); +*/ + if (SQL_SUCCEEDED(rc)) { + printf("Connected\n"); + //printf("Returned connection string was:\n\t%s\n", outstr); + if (rc == SQL_SUCCESS_WITH_INFO) { + printf("Driver reported the following diagnostics\n"); + extract_error("SQLDriverConnect", hdbc, SQL_HANDLE_DBC); + } + } else { + fprintf(stderr, "Failed to connect\n"); + extract_error("SQLDriverConnect", hdbc, SQL_HANDLE_DBC); + } + + //check_error (SQL_HANDLE_DBC, hdbc, rc, __LINE__); + checkrc (rc, __LINE__); + rc = SQLSetConnectOption (hdbc, SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF); + checkrc (rc, __LINE__); + rc = SQLAllocHandle (SQL_HANDLE_STMT, hdbc, &hstmt); + checkrc (rc, __LINE__); + if(ddl){ + rc = SQLExecDirect(hstmt, (SQLCHAR*) "CREATE TABLE t1 (f1 INT NOT NULL , f2 INT NOT NULL , f3 INT NOT NULL , four INT NOT NULL , ten INT NOT NULL , twenty INT NOT NULL , onepercent INT NOT NULL , tenpercent INT NOT NULL , twentypercent INT NOT NULL , fiftypercent INT NOT NULL , unique3 INT NOT NULL , evenonepercent INT NOT NULL , oddonepercent INT NOT NULL , stringu1 CHAR (52) NOT NULL , stringu2 CHAR (52) NOT NULL , string4 CHAR (52) NOT NULL );", SQL_NTS ); + checkrc (rc, __LINE__); + rc = SQLExecDirect(hstmt, (SQLCHAR*)"create index idx1 on t1(f1) tree unique;" +,SQL_NTS ); + checkrc (rc, __LINE__); +} + runInsertTest (henv, hdbc, hstmt); + /* + rc = SQLExecDirect(hstmt, (SQLCHAR*) "DROP TABLE t1;", SQL_NTS ); + checkrc (rc, __LINE__); + rc = SQLEndTran(SQL_HANDLE_DBC, hdbc, SQL_COMMIT ); + checkrc (rc, __LINE__); +*/ + rc = SQLFreeHandle (SQL_HANDLE_STMT, hstmt); + checkrc (rc, __LINE__); + rc = SQLDisconnect (hdbc); + checkrc (rc, __LINE__); + rc = SQLFreeHandle (SQL_HANDLE_DBC, hdbc); + checkrc (rc, __LINE__); + rc = SQLFreeHandle (SQL_HANDLE_ENV, henv); + checkrc (rc, __LINE__); + exit (0); +} diff --git a/test/performance/loadtest/ODBCTest.c b/test/performance/loadtest/ODBCTest.c new file mode 100644 index 00000000..aa9da775 --- /dev/null +++ b/test/performance/loadtest/ODBCTest.c @@ -0,0 +1,347 @@ + +#include +#include +#include +#include +#include +#include +#include +#include "NanoTimer.h" +//#define START 1010000001 +//#define ITERATION 100 +using namespace std; + +int START=0; +int ITERATION=0; +NanoTimer timer; + +void extract_error( + char *fn, + SQLHANDLE handle, + SQLSMALLINT type) +{ + SQLINTEGER i = 0; + SQLINTEGER native; + SQLCHAR state[ 7 ]; + SQLCHAR text[256]; + SQLSMALLINT len; + SQLRETURN ret; + + fprintf(stderr, + "\n" + "The driver reported the following diagnostics whilst running " + "%s\n\n", + fn); + + do + { + ret = SQLGetDiagRec(type, handle, ++i, state, &native, text, + sizeof(text), &len ); + if (SQL_SUCCEEDED(ret)) + printf("%s:%ld:%ld:%s\n", state, i, native, text); + } + while( ret == SQL_SUCCESS ); +} + +inline void +check_error (SQLSMALLINT handleType, SQLHANDLE handle, int rc, int line) +{ + if (rc) + { + cout << "Error " << rc << " at line: " << line << endl; + SQLCHAR state[10]; + SQLINTEGER native; + SQLCHAR mesg[300]; + int i=0; + while (SQLGetDiagRec (handleType, handle, i++, state, &native, mesg, 300, + NULL) == SQL_SUCCESS) + { + mesg[299] = '\0'; + cout << "state: " << state << endl; + cout << "native: " << native << endl; + cout << "mesg: " << mesg << endl; + } + exit (1); + } +} + + +inline void +checkrc (int rc, int line) +{ + if (rc) + { + cout << "Error " << rc << " at line: " << line << endl; + exit (1); + } +} + +void +readWriteTrans (SQLHDBC hdbc) +{ + int rc = SQLSetConnectAttr (hdbc, SQL_ATTR_ACCESS_MODE, + (SQLPOINTER) SQL_MODE_READ_WRITE, 0); + checkrc (rc, __LINE__); + rc = SQLEndTran (SQL_HANDLE_DBC, hdbc, SQL_COMMIT); + checkrc (rc, __LINE__); +} + +void +readOnlyTrans (SQLHDBC hdbc) +{ + int rc = SQLSetConnectAttr (hdbc, SQL_ATTR_ACCESS_MODE, + (SQLPOINTER) SQL_MODE_READ_ONLY, 0); + checkrc (rc, __LINE__); + rc = SQLEndTran (SQL_HANDLE_DBC, hdbc, SQL_COMMIT); + checkrc (rc, __LINE__); +} + +int +runInsertTest (SQLHANDLE henv, SQLHANDLE hdbc, SQLHANDLE hstmt) +{ + int rc; + int iHolder; + char sHolder[200]; + char sData[200]; + + iHolder = 0; + strcpy (sData, "0123456789012345678901234567890123456789"); + rc = SQLPrepare (hstmt, (unsigned char *) "INSERT INTO t1 VALUES (?, 2000)", + SQL_NTS); + checkrc (rc, __LINE__); + rc = SQLBindParameter (hstmt, 1, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, + 0, 0, &iHolder, 0, NULL); + checkrc (rc, __LINE__); + SQLINTEGER sLen = SQL_NTS; +/* rc = SQLBindParameter (hstmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, + 196, 0, (void *) sHolder, 0, &sLen);*/ + checkrc (rc, __LINE__); + int i, j, k; + int tCount; + + timer.reset (); + + /* Run 1per Test */ + for (i = START; i<(START + ITERATION); i++) + { + timer.start (); + iHolder = i ; + strcpy (sHolder, sData); + rc = SQLExecute (hstmt); + checkrc (rc, __LINE__); + rc = SQLTransact (henv, hdbc, SQL_COMMIT); + checkrc (rc, __LINE__); + timer.stop (); + } + + printf ("Insert: 1 %lld %lld %lld\n", timer.min (), timer.max (), + timer.avg ()); + + return 0; + +} + +int +runReadTest (SQLHANDLE henv, SQLHANDLE hdbc, SQLHANDLE hstmt) +{ + int iHolder; + int second; + char sHolder[200]; + char sData[200]; + + int tempTermVar = 0; + int tempTermVal = 0; + int rc; + + /* Set read-only transaction type */ + readOnlyTrans (hdbc); + rc = SQLPrepare (hstmt, (unsigned char *) + "SELECT f1, f2 FROM t1 where f1 = ?", SQL_NTS); + checkrc (rc, __LINE__); + long sz = 0; + rc = SQLBindParameter (hstmt, 1, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, + 0, 0, &tempTermVar, 0, NULL); + checkrc (rc, __LINE__); + rc = SQLBindCol (hstmt, 1, SQL_INTEGER, &iHolder, 0, NULL); + checkrc (rc, __LINE__); + rc = SQLBindCol (hstmt, 2, SQL_INTEGER, &second, 0, NULL); + checkrc (rc, __LINE__); + iHolder = 0; + strcpy (sData, "0123456789012345678901234567890123456789"); + + int i, j, k; + int tCount; + + timer.reset (); + + /* Run 1per Test */ + for (i = START; i < (START+ITERATION); i++) + { + timer.start (); + tempTermVar = i ; + rc = SQLExecute (hstmt); + checkrc (rc, __LINE__); + rc = SQLFetch (hstmt); + checkrc (rc, __LINE__); + tempTermVal = iHolder; + strcpy (sData, sHolder); + rc = SQLCloseCursor (hstmt); + checkrc (rc, __LINE__); + rc = SQLTransact (henv, hdbc, SQL_COMMIT); + checkrc (rc, __LINE__); + timer.stop (); + } + printf ("Read: 1 %lld %lld %lld\n", timer.min (), timer.max (), + timer.avg ()); + /* Set read-write transaction type */ + readWriteTrans (hdbc); + return rc; +} + +int +runUpdateTest (SQLHANDLE henv, SQLHANDLE hdbc, SQLHANDLE hstmt) +{ + int rc; + int iHolder; + char sHolder[200]; + char sData[200]; + + rc = SQLPrepare (hstmt, + (unsigned char *) "UPDATE t1 SET f2 = 122323 WHERE f1 = ?", + SQL_NTS); + checkrc (rc, __LINE__); + SQLINTEGER sLen = SQL_NTS; + rc = SQLBindParameter (hstmt, 1, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, + 0, 0, &iHolder, 0, NULL); + checkrc (rc, __LINE__); + iHolder = 0; + strcpy (sData, "9876543210987654321098765432109876543210"); + + int i, j, k; + int tCount; + + timer.reset (); + + /* Run 1per Test */ + for (i = START; i < (START+ITERATION); i++) + { + timer.start (); + iHolder = i ; + strcpy (sHolder, sData); + rc = SQLExecute (hstmt); + checkrc (rc, __LINE__); + rc = SQLTransact (henv, hdbc, SQL_COMMIT); + checkrc (rc, __LINE__); + timer.stop (); + } + printf ("Update: 1 %lld %lld %lld\n", timer.min (), timer.max (), + timer.avg ()); + + return 0; +} + +int +runDeleteTest (SQLHANDLE henv, SQLHANDLE hdbc, SQLHANDLE hstmt) +{ + int rc; + int iHolder; + + rc = SQLPrepare (hstmt, (unsigned char *) + "DELETE FROM t1 WHERE f1 = ?", SQL_NTS); + checkrc (rc, __LINE__); + rc = SQLBindParameter (hstmt, 1, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, + 0, 0, &iHolder, 0, NULL); + checkrc (rc, __LINE__); + iHolder = 0; + int i, j, k; + int tCount; + timer.reset (); + /* Run 1per Test */ + for (i = START; i < (START+ITERATION); i++) + { + timer.start (); + iHolder = i ; + rc = SQLExecute (hstmt); + checkrc (rc, __LINE__); + rc = SQLTransact (henv, hdbc, SQL_COMMIT); + checkrc (rc, __LINE__); + timer.stop (); + } + printf ("Delete: 1 %lld %lld %lld\n", timer.min (), timer.max (), + timer.avg ()); + return 0; + +} +int +main (int ac, char **av) +{ + int rc; + char *dsn; + //SQLHANDLE henv, hdbc, hstmt; + ITERATION = atoi(getenv("ITERATION")); + START = atoi(getenv("START")); +SQLHENV henv; +SQLHDBC hdbc; +SQLHSTMT hstmt; + + dsn = (char *) "DSN=myodbc3;"; + + rc = SQLAllocHandle (SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv); + checkrc (rc, __LINE__); + SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (void *) SQL_OV_ODBC3, 0); + + rc = SQLAllocHandle (SQL_HANDLE_DBC, henv, &hdbc); + checkrc (rc, __LINE__); + rc = SQLConnect (hdbc, + (SQLCHAR *) "test", (SQLSMALLINT) strlen ("test"), + (SQLCHAR *) "root", + (SQLSMALLINT) strlen ("root"), + (SQLCHAR *) "manager", + (SQLSMALLINT) strlen ("manager")); + + SQLCHAR outstr[1024]; + SQLSMALLINT outstrlen; +/*rc = SQLDriverConnect(hdbc, NULL, (SQLCHAR*)"DSN=myodbc3;UID=root;PWD=root123;", SQL_NTS, outstr, sizeof(outstr), &outstrlen, SQL_DRIVER_NOPROMPT); +*/ + if (SQL_SUCCEEDED(rc)) { + printf("Connected\n"); + //printf("Returned connection string was:\n\t%s\n", outstr); + if (rc == SQL_SUCCESS_WITH_INFO) { + printf("Driver reported the following diagnostics\n"); + extract_error("SQLDriverConnect", hdbc, SQL_HANDLE_DBC); + } + } else { + fprintf(stderr, "Failed to connect\n"); + extract_error("SQLDriverConnect", hdbc, SQL_HANDLE_DBC); + } + + //check_error (SQL_HANDLE_DBC, hdbc, rc, __LINE__); + checkrc (rc, __LINE__); + rc = SQLSetConnectOption (hdbc, SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF); + checkrc (rc, __LINE__); + rc = SQLAllocHandle (SQL_HANDLE_STMT, hdbc, &hstmt); + checkrc (rc, __LINE__); + /* + rc = SQLExecDirect(hstmt, (SQLCHAR*) "CREATE TABLE t1 (f1 INTEGER, f2 char(1960), primary key (f1) size 10000);", SQL_NTS ); + checkrc (rc, __LINE__); +*/ + runInsertTest (henv, hdbc, hstmt); + runReadTest (henv, hdbc, hstmt); + runUpdateTest (henv, hdbc, hstmt); + runDeleteTest (henv, hdbc, hstmt); +/* + rc = SQLExecDirect(hstmt, (SQLCHAR*) "DROP TABLE t1;", SQL_NTS ); + checkrc (rc, __LINE__); + rc = SQLEndTran(SQL_HANDLE_DBC, hdbc, SQL_COMMIT ); + checkrc (rc, __LINE__); +*/ + rc = SQLFreeHandle (SQL_HANDLE_STMT, hstmt); + checkrc (rc, __LINE__); + rc = SQLDisconnect (hdbc); + checkrc (rc, __LINE__); + rc = SQLFreeHandle (SQL_HANDLE_DBC, hdbc); + checkrc (rc, __LINE__); + rc = SQLFreeHandle (SQL_HANDLE_ENV, henv); + checkrc (rc, __LINE__); + exit (0); +} diff --git a/test/performance/loadtest/ODBCTestWiscSchema.c b/test/performance/loadtest/ODBCTestWiscSchema.c new file mode 100644 index 00000000..f13be8cd --- /dev/null +++ b/test/performance/loadtest/ODBCTestWiscSchema.c @@ -0,0 +1,346 @@ + +#include +#include +#include +#include +#include +#include +#include +#include "NanoTimer.h" +//#define START 1010000001 +//#define ITERATION 100 +using namespace std; + +int START=0; +int ITERATION=0; +NanoTimer timer; + +void extract_error( + char *fn, + SQLHANDLE handle, + SQLSMALLINT type) +{ + SQLINTEGER i = 0; + SQLINTEGER native; + SQLCHAR state[ 7 ]; + SQLCHAR text[256]; + SQLSMALLINT len; + SQLRETURN ret; + + fprintf(stderr, + "\n" + "The driver reported the following diagnostics whilst running " + "%s\n\n", + fn); + + do + { + ret = SQLGetDiagRec(type, handle, ++i, state, &native, text, + sizeof(text), &len ); + if (SQL_SUCCEEDED(ret)) + printf("%s:%ld:%ld:%s\n", state, i, native, text); + } + while( ret == SQL_SUCCESS ); +} + +inline void +check_error (SQLSMALLINT handleType, SQLHANDLE handle, int rc, int line) +{ + if (rc) + { + cout << "Error " << rc << " at line: " << line << endl; + SQLCHAR state[10]; + SQLINTEGER native; + SQLCHAR mesg[300]; + int i=0; + while (SQLGetDiagRec (handleType, handle, i++, state, &native, mesg, 300, + NULL) == SQL_SUCCESS) + { + mesg[299] = '\0'; + cout << "state: " << state << endl; + cout << "native: " << native << endl; + cout << "mesg: " << mesg << endl; + } + exit (1); + } +} + + +inline void +checkrc (int rc, int line) +{ + if (rc) + { + cout << "Error " << rc << " at line: " << line << endl; + exit (1); + } +} + +void +readWriteTrans (SQLHDBC hdbc) +{ + int rc = SQLSetConnectAttr (hdbc, SQL_ATTR_ACCESS_MODE, + (SQLPOINTER) SQL_MODE_READ_WRITE, 0); + checkrc (rc, __LINE__); + rc = SQLEndTran (SQL_HANDLE_DBC, hdbc, SQL_COMMIT); + checkrc (rc, __LINE__); +} + +void +readOnlyTrans (SQLHDBC hdbc) +{ + int rc = SQLSetConnectAttr (hdbc, SQL_ATTR_ACCESS_MODE, + (SQLPOINTER) SQL_MODE_READ_ONLY, 0); + checkrc (rc, __LINE__); + rc = SQLEndTran (SQL_HANDLE_DBC, hdbc, SQL_COMMIT); + checkrc (rc, __LINE__); +} + +int +runInsertTest (SQLHANDLE henv, SQLHANDLE hdbc, SQLHANDLE hstmt) +{ + int rc; + int iHolder; + char sHolder[200]; + char sData[200]; + + iHolder = 0; + strcpy (sData, "0123456789012345678901234567890123456789"); + rc = SQLPrepare (hstmt, (unsigned char *) "insert into t1 values(?,12,13,14,15,16,17,18,19,20,21,100,100,'AXXXXXXXXXXXXXXXXXXXXXXXXXCXXXXXXXXXXXXXXXXXXXXXXXX','GXXXXXXXXXXXXXXXXXXXXXXXXXCXXXXXXXXXXXXXXXXXXXXXXXXA','OXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXO')", SQL_NTS); + checkrc (rc, __LINE__); + rc = SQLBindParameter (hstmt, 1, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, + 0, 0, &iHolder, 0, NULL); + checkrc (rc, __LINE__); + SQLINTEGER sLen = SQL_NTS; +/* rc = SQLBindParameter (hstmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, + 196, 0, (void *) sHolder, 0, &sLen);*/ + checkrc (rc, __LINE__); + int i, j, k; + int tCount; + + timer.reset (); + + /* Run 1per Test */ + for (i = START; i<(START + ITERATION); i++) + { + timer.start (); + iHolder = i ; + strcpy (sHolder, sData); + rc = SQLExecute (hstmt); + checkrc (rc, __LINE__); + rc = SQLTransact (henv, hdbc, SQL_COMMIT); + checkrc (rc, __LINE__); + timer.stop (); + } + + printf ("Insert: 1 %lld %lld %lld\n", timer.min (), timer.max (), + timer.avg ()); + + return 0; + +} + +int +runReadTest (SQLHANDLE henv, SQLHANDLE hdbc, SQLHANDLE hstmt) +{ + int iHolder; + int second; + char sHolder[200]; + char sData[200]; + + int tempTermVar = 0; + int tempTermVal = 0; + int rc; + + /* Set read-only transaction type */ + readOnlyTrans (hdbc); + rc = SQLPrepare (hstmt, (unsigned char *) + "SELECT f1, f2 FROM t1 where f1 = ?", SQL_NTS); + checkrc (rc, __LINE__); + long sz = 0; + rc = SQLBindParameter (hstmt, 1, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, + 0, 0, &tempTermVar, 0, NULL); + checkrc (rc, __LINE__); + rc = SQLBindCol (hstmt, 1, SQL_INTEGER, &iHolder, 0, NULL); + checkrc (rc, __LINE__); + rc = SQLBindCol (hstmt, 2, SQL_INTEGER, &second, 0, NULL); + checkrc (rc, __LINE__); + iHolder = 0; + strcpy (sData, "0123456789012345678901234567890123456789"); + + int i, j, k; + int tCount; + + timer.reset (); + + /* Run 1per Test */ + for (i = START; i < (START+ITERATION); i++) + { + timer.start (); + tempTermVar = i ; + rc = SQLExecute (hstmt); + checkrc (rc, __LINE__); + rc = SQLFetch (hstmt); + checkrc (rc, __LINE__); + tempTermVal = iHolder; + strcpy (sData, sHolder); + rc = SQLCloseCursor (hstmt); + checkrc (rc, __LINE__); + rc = SQLTransact (henv, hdbc, SQL_COMMIT); + checkrc (rc, __LINE__); + timer.stop (); + } + printf ("Read: 1 %lld %lld %lld\n", timer.min (), timer.max (), + timer.avg ()); + /* Set read-write transaction type */ + readWriteTrans (hdbc); + return rc; +} + +int +runUpdateTest (SQLHANDLE henv, SQLHANDLE hdbc, SQLHANDLE hstmt) +{ + int rc; + int iHolder; + char sHolder[200]; + char sData[200]; + + rc = SQLPrepare (hstmt, + (unsigned char *) "UPDATE t1 SET f2 = 122323 WHERE f1 = ?", + SQL_NTS); + checkrc (rc, __LINE__); + SQLINTEGER sLen = SQL_NTS; + rc = SQLBindParameter (hstmt, 1, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, + 0, 0, &iHolder, 0, NULL); + checkrc (rc, __LINE__); + iHolder = 0; + strcpy (sData, "9876543210987654321098765432109876543210"); + + int i, j, k; + int tCount; + + timer.reset (); + + /* Run 1per Test */ + for (i = START; i < (START+ITERATION); i++) + { + timer.start (); + iHolder = i ; + strcpy (sHolder, sData); + rc = SQLExecute (hstmt); + checkrc (rc, __LINE__); + rc = SQLTransact (henv, hdbc, SQL_COMMIT); + checkrc (rc, __LINE__); + timer.stop (); + } + printf ("Update: 1 %lld %lld %lld\n", timer.min (), timer.max (), + timer.avg ()); + + return 0; +} + +int +runDeleteTest (SQLHANDLE henv, SQLHANDLE hdbc, SQLHANDLE hstmt) +{ + int rc; + int iHolder; + + rc = SQLPrepare (hstmt, (unsigned char *) + "DELETE FROM t1 WHERE f1 = ?", SQL_NTS); + checkrc (rc, __LINE__); + rc = SQLBindParameter (hstmt, 1, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, + 0, 0, &iHolder, 0, NULL); + checkrc (rc, __LINE__); + iHolder = 0; + int i, j, k; + int tCount; + timer.reset (); + /* Run 1per Test */ + for (i = START; i < (START+ITERATION); i++) + { + timer.start (); + iHolder = i ; + rc = SQLExecute (hstmt); + checkrc (rc, __LINE__); + rc = SQLTransact (henv, hdbc, SQL_COMMIT); + checkrc (rc, __LINE__); + timer.stop (); + } + printf ("Delete: 1 %lld %lld %lld\n", timer.min (), timer.max (), + timer.avg ()); + return 0; + +} +int +main (int ac, char **av) +{ + int rc; + char *dsn; + //SQLHANDLE henv, hdbc, hstmt; + ITERATION = atoi(getenv("ITERATION")); + START = atoi(getenv("START")); +SQLHENV henv; +SQLHDBC hdbc; +SQLHSTMT hstmt; + + dsn = (char *) "DSN=myodbc3;"; + + rc = SQLAllocHandle (SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv); + checkrc (rc, __LINE__); + SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (void *) SQL_OV_ODBC3, 0); + + rc = SQLAllocHandle (SQL_HANDLE_DBC, henv, &hdbc); + checkrc (rc, __LINE__); + rc = SQLConnect (hdbc, + (SQLCHAR *) "test", (SQLSMALLINT) strlen ("test"), + (SQLCHAR *) "root", + (SQLSMALLINT) strlen ("root"), + (SQLCHAR *) "manager", + (SQLSMALLINT) strlen ("manager")); + + SQLCHAR outstr[1024]; + SQLSMALLINT outstrlen; +/*rc = SQLDriverConnect(hdbc, NULL, (SQLCHAR*)"DSN=myodbc3;UID=root;PWD=root123;", SQL_NTS, outstr, sizeof(outstr), &outstrlen, SQL_DRIVER_NOPROMPT); +*/ + if (SQL_SUCCEEDED(rc)) { + printf("Connected\n"); + //printf("Returned connection string was:\n\t%s\n", outstr); + if (rc == SQL_SUCCESS_WITH_INFO) { + printf("Driver reported the following diagnostics\n"); + extract_error("SQLDriverConnect", hdbc, SQL_HANDLE_DBC); + } + } else { + fprintf(stderr, "Failed to connect\n"); + extract_error("SQLDriverConnect", hdbc, SQL_HANDLE_DBC); + } + + //check_error (SQL_HANDLE_DBC, hdbc, rc, __LINE__); + checkrc (rc, __LINE__); + rc = SQLSetConnectOption (hdbc, SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF); + checkrc (rc, __LINE__); + rc = SQLAllocHandle (SQL_HANDLE_STMT, hdbc, &hstmt); + checkrc (rc, __LINE__); + /* + rc = SQLExecDirect(hstmt, (SQLCHAR*) "CREATE TABLE t1 (f1 INTEGER, f2 char(1960), primary key (f1) size 10000);", SQL_NTS ); + checkrc (rc, __LINE__); +*/ + runInsertTest (henv, hdbc, hstmt); + runReadTest (henv, hdbc, hstmt); + runUpdateTest (henv, hdbc, hstmt); + runDeleteTest (henv, hdbc, hstmt); +/* + rc = SQLExecDirect(hstmt, (SQLCHAR*) "DROP TABLE t1;", SQL_NTS ); + checkrc (rc, __LINE__); + rc = SQLEndTran(SQL_HANDLE_DBC, hdbc, SQL_COMMIT ); + checkrc (rc, __LINE__); +*/ + rc = SQLFreeHandle (SQL_HANDLE_STMT, hstmt); + checkrc (rc, __LINE__); + rc = SQLDisconnect (hdbc); + checkrc (rc, __LINE__); + rc = SQLFreeHandle (SQL_HANDLE_DBC, hdbc); + checkrc (rc, __LINE__); + rc = SQLFreeHandle (SQL_HANDLE_ENV, henv); + checkrc (rc, __LINE__); + exit (0); +} diff --git a/test/performance/loadtest/README b/test/performance/loadtest/README new file mode 100644 index 00000000..dcc45913 --- /dev/null +++ b/test/performance/loadtest/README @@ -0,0 +1,12 @@ +Load Test Run +--------------- +set the following in csql.conf file +MAX_SYS_DB_SIZE=104857600 +MAX_DB_SIZE=34359738368 +MAP=true + +For wisc small table schema +Run . ./runsuiteWiscSchema.ksh + +For table having two integer +Run . ./runsuite.ksh diff --git a/test/performance/loadtest/runsuite.ksh b/test/performance/loadtest/runsuite.ksh new file mode 100755 index 00000000..da044edf --- /dev/null +++ b/test/performance/loadtest/runsuite.ksh @@ -0,0 +1,57 @@ +#!/bin/ksh +export START=1 +export END=1000000 +echo "Loading 1000000 record ...." +./ODBCLoad csql +export ITERATION=100 +export START=1000001 +echo "Operation After Loading $END Record" +./ODBCTest +export START=1000001 +export END=2000000 +echo "Loading 1000000 record ...." +./ODBCLoad +export ITERATION=100 +export START=2000001 +echo "Operation After Loading $END Record" +./ODBCTest +export START=2000001 +export END=5000000 +echo "Loading 5000000 record ...." +./ODBCLoad +export ITERATION=100 +export START=5000001 +echo "Operation After Loading $END Record" +./ODBCTest +export START=5000001 +export END=10000000 +echo "Loading 5000000 record ...." +./ODBCLoad +export ITERATION=100 +export START=10000001 +echo "Operation After Loading $END Record" +./ODBCTest +export START=10000001 +export END=20000000 +echo "Loading 10000000 record ...." +./ODBCLoad +export ITERATION=100 +export START=20000001 +echo "Operation After Loading $END Record" +./ODBCTest +export START=20000001 +export END=50000000 +echo "Loading 30000000 record ...." +./ODBCLoad +export ITERATION=100 +export START=50000001 +echo "Operation After Loading $END Record" +./ODBCTest +export START=50000001 +export END=100000000 +echo "Loading 50000000 record ...." +./ODBCLoad +export ITERATION=100 +export START=100000001 +echo "Operation After Loading $END Record" + diff --git a/test/performance/loadtest/runsuiteWiscSchema.ksh b/test/performance/loadtest/runsuiteWiscSchema.ksh new file mode 100755 index 00000000..68193a7c --- /dev/null +++ b/test/performance/loadtest/runsuiteWiscSchema.ksh @@ -0,0 +1,57 @@ +#!/bin/ksh +export START=1 +export END=1000000 +echo "Loading 1000000 record ...." +./ODBCLoadWiscSchema csql +export ITERATION=100 +export START=1000001 +echo "Operation After Loading $END Record" +./ODBCTestWiscSchema +export START=1000001 +export END=2000000 +echo "Loading 1000000 record ...." +./ODBCLoadWiscSchema +export ITERATION=100 +export START=2000001 +echo "Operation After Loading $END Record" +./ODBCTestWiscSchema +export START=2000001 +export END=5000000 +echo "Loading 5000000 record ...." +./ODBCLoadWiscSchema +export ITERATION=100 +export START=5000001 +echo "Operation After Loading $END Record" +./ODBCTestWiscSchema +export START=5000001 +export END=10000000 +echo "Loading 5000000 record ...." +./ODBCLoadWiscSchema +export ITERATION=100 +export START=10000001 +echo "Operation After Loading $END Record" +./ODBCTestWiscSchema +export START=10000001 +export END=20000000 +echo "Loading 10000000 record ...." +./ODBCLoadWiscSchema +export ITERATION=100 +export START=20000001 +echo "Operation After Loading $END Record" +./ODBCTestWiscSchema +export START=20000001 +export END=50000000 +echo "Loading 30000000 record ...." +./ODBCLoadWiscSchema +export ITERATION=100 +export START=50000001 +echo "Operation After Loading $END Record" +./ODBCTestWiscSchema +export START=50000001 +export END=100000000 +echo "Loading 50000000 record ...." +./ODBCLoadWiscSchema +export ITERATION=100 +export START=100000001 +echo "Operation After Loading $END Record" + diff --git a/test/performance/perf.php b/test/performance/perf.php new file mode 100644 index 00000000..14b54b38 --- /dev/null +++ b/test/performance/perf.php @@ -0,0 +1,161 @@ + + + $time) + {$min = $time;} + if ($max < $time) + {$max = $time;} + $count++; + } + printf("\nInsert :%6d MIN :%4f MAX :%4f AVG :%4f \n",$count,$min,$max,$timecount/$count); + +/*$sth = 'SELECT * FROM t1;'; +$rs = odbc_exec($conn, $sth); +if (!$rs) + {exit("Error in SQL-2");} +odbc_result_all($rs, 'border = 2'); +*/ + + $timecount = 0; + $min = 1; + $max = 0; + $time_start = 0; + $time_end = 0; + $time = 0; + $count =0; + $q = "SELECT * FROM t1 WHERE f1=?;"; + $res = odbc_prepare ($conn, $q); + for ($i = 0; $i <100; $i++) + { + $time_start = microtime(); + $a = $i; + $rs=odbc_execute($res, array($a)); + + while (odbc_fetch_row($res)) + { + //$roll=preg_replace('/[\x00-\x09\x0B-\x19\x7F]/', '',odbc_result($res, 1)); + $roll=odbc_result($res, 1); + //$name=preg_replace('/[\x00-\x09\x0B-\x19\x7F]/', '',odbc_result($res, 2)); + $name=odbc_result($res, 2); + } + + $time_end = microtime(); + $time = $time_end - $time_start; + $timecount = $timecount + $time ; + if ($min > $time) + {$min = $time;} + if ($max < $time) + {$max = $time;} + $count++; + } + printf("\nSelect :%6d MIN :%4f MAX :%4f AVG :%4f \n",$count,$min,$max,$timecount/$count); + + $timecount = 0; + $min = 1; + $max = 0; + $time_start = 0; + $time_end = 0; + $time = 0; + $count =0; + $q = "update t1 set f2=? where f1=?;"; + $res = odbc_prepare ($conn, $q); + for ($i = 0; $i <100; $i++) + { + $time_start = microtime(); + $a = "LAKSHYA_CSQL"; + $b = $i; + odbc_execute($res, array($a, $b)); + $time_end = microtime(); + $time = $time_end - $time_start; + $timecount = $timecount + $time ; + if ($min > $time) + {$min = $time;} + if ($max < $time) + {$max = $time;} + $count++; + } + printf("\nUpdate :%6d MIN :%4f MAX :%4f AVG :%4f \n",$count,$min,$max,$timecount/$count); + +/* +$sth = 'SELECT * FROM t1;'; +$rs = odbc_exec($conn, $sth); +if (!$rs) + {exit("Error in SQL-2");} +odbc_result_all($rs, 'border = 2'); +*/ + + $timecount = 0; + $min = 1; + $max = 0; + $time_start = 0; + $time_end = 0; + $time = 0; + $count =0; + $q = "DELETE FROM t1 WHERE f1=?;"; + $res = odbc_prepare ($conn, $q); + for ($i = 0; $i <100; $i++) + { + $time_start = microtime(); + $a = $i; + $rs = odbc_execute($res, array($a)); + $time_end = microtime(); + $time = $time_end - $time_start; + $timecount = $timecount + $time ; + if ($min > $time) + {$min = $time;} + if ($max < $time) + {$max = $time;} + $count++; + } + printf("\nDelete :%6d MIN :%4f MAX :%4f AVG :%4f \n",$count,$min,$max,$timecount/$count); + +/* +$sth = 'SELECT * FROM t1;'; +$rs = odbc_exec($conn, $sth); +if (!$rs) + {exit("Error in SQL-2");} +odbc_result_all($rs, 'border = 2'); +*/ + +$sth=odbc_prepare($conn,"DROP TABLE t1;"); +$res = odbc_execute($sth); +if (!$res) + {exit("\nError in Drop Table");} +echo "\nTable Dropped \nTest Passed"; +odbc_close($conn); + +?> + + diff --git a/test/performance/throughput/Makefile b/test/performance/throughput/Makefile new file mode 100644 index 00000000..c4c2893a --- /dev/null +++ b/test/performance/throughput/Makefile @@ -0,0 +1,7 @@ +OSNAME = $(shell uname -s) +JAVAC = javac +TARGETS = ConnTests +TARGETS:hashIndexTest.java noIndexTest.java treeIndexTest.java + ${JAVAC} *.java +clean: + rm -rf *.class diff --git a/test/performance/throughput/connect.java b/test/performance/throughput/connect.java new file mode 100644 index 00000000..3ac7dcb4 --- /dev/null +++ b/test/performance/throughput/connect.java @@ -0,0 +1,284 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + + +/** + * + * @author bijaya + */ + +import java.sql.*; + +public class connect implements Runnable +{ + Connection con; + PreparedStatement stmt; + ResultSet rs; + Thread th; + int thid; + int totalrecord; + int type; + long timeTaken; + connect(int i,int ty ,int record) + { + System.out.println("thread "+ i); + thid=i; + totalrecord=record; + type=ty; + timeTaken=0; + th=new Thread(this); + th.start(); + } + public static Connection getDBConn() throws Exception + { + Class.forName("csql.jdbc.JdbcSqlDriver"); + Connection con = DriverManager.getConnection("jdbc:csql:", "root", "manager"); + return con; + } + public void run() + { + if(0==type) insertTest(); + else if(1==type) selectTest(); + else if(2==type) updateTest(); + else if(3==type) deleteTest(); + else selectTest1(); + } + + public void insertTest() + { + try{ + //Class.forName("csql.jdbc.JdbcSqlDriver"); + //con = DriverManager.getConnection("jdbc:csql:","root","manager"); + con = getDBConn(); + stmt = con.prepareStatement("insert into emp values (?, 'SECOND');"); + long count = 0, recordCount=0; + int ret = 0; + long start = 0,end = 0,curr = 0; + long tot = 0; + for(int i=0; i=? and f1 ? AND big1.unique1 <= ?"; + stmtStr = buf; + } + else if(val==2) + { + String buf = "SELECT small.unique1, big1.unique1, big2.unique1, small.stringu1, big1.unique2, big2.unique2 FROM big1, big2, small WHERE big1.unique2=small.unique1 AND big1.unique2=big2.unique1 AND big1.unique1 > ? and big1.unique1 <= ?"; + stmtStr=buf; + } + + stmt = con.prepareStatement(stmtStr); + int count=0,recordCount=0,ret=0; + long start=0,end=0,curr=0; + long tot=0; + ResultSet rs; + int searchVal[] = {1, 5, 10, 50, 100, 200, 250, 500, 750, 800}; + for(int i=0;i<10;i++) + { + recordCount =0; + start = System.nanoTime(); + stmt.setInt(1, searchVal[i]); + stmt.setInt(2, searchVal[i]+100); + rs = stmt.executeQuery(); + while(rs.next()) + { + //System.out.println("Record:"+ rs.getInt(1)+ " "+ rs.getInt(2)+" " +rs.getInt(3)+ " "+ rs.getString(4)); + recordCount++; + } + rs.close(); + con.commit(); + end=System.nanoTime(); + if(recordCount!=100) + { + System.out.println("No. of records in"+ stmtStr +" "+ recordCount); + return 0; + } + + curr = end - start; + tot = tot + curr; + count++; + } + stmt.close(); + return tot/10/1000; +} + + + +//***************************************************** +public static void main(String[] args) + + { + int flag=1; + if (args.length == 3) + { + if (args[0].equals("csql")) flag=1; + else if (args[0].equals("mysql")) flag=2; + else if (args[0].equals("postgres")) flag=3; + else if (args[0].equals("oracle")) flag=4; + else if (args[0].equals("sybase")) flag=5; + } + else { + System.out.println("Usage: java JDBCBench "); + return; + } + try + { + Connection con = null; + if (flag == 1) { + Class.forName("csql.jdbc.JdbcSqlDriver"); + con = DriverManager.getConnection("jdbc:csql", args[1], args[2]); + } else if (flag == 2) { + Class.forName("com.mysql.jdbc.Driver"); + con = DriverManager.getConnection("jdbc:mysql://localhost/test", args[1], args[2]); + } else if (flag == 3) { + Class.forName("org.postgresql.Driver"); + con = DriverManager.getConnection("jdbc:postgresql://localhost/test", args[1], args[2]); + } else if (flag == 4) { + Class.forName("oracle.jdbc.driver.OracleDriver"); + con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE", args[1], args[2]); + } else if (flag == 5) { + Class.forName("com.sybase.jdbc3.jdbc.SybDataSource"); + con = DriverManager.getConnection("jdbc:sybase:Tds:localhost:4112", args[1], args[2]); + } + con.setAutoCommit(false); + con.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); + Statement cStmt = con.createStatement(); + + long timeTaken[][] = new long[20][3]; + int ins=1,upd=2,del=3;// function parameter + int min=1, max=2,sum=3;// function parameter + + + timeTaken[0][0] = singleTuple(con, true); + timeTaken[1][0] = singleTuple(con, false); + + timeTaken[2][0] = onePerSel(con); + timeTaken[3][0] = aggregate(con,min,false); + timeTaken[4][0] = aggregate(con,min,true); + timeTaken[5][0] = aggregate(con,max,false); + timeTaken[6][0] = aggregate(con,max,true); + + timeTaken[7][0] = aggregate(con,sum,false); + timeTaken[8][0] = aggregate(con,sum,true); + timeTaken[9][0] = distinct(con); + timeTaken[10][0] = orderby(con); + + timeTaken[11][0] = dmlstatement(con,ins); + timeTaken[12][0] = dmlstatement(con,upd); + timeTaken[13][0] = dmlstatement(con,del); + timeTaken[14][0] = joining(con,1); + timeTaken[15][0] = joining(con,2); + timeTaken[16][0] = joinCondition(con,1); + timeTaken[17][0] = joinCondition(con,2); + System.out.println("Finished no index queries"); + try{ + if(flag == 1) + { + cStmt.execute("FLUSH CACHE"); + con.commit(); + } + }catch(Exception e ){e.printStackTrace(); System.out.println("Error creating index");} + //create index + try{ + if (flag ==1) { + cStmt.execute("CREATE INDEX idx1 ON big1(unique1) HASH"); + cStmt.close(); + cStmt.execute("CREATE INDEX idx2 ON big2(unique1) HASH"); + cStmt.close(); + cStmt.execute("CREATE INDEX idx3 ON small(unique1) HASH"); + cStmt.close(); + cStmt.execute("CREATE INDEX idx4 ON big1(stringu1) HASH"); + cStmt.close(); + con.commit(); + }else if (flag ==2) { + cStmt.execute("CREATE INDEX mysqld1 USING HASH ON big1(unique1)"); + cStmt.execute("CREATE INDEX mysqld2 USING HASH ON big2(unique1)"); + cStmt.execute("CREATE INDEX mysqld3 USING HASH ON small(unique1)"); + cStmt.execute("CREATE INDEX mysqld4 USING HASH ON big1(stringu1)"); + con.commit(); + } else if (flag == 3) { + cStmt.execute("CREATE INDEX psqld1 on big1 USING HASH (unique1)"); + cStmt.execute("CREATE INDEX psqld2 on big2 USING HASH (unique1)"); + cStmt.execute("CREATE INDEX psqld3 on small USING HASH (unique1)"); + cStmt.execute("CREATE INDEX psqld4 on big1 USING HASH (stringu1)"); + } + } + catch(Exception e ){e.printStackTrace(); System.out.println("Error creating index");} + timeTaken[0][1] = singleTuple(con, true); + timeTaken[1][1] = singleTuple(con, false); + timeTaken[2][1] = 0; + timeTaken[3][1] = 0; + timeTaken[4][1] = 0; + timeTaken[5][1] = 0; + timeTaken[6][1] = 0; + timeTaken[7][1] = 0; + timeTaken[8][1] = 0; + timeTaken[9][1] = 0; + timeTaken[10][1] = orderby(con); + + timeTaken[11][1] = dmlstatement(con,ins); + timeTaken[12][1] = dmlstatement(con,upd); + timeTaken[13][1] = dmlstatement(con,del); + timeTaken[14][1] = joining(con,1); + timeTaken[15][1] = joining(con,2); + timeTaken[16][1] = joinCondition(con,1); + timeTaken[17][1] = joinCondition(con,2); + System.out.println("Finished hash index queries"); + + try{ + if(flag == 1) + { + cStmt.execute("FLUSH CACHE"); + con.commit(); + } + }catch(Exception e ){e.printStackTrace(); System.out.println("Error creating index");} + + + try{ + if (flag ==1) { + cStmt.execute("DROP INDEX idx1"); + cStmt.close(); + cStmt.execute("DROP INDEX idx2"); + cStmt.close(); + cStmt.execute("DROP INDEX idx3"); + cStmt.close(); + cStmt.execute("DROP INDEX idx4"); + cStmt.close(); + cStmt.execute("CREATE INDEX idx5 ON big1(unique1) TREE"); + cStmt.execute("CREATE INDEX idx6 ON big2(unique1) TREE"); + cStmt.execute("CREATE INDEX idx7 ON small(unique1) TREE"); + cStmt.execute("CREATE INDEX idx8 ON big1(stringu1) TREE"); + con.commit(); + }else if (flag ==2) { + cStmt.execute("DROP INDEX mysqld1 on big1"); + cStmt.execute("DROP INDEX mysqld2 on big2"); + cStmt.execute("DROP INDEX mysqld3 on small"); + cStmt.execute("DROP INDEX mysqld4 on big1"); + cStmt.execute("CREATE INDEX mysqld5 USING BTREE ON big1(unique1)"); + cStmt.execute("CREATE INDEX mysqld6 USING BTREE ON big2(unique1)"); + cStmt.execute("CREATE INDEX mysqld7 USING BTREE ON small(unique1)"); + cStmt.execute("CREATE INDEX mysqld8 USING BTREE ON big1(stringu1)"); + con.commit(); + } else if (flag == 3) { + cStmt.execute("DROP INDEX psqld1"); + cStmt.execute("DROP INDEX psqld2"); + cStmt.execute("DROP INDEX psqld3"); + cStmt.execute("DROP INDEX psqld4"); + cStmt.execute("CREATE INDEX psqld5 on big1 USING BTREE (unique1)"); + cStmt.execute("CREATE INDEX psqld6 on big2 USING BTREE (unique1)"); + cStmt.execute("CREATE INDEX psqld7 on small USING BTREE (unique1)"); + cStmt.execute("CREATE INDEX psqld8 on big1 USING BTREE (stringu1)"); + con.commit(); + } + }catch(Exception e ){e.printStackTrace(); System.out.println("Error creating index");} + + timeTaken[0][2] = singleTuple(con, true); + timeTaken[1][2] = singleTuple(con, false); + timeTaken[2][2] = onePerSel(con); + timeTaken[3][2] = aggregate(con,min,false); + timeTaken[4][2] = aggregate(con,min,true); + timeTaken[5][2] = aggregate(con,max,false); + timeTaken[6][2] = aggregate(con,max,true); + timeTaken[7][2] = 0; + timeTaken[8][2] = 0; + timeTaken[9][2] = 0; + timeTaken[10][2] = orderby(con); + timeTaken[11][2] = dmlstatement(con,ins); + timeTaken[12][2] = dmlstatement(con,upd); + timeTaken[13][2] = dmlstatement(con,del); + timeTaken[14][2] = joining(con,1); + timeTaken[15][2] = joining(con,2); + timeTaken[16][2] = joinCondition(con,1); + timeTaken[17][2] = joinCondition(con,2); + System.out.println("Finished tree index queries"); + + + + try{ + if (flag ==1) { + cStmt.execute("DROP INDEX idx5"); + cStmt.close(); + cStmt.execute("DROP INDEX idx6"); + cStmt.close(); + cStmt.execute("DROP INDEX idx7"); + cStmt.close(); + cStmt.execute("DROP INDEX idx8"); + cStmt.close(); + con.commit(); + } else if (flag ==2) { + cStmt.execute("DROP INDEX mysqld5 on big1"); + cStmt.execute("DROP INDEX mysqld6 on big2"); + cStmt.execute("DROP INDEX mysqld7 on small"); + cStmt.execute("DROP INDEX mysqld8 on big1"); + con.commit(); + } else if (flag ==3) { + cStmt.execute("DROP INDEX psqld5"); + cStmt.execute("DROP INDEX psqld6"); + cStmt.execute("DROP INDEX psqld7"); + cStmt.execute("DROP INDEX psqld8"); + con.commit(); + } + }catch(Exception e ){System.out.println("Error dropping indexes");} + + System.out.println("Wisconsin Benchmark Report:"); + + System.out.println("**********************************************************"); + System.out.println(" Statement \t NoIndex\tHash \tTree"); + System.out.println("**********************************************************"); + System.out.println(" SelectInt 1 \t "+timeTaken[0][0] +" \t \t"+ timeTaken[0][1]+ " \t"+ timeTaken[0][2]); + System.out.println(" SelectStr 1 \t "+timeTaken[1][0] +" \t \t"+ timeTaken[1][1]+ " \t"+ timeTaken[1][2]); + System.out.println(" 1% Sel \t "+timeTaken[2][0] +" \t \t- \t"+ timeTaken[2][2]); + + System.out.println(" Min 1 \t "+timeTaken[3][0] +" \t \t- \t"+ timeTaken[3][2]); + System.out.println(" Min_GrBy 1% \t "+timeTaken[4][0] +" \t \t- \t-"); + + System.out.println(" Max 1 \t "+timeTaken[5][0] +" \t \t- \t"+ timeTaken[5][2]); + System.out.println(" Max_GrBy 1% \t "+timeTaken[6][0] +" \t \t- \t-"); + + System.out.println(" Sum 1 \t "+timeTaken[7][0] +" \t \t- \t-"); + System.out.println(" Sum_GrBy 1% \t "+timeTaken[8][0] +" \t \t- \t-"); + + System.out.println(" Distinct 1% \t "+timeTaken[9][0] +" \t \t- \t-"); + System.out.println(" OrderBy 1% \t "+timeTaken[10][0] +" \t \t"+ timeTaken[10][1]+ " \t"+ timeTaken[10][2]); + + System.out.println(" Insert 1 \t "+timeTaken[11][0] +" \t \t"+ timeTaken[11][1]+ " \t"+ timeTaken[11][2]); + System.out.println(" Update 1 \t "+timeTaken[12][0] +" \t \t"+ timeTaken[12][1]+ " \t"+ timeTaken[12][2]); + System.out.println(" Delete 1 \t "+timeTaken[13][0] +" \t \t"+ timeTaken[13][1]+ " \t"+ timeTaken[13][2]); + System.out.println(" Join(10K*1K)1 \t "+timeTaken[14][0] +" \t \t"+ timeTaken[14][1]+ "\t"+ timeTaken[14][2]); + System.out.println(" Join(10K*10K*1K)1\t "+timeTaken[15][0] +"\t \t"+ timeTaken[15][1]+ "\t"+ timeTaken[15][2]); + + System.out.println(" Join(10K*1K)100 \t "+timeTaken[16][0]+"\t \t"+ timeTaken[16][1]+ "\t"+ timeTaken[16][2]); + System.out.println(" Join(10K*10K*1K)100\t "+timeTaken[17][0] +"\t \t"+ timeTaken[17][1]+ "\t"+ timeTaken[17][2]); + + System.out.println("**********************************************************"); + con.close(); + } + catch(Exception e) { + System.out.println("Exception in Test: "+e); + e.printStackTrace(); + } + + } +} diff --git a/test/performance/wisc/JDBCPopulate.java b/test/performance/wisc/JDBCPopulate.java new file mode 100644 index 00000000..f243224f --- /dev/null +++ b/test/performance/wisc/JDBCPopulate.java @@ -0,0 +1,164 @@ +import java.sql.*; +import java.util.Random; +public class JDBCPopulate +{ + public static Random generator = new Random(); + public static int getRandom(int end) + { + double val = generator.nextDouble(); + val *=end; + return (int)(val); + } + + public static void populate(Connection con)throws Exception + { + PreparedStatement stmt = null; + String stmtStr=""; + String buf = "insert into big1 values(?,?,?,?,?,?,?,?,?,?,?,1,100,?,'GXXXXXXXXXXXXXXXXXXXXXXXXXCXXXXXXXXXXXXXXXXXXXXXXXXA','OXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXO')"; + stmtStr = buf; + stmt = con.prepareStatement(stmtStr); + int count = 0; + int ret =0; + for(int i=0; i<10000; i++){ + stmt.setInt(1, i); + stmt.setInt(2, i); + stmt.setInt(3, i%2); + stmt.setInt(4, i%4); + stmt.setInt(5, i%10); + stmt.setInt(6, i%20); + stmt.setInt(7, i % 100); + stmt.setInt(8, i % 1000); + stmt.setInt(9, i % 2000); + stmt.setInt(10, i % 5000); + stmt.setInt(11,i); + stmt.setString(12, "Value" + i); + ret = stmt.executeUpdate(); + if(ret!=1) { + System.out.println("Table population failed"); + return; + } + if (i % 1000 == 0) con.commit(); + count++; + } + con.commit(); + stmt.close(); + System.out.println("Records Inserted into big1 table: "+count); + + stmtStr = "insert into big2 values(?,?,?,?,?,?,?,?,?,?,?,1,100,'AXXXXXXXXXXXXXXXXXXXXXXXXXCXXXXXXXXXXXXXXXXXXXXXXXX','GXXXXXXXXXXXXXXXXXXXXXXXXXCXXXXXXXXXXXXXXXXXXXXXXXXA','OXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXO')"; + stmt = con.prepareStatement(stmtStr); + count = 0; + for(int i=0; i<10000; i++){ + stmt.setInt(1, i); + stmt.setInt(2, i); + stmt.setInt(3, i%2); + stmt.setInt(4, i%4); + stmt.setInt(5, i%10); + stmt.setInt(6, i%20); + stmt.setInt(7, i % 100); + stmt.setInt(8, i % 1000); + stmt.setInt(9, i % 2000); + stmt.setInt(10, i % 5000); + stmt.setInt(11,i); + + ret = stmt.executeUpdate(); + if(ret!=1) { + System.out.println("Table population failed"); + return; + } + if (i % 1000 == 0) con.commit(); + count++; + } + con.commit(); + stmt.close(); + System.out.println("Records Inserted into big2 table: "+count); + + stmtStr = "insert into small values(?,?,?,?,?,?,?,?,?,?,?,1,100,'AXXXXXXXXXXXXXXXXXXXXXXXXXCXXXXXXXXXXXXXXXXXXXXXXXX','GXXXXXXXXXXXXXXXXXXXXXXXXXCXXXXXXXXXXXXXXXXXXXXXXXXA','OXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXO')"; + stmt = con.prepareStatement(stmtStr); + count = 0; + for(int i=0; i<1000; i++){ + stmt.setInt(1, i); + stmt.setInt(2, i); + stmt.setInt(3, i%2); + stmt.setInt(4, i%4); + stmt.setInt(5, i%10); + stmt.setInt(6, i%20); + stmt.setInt(7, i % 100); + stmt.setInt(8, i % 1000); + stmt.setInt(9, i % 2000); + stmt.setInt(10, i % 5000); + stmt.setInt(11,i); + + ret = stmt.executeUpdate(); + if(ret!=1) { + System.out.println("Table population failed"); + return; + } + if (i % 100 == 0) con.commit(); + count++; + } + con.commit(); + stmt.close(); + System.out.println("Records Inserted into small table: "+count); + + return; + } + +//***************************************************** +public static void main(String[] args) + + { + int flag=1; + if (args.length == 3) + { + if (args[0].equals("csql")) flag=1; + else if (args[0].equals("mysql")) flag=2; + else if (args[0].equals("postgres")) flag=3; + else if (args[0].equals("oracle")) flag=4; + else if (args[0].equals("sybase")) flag=5; + } + else { + System.out.println("Usage: java JDBCPopulate "); + return; + } + + try + { + Connection con = null; + if (flag == 1) { + Class.forName("csql.jdbc.JdbcSqlDriver"); + con = DriverManager.getConnection("jdbc:csql", args[1], args[2]); + }else if (flag == 2) { + Class.forName("com.mysql.jdbc.Driver"); + con = DriverManager.getConnection("jdbc:mysql://localhost/test", args[1], args[2]); + }else if (flag == 3) { + Class.forName("org.postgresql.Driver"); + con = DriverManager.getConnection("jdbc:postgresql://localhost:5432/test", args[1], args[2]); + }else if (flag == 4) { + Class.forName("oracle.jdbc.driver.OracleDriver"); + con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE", args[1], args[2]); + }else if (flag == 5) { + Class.forName("com.sybase.jdbc3.jdbc.SybDataSource"); + con = DriverManager.getConnection("jdbc:sybase:Tds:localhost:4112", args[1], args[2]); + } + con.setAutoCommit(false); + con.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); + Statement cStmt = con.createStatement(); + try { + cStmt.execute("CREATE TABLE small (unique1 INT NOT NULL , unique2 INT NOT NULL , two INT NOT NULL , four INT NOT NULL , ten INT NOT NULL , twenty INT NOT NULL , onepercent INT NOT NULL , tenpercent INT NOT NULL , twentypercent INT NOT NULL , fiftypercent INT NOT NULL , unique3 INT NOT NULL , evenonepercent INT NOT NULL , oddonepercent INT NOT NULL , stringu1 CHAR (52) NOT NULL , stringu2 CHAR (52) NOT NULL , string4 CHAR (52) NOT NULL )"); + + cStmt.execute("CREATE TABLE big1 (unique1 INT NOT NULL , unique2 INT NOT NULL , two INT NOT NULL , four INT NOT NULL , ten INT NOT NULL , twenty INT NOT NULL , onepercent INT NOT NULL , tenpercent INT NOT NULL , twentypercent INT NOT NULL , fiftypercent INT NOT NULL , unique3 INT NOT NULL , evenonepercent INT NOT NULL , oddonepercent INT NOT NULL , stringu1 CHAR (52) NOT NULL , stringu2 CHAR (52) NOT NULL , string4 CHAR (52) NOT NULL )"); + + cStmt.execute("CREATE TABLE big2 (unique1 INT NOT NULL , unique2 INT NOT NULL , two INT NOT NULL , four INT NOT NULL , ten INT NOT NULL , twenty INT NOT NULL , onepercent INT NOT NULL , tenpercent INT NOT NULL , twentypercent INT NOT NULL , fiftypercent INT NOT NULL , unique3 INT NOT NULL , evenonepercent INT NOT NULL , oddonepercent INT NOT NULL , stringu1 CHAR (52) NOT NULL , stringu2 CHAR (52) NOT NULL , string4 CHAR (52) NOT NULL )"); + cStmt.close(); + con.commit(); + }catch(Exception e ){e.printStackTrace(); System.out.println("Error creating index");} + populate(con); + con.close(); + + } catch(Exception e) { + System.out.println("Exception in Test: "+e); + e.printStackTrace(); + } + + } +} diff --git a/test/performance/wisc/Makefile b/test/performance/wisc/Makefile new file mode 100644 index 00000000..d738755c --- /dev/null +++ b/test/performance/wisc/Makefile @@ -0,0 +1,19 @@ +CC=g++ -O2 +INCL= -I$(CSQL_INSTALL_ROOT)/include +#LIBS= -L$(CSQL_INSTALL_ROOT)/lib -lcrypt -lrt -lodbc +LIBS= -L$(CSQL_INSTALL_ROOT)/lib -lcrypt -lrt -lcsqlodbc -lcacheload +ALL_CC_FLAG=$(INCL) $(LIBS) +JAVAC = javac -g:none + +all: odbcBench JDBCBench JDBCPopulate + +odbcBench: odbcBench.c + $(CC) $(ALL_CC_FLAG) -o odbcBench odbcBench.c +JDBCBench: JDBCBench.java + $(JAVAC) JDBCBench.java + +JDBCPopulate: JDBCPopulate.java + $(JAVAC) JDBCPopulate.java +clean: + rm -rf *.o odbcBench + rm -rf *.class diff --git a/test/performance/wisc/README b/test/performance/wisc/README new file mode 100644 index 00000000..c9e47810 --- /dev/null +++ b/test/performance/wisc/README @@ -0,0 +1,30 @@ +Wisconsin Benchmark Suite +------------------------- +set the following in csql.conf file +MAX_SYS_DB_SIZE=104857600 +MAX_DB_SIZE=104857600 + +Run make to build the suite as follows +--------------------------- +$make + +To populate the database run +---------------------------- +$java JDBCPopulate + +For mysql +$java JDBCPopulate mysql + + +To run odbc test +$./odbcBench + +For mysql, edit(uncomment) Makefile to link with unixODBC library +$./odbcBench mysql + +To run csql jdbc test +--------------------- +$java JDBCBench + +For mysql, set the CLASSPATH to point to mysql jdbc jar file and run +$java JDBCBench mysql diff --git a/test/performance/wisc/odbcBench.c b/test/performance/wisc/odbcBench.c new file mode 100644 index 00000000..10b3e3a0 --- /dev/null +++ b/test/performance/wisc/odbcBench.c @@ -0,0 +1,864 @@ + +#include +#include +#include +#include +#include +#include +#include +#include "NanoTimer.h" +#define ITERATION 100 +using namespace std; +bool mysql; + +NanoTimer timer; +long long int timevalues[30][3]={0}; +void extract_error( + char *fn, + SQLHANDLE handle, + SQLSMALLINT type) +{ + SQLINTEGER i = 0; + SQLINTEGER native; + SQLCHAR state[ 7 ]; + SQLCHAR text[256]; + SQLSMALLINT len; + SQLRETURN ret; + + fprintf(stderr, + "\n" + "The driver reported the following diagnostics whilst running " + "%s\n\n", + fn); + + do + { + ret = SQLGetDiagRec(type, handle, ++i, state, &native, text, + sizeof(text), &len ); + if (SQL_SUCCEEDED(ret)) + printf("%s:%ld:%ld:%s\n", state, i, native, text); + } + while( ret == SQL_SUCCESS ); +} + +inline void +check_error (SQLSMALLINT handleType, SQLHANDLE handle, int rc, int line) +{ + if (rc) + { + cout << "Error " << rc << " at line: " << line << endl; + SQLCHAR state[10]; + SQLINTEGER native; + SQLCHAR mesg[300]; + int i=0; + while (SQLGetDiagRec (handleType, handle, i++, state, &native, mesg, 300, + NULL) == SQL_SUCCESS) + { + mesg[299] = '\0'; + cout << "state: " << state << endl; + cout << "native: " << native << endl; + cout << "mesg: " << mesg << endl; + } + exit (1); + } +} + + +inline void checkrc (int rc, int line) +{ + if (rc) + { + cout << "Error " << rc << " at line: " << line << endl; + exit (1); + } +} + +void readWriteTrans (SQLHDBC hdbc) +{ + int rc = SQLSetConnectAttr (hdbc, SQL_ATTR_ACCESS_MODE, + (SQLPOINTER) SQL_MODE_READ_WRITE, 0); + checkrc (rc, __LINE__); + rc = SQLEndTran (SQL_HANDLE_DBC, hdbc, SQL_COMMIT); + checkrc (rc, __LINE__); +} + +void readOnlyTrans (SQLHDBC hdbc) +{ + int rc = SQLSetConnectAttr (hdbc, SQL_ATTR_ACCESS_MODE, + (SQLPOINTER) SQL_MODE_READ_ONLY, 0); + checkrc (rc, __LINE__); + rc = SQLEndTran (SQL_HANDLE_DBC, hdbc, SQL_COMMIT); + checkrc (rc, __LINE__); +} + +void createHashIndex(SQLHANDLE hstmt,bool flag) +{ + int rc; + if (mysql) { + rc = SQLExecDirect(hstmt, (SQLCHAR*) "CREATE INDEX idx1 USING HASH ON big1(unique1);", SQL_NTS ); + checkrc (rc, __LINE__); + rc = SQLExecDirect(hstmt, (SQLCHAR*) "CREATE INDEX idx2 USING HASH ON big2(unique1);", SQL_NTS ); + checkrc (rc, __LINE__); + rc = SQLExecDirect(hstmt, (SQLCHAR*) "CREATE INDEX idx3 USING HASH ON small(unique1)", SQL_NTS ); + checkrc (rc, __LINE__); + rc = SQLExecDirect(hstmt, (SQLCHAR*) "CREATE INDEX idx4 USING HASH ON big1(stringu1)", SQL_NTS ); + checkrc (rc, __LINE__); + } else { + rc = SQLExecDirect(hstmt, (SQLCHAR*) "CREATE INDEX idx1 ON big1(unique1) HASH;", SQL_NTS ); + checkrc (rc, __LINE__); + rc = SQLExecDirect(hstmt, (SQLCHAR*) "CREATE INDEX idx2 ON big2(unique1) HASH;", SQL_NTS ); + checkrc (rc, __LINE__); + rc = SQLExecDirect(hstmt, (SQLCHAR*) "CREATE INDEX idx3 ON small(unique1) HASH", SQL_NTS ); + checkrc (rc, __LINE__); + rc = SQLExecDirect(hstmt, (SQLCHAR*) "CREATE INDEX idx4 ON big1(stringu1) HASH", SQL_NTS ); + checkrc (rc, __LINE__); + } +} +void createTreeIndex(SQLHANDLE hstmt,bool flag) +{ + int rc; + if (mysql) + { + rc = SQLExecDirect(hstmt, (SQLCHAR*) "CREATE INDEX idx5 USING BTREE ON big1(unique1);", SQL_NTS ); + checkrc (rc, __LINE__); + rc = SQLExecDirect(hstmt, (SQLCHAR*) "CREATE INDEX idx6 USING BTREE ON big2(unique1);", SQL_NTS ); + checkrc (rc, __LINE__); + rc = SQLExecDirect(hstmt, (SQLCHAR*) "CREATE INDEX idx7 USING BTREE ON small(unique1);", SQL_NTS ); + checkrc (rc, __LINE__); + rc = SQLExecDirect(hstmt, (SQLCHAR*) "CREATE INDEX idx8 USING BTREE ON big1(stringu1);", SQL_NTS ); + checkrc (rc, __LINE__); + }else { + rc = SQLExecDirect(hstmt, (SQLCHAR*) "CREATE INDEX idx5 ON big1(unique1) TREE;", SQL_NTS ); + checkrc (rc, __LINE__); + rc = SQLExecDirect(hstmt, (SQLCHAR*) "CREATE INDEX idx6 ON big2(unique1) TREE;", SQL_NTS ); + checkrc (rc, __LINE__); + rc = SQLExecDirect(hstmt, (SQLCHAR*) "CREATE INDEX idx7 ON small(unique1) TREE;", SQL_NTS ); + checkrc (rc, __LINE__); + rc = SQLExecDirect(hstmt, (SQLCHAR*) "CREATE INDEX idx8 ON big1(stringu1) TREE;", SQL_NTS ); + checkrc (rc, __LINE__); + } + +} +void dropHashIndex(SQLHANDLE hstmt,bool flag) +{ + int rc; + if (mysql) { + rc = SQLExecDirect(hstmt, (SQLCHAR*) "DROP INDEX idx1 on big1 ;", SQL_NTS ); + checkrc (rc, __LINE__); + rc = SQLExecDirect(hstmt, (SQLCHAR*) "DROP INDEX idx2 on big2;", SQL_NTS ); + checkrc (rc, __LINE__); + rc = SQLExecDirect(hstmt, (SQLCHAR*) "DROP INDEX idx3 on small", SQL_NTS ); + checkrc (rc, __LINE__); + rc = SQLExecDirect(hstmt, (SQLCHAR*) "DROP INDEX idx4 on big1;", SQL_NTS ); + checkrc (rc, __LINE__); + } else { + rc = SQLExecDirect(hstmt, (SQLCHAR*) "DROP INDEX idx1 ;", SQL_NTS ); + checkrc (rc, __LINE__); + rc = SQLExecDirect(hstmt, (SQLCHAR*) "DROP INDEX idx2 ;", SQL_NTS ); + checkrc (rc, __LINE__); + rc = SQLExecDirect(hstmt, (SQLCHAR*) "DROP INDEX idx3 ;", SQL_NTS ); + checkrc (rc, __LINE__); + rc = SQLExecDirect(hstmt, (SQLCHAR*) "DROP INDEX idx4 ;", SQL_NTS ); + checkrc (rc, __LINE__); + } +} +void dropTreeIndex(SQLHANDLE hstmt,bool flag) +{ + int rc; + if (mysql) + { + rc = SQLExecDirect(hstmt, (SQLCHAR*) "DROP INDEX idx5 on big1 ;", SQL_NTS ); + checkrc (rc, __LINE__); + rc = SQLExecDirect(hstmt, (SQLCHAR*) "DROP INDEX idx6 on big2;", SQL_NTS ); + checkrc (rc, __LINE__); + rc = SQLExecDirect(hstmt, (SQLCHAR*) "DROP INDEX idx7 on small;", SQL_NTS ); + checkrc (rc, __LINE__); + rc = SQLExecDirect(hstmt, (SQLCHAR*) "DROP INDEX idx8 on big1;", SQL_NTS ); + checkrc (rc, __LINE__); + }else { + rc = SQLExecDirect(hstmt, (SQLCHAR*) "DROP INDEX idx5 ;", SQL_NTS ); + checkrc (rc, __LINE__); + rc = SQLExecDirect(hstmt, (SQLCHAR*) "DROP INDEX idx6 ;", SQL_NTS ); + checkrc (rc, __LINE__); + rc = SQLExecDirect(hstmt, (SQLCHAR*) "DROP INDEX idx7 ;", SQL_NTS ); + checkrc (rc, __LINE__); + rc = SQLExecDirect(hstmt, (SQLCHAR*) "DROP INDEX idx8 ;", SQL_NTS ); + checkrc (rc, __LINE__); + } + +} + +long long int onePerSel(SQLHANDLE henv, SQLHANDLE hdbc, SQLHANDLE hstmt) +{ + int uni1; + int uni2; + char str1[52]; + char str2[52]; + int val[] = {1, 5, 10, 50, 100, 500, 1000, 5000 ,7500, 9500}; + int tempTermVar=0; + int tempTermVar2=0; + char tempval[124]="Value"; + int rc; + readOnlyTrans (hdbc); + rc = SQLPrepare (hstmt, (unsigned char *) "SELECT unique1, unique2, stringu1 from big1 where unique1 between ? and ?;", SQL_NTS); + checkrc (rc, __LINE__); + rc = SQLBindParameter (hstmt, 1, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &tempTermVar, 0, NULL); + checkrc (rc, __LINE__); + rc = SQLBindParameter (hstmt, 2, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &tempTermVar2, 0, NULL); + checkrc (rc, __LINE__); + + rc = SQLBindCol (hstmt, 1, SQL_INTEGER, &uni1, 0, NULL); + checkrc (rc, __LINE__); + rc = SQLBindCol (hstmt, 2, SQL_INTEGER, &uni2, 0, NULL); + checkrc (rc, __LINE__); + rc = SQLBindCol (hstmt, 3, SQL_C_CHAR, str1, sizeof (str1), NULL); + checkrc (rc, __LINE__); + + int i, j, k; + int Count; + + timer.reset (); + + for (i = 0; i < 10; i++) + { + Count=0; + strcpy(tempval,"Value"); + tempTermVar = val[i] ; + tempTermVar2 = val[i]+99 ; + timer.start (); + rc = SQLExecute (hstmt); + checkrc (rc, __LINE__); + while(SQL_SUCCEEDED(rc = SQLFetch(hstmt))) + { + Count++; + } + // printf("Count=%d\n",Count); + rc = SQLCloseCursor (hstmt); + checkrc (rc, __LINE__); + rc = SQLTransact (henv, hdbc, SQL_COMMIT); + checkrc (rc, __LINE__); + timer.stop (); + if (Count != 100) { + printf("One % Selection returned %d rows", Count); + readWriteTrans (hdbc); + return 0; + } + } + readWriteTrans (hdbc); + //printf ("Read: 1 %lld\n", timer.avg ()); + return timer.avg()/1000; +} + +long long int runReadTest (SQLHANDLE henv, SQLHANDLE hdbc,SQLHANDLE hstmt,bool flag) +{ + int uni1; + int uni2; + char str1[52]; + char str2[52]; + + int val[] = {1, 10, 100, 500, 1000, 5000 ,7500, 8000, 9000, 9999}; + int tempTermVar=0; + char tempval[52]="Value"; + int rc; + + /* Set read-only transaction type */ + readOnlyTrans (hdbc); + if(flag){ + rc = SQLPrepare (hstmt, (unsigned char *) "SELECT unique1, unique2, stringu1, stringu2 from big1 where unique1=?;", SQL_NTS); + } + else { + rc = SQLPrepare (hstmt, (unsigned char *) "SELECT unique1, unique2, stringu1, stringu2 from big1 where stringu1=?;", SQL_NTS); + } + checkrc (rc, __LINE__); + long sz = 0; + if(flag){ + rc = SQLBindParameter (hstmt, 1, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &tempTermVar, 0, NULL); + checkrc (rc, __LINE__); + } + else{ + rc = SQLBindParameter (hstmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_C_CHAR, 196, 0, tempval, 0, NULL); + checkrc (rc, __LINE__); + + } + rc = SQLBindCol (hstmt, 1, SQL_INTEGER, &uni1, 0, NULL); + checkrc (rc, __LINE__); + rc = SQLBindCol (hstmt, 2, SQL_INTEGER, &uni2, 0, NULL); + checkrc (rc, __LINE__); + rc = SQLBindCol (hstmt, 3, SQL_C_CHAR, str1, sizeof (str1), NULL); + checkrc (rc, __LINE__); + rc = SQLBindCol (hstmt, 4, SQL_C_CHAR, str2, sizeof (str2), NULL); + checkrc (rc, __LINE__); + + int i, j, k; + int Count; + + timer.reset (); + char buf[10]="Value"; + + /* Run 1per Test */ + for (i = 0; i < 10; i++) + { + if(flag){ + tempTermVar = val[i] ;} + else{ + sprintf(tempval,"%s%d",buf, val[i]); + } + timer.start (); + rc = SQLExecute (hstmt); + checkrc (rc, __LINE__); + rc = SQLFetch (hstmt); + checkrc (rc, __LINE__); + Count++; + rc = SQLCloseCursor (hstmt); + checkrc (rc, __LINE__); + rc = SQLTransact (henv, hdbc, SQL_COMMIT); + checkrc (rc, __LINE__); + timer.stop (); + } + //printf ("Read: 1 %lld\n", timer.avg ()); + /* Set read-write transaction type */ + readWriteTrans (hdbc); + return timer.avg()/1000; +} + +//DISTINCT +long long int distinct(SQLHANDLE henv, SQLHANDLE hdbc,SQLHANDLE hstmt) +{ + int var_onepercent; + int rc; + + readOnlyTrans (hdbc); + rc = SQLPrepare (hstmt, (unsigned char *) "SELECT DISTINCT onepercent FROM big1;", SQL_NTS); + checkrc (rc, __LINE__); + + rc = SQLBindCol (hstmt, 1, SQL_INTEGER, &var_onepercent, 0, NULL); + checkrc (rc, __LINE__); + + int i,count; + timer.reset (); + + for (i = 0; i < 10; i++) + { + count=0; + timer.start (); + rc = SQLExecute (hstmt); + checkrc (rc, __LINE__); + while(SQL_SUCCEEDED(rc = SQLFetch(hstmt))){ + count++; + } + //checkrc (rc, __LINE__); + rc = SQLCloseCursor (hstmt); + checkrc (rc, __LINE__); + rc = SQLTransact (henv, hdbc, SQL_COMMIT); + checkrc (rc, __LINE__); + timer.stop (); + if (count != 100) { + printf("distinct returned %d rows\n"); + readWriteTrans(hdbc); + return 0; + } + } + readWriteTrans(hdbc); + return timer.avg()/1000; +} +long long int orderBy(SQLHANDLE henv, SQLHANDLE hdbc,SQLHANDLE hstmt) +{ + int val[] = {1, 5, 10, 50, 100, 500, 1000, 5000 ,7500, 9500}; + int var_two, var_four, var_ten, var_twenty, var_onepercent; + char str1[52]; + int tempTermVar=0, tempTermVar2=0, tempTermVar3=0; + int rc; + + rc = SQLPrepare (hstmt, (unsigned char *) "SELECT two, four, ten, twenty, onepercent, string4 from big1 where unique1 between ? and ? order by unique1;", SQL_NTS); + checkrc (rc, __LINE__); + + readOnlyTrans (hdbc); + rc = SQLBindParameter (hstmt, 1, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &tempTermVar, 0, NULL); + checkrc (rc, __LINE__); + rc = SQLBindParameter (hstmt, 2, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &tempTermVar2, 0, NULL); + checkrc (rc, __LINE__); + + + rc = SQLBindCol (hstmt, 1, SQL_INTEGER, &var_two, 0, NULL); + checkrc (rc, __LINE__); + + rc = SQLBindCol (hstmt, 2, SQL_INTEGER, &var_four, 0, NULL); + checkrc (rc, __LINE__); + + rc = SQLBindCol (hstmt, 3, SQL_INTEGER, &var_ten, 0, NULL); + checkrc (rc, __LINE__); + + rc = SQLBindCol (hstmt, 4, SQL_INTEGER, &var_twenty, 0, NULL); + checkrc (rc, __LINE__); + + rc = SQLBindCol (hstmt, 5, SQL_INTEGER, &var_onepercent, 0, NULL); + checkrc (rc, __LINE__); + + rc = SQLBindCol (hstmt, 6, SQL_C_CHAR, str1, sizeof (str1), NULL); + checkrc (rc, __LINE__); + + + int i, j, k; + int count; + + timer.reset (); + + for (i = 0; i < 10; i++) + { + count=0; + tempTermVar=val[i]; + tempTermVar2 = val[i]+100 ; + timer.start (); + rc = SQLExecute (hstmt); + checkrc (rc, __LINE__); + rc = SQLFetch (hstmt); + while(SQL_SUCCEEDED(rc = SQLFetch(hstmt))) count++; + //checkrc (rc, __LINE__); + rc = SQLCloseCursor (hstmt); + checkrc (rc, __LINE__); + rc = SQLTransact (henv, hdbc, SQL_COMMIT); + checkrc (rc, __LINE__); + timer.stop (); + if (count != 100) { + printf("orderby returned %d rows \n", count); + readWriteTrans(hdbc); + return 0; + } + } + readWriteTrans(hdbc); + return timer.avg()/1000; +} + + +//aggregate +long long int aggregate(SQLHANDLE henv, SQLHANDLE hdbc,SQLHANDLE hstmt,int val,bool flag) +{ + int summinmax=0,tempTermVar=0; + int rc; + /* Set read-only transaction type */ + readOnlyTrans (hdbc); + if(val==1 && flag){ + rc = SQLPrepare (hstmt, (unsigned char *) "SELECT MIN(unique1) from big1;", SQL_NTS); + } + else if(val==1 && !flag) + { + rc = SQLPrepare (hstmt, (unsigned char *) "SELECT MIN(unique1) from big1 group by onepercent;", SQL_NTS); + + } + else if(val==2 && flag) { + rc = SQLPrepare (hstmt, (unsigned char *) "SELECT MAX(unique1) from big1;", SQL_NTS); + } + else if(val==2 && !flag){ + rc = SQLPrepare (hstmt, (unsigned char *) "SELECT MAX(unique1) from big1 group by onepercent;", SQL_NTS); + } + else if(val==3 && flag) { + rc = SQLPrepare (hstmt, (unsigned char *) "SELECT SUM(unique1) from big1;", SQL_NTS); + } + else if(val==3 && !flag){ + rc = SQLPrepare (hstmt, (unsigned char *) "SELECT SUM(unique1) from big1 group by onepercent;", SQL_NTS); + } + checkrc (rc, __LINE__); + + rc = SQLBindCol (hstmt, 1, SQL_INTEGER, &summinmax, 0, NULL); + checkrc (rc, __LINE__); + + int i, j, k; + int Count; + + timer.reset (); + for (i = 0; i < 10; i++) + { + timer.start (); + rc = SQLExecute (hstmt); + checkrc (rc, __LINE__); + rc = SQLFetch (hstmt); + checkrc (rc, __LINE__); + Count++; + // printf("value=%d",summin); + rc = SQLCloseCursor (hstmt); + checkrc (rc, __LINE__); + rc = SQLTransact (henv, hdbc, SQL_COMMIT); + checkrc (rc, __LINE__); + timer.stop (); + } + //printf ("Read: 1 %lld\n", timer.avg ()); + /* Set read-write transaction type */ + readWriteTrans (hdbc); + return timer.avg()/1000; + +} + +long long int dmlstatement(SQLHANDLE henv, SQLHANDLE hdbc,SQLHANDLE hstmt,int val) +{ + int tempTermVar=10000,tempTermVar2=10000; + int rc; + /* Set read-only transaction type */ + readOnlyTrans (hdbc); + if(val==1){ + rc = SQLPrepare (hstmt, (unsigned char *) "insert into big1 values(?,?,0,2,0,10,50,688,1950,4950,9950,1,100,'MXXXXXXXXXXXXXXXXXXXXXXXXXGXXXXXXXXXXXXXXXXXXXXXXXXC','GXXXXXXXXXXXXXXXXXXXXXXXXXCXXXXXXXXXXXXXXXXXXXXXXXXA','OXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXO');", SQL_NTS); + } + else if(val==2){ + rc = SQLPrepare (hstmt, (unsigned char *) "UPDATE big1 SET two=1 WHERE unique1=?;", SQL_NTS); + }else + { + rc = SQLPrepare (hstmt, (unsigned char *) "DELETE FROM big1 WHERE unique1=?;", SQL_NTS); + } + checkrc (rc, __LINE__); + + int i, j, k; + int Count; + + timer.reset (); + for (i = 0; i < 100; i++) + { tempTermVar+=i; + rc = SQLBindParameter (hstmt, 1, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &tempTermVar, 0, NULL); + checkrc (rc, __LINE__); + if(val==1) + { + tempTermVar2+=i; + rc = SQLBindParameter (hstmt, 1, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &tempTermVar2, 0, NULL); + checkrc (rc, __LINE__); + } + timer.start (); + rc = SQLExecute (hstmt); + checkrc (rc, __LINE__); + rc = SQLTransact (henv, hdbc, SQL_COMMIT); + checkrc (rc, __LINE__); + timer.stop (); + tempTermVar=10000;tempTermVar2=10000; + } + //printf ("Read: 1 %lld\n", timer.avg ()); + /* Set read-write transaction type */ + readWriteTrans (hdbc); + return timer.avg()/1000; + +} + +//Joining +long long int joining(SQLHANDLE henv, SQLHANDLE hdbc, SQLHANDLE hstmt,int value) +{ + int uni1; + int uni2,uni3,uni4,uni5; + char str1[52]; + char str2[52]; + + int val[10] = {1, 5, 10, 50, 100, 250, 500, 750, 900, 999}; + int tempTermVar=0; + char tempval[124]="Value"; + int rc; + + /* Set read-only transaction type */ + readOnlyTrans (hdbc); + if(value==1 ){ + rc = SQLPrepare (hstmt, (unsigned char *) "SELECT big1.unique1, big1.unique2, small.unique1, small.stringu1 FROM big1,small WHERE big1.unique1=small.unique1 AND big1.unique1=?;", SQL_NTS); + } + + else { + rc = SQLPrepare (hstmt, (unsigned char *) "SELECT small.unique1, big1.unique1, big2.unique1, small.stringu1, big1.unique2, big2.unique2 FROM big1, big2, small WHERE small.unique1=big1.unique2 AND big1.unique2=big2.unique1 AND big1.unique1 = ?;", SQL_NTS); + } + + checkrc (rc, __LINE__); + long sz = 0; + + + rc = SQLBindParameter (hstmt, 1, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &tempTermVar, 0, NULL); + checkrc (rc, __LINE__); + + rc = SQLBindCol (hstmt, 1, SQL_C_LONG, &uni1, 0, NULL); + checkrc (rc, __LINE__); + rc = SQLBindCol (hstmt, 2, SQL_C_LONG, &uni2, 0, NULL); + checkrc (rc, __LINE__); + rc = SQLBindCol (hstmt, 3, SQL_C_LONG, &uni3, 0, NULL); + checkrc (rc, __LINE__); + rc = SQLBindCol (hstmt, 4, SQL_C_CHAR, str1, sizeof (str1), NULL); + checkrc (rc, __LINE__); + if(value==2 ){ + rc = SQLBindCol (hstmt, 5, SQL_C_LONG, &uni4, 0, NULL); + checkrc (rc, __LINE__); + rc = SQLBindCol (hstmt, 6, SQL_C_LONG, &uni5, 0, NULL); + checkrc (rc, __LINE__); + } + int i, j, k; + int Count=0; + + timer.reset (); + + for (i = 0; i < 10; i++) + { + tempTermVar = val[i]; + timer.start (); + rc = SQLExecute (hstmt); + checkrc (rc, __LINE__); + rc=SQLFetch(hstmt); + Count++; + rc = SQLCloseCursor (hstmt); + checkrc (rc, __LINE__); + rc = SQLTransact (henv, hdbc, SQL_COMMIT); + checkrc (rc, __LINE__); + timer.stop (); + // printf("uni1=%d uni2=%d uni3=%d str1=%s \n",uni1,uni2,uni3,str1); + } + readWriteTrans (hdbc); + return timer.avg()/1000; +} +//JOINCondition + +long long int joinCondition(SQLHANDLE henv, SQLHANDLE hdbc, SQLHANDLE hstmt,int value) +{ + int uni1; + int uni2,uni3,uni4,uni5; + char str1[52]; + char str2[52]; + int rc; + int searchVal[] = {1, 5, 10, 50, 100, 200, 250, 500, 750, 800}; + + //Set read-only transaction type + readOnlyTrans (hdbc); + if(value==1 ) + { + rc = SQLPrepare (hstmt, (unsigned char *) "SELECT big1.unique1, big1.unique2, small.unique1, small.stringu1 FROM big1,small WHERE big1.unique1=small.unique1 AND big1.unique1 > ? and big1.unique1 <= ?;", SQL_NTS); + + } + else { + rc = SQLPrepare (hstmt, (unsigned char *) "SELECT small.unique1, big1.unique1, big2.unique1, small.stringu1, big1.unique2, big2.unique2 FROM big1, big2, small WHERE big1.unique1=small.unique1 AND big1.unique1=big2.unique1 AND big1.unique1 > ? and big1.unique1 <= ?;", SQL_NTS); + } + + checkrc (rc, __LINE__); + int tempTermVar1 =0, tempTermVar2=0; + + rc = SQLBindParameter (hstmt, 1, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &tempTermVar1, 0, NULL); + checkrc (rc, __LINE__); + rc = SQLBindParameter (hstmt, 2, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &tempTermVar2, 0, NULL); + checkrc (rc, __LINE__); + + long sz = 0; + rc = SQLBindCol (hstmt, 1, SQL_C_SLONG, &uni1, 0, NULL); + checkrc (rc, __LINE__); + rc = SQLBindCol (hstmt, 2, SQL_C_SLONG, &uni2, 0, NULL); + checkrc (rc, __LINE__); + rc = SQLBindCol (hstmt, 3, SQL_C_SLONG, &uni3, 0, NULL); + checkrc (rc, __LINE__); + rc = SQLBindCol (hstmt, 4, SQL_C_CHAR, str1, sizeof (str1), NULL); + checkrc (rc, __LINE__); + if(value==2){ + rc = SQLBindCol (hstmt, 5, SQL_C_SLONG, &uni4, 0, NULL); + checkrc (rc, __LINE__); + rc = SQLBindCol (hstmt, 6, SQL_C_SLONG, &uni5, 0, NULL); + checkrc (rc, __LINE__); + } + int i, j, k; + int count=0; + + timer.reset (); + for(i=0;i<10;i++){ + count=0; + tempTermVar1 = searchVal[i]; + tempTermVar2 = searchVal[i]+100; + timer.start (); + rc = SQLExecute (hstmt); + checkrc (rc, __LINE__); + while(SQL_SUCCEEDED(rc = SQLFetch(hstmt))) + { + count++; + //printf("Uni1:%d uni2=%d uni3=%d \n",uni1,uni2,uni3); + } + rc = SQLCloseCursor (hstmt); + checkrc (rc, __LINE__); + rc = SQLTransact (henv, hdbc, SQL_COMMIT); + checkrc (rc, __LINE__); + timer.stop (); + if (count != 100) { + printf ("range join returned %d rows\n", count); + readWriteTrans (hdbc); + return 0; + } + } + readWriteTrans (hdbc); + return timer.avg()/1000; + +} + +void printTime() +{ + printf("Wisconsin Benchmark Report:\n"); + printf("*******************************************************\n"); + printf(" Statement \tNoIndex\tHash\tTree\n"); + printf("*******************************************************\n"); + printf(" SelectInt 1 \t%lld\t%lld\t%lld\n",timevalues[0][0],timevalues[0][1],timevalues[0][2]); + printf(" SelectStr 1 \t%lld\t%lld\t%lld\n",timevalues[1][0],timevalues[1][1],timevalues[1][2]); + printf(" 1Per Sel \t%lld\t%lld\t%lld\n",timevalues[2][0],timevalues[2][1],timevalues[2][2]); + printf(" Min All \t%lld\t%lld\t%lld\n",timevalues[3][0],timevalues[3][1],timevalues[3][2]); + printf(" Min GrBy 1% \t%lld\t%lld\t%lld\n",timevalues[4][0],timevalues[4][1],timevalues[4][2]); + printf(" Max All \t%lld\t%lld\t%lld\n",timevalues[5][0],timevalues[5][1],timevalues[5][2]); + printf(" Max GrBy 1 \t%lld\t%lld\t%lld\n",timevalues[6][0],timevalues[6][1],timevalues[6][2]); + printf(" Sum All \t%lld\t%lld\t%lld\n",timevalues[7][0],timevalues[7][1],timevalues[7][2]); + printf(" Sum GrBy 1% \t%lld\t%lld\t%lld\n",timevalues[8][0],timevalues[8][1],timevalues[8][2]); + printf(" Distinct 1% \t%lld\t%lld\t%lld\n",timevalues[9][0],timevalues[9][1],timevalues[9][2]); + printf(" Order By 1% \t%lld\t%lld\t%lld\n",timevalues[10][0],timevalues[10][1],timevalues[10][2]); + printf(" Insert 1 \t%lld\t%lld\t%lld\n",timevalues[11][0],timevalues[11][1],timevalues[11][2]); + printf(" Update 1 \t%lld\t%lld\t%lld\n",timevalues[12][0],timevalues[12][1],timevalues[12][2]); + printf(" Delete 1 \t%lld\t%lld\t%lld\n",timevalues[13][0],timevalues[13][1],timevalues[13][2]); + printf(" Join(10K*1K)1 \t%lld\t%lld\t%lld\n",timevalues[14][0],timevalues[14][1],timevalues[14][2]); + printf(" Join(10K*10K*1K) \t%lld\t%lld\t%lld\n",timevalues[15][0],timevalues[15][1],timevalues[15][2]); + printf(" Join(10K*1K)100 \t%lld\t%lld\t%lld\n",timevalues[16][0],timevalues[16][1],timevalues[16][2]); + printf(" Join(10K*10K*1K)100 \t%lld\t%lld\t%lld\n",timevalues[17][0],timevalues[17][1],timevalues[17][2]); + + + printf("*******************************************************\n"); + +} + +int main (int ac, char **av) +{ + int rc; + SQLHENV henv; + SQLHDBC hdbc; + SQLHSTMT hstmt; + mysql=false; + if (ac ==2) mysql = true; + //printf("Mysql Set %d \n", ac); return 0; + rc = SQLAllocHandle (SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv); + checkrc (rc, __LINE__); + SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (void *) SQL_OV_ODBC3, 0); + + rc = SQLAllocHandle (SQL_HANDLE_DBC, henv, &hdbc); + checkrc (rc, __LINE__); + if (!mysql) { + rc = SQLConnect (hdbc, + (SQLCHAR *) "test", (SQLSMALLINT) strlen ("test"), + (SQLCHAR *) "root", + (SQLSMALLINT) strlen ("root"), + (SQLCHAR *) "manager", + (SQLSMALLINT) strlen ("")); + }else { + + SQLCHAR outstr[1024]; + SQLSMALLINT outstrlen; + rc = SQLDriverConnect(hdbc, NULL, (SQLCHAR*)"DSN=myodbc3;", SQL_NTS, + outstr, sizeof(outstr), &outstrlen, + SQL_DRIVER_NOPROMPT); + } + + + if (SQL_SUCCEEDED(rc)) { + printf("Connected\n"); + //printf("Returned connection string was:\n\t%s\n", outstr); + if (rc == SQL_SUCCESS_WITH_INFO) { + printf("Driver reported the following diagnostics\n"); + extract_error("SQLDriverConnect", hdbc, SQL_HANDLE_DBC); + } + } else { + fprintf(stderr, "Failed to connect\n"); + extract_error("SQLDriverConnect", hdbc, SQL_HANDLE_DBC); + } + + //check_error (SQL_HANDLE_DBC, hdbc, rc, __LINE__); + checkrc (rc, __LINE__); + rc = SQLSetConnectOption (hdbc, SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF); + checkrc (rc, __LINE__); + rc = SQLAllocHandle (SQL_HANDLE_STMT, hdbc, &hstmt); + checkrc (rc, __LINE__); + int ins=1,upd=2,del=3; + int min=1, max=2, sum=3; + + timevalues[0][0] = runReadTest (henv, hdbc, hstmt,true); + timevalues[1][0] = runReadTest (henv, hdbc, hstmt,false); + timevalues[2][0] = onePerSel(henv, hdbc, hstmt); + timevalues[3][0] = aggregate(henv, hdbc, hstmt,min,true); + timevalues[4][0] = aggregate(henv, hdbc, hstmt,min,false); + timevalues[5][0] = aggregate(henv, hdbc, hstmt,max,true); + timevalues[6][0] = aggregate(henv, hdbc, hstmt,max,false); + timevalues[7][0] = aggregate(henv, hdbc, hstmt,sum,true); + timevalues[8][0] = aggregate(henv, hdbc, hstmt,sum,false); + timevalues[9][0] = distinct(henv, hdbc, hstmt); + timevalues[10][0] = orderBy(henv, hdbc, hstmt); + timevalues[11][0] = dmlstatement(henv, hdbc, hstmt,ins); + timevalues[12][0] = dmlstatement(henv, hdbc, hstmt,upd); + timevalues[13][0] = dmlstatement(henv, hdbc, hstmt,del); + timevalues[14][0] = joining(henv, hdbc, hstmt,1); + timevalues[15][0] = joining(henv, hdbc, hstmt,2); + timevalues[16][0] = joinCondition(henv, hdbc, hstmt,1); + timevalues[17][0] = joinCondition(henv, hdbc, hstmt,2); + printf("NON INDEX OVER\n"); + if (!mysql){ + rc = SQLExecDirect(hstmt, (SQLCHAR*) "FLUSH CACHE", SQL_NTS ); + checkrc (rc, __LINE__); + } + +//Hash + createHashIndex( hstmt,true); + + timevalues[0][1] = runReadTest (henv, hdbc, hstmt,true); + timevalues[1][1] = runReadTest (henv, hdbc, hstmt,false); + timevalues[2][1] = onePerSel(henv, hdbc, hstmt); + timevalues[3][1] = aggregate(henv, hdbc, hstmt,min,true); + timevalues[4][1] = 0; + timevalues[5][1] = 0; + timevalues[6][1] = 0; + timevalues[7][1] = 0; + timevalues[8][1] = 0; + timevalues[9][1] = distinct(henv, hdbc, hstmt); + timevalues[10][1] = orderBy(henv, hdbc, hstmt); + timevalues[11][1] = dmlstatement(henv, hdbc, hstmt,ins); + timevalues[12][1] = dmlstatement(henv, hdbc, hstmt,upd); + timevalues[13][1] = dmlstatement(henv, hdbc, hstmt,del); + timevalues[14][1] = joining(henv, hdbc, hstmt,1); + timevalues[15][1] = joining(henv, hdbc, hstmt,2); + + timevalues[16][1] = joinCondition(henv, hdbc, hstmt,1); + timevalues[17][1] = joinCondition(henv, hdbc, hstmt,2); + dropHashIndex(hstmt,true); + printf("HASH INDEX OVER\n"); + //printTime(); + + + if (!mysql){ + rc = SQLExecDirect(hstmt, (SQLCHAR*) "FLUSH CACHE", SQL_NTS ); + checkrc (rc, __LINE__); + } + + +//TREE + createTreeIndex(hstmt,true); + timevalues[0][2] = runReadTest (henv, hdbc, hstmt,true); + timevalues[1][2] = runReadTest (henv, hdbc, hstmt,false); + timevalues[2][2] = onePerSel(henv, hdbc, hstmt); + timevalues[3][2] = aggregate(henv, hdbc, hstmt,min,true); + timevalues[4][2] = 0; + timevalues[5][2] = 0; + timevalues[6][2] = 0; + timevalues[7][2] = 0; + timevalues[8][2] = 0; + timevalues[9][2] = distinct(henv, hdbc, hstmt); + timevalues[10][2] = orderBy(henv, hdbc, hstmt); + timevalues[11][2] = dmlstatement(henv, hdbc, hstmt,ins); + timevalues[12][2] = dmlstatement(henv, hdbc, hstmt,upd); + timevalues[13][2] = dmlstatement(henv, hdbc, hstmt,del); + timevalues[14][2] = joining(henv, hdbc, hstmt,1); + timevalues[15][2] = joining(henv, hdbc, hstmt,2); + + timevalues[16][2] = joinCondition(henv, hdbc, hstmt,1); + timevalues[17][2] = joinCondition(henv, hdbc, hstmt,2); + + dropTreeIndex(hstmt,true); + printf("TREE INDEX OVER\n"); + + + //printTime + printTime(); + rc = SQLEndTran(SQL_HANDLE_DBC, hdbc, SQL_COMMIT ); + checkrc (rc, __LINE__); + + rc = SQLFreeHandle (SQL_HANDLE_STMT, hstmt); + checkrc (rc, __LINE__); + rc = SQLDisconnect (hdbc); + checkrc (rc, __LINE__); + rc = SQLFreeHandle (SQL_HANDLE_DBC, hdbc); + checkrc (rc, __LINE__); + rc = SQLFreeHandle (SQL_HANDLE_ENV, henv); + checkrc (rc, __LINE__); + exit (0); +} + + + diff --git a/test/sql/Aggregate/TODO b/test/sql/Aggregate/TODO new file mode 100644 index 00000000..5cf49d4c --- /dev/null +++ b/test/sql/Aggregate/TODO @@ -0,0 +1,3 @@ +2. Null and exp file to be checked in 25,26,27,28,29,30,31 + +3. New case to be written for Ivan Bayross page:426 No:2(f)(g) (by Nihar) diff --git a/test/sql/Aggregate/agg1.sql b/test/sql/Aggregate/agg1.sql new file mode 100644 index 00000000..9fe948fd --- /dev/null +++ b/test/sql/Aggregate/agg1.sql @@ -0,0 +1 @@ +select count(*),min(f1),sum(f1) from t1; diff --git a/test/sql/Aggregate/aggmin4.sql b/test/sql/Aggregate/aggmin4.sql new file mode 100644 index 00000000..f2fc2d44 --- /dev/null +++ b/test/sql/Aggregate/aggmin4.sql @@ -0,0 +1 @@ +select min(t10.f1) from t1; diff --git a/test/sql/Aggregate/aggregate1.sql b/test/sql/Aggregate/aggregate1.sql new file mode 100644 index 00000000..78c74eaf --- /dev/null +++ b/test/sql/Aggregate/aggregate1.sql @@ -0,0 +1,17 @@ +echo select count(f1) from t2; +select count(f1) from t2; + +echo select count(f1) from t1; +select count(f1) from t1; + +echo select sum(f1) from t1; +select sum(f1) from t1; + +echo select avg(f1) from t1; +select avg(f1) from t1; + +echo select min(f1) from t1; +select min(f1) from t1; + +echo select max(f1) from t1; +select max(f1) from t1; diff --git a/test/sql/Aggregate/aggregate2.sql b/test/sql/Aggregate/aggregate2.sql new file mode 100644 index 00000000..d4ecd7c9 --- /dev/null +++ b/test/sql/Aggregate/aggregate2.sql @@ -0,0 +1,23 @@ +echo select count(f1) from t1; +select count(t1.f1) from t1; + +echo select count(*) from t1 where f4='AAA'; +select count(*) from t1 where f4='AAA'; + +echo select sum(f1) from t1; +select sum(t1.f1) from t1; + +echo select avg(f1) from t1; +select avg(t1.f1) from t1; + +echo select min(t1.f1) from t1; +select min(t1.f1) from t1; + +echo select min(f4) from t1; +select min(f4) from t1; + +echo select max(t1.f1) from t1; +select max(t1.f1) from t1; + +echo select max(f4) from t1; +select max(f4) from t1; diff --git a/test/sql/Aggregate/aggregate4.sql b/test/sql/Aggregate/aggregate4.sql new file mode 100644 index 00000000..0cd0c53e --- /dev/null +++ b/test/sql/Aggregate/aggregate4.sql @@ -0,0 +1,11 @@ +echo select min(t1.notexist) from t1; +select min(t1.notexist) from t1; + +echo select max(t1.f1), sum(t2.f1) from t1,t2 where t1.f1 = t2.f1 and t1.f1 <100; +select max(t1.f1), sum(t2.f1) from t1,t2 where t1.f1 = t2.f1 and t1.f1 <100; + +echo select max(t1.f1), sum(t2.f1) from t1,t2 where t1.f1 = t2.f1 and t1.f1 <100 group by t1.f2; +select max(t1.f1), sum(t2.f1) from t1,t2 where t1.f1 = t2.f1 and t1.f1 <100 group by t1.f2; + +echo select max(t1.f1), max(t2.notexist) from t1,t2 group by t1.f2; +select max(t1.f1), max(t2.notexist) from t1,t2 group by t1.f2; diff --git a/test/sql/Aggregate/aggregate5.sql b/test/sql/Aggregate/aggregate5.sql new file mode 100644 index 00000000..7d57755a --- /dev/null +++ b/test/sql/Aggregate/aggregate5.sql @@ -0,0 +1,15 @@ + +echo select t1.f2, t1.f1, t2.f1 from t1,t2; +select t1.f2, t1.f1, t2.f1 from t1,t2; + +echo select t1.f2, t1.f1, t2.f1 from t1,t2 group by t1.f2; +select t1.f2, t1.f1, t2.f1 from t1,t2 group by t1.f2; + +echo select t1.f2, max(t1.f1), sum(t2.f1) from t1, t2 group by t1.f2; +select t1.f2, max(t1.f1), sum(t2.f1) from t1, t2 group by t1.f2; + +echo select f1, f2 from t1 group by f1,f2; +select f1, f2 from t1 group by f1,f2; + +echo select f1, sum(f2) from t1 group by f3; +select f1, sum(f2) from t1 group by f3; diff --git a/test/sql/Aggregate/aggregate6.sql b/test/sql/Aggregate/aggregate6.sql new file mode 100644 index 00000000..2ae2f579 --- /dev/null +++ b/test/sql/Aggregate/aggregate6.sql @@ -0,0 +1,17 @@ +echo select * from t1; +select * from t1; + +echo select min(t1.f2) from t1 group by t1.f1; +select min(t1.f2) from t1 group by t1.f1; + +echo select avg(t1.f2) from t1 group by t1.f1; +select avg(t1.f2) from t1 group by t1.f1; + +echo select sum(t1.f2) from t1 group by notexist; +select sum(t1.f2) from t1 group by notexist; + +echo select sum(t1.f2) from t1 group by t1.notexist; +select sum(t1.f2) from t1 group by t1.notexist; + +echo select sum(t1.f2) from t1 group by notexist.f1; +select sum(t1.f2) from t1 group by notexist.f1; diff --git a/test/sql/Aggregate/aggregate7.sql b/test/sql/Aggregate/aggregate7.sql new file mode 100644 index 00000000..a014a230 --- /dev/null +++ b/test/sql/Aggregate/aggregate7.sql @@ -0,0 +1,28 @@ +echo select count(f1) from t1; +select count(f1) from t1; +echo select count(f2) from t1; +select count(f2) from t1; +echo select sum(f1) from t1; +select sum(f1) from t1; +echo select sum(f3) from t1; +select sum(f3) from t1; +echo select avg(f1) from t1; +select avg(f1) from t1; +echo select avg(f2) from t1; +select avg(f2) from t1; +echo select min(f2) from t1; +select min(f2) from t1; +echo select max(f3) from t1; +select max(f3) from t1; +echo select avg(t1.f2) from t1; +select avg(t1.f2) from t1; +echo select count(t1.f3) from t1; +select count(t1.f3) from t1; +echo select min(t1.f3) from t1; +select min(t1.f3) from t1; +echo select avg(t1.f2), min(f3), count(t1.f1) from t1; +select avg(t1.f2), min(f3), count(t1.f1) from t1; +echo select avg(t1.f2),avg(t2.f2) from t1,t2; +select avg(t1.f2),avg(t2.f2) from t1,t2; +echo select avg(t1.f2), min(t2.f2), max(t1.f2), count(t2.f3), sum(t1.f1) from t1,t2; +select avg(t1.f2), min(t2.f2), max(t1.f2), count(t2.f3), sum(t1.f1) from t1,t2; diff --git a/test/sql/Aggregate/aggregate_groupby1.sql b/test/sql/Aggregate/aggregate_groupby1.sql new file mode 100644 index 00000000..f8f9613f --- /dev/null +++ b/test/sql/Aggregate/aggregate_groupby1.sql @@ -0,0 +1,30 @@ +echo select f3, avg(f1) from t1 group by f3; +select f3, avg(f1) from t1 group by f3; +echo select f3, min(f2) from t1 group by f3; +select f3, min(f2) from t1 group by f3; +echo select f3, count(f1) from t1 group by f3; +select f3, count(f1) from t1 group by f3; +echo select f3, sum(f2) from t1 group by f3; +select f3, sum(f2) from t1 group by f3; +echo select f3, max(f1) from t1 group by f3; +select f3, max(f1) from t1 group by f3; +echo select f1, avg(f2) from t1 group by f1; +select f1, avg(f2) from t1 group by f1; +echo select f1, count(f3) from t1 group by f1; +select f1, count(f3) from t1 group by f1; +echo select f1, min(f2) from t1 group by f1; +select f1, min(f2) from t1 group by f1; +echo select f1, sum(f3) from t1 group by f1; +select f1, sum(f3) from t1 group by f1; +echo select f1, max(f1) from t1 group by f1; +select f1, max(f1) from t1 group by f1; +echo select f2, avg(f2) from t1 group by f2; +select f2, avg(f2) from t1 group by f2; +echo select f2, count(f2) from t1 group by f2; +select f2, count(f2) from t1 group by f2; +echo select f2, min(f2) from t1 group by f2; +select f2, min(f2) from t1 group by f2; +echo select f2, sum(f2) from t1 group by f2; +select f2, sum(f2) from t1 group by f2; +echo select f2, max(f2) from t1 group by f2; +select f2, max(f2) from t1 group by f2; diff --git a/test/sql/Aggregate/aggsum3.sql b/test/sql/Aggregate/aggsum3.sql new file mode 100644 index 00000000..6e95da4f --- /dev/null +++ b/test/sql/Aggregate/aggsum3.sql @@ -0,0 +1 @@ +select sum(12*f1) from t1 where f4='BBB'; diff --git a/test/sql/Aggregate/all_agg.sql b/test/sql/Aggregate/all_agg.sql new file mode 100644 index 00000000..359af75a --- /dev/null +++ b/test/sql/Aggregate/all_agg.sql @@ -0,0 +1,5 @@ +select COUNT(*) from T1,T2,T3,T4,T5 where T1.f2=T2.f2 and T1.f3=T3.f3 and T1.f4=T4.f4 and T1.f5=T5.f5; +select SUM(T1.f1) from T1,T2,T3,T4,T5 where T1.f2=T2.f2 and T1.f3=T3.f3 and T1.f4=T4.f4 and T1.f5=T5.f5; +select MIN(T1.f1) from T1,T2,T3,T4,T5 where T1.f2=T2.f2 and T1.f3=T3.f3 and T1.f4=T4.f4 and T1.f5=T5.f5; +select AVG(T1.f1) from T1,T2,T3,T4,T5 where T1.f2=T2.f2 and T1.f3=T3.f3 and T1.f4=T4.f4 and T1.f5=T5.f5; +select MAX(T1.f1) from T1,T2,T3,T4,T5 where T1.f2=T2.f2 and T1.f3=T3.f3 and T1.f4=T4.f4 and T1.f5=T5.f5; diff --git a/test/sql/Aggregate/alldatatype.sql b/test/sql/Aggregate/alldatatype.sql new file mode 100644 index 00000000..c8879674 --- /dev/null +++ b/test/sql/Aggregate/alldatatype.sql @@ -0,0 +1,19 @@ +create table t1(f1 smallint,f2 int,f3 bigint,f4 char(10),f5 float,f6 double,f7 date,f8 time,f9 timestamp); +insert into t1 values(10,100 ,1000, 'Bijay',1000,100000,'2009-03-01','11:59:59','2009-03-01 11:59:59'); +insert into t1 values(11,110 ,1100, 'Jitendr',2000,200000,'2009-03-02','11:59:58','2009-03-02 11:59:59'); +insert into t1 values(12,120 ,1000, 'Nihar',3000,300000,'2009-03-03','11:59:57','2009-03-03 11:59:59'); +insert into t1 values(13,130 ,NULL, 'Kishor',4000,400000,'2009-03-04','11:59:59','2009-03-04 11:59:59'); +insert into t1 values(14,100 ,1000, 'Praba',5000,500000,'2009-03-01','11:59:58','2009-03-01 11:59:59'); +insert into t1 values(15,110 ,1100, 'Sanjit',6000,600000,'2009-03-02','11:59:57','2009-03-02 11:59:59'); +insert into t1 values(16,120 ,1000, 'Sanjay',NULL,700000,'2009-03-03','11:59:59','2009-03-03 11:59:59'); +insert into t1 values(17,130 ,1100, 'Arindam',8000,800000,'2009-03-04','11:59:58','2009-03-04 11:59:59'); +insert into t1 values(10,100 ,1000, 'Bijay',9000,900000,'2009-03-01','11:59:57','2009-03-01 11:59:59'); +insert into t1 values(11,NULL,1100, 'Jitendr',1000,100000,'2009-03-02','11:59:58','2009-03-02 11:59:59'); +insert into t1 values(12,120 ,1000, 'Nihar',2000,200000,'2009-03-03', NULL ,'2009-03-03 11:59:59'); +insert into t1 values(13,130 ,1100, 'Kishor',3000,300000,'2009-03-05','11:59:56','2009-03-05 11:59:59'); +insert into t1 values(14,100 ,1000, 'Praba',4000,400000,'2009-03-01','11:59:55','2009-03-04 11:59:59'); +insert into t1 values(15,110 ,NULL, 'Sanjit',5000,500000,'2009-03-02','11:59:56','2009-03-01 11:59:59'); +insert into t1 values(16,120 ,1000, 'Sanjay',6000,600000,'2009-03-03','11:59:55','2009-03-03 11:59:59'); +insert into t1 values(17,130 ,1100, 'Arindam',7000,700000,'2009-03-01','11:59:59','2009-03-01 11:59:59'); +echo select * from t1; +select * from t1; diff --git a/test/sql/Aggregate/alldatatype_aggregate_count.sql b/test/sql/Aggregate/alldatatype_aggregate_count.sql new file mode 100644 index 00000000..e45b5109 --- /dev/null +++ b/test/sql/Aggregate/alldatatype_aggregate_count.sql @@ -0,0 +1,32 @@ +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 group by f1,f2,f3,f4; +select f1,f2,f3,f4,count(f5),count(f6) from t1 group by f1,f2,f3,f4; +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 group by f2,f1,f4,f3; +select f1,f2,f3,f4,count(f5),count(f6) from t1 group by f2,f1,f4,f3; +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 group by f3,f1,f4,f2; +select f1,f2,f3,f4,count(f5),count(f6) from t1 group by f3,f1,f4,f2; +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 group by f4,f3,f2,f1; +select f1,f2,f3,f4,count(f5),count(f6) from t1 group by f4,f3,f2,f1; +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 group by f1,f2,f3,f4 having count(f5)>=2; +select f1,f2,f3,f4,count(f5),count(f6) from t1 group by f1,f2,f3,f4 having count(f5)>=2; + +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 group by f1,f2,f3,f4; +select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 group by f1,f2,f3,f4; +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 group by f4,f3,f1,f2; +select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 group by f4,f3,f1,f2; +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 group by f4,f1,f2,f3; +select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 group by f4,f1,f2,f3; +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 group by f4,f3,f1,f2; +select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 group by f4,f3,f1,f2; + +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4; +select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4; +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 and f1<15 group by f2,f3,f4,f1; +select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 and f1<15 group by f2,f3,f4,f1; +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f4,f3; +select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f4,f3; +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4 having count(f5)>=0 and count(f5)<2; +select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4 having count(f5)>=0 and count(f5)<2; +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 and f2<=130 group by f1,f2,f3,f4; +select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 and f2<=130 group by f1,f2,f3,f4; +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 and f2<=130 group by f1,f2,f3,f4 having count(f5)>=0 and count(f5)<2; +select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 and f2<=130 group by f1,f2,f3,f4 having count(f5)>=0 and count(f5)<2; diff --git a/test/sql/Aggregate/alldatatype_aggregate_max.sql b/test/sql/Aggregate/alldatatype_aggregate_max.sql new file mode 100644 index 00000000..6cbd3717 --- /dev/null +++ b/test/sql/Aggregate/alldatatype_aggregate_max.sql @@ -0,0 +1,32 @@ +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 group by f1,f2,f3,f4; +select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 group by f1,f2,f3,f4; +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 group by f2,f1,f4,f3; +select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 group by f2,f1,f4,f3; +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 group by f3,f1,f4,f2; +select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 group by f3,f1,f4,f2; +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 group by f4,f3,f2,f1; +select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 group by f4,f3,f2,f1; +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 group by f1,f2,f3,f4 having max(f5)>=5000; +select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 group by f1,f2,f3,f4 having max(f5)>=5000; + +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 group by f1,f2,f3,f4; +select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 group by f1,f2,f3,f4; +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 group by f4,f3,f1,f2; +select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 group by f4,f3,f1,f2; +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 group by f4,f1,f2,f3; +select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 group by f4,f1,f2,f3; +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 group by f4,f3,f1,f2; +select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 group by f4,f3,f1,f2; + +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4; +select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4; +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 and f1<15 group by f2,f3,f4,f1; +select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 and f1<15 group by f2,f3,f4,f1; +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f4,f3; +select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f4,f3; +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4 having max(f5)>=4000 and max(f5)<6000; +select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4 having max(f5)>=4000 and max(f5)<6000; +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 and f2<=130 group by f1,f2,f3,f4; +select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 and f2<=130 group by f1,f2,f3,f4; +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 and f2<=130 group by f1,f2,f3,f4 having max(f5)>=5000 and max(f5)<10000; +select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 and f2<=130 group by f1,f2,f3,f4 having max(f5)>=5000 and max(f5)<10000; diff --git a/test/sql/Aggregate/alldatatype_aggregate_min.sql b/test/sql/Aggregate/alldatatype_aggregate_min.sql new file mode 100644 index 00000000..6b5375a5 --- /dev/null +++ b/test/sql/Aggregate/alldatatype_aggregate_min.sql @@ -0,0 +1,32 @@ +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 group by f1,f2,f3,f4; +select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 group by f1,f2,f3,f4; +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 group by f2,f1,f4,f3; +select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 group by f2,f1,f4,f3; +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 group by f3,f1,f4,f2; +select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 group by f3,f1,f4,f2; +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 group by f4,f3,f2,f1; +select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 group by f4,f3,f2,f1; +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 group by f1,f2,f3,f4 having min(f5)>=5000; +select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 group by f1,f2,f3,f4 having min(f5)>=5000; + +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 group by f1,f2,f3,f4; +select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 group by f1,f2,f3,f4; +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 group by f4,f3,f1,f2; +select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 group by f4,f3,f1,f2; +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 group by f4,f1,f2,f3; +select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 group by f4,f1,f2,f3; +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 group by f4,f3,f1,f2; +select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 group by f4,f3,f1,f2; + +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4; +select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4; +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 and f1<15 group by f2,f3,f4,f1; +select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 and f1<15 group by f2,f3,f4,f1; +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f4,f3; +select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f4,f3; +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4 having min(f5)>=4000 and min(f5)<6000; +select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4 having min(f5)>=4000 and min(f5)<6000; +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 and f2<=130 group by f1,f2,f3,f4; +select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 and f2<=130 group by f1,f2,f3,f4; +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 and f2<=130 group by f1,f2,f3,f4 having min(f5)>=5000 and min(f5)<10000; +select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 and f2<=130 group by f1,f2,f3,f4 having min(f5)>=5000 and min(f5)<10000; diff --git a/test/sql/Aggregate/alldatatype_aggregate_sum.sql b/test/sql/Aggregate/alldatatype_aggregate_sum.sql new file mode 100644 index 00000000..80b16a9c --- /dev/null +++ b/test/sql/Aggregate/alldatatype_aggregate_sum.sql @@ -0,0 +1,32 @@ +echo select f1,f2,f3,f4,count(f5),sum(f5), count(f6),sum(f6) from t1 group by f1,f2,f3,f4; +select f1,f2,f3,f4,count(f5),sum(f5), count(f6),sum(f6) from t1 group by f1,f2,f3,f4; +echo select f2,f1,f4,f3,count(f5),sum(f5), count(f6),sum(f6) from t1 group by f1,f2,f3,f4; +select f2,f1,f4,f3,count(f5),sum(f5), count(f6),sum(f6) from t1 group by f1,f2,f3,f4; +echo select f3,f1,f4,f2,count(f5),sum(f5), count(f6),sum(f6) from t1 group by f1,f2,f3,f4; +select f3,f1,f4,f2,count(f5),sum(f5), count(f6),sum(f6) from t1 group by f1,f2,f3,f4; +echo select f4,f3,f2,f1,count(f5),sum(f5), count(f6),sum(f6) from t1 group by f1,f2,f3,f4; +select f4,f3,f2,f1,count(f5),sum(f5), count(f6),sum(f6) from t1 group by f1,f2,f3,f4; +echo select f1,f2,f3,f4,count(f5),sum(f5), count(f6),sum(f6) from t1 group by f1,f2,f3,f4 having sum(f5)>=5000; +select f1,f2,f3,f4,count(f5),sum(f5), count(f6),sum(f6) from t1 group by f1,f2,f3,f4 having sum(f5)>=5000; + +echo select f1,f2,f3,f4,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 group by f1,f2,f3,f4; +select f1,f2,f3,f4,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 group by f1,f2,f3,f4; +echo select f4,f3,f1,f2,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 group by f1,f2,f3,f4; +select f4,f3,f1,f2,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 group by f1,f2,f3,f4; +echo select f4,f1,f2,f3,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 group by f1,f2,f3,f4; +select f4,f1,f2,f3,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 group by f1,f2,f3,f4; +echo select f4,f3,f1,f2,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 group by f1,f2,f3,f4; +select f4,f3,f1,f2,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 group by f1,f2,f3,f4; + +echo select f1,f2,f3,f4,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4; +select f1,f2,f3,f4,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4; +echo select f2,f3,f4,f1,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4; +select f2,f3,f4,f1,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4; +echo select f1,f2,f3,f4,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4; +select f1,f2,f3,f4,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4; +echo select f1,f2,f3,f4,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4 having sum(f5)>=4000 and sum(f5)<6000; +select f1,f2,f3,f4,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4 having sum(f5)>=4000 and sum(f5)<6000; +echo select f1,f2,f3,f4,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 and f2<=130 group by f1,f2,f3,f4; +select f1,f2,f3,f4,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 and f2<=130 group by f1,f2,f3,f4; +echo select f1,f2,f3,f4,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 and f2<=130 group by f1,f2,f3,f4 having sum(f5)>=5000 and sum(f5)<10000; +select f1,f2,f3,f4,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 and f2<=130 group by f1,f2,f3,f4 having sum(f5)>=5000 and sum(f5)<10000; diff --git a/test/sql/Aggregate/bigtable.sql b/test/sql/Aggregate/bigtable.sql new file mode 100644 index 00000000..648772cf --- /dev/null +++ b/test/sql/Aggregate/bigtable.sql @@ -0,0 +1,9 @@ +CREATE TABLE T1(f1 int,f2 int,f3 int,f4 int,f5 int); +CREATE INDEX idx1 on T1(f2); +CREATE INDEX idx2 on T1(f3); +CREATE INDEX idx3 on T1(f4); +CREATE INDEX idx4 on T1(f5); +CREATE TABLE T2(f1 int,f2 int,primary key(f2)); +CREATE TABLE T3(f1 int,f3 int,primary key(f3)); +CREATE TABLE T4(f1 int,f4 int,primary key(f4)); +CREATE TABLE T5(f1 int,f5 int,primary key(f5)); diff --git a/test/sql/Aggregate/char_datetypes_count.sql b/test/sql/Aggregate/char_datetypes_count.sql new file mode 100644 index 00000000..cbdd71d0 --- /dev/null +++ b/test/sql/Aggregate/char_datetypes_count.sql @@ -0,0 +1,38 @@ +echo select f1,f2,count(f4),count(f7),count(f8),count(f9) from t1 group by f1,f2; +select f1,f2,count(f4),count(f7),count(f8),count(f9) from t1 group by f1,f2; +echo select f1,f2,count(f4),count(f7),count(f8),count(f9) from t1 group by f1,f2 having count(f4)>=2; +select f1,f2,count(f4),count(f7),count(f8),count(f9) from t1 group by f1,f2 having count(f4)>=2; +echo select f1,f2,count(f4),count(f7),count(f8),count(f9) from t1 where f1 >= 12 group by f1,f2; +select f1,f2,count(f4),count(f7),count(f8),count(f9) from t1 where f1 >= 12 group by f1,f2; +echo select f1,f2,count(f4),count(f7),count(f8),count(f9) from t1 where f1 >= 12 group by f1,f2 having count(f8)>=1; +select f1,f2,count(f4),count(f7),count(f8),count(f9) from t1 where f1 >= 12 group by f1,f2 having count(f8)>=1; +echo select f1,f2,count(f4),count(f7),count(f8),count(f9) from t1 where f1 >= 12 and f1<15 group by f1,f2; +select f1,f2,count(f4),count(f7),count(f8),count(f9) from t1 where f1 >= 12 and f1<15 group by f1,f2; +echo select f1,f2,count(f4),count(f7),count(f8),count(f9) from t1 where f1 >= 12 and f1<15 group by f1,f2 having count(f9)>=2; +select f1,f2,count(f4),count(f7),count(f8),count(f9) from t1 where f1 >= 12 and f1<15 group by f1,f2 having count(f9)>=2; +echo select f1,f2,count(f4),count(f7),count(f8),count(f9) from t1 where f1 >= 12 and f1<15 group by f1,f2 having count(f4)>=2 and count(f8) <2; +select f1,f2,count(f4),count(f7),count(f8),count(f9) from t1 where f1 >= 12 and f1<15 group by f1,f2 having count(f4)>=2 and count(f8) <2; +echo select f1,f2,count(f4),count(f7),count(f8),count(f9) from t1 where f1 >= 12 and f2<130 group by f1,f2 ; +select f1,f2,count(f4),count(f7),count(f8),count(f9) from t1 where f1 >= 12 and f2<130 group by f1,f2 ; +echo select f1,f2,count(f4),count(f7),count(f8),count(f9) from t1 where f1 >= 12 and f2<130 group by f1,f2 having count(f7)>=2 and count(f8)<>2; +select f1,f2,count(f4),count(f7),count(f8),count(f9) from t1 where f1 >= 12 and f2<130 group by f1,f2 having count(f7)>=2 and count(f8)<>2; +echo select f7,f8,f9,count(f4) from t1 group by f7,f8,f9; +select f7,f8,f9,count(f4) from t1 group by f7,f8,f9; +echo select f9,f7,f8,count(f4) from t1 group by f7,f8,f9; +select f9,f7,f8,count(f4) from t1 group by f7,f8,f9; +echo select f7,f8,f9,count(f4) from t1 group by f7,f9,f8; +select f7,f8,f9,count(f4) from t1 group by f7,f9,f8; +echo select f7,f8,f9,count(f4) from t1 group by f7,f9,f8 having count(f4)>=1 and count(f4) <2; +select f7,f8,f9,count(f4) from t1 group by f7,f9,f8 having count(f4)>=1 and count(f4) <2; +echo select f4,f8,f9,count(f7) from t1 group by f4,f8,f9; +select f4,f8,f9,count(f7) from t1 group by f4,f8,f9; +echo select f4,f8,f9,count(f7) from t1 group by f4,f8,f9 having count(f7)<=2 and count(f7) >1 ; +select f4,f8,f9,count(f7) from t1 group by f4,f8,f9 having count(f7)<=2 and count(f7) >1 ; +echo select f9,f7,f4,count(f8) from t1 group by f4,f7,f9; +select f9,f7,f4,count(f8) from t1 group by f4,f7,f9; +echo select f9,f7,f4,count(f8) from t1 group by f4,f7,f9 having count(f8)<=2 and count(f8) >=2 ; +select f9,f7,f4,count(f8) from t1 group by f4,f7,f9 having count(f8)<=2 and count(f8) >=2 ; +echo select f7,f8,f4,count(f9) from t1 group by f4,f7,f8; +select f7,f8,f4,count(f9) from t1 group by f4,f7,f8; +echo select f7,f8,f4,count(f9) from t1 group by f4,f7,f8 having count(f9)<=2 and count(f9) >=2 ; +select f7,f8,f4,count(f9) from t1 group by f4,f7,f8 having count(f9)<=2 and count(f9) >=2 ; diff --git a/test/sql/Aggregate/char_datetypes_max.sql b/test/sql/Aggregate/char_datetypes_max.sql new file mode 100644 index 00000000..feef37be --- /dev/null +++ b/test/sql/Aggregate/char_datetypes_max.sql @@ -0,0 +1,38 @@ +echo select f1,f2,max(f4),max(f7),max(f8),max(f9) from t1 group by f1,f2; +select f1,f2,max(f4),max(f7),max(f8),max(f9) from t1 group by f1,f2; +echo select f1,f2,max(f4),max(f7),max(f8),max(f9) from t1 group by f1,f2 having max(f4)>='K'; +select f1,f2,max(f4),max(f7),max(f8),max(f9) from t1 group by f1,f2 having max(f4)>='K'; +echo select f1,f2,max(f4),max(f7),max(f8),max(f9) from t1 where f1 >= 12 group by f1,f2; +select f1,f2,max(f4),max(f7),max(f8),max(f9) from t1 where f1 >= 12 group by f1,f2; +echo select f1,f2,max(f4),max(f7),max(f8),max(f9) from t1 where f1 >= 12 group by f1,f2 having max(f8)>='11:59:55'; +select f1,f2,max(f4),max(f7),max(f8),max(f9) from t1 where f1 >= 12 group by f1,f2 having max(f8)>='11:59:55'; +echo select f1,f2,max(f4),max(f7),max(f8),max(f9) from t1 where f1 >= 12 and f1<15 group by f1,f2; +select f1,f2,max(f4),max(f7),max(f8),max(f9) from t1 where f1 >= 12 and f1<15 group by f1,f2; +echo select f1,f2,max(f4),max(f7),max(f8),max(f9) from t1 where f1 >= 12 and f1<15 group by f1,f2 having max(f9)>='2009-03-03 11:59:59'; +select f1,f2,max(f4),max(f7),max(f8),max(f9) from t1 where f1 >= 12 and f1<15 group by f1,f2 having max(f9)>='2009-03-03 11:59:59'; +echo select f1,f2,max(f4),max(f7),max(f8),max(f9) from t1 where f1 >= 12 and f1<15 group by f1,f2 having max(f4)>='K' and max(f8) <'11:59:58'; +select f1,f2,max(f4),max(f7),max(f8),max(f9) from t1 where f1 >= 12 and f1<15 group by f1,f2 having max(f4)>='K' and max(f8) <'11:59:58'; +echo select f1,f2,max(f4),max(f7),max(f8),max(f9) from t1 where f1 >= 12 and f2<130 group by f1,f2 ; +select f1,f2,max(f4),max(f7),max(f8),max(f9) from t1 where f1 >= 12 and f2<130 group by f1,f2 ; +echo select f1,f2,max(f4),max(f7),max(f8),max(f9) from t1 where f1 >= 12 and f2<130 group by f1,f2 having max(f7)>='2009/3/2' and max(f9)<>'2009-03-01 11:59:59'; +select f1,f2,max(f4),max(f7),max(f8),max(f9) from t1 where f1 >= 12 and f2<130 group by f1,f2 having max(f7)>='2009/3/2' and max(f9)<>'2009-03-01 11:59:59'; +echo select f7,f8,f9,max(f4) from t1 group by f7,f8,f9; +select f7,f8,f9,max(f4) from t1 group by f7,f8,f9; +echo select f9,f7,f8,max(f4) from t1 group by f7,f8,f9; +select f9,f7,f8,max(f4) from t1 group by f7,f8,f9; +echo select f7,f8,f9,max(f4) from t1 group by f7,f9,f8; +select f7,f8,f9,max(f4) from t1 group by f7,f9,f8; +echo select f7,f8,f9,max(f4) from t1 group by f7,f9,f8 having max(f4)>='K' and max(f4) <'Q'; +select f7,f8,f9,max(f4) from t1 group by f7,f9,f8 having max(f4)>='K' and max(f4) <'Q'; +echo select f4,f8,f9,max(f7) from t1 group by f4,f8,f9; +select f4,f8,f9,max(f7) from t1 group by f4,f8,f9; +echo select f4,f8,f9,max(f7) from t1 group by f4,f8,f9 having max(f7)<='2009-03-04' and max(f7) >'2009-03-02' ; +select f4,f8,f9,max(f7) from t1 group by f4,f8,f9 having max(f7)<='2009-03-04' and max(f7) >'2009-03-02' ; +echo select f9,f7,f4,max(f8) from t1 group by f4,f7,f9; +select f9,f7,f4,max(f8) from t1 group by f4,f7,f9; +echo select f9,f7,f4,max(f8) from t1 group by f4,f7,f9 having max(f8)<='11:59:59' and max(f8) >'11:59:57' ; +select f9,f7,f4,max(f8) from t1 group by f4,f7,f9 having max(f8)<='11:59:59' and max(f8) >'11:59:57' ; +echo select f7,f8,f4,max(f9) from t1 group by f4,f7,f8; +select f7,f8,f4,max(f9) from t1 group by f4,f7,f8; +echo select f7,f8,f4,max(f9) from t1 group by f4,f7,f8 having max(f9)<='2009-03-05 11:59:59' and max(f9) >'2009-03-02 11:59:59' ; +select f7,f8,f4,max(f9) from t1 group by f4,f7,f8 having max(f9)<='2009-03-05 11:59:59' and max(f9) >'2009-03-02 11:59:59' ; diff --git a/test/sql/Aggregate/char_datetypes_min.sql b/test/sql/Aggregate/char_datetypes_min.sql new file mode 100644 index 00000000..cf854c31 --- /dev/null +++ b/test/sql/Aggregate/char_datetypes_min.sql @@ -0,0 +1,38 @@ +echo select f1,f2,min(f4),min(f7),min(f8),min(f9) from t1 group by f1,f2; +select f1,f2,min(f4),min(f7),min(f8),min(f9) from t1 group by f1,f2; +echo select f1,f2,min(f4),min(f7),min(f8),min(f9) from t1 group by f1,f2 having min(f4)>='K'; +select f1,f2,min(f4),min(f7),min(f8),min(f9) from t1 group by f1,f2 having min(f4)>='K'; +echo select f1,f2,min(f4),min(f7),min(f8),min(f9) from t1 where f1 >= 12 group by f1,f2; +select f1,f2,min(f4),min(f7),min(f8),min(f9) from t1 where f1 >= 12 group by f1,f2; +echo select f1,f2,min(f4),min(f7),min(f8),min(f9) from t1 where f1 >= 12 group by f1,f2 having min(f8)>='11:59:55'; +select f1,f2,min(f4),min(f7),min(f8),min(f9) from t1 where f1 >= 12 group by f1,f2 having min(f8)>='11:59:55'; +echo select f1,f2,min(f4),min(f7),min(f8),min(f9) from t1 where f1 >= 12 and f1<15 group by f1,f2; +select f1,f2,min(f4),min(f7),min(f8),min(f9) from t1 where f1 >= 12 and f1<15 group by f1,f2; +echo select f1,f2,min(f4),min(f7),min(f8),min(f9) from t1 where f1 >= 12 and f1<15 group by f1,f2 having min(f9)>='2009-03-03 11:59:59'; +select f1,f2,min(f4),min(f7),min(f8),min(f9) from t1 where f1 >= 12 and f1<15 group by f1,f2 having min(f9)>='2009-03-03 11:59:59'; +echo select f1,f2,min(f4),min(f7),min(f8),min(f9) from t1 where f1 >= 12 and f1<15 group by f1,f2 having min(f4)>='K' and min(f8) <'11:59:56'; +select f1,f2,min(f4),min(f7),min(f8),min(f9) from t1 where f1 >= 12 and f1<15 group by f1,f2 having min(f4)>='K' and min(f8) <'11:59:56'; +echo select f1,f2,min(f4),min(f7),min(f8),min(f9) from t1 where f1 >= 12 and f2<130 group by f1,f2 ; +select f1,f2,min(f4),min(f7),min(f8),min(f9) from t1 where f1 >= 12 and f2<130 group by f1,f2 ; +echo select f1,f2,min(f4),min(f7),min(f8),min(f9) from t1 where f1 >= 12 and f2<130 group by f1,f2 having min(f7)>='2009/3/2' and min(f9)<>'2009-03-01 11:59:59'; +select f1,f2,min(f4),min(f7),min(f8),min(f9) from t1 where f1 >= 12 and f2<130 group by f1,f2 having min(f7)>='2009/3/2' and min(f9)<>'2009-03-01 11:59:59'; +echo select f7,f8,f9,min(f4) from t1 group by f7,f8,f9; +select f7,f8,f9,min(f4) from t1 group by f7,f8,f9; +echo select f9,f7,f8,min(f4) from t1 group by f7,f8,f9; +select f9,f7,f8,min(f4) from t1 group by f7,f8,f9; +echo select f7,f8,f9,min(f4) from t1 group by f7,f9,f8; +select f7,f8,f9,min(f4) from t1 group by f7,f9,f8; +echo select f7,f8,f9,min(f4) from t1 group by f7,f9,f8 having min(f4)>='K' and min(f4) <'Q'; +select f7,f8,f9,min(f4) from t1 group by f7,f9,f8 having min(f4)>='K' and min(f4) <'Q'; +echo select f4,f8,f9,min(f7) from t1 group by f4,f8,f9; +select f4,f8,f9,min(f7) from t1 group by f4,f8,f9; +echo select f4,f8,f9,min(f7) from t1 group by f4,f8,f9 having min(f7)<='2009-03-04' and min(f7) >'2009-03-02' ; +select f4,f8,f9,min(f7) from t1 group by f4,f8,f9 having min(f7)<='2009-03-04' and min(f7) >'2009-03-02' ; +echo select f9,f7,f4,min(f8) from t1 group by f4,f7,f9; +select f9,f7,f4,min(f8) from t1 group by f4,f7,f9; +echo select f9,f7,f4,min(f8) from t1 group by f4,f7,f9 having min(f8)<='11:59:59' and min(f8) >'11:59:57' ; +select f9,f7,f4,min(f8) from t1 group by f4,f7,f9 having min(f8)<='11:59:59' and min(f8) >'11:59:57' ; +echo select f7,f8,f4,min(f9) from t1 group by f4,f7,f8; +select f7,f8,f4,min(f9) from t1 group by f4,f7,f8; +echo select f7,f8,f4,min(f9) from t1 group by f4,f7,f8 having min(f9)<='2009-03-05 11:59:59' and min(f9) >'2009-03-02 11:59:59' ; +select f7,f8,f4,min(f9) from t1 group by f4,f7,f8 having min(f9)<='2009-03-05 11:59:59' and min(f9) >'2009-03-02 11:59:59' ; diff --git a/test/sql/Aggregate/createt1.sql b/test/sql/Aggregate/createt1.sql new file mode 100644 index 00000000..b82e392a --- /dev/null +++ b/test/sql/Aggregate/createt1.sql @@ -0,0 +1,6 @@ +create table t1(f1 int,f2 int,f3 int,f4 char(10),primary key(f1)); +insert into t1 values(98,1,10,'AAA'); +insert into t1 values(99,2,20,'BBB'); +insert into t1 values(100,3,30,'CCC'); +insert into t1 values(101,4,40,'AAA'); +insert into t1 values(102,5,50,'BBB'); diff --git a/test/sql/Aggregate/createt1t2.sql b/test/sql/Aggregate/createt1t2.sql new file mode 100644 index 00000000..f983f8dc --- /dev/null +++ b/test/sql/Aggregate/createt1t2.sql @@ -0,0 +1,13 @@ +create table t1(f1 int,f2 int,f3 int,primary key(f1)); +insert into t1 values(98,1,10); +insert into t1 values(99,2,20); +insert into t1 values(100,3,30); +insert into t1 values(101,4,40); +insert into t1 values(102,5,50); +create table t2(f1 int,f2 int,f3 int,primary key(f1)); +insert into t2 values(98,1,10); +insert into t2 values(99,2,20); +insert into t2 values(100,3,30); +insert into t2 values(101,4,40); +insert into t2 values(102,5,50); + diff --git a/test/sql/Aggregate/dropemp.sql b/test/sql/Aggregate/dropemp.sql new file mode 100644 index 00000000..7a9fd3e6 --- /dev/null +++ b/test/sql/Aggregate/dropemp.sql @@ -0,0 +1 @@ +drop table emp; diff --git a/test/sql/Aggregate/dropt1.sql b/test/sql/Aggregate/dropt1.sql new file mode 100644 index 00000000..2d707d46 --- /dev/null +++ b/test/sql/Aggregate/dropt1.sql @@ -0,0 +1,2 @@ +drop table t1; + diff --git a/test/sql/Aggregate/dropt1t2.sql b/test/sql/Aggregate/dropt1t2.sql new file mode 100644 index 00000000..9c354ab0 --- /dev/null +++ b/test/sql/Aggregate/dropt1t2.sql @@ -0,0 +1,2 @@ +drop table t1; +drop table t2; diff --git a/test/sql/Aggregate/exp.test001.ksh b/test/sql/Aggregate/exp.test001.ksh new file mode 100644 index 00000000..58ddc592 --- /dev/null +++ b/test/sql/Aggregate/exp.test001.ksh @@ -0,0 +1,32 @@ +echo select count(f1) from t2; +Statement prepare failed with error -5 +echo select count(f1) from t1; +--------------------------------------------------------- + COUNT(f1) +--------------------------------------------------------- + 5 + +echo select sum(f1) from t1; +--------------------------------------------------------- + SUM(f1) +--------------------------------------------------------- + 500 + +echo select avg(f1) from t1; +--------------------------------------------------------- + AVG(f1) +--------------------------------------------------------- + 100.000000 + +echo select min(f1) from t1; +--------------------------------------------------------- + MIN(f1) +--------------------------------------------------------- + 98 + +echo select max(f1) from t1; +--------------------------------------------------------- + MAX(f1) +--------------------------------------------------------- + 102 + diff --git a/test/sql/Aggregate/exp.test002.ksh b/test/sql/Aggregate/exp.test002.ksh new file mode 100644 index 00000000..76e33dac --- /dev/null +++ b/test/sql/Aggregate/exp.test002.ksh @@ -0,0 +1,48 @@ +echo select count(f1) from t1; +--------------------------------------------------------- + COUNT(t1.f1) +--------------------------------------------------------- + 5 + +echo select count(*) from t1 where f4='AAA'; +--------------------------------------------------------- + COUNT(*) +--------------------------------------------------------- + 2 + +echo select sum(f1) from t1; +--------------------------------------------------------- + SUM(t1.f1) +--------------------------------------------------------- + 500 + +echo select avg(f1) from t1; +--------------------------------------------------------- + AVG(t1.f1) +--------------------------------------------------------- + 100.000000 + +echo select min(t1.f1) from t1; +--------------------------------------------------------- + MIN(t1.f1) +--------------------------------------------------------- + 98 + +echo select min(f4) from t1; +--------------------------------------------------------- + MIN(f4) +--------------------------------------------------------- + AAA + +echo select max(t1.f1) from t1; +--------------------------------------------------------- + MAX(t1.f1) +--------------------------------------------------------- + 102 + +echo select max(f4) from t1; +--------------------------------------------------------- + MAX(f4) +--------------------------------------------------------- + CCC + diff --git a/test/sql/Aggregate/exp.test003.ksh b/test/sql/Aggregate/exp.test003.ksh new file mode 100644 index 00000000..480ee0ff --- /dev/null +++ b/test/sql/Aggregate/exp.test003.ksh @@ -0,0 +1,6 @@ +select count(*) from t1 : +--------------------------------------------------------- + +--------------------------------------------------------- + 5 + diff --git a/test/sql/Aggregate/exp.test004.ksh b/test/sql/Aggregate/exp.test004.ksh new file mode 100644 index 00000000..ed7e24f6 --- /dev/null +++ b/test/sql/Aggregate/exp.test004.ksh @@ -0,0 +1,17 @@ +echo select min(t1.notexist) from t1; +Statement prepare failed with error -19 +echo select max(t1.f1), sum(t2.f1) from t1,t2 where t1.f1 = t2.f1 and t1.f1 <100; +--------------------------------------------------------- + MAX(t1.f1) SUM(t2.f1) +--------------------------------------------------------- + 99 197 + +echo select max(t1.f1), sum(t2.f1) from t1,t2 where t1.f1 = t2.f1 and t1.f1 <100 group by t1.f2; +--------------------------------------------------------- + MAX(t1.f1) SUM(t2.f1) +--------------------------------------------------------- + 98 98 + 99 99 + +echo select max(t1.f1), max(t2.notexist) from t1,t2 group by t1.f2; +Statement prepare failed with error -19 diff --git a/test/sql/Aggregate/exp.test005.ksh b/test/sql/Aggregate/exp.test005.ksh new file mode 100644 index 00000000..f421cf53 --- /dev/null +++ b/test/sql/Aggregate/exp.test005.ksh @@ -0,0 +1,54 @@ +echo select t1.f2, t1.f1, t2.f1 from t1,t2; +--------------------------------------------------------- + t1.f2 t1.f1 t2.f1 +--------------------------------------------------------- + 1 98 98 + 1 98 99 + 1 98 100 + 1 98 101 + 1 98 102 + 2 99 98 + 2 99 99 + 2 99 100 + 2 99 101 + 2 99 102 + 3 100 98 + 3 100 99 + 3 100 100 + 3 100 101 + 3 100 102 + 4 101 98 + 4 101 99 + 4 101 100 + 4 101 101 + 4 101 102 + 5 102 98 + 5 102 99 + 5 102 100 + 5 102 101 + 5 102 102 + +echo select t1.f2, t1.f1, t2.f1 from t1,t2 group by t1.f2; +Statement prepare failed with error -19 +echo select t1.f2, max(t1.f1), sum(t2.f1) from t1, t2 group by t1.f2; +--------------------------------------------------------- + t1.f2 MAX(t1.f1) SUM(t2.f1) +--------------------------------------------------------- + 1 98 500 + 2 99 500 + 3 100 500 + 4 101 500 + 5 102 500 + +echo select f1, f2 from t1 group by f1,f2; +--------------------------------------------------------- + f1 f2 +--------------------------------------------------------- + 98 1 + 99 2 + 100 3 + 101 4 + 102 5 + +echo select f1, sum(f2) from t1 group by f3; +Statement prepare failed with error -19 diff --git a/test/sql/Aggregate/exp.test006.ksh b/test/sql/Aggregate/exp.test006.ksh new file mode 100644 index 00000000..fdc4c1a1 --- /dev/null +++ b/test/sql/Aggregate/exp.test006.ksh @@ -0,0 +1,36 @@ +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 +--------------------------------------------------------- + 98 1 10 + 99 2 20 + 100 3 30 + 101 4 40 + 102 5 50 + +echo select min(t1.f2) from t1 group by t1.f1; +--------------------------------------------------------- + MIN(t1.f2) +--------------------------------------------------------- + 1 + 2 + 3 + 4 + 5 + +echo select avg(t1.f2) from t1 group by t1.f1; +--------------------------------------------------------- + AVG(t1.f2) +--------------------------------------------------------- + 1.000000 + 2.000000 + 3.000000 + 4.000000 + 5.000000 + +echo select sum(t1.f2) from t1 group by notexist; +Statement prepare failed with error -19 +echo select sum(t1.f2) from t1 group by t1.notexist; +Statement prepare failed with error -19 +echo select sum(t1.f2) from t1 group by notexist.f1; +Statement prepare failed with error -19 diff --git a/test/sql/Aggregate/exp.test007.ksh b/test/sql/Aggregate/exp.test007.ksh new file mode 100644 index 00000000..72b6c117 --- /dev/null +++ b/test/sql/Aggregate/exp.test007.ksh @@ -0,0 +1,6 @@ +select count(*),min(f1),sum(f1) from t1 : +--------------------------------------------------------- + COUNT(*) MIN(f1) SUM(f1) +--------------------------------------------------------- + 5 98 500 + diff --git a/test/sql/Aggregate/exp.test008.ksh b/test/sql/Aggregate/exp.test008.ksh new file mode 100644 index 00000000..6d2f5da5 --- /dev/null +++ b/test/sql/Aggregate/exp.test008.ksh @@ -0,0 +1,2 @@ +select min(nonexist.f1) from t1 : +Statement prepare failed with error -19 diff --git a/test/sql/Aggregate/exp.test009.ksh b/test/sql/Aggregate/exp.test009.ksh new file mode 100644 index 00000000..26b68a3b --- /dev/null +++ b/test/sql/Aggregate/exp.test009.ksh @@ -0,0 +1,2 @@ +select sum(12*f1) where f4='BBB': +Statement prepare failed with error -19 diff --git a/test/sql/Aggregate/exp.test010.ksh b/test/sql/Aggregate/exp.test010.ksh new file mode 100644 index 00000000..6f962797 --- /dev/null +++ b/test/sql/Aggregate/exp.test010.ksh @@ -0,0 +1,116 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 +--------------------------------------------------------- + 98 1 10 + 99 NULL 20 + 100 3 30 + 101 4 NULL + 102 5 50 + +--------------------------------------------------------- + t2.f1 t2.f2 t2.f3 +--------------------------------------------------------- + 98 1 10 + 99 2 20 + 100 NULL NULL + 101 4 40 + 102 NULL 50 + +echo select count(f1) from t1; +--------------------------------------------------------- + COUNT(f1) +--------------------------------------------------------- + 5 + +echo select count(f2) from t1; +--------------------------------------------------------- + COUNT(f2) +--------------------------------------------------------- + 4 + +echo select sum(f1) from t1; +--------------------------------------------------------- + SUM(f1) +--------------------------------------------------------- + 500 + +echo select sum(f3) from t1; +--------------------------------------------------------- + SUM(f3) +--------------------------------------------------------- + 110 + +echo select avg(f1) from t1; +--------------------------------------------------------- + AVG(f1) +--------------------------------------------------------- + 100.000000 + +echo select avg(f2) from t1; +--------------------------------------------------------- + AVG(f2) +--------------------------------------------------------- + 3.250000 + +echo select min(f2) from t1; +--------------------------------------------------------- + MIN(f2) +--------------------------------------------------------- + 1 + +echo select max(f3) from t1; +--------------------------------------------------------- + MAX(f3) +--------------------------------------------------------- + 50 + +echo select avg(t1.f2) from t1; +--------------------------------------------------------- + AVG(t1.f2) +--------------------------------------------------------- + 3.250000 + +echo select count(t1.f3) from t1; +--------------------------------------------------------- + COUNT(t1.f3) +--------------------------------------------------------- + 4 + +echo select min(t1.f3) from t1; +--------------------------------------------------------- + MIN(t1.f3) +--------------------------------------------------------- + 10 + +echo select avg(t1.f2), min(f3), count(t1.f1) from t1; +--------------------------------------------------------- + AVG(t1.f2) MIN(f3) COUNT(t1.f1) +--------------------------------------------------------- + 3.250000 10 5 + +echo select avg(t1.f2),avg(t2.f2) from t1,t2; +--------------------------------------------------------- + AVG(t1.f2) AVG(t2.f2) +--------------------------------------------------------- + 3.250000 2.333333 + +echo select avg(t1.f2), min(t2.f2), max(t1.f2), count(t2.f3), sum(t1.f1) from t1,t2; +--------------------------------------------------------- + AVG(t1.f2) MIN(t2.f2) MAX(t1.f2) COUNT(t2.f3) SUM(t1.f1) +--------------------------------------------------------- + 3.250000 1 5 20 2500 + +Statement Executed +Statement Executed diff --git a/test/sql/Aggregate/exp.test011.ksh b/test/sql/Aggregate/exp.test011.ksh new file mode 100644 index 00000000..9533c6e9 --- /dev/null +++ b/test/sql/Aggregate/exp.test011.ksh @@ -0,0 +1,189 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 +--------------------------------------------------------- + 1 10 100 + 2 20 200 + 3 30 300 + NULL 20 500 + 12 20 500 + 1 NULL 400 + 1 11 500 + 13 30 200 + 14 31 300 + +echo select f3, avg(f1) from t1 group by f3; +--------------------------------------------------------- + f3 AVG(f1) +--------------------------------------------------------- + 100 1.000000 + 200 7.500000 + 300 8.500000 + 500 6.500000 + 400 1.000000 + +echo select f3, min(f2) from t1 group by f3; +--------------------------------------------------------- + f3 MIN(f2) +--------------------------------------------------------- + 100 10 + 200 20 + 300 30 + 500 11 + 400 NULL + +echo select f3, count(f1) from t1 group by f3; +--------------------------------------------------------- + f3 COUNT(f1) +--------------------------------------------------------- + 100 1 + 200 2 + 300 2 + 500 2 + 400 1 + +echo select f3, sum(f2) from t1 group by f3; +--------------------------------------------------------- + f3 SUM(f2) +--------------------------------------------------------- + 100 10 + 200 50 + 300 61 + 500 51 + 400 NULL + +echo select f3, max(f1) from t1 group by f3; +--------------------------------------------------------- + f3 MAX(f1) +--------------------------------------------------------- + 100 1 + 200 13 + 300 14 + 500 12 + 400 1 + +echo select f1, avg(f2) from t1 group by f1; +--------------------------------------------------------- + f1 AVG(f2) +--------------------------------------------------------- + 1 10.500000 + 2 20.000000 + 3 30.000000 + NULL 20.000000 + 12 20.000000 + 13 30.000000 + 14 31.000000 + +echo select f1, count(f3) from t1 group by f1; +--------------------------------------------------------- + f1 COUNT(f3) +--------------------------------------------------------- + 1 3 + 2 1 + 3 1 + NULL 1 + 12 1 + 13 1 + 14 1 + +echo select f1, min(f2) from t1 group by f1; +--------------------------------------------------------- + f1 MIN(f2) +--------------------------------------------------------- + 1 10 + 2 20 + 3 30 + NULL 20 + 12 20 + 13 30 + 14 31 + +echo select f1, sum(f3) from t1 group by f1; +--------------------------------------------------------- + f1 SUM(f3) +--------------------------------------------------------- + 1 1000 + 2 200 + 3 300 + NULL 500 + 12 500 + 13 200 + 14 300 + +echo select f1, max(f1) from t1 group by f1; +--------------------------------------------------------- + f1 MAX(f1) +--------------------------------------------------------- + 1 1 + 2 2 + 3 3 + NULL NULL + 12 12 + 13 13 + 14 14 + +echo select f2, avg(f2) from t1 group by f2; +--------------------------------------------------------- + f2 AVG(f2) +--------------------------------------------------------- + 10 10.000000 + 20 20.000000 + 30 30.000000 + NULL NULL + 11 11.000000 + 31 31.000000 + +echo select f2, count(f2) from t1 group by f2; +--------------------------------------------------------- + f2 COUNT(f2) +--------------------------------------------------------- + 10 1 + 20 3 + 30 2 + NULL 0 + 11 1 + 31 1 + +echo select f2, min(f2) from t1 group by f2; +--------------------------------------------------------- + f2 MIN(f2) +--------------------------------------------------------- + 10 10 + 20 20 + 30 30 + NULL NULL + 11 11 + 31 31 + +echo select f2, sum(f2) from t1 group by f2; +--------------------------------------------------------- + f2 SUM(f2) +--------------------------------------------------------- + 10 10 + 20 60 + 30 60 + NULL NULL + 11 11 + 31 31 + +echo select f2, max(f2) from t1 group by f2; +--------------------------------------------------------- + f2 MAX(f2) +--------------------------------------------------------- + 10 10 + 20 20 + 30 30 + NULL NULL + 11 11 + 31 31 + +Statement Executed diff --git a/test/sql/Aggregate/exp.test012.ksh b/test/sql/Aggregate/exp.test012.ksh new file mode 100644 index 00000000..edb716b7 --- /dev/null +++ b/test/sql/Aggregate/exp.test012.ksh @@ -0,0 +1,81 @@ +echo CREATE TABLE t1(f1 int,f2 int,f3 char(15)); +Statement Executed +echo INSERT INTO t1 VALUES(1,70,'Nihar Pital'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(2,70,'Bijay Sahoo'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(3,60,'Kisor Ambli'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(2,90,'Jiten Lenka'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(3,80,'Papu Paital'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(1,80,'Bijay Sahoo'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(2,70,'Jiten Lenka'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(1,70,'Bijay Sahoo'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(2,70,'Bijay Sahoo'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(3,60,'Papu Paital'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(1,70,'Nihar Pital'); +Statement Executed: Rows Affected = 1 +echo SELECT * FROM t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 +--------------------------------------------------------- + 1 70 Nihar Pital + 2 70 Bijay Sahoo + 3 60 Kisor Ambli + 2 91 Jiten Lenka + 3 81 Papu Paital + 1 80 Bijay Sahoo + 2 70 Jiten Lenka + 1 72 Bijay Sahoo + 2 70 Bijay Sahoo + 3 60 Papu Paital + 1 71 Nihar Pital + +echo SELECT f1,sum(f2),count(f2),avg(f2),min(f2),max(f2),count(f3) from t1 GROUP BY f1; +--------------------------------------------------------- + f1 SUM(f2) COUNT(f2) AVG(f2) MIN(f2) MAX(f2) COUNT(f3) +--------------------------------------------------------- + 1 293 4 73.250000 70 80 4 + 2 301 4 75.250000 70 91 4 + 3 201 3 67.000000 60 81 3 + +echo SELECT f3,count(f1),sum(f2),count(f2),avg(f2),min(f2),max(f2) from t1 GROUP BY f3; +--------------------------------------------------------- + f3 COUNT(f1) SUM(f2) COUNT(f2) AVG(f2) MIN(f2) MAX(f2) +--------------------------------------------------------- + Nihar Pital 2 141 2 70.500000 70 71 + Bijay Sahoo 4 292 4 73.000000 70 80 + Kisor Ambli 1 60 1 60.000000 60 60 + Jiten Lenka 2 161 2 80.500000 70 91 + Papu Paital 2 141 2 70.500000 60 81 + +echo SELECT f1,sum(f2),count(f2),avg(f2),min(f2),max(f2) from t1 GROUP BY f1,f3; +--------------------------------------------------------- + f1 SUM(f2) COUNT(f2) AVG(f2) MIN(f2) MAX(f2) +--------------------------------------------------------- + 1 141 2 70.500000 70 71 + 2 140 2 70.000000 70 70 + 3 60 1 60.000000 60 60 + 2 161 2 80.500000 70 91 + 3 141 2 70.500000 60 81 + 1 152 2 76.000000 72 80 + +echo SELECT f1,f3,sum(f2),count(f2),avg(f2),min(f2),max(f2) from t1 GROUP BY f1,f3; +--------------------------------------------------------- + f1 f3 SUM(f2) COUNT(f2) AVG(f2) MIN(f2) MAX(f2) +--------------------------------------------------------- + 1 Nihar Pital 141 2 70.500000 70 71 + 2 Bijay Sahoo 140 2 70.000000 70 70 + 3 Kisor Ambli 60 1 60.000000 60 60 + 2 Jiten Lenka 161 2 80.500000 70 91 + 3 Papu Paital 141 2 70.500000 60 81 + 1 Bijay Sahoo 152 2 76.000000 72 80 + +Statement Executed diff --git a/test/sql/Aggregate/exp.test013.ksh b/test/sql/Aggregate/exp.test013.ksh new file mode 100644 index 00000000..24108844 --- /dev/null +++ b/test/sql/Aggregate/exp.test013.ksh @@ -0,0 +1,72 @@ +echo CREATE TABLE t1(f1 int,f2 int,f3 char(15)); +Statement Executed +echo INSERT INTO t1 VALUES(1,70,'Nihar Pital'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(2,70,'Bijay Sahoo'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(3,60,'Kisor Ambli'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(2,90,'Jiten Lenka'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(3,80,'Papu Paital'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(1,80,'Bijay Sahoo'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(2,70,'Jiten Lenka'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(1,70,'Bijay Sahoo'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(2,70,'Bijay Sahoo'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(3,60,'Papu Paital'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(1,70,'Nihar Pital'); +Statement Executed: Rows Affected = 1 +echo SELECT * FROM t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 +--------------------------------------------------------- + 1 70 Nihar Pital + 2 70 Bijay Sahoo + 3 60 Kisor Ambli + 2 91 Jiten Lenka + 3 81 Papu Paital + 1 80 Bijay Sahoo + 2 70 Jiten Lenka + 1 72 Bijay Sahoo + 2 70 Bijay Sahoo + 3 60 Papu Paital + 1 71 Nihar Pital + +echo SELECT f1,sum(f2),count(f2),avg(f2),min(f2),max(f2),count(f3) from t1 GROUP BY f1 having sum(f2) >300 ; +--------------------------------------------------------- + f1 SUM(f2) COUNT(f2) AVG(f2) MIN(f2) MAX(f2) COUNT(f3) +--------------------------------------------------------- + 2 301 4 75.250000 70 91 4 + +echo SELECT f3,count(f1),sum(f2),count(f2),avg(f2),min(f2),max(f2) from t1 GROUP BY f3 having avg(f2) <75; +--------------------------------------------------------- + f3 COUNT(f1) SUM(f2) COUNT(f2) AVG(f2) MIN(f2) MAX(f2) +--------------------------------------------------------- + Nihar Pital 2 141 2 70.500000 70 71 + Bijay Sahoo 4 292 4 73.000000 70 80 + Kisor Ambli 1 60 1 60.000000 60 60 + Papu Paital 2 141 2 70.500000 60 81 + +echo SELECT f1,sum(f2),count(f2),avg(f2),min(f2),max(f2) from t1 GROUP BY f1; +--------------------------------------------------------- + f1 SUM(f2) COUNT(f2) AVG(f2) MIN(f2) MAX(f2) +--------------------------------------------------------- + 1 293 4 73.250000 70 80 + 2 301 4 75.250000 70 91 + 3 201 3 67.000000 60 81 + +echo SELECT f1,sum(f2),count(f2),avg(f2),min(f2),max(f2) from t1 GROUP BY f1 having avg(f2) <70 or min(f2)=70; +--------------------------------------------------------- + f1 SUM(f2) COUNT(f2) AVG(f2) MIN(f2) MAX(f2) +--------------------------------------------------------- + 1 293 4 73.250000 70 80 + 2 301 4 75.250000 70 91 + 3 201 3 67.000000 60 81 + +Statement Executed diff --git a/test/sql/Aggregate/exp.test014.ksh b/test/sql/Aggregate/exp.test014.ksh new file mode 100644 index 00000000..395f3efa --- /dev/null +++ b/test/sql/Aggregate/exp.test014.ksh @@ -0,0 +1,110 @@ +echo create table t1(f1 char(10),f2 char(10),f3 int); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 +--------------------------------------------------------- + s y 5000 + p q 4000 + z y 2000 + p y 3000 + c q 1000 + z y 1500 + s y 3000 + c t 2500 + s p 2300 + c q 4000 + c y 5000 + c p 3500 + +echo select f2,avg(f3) from t1 group by f2; +--------------------------------------------------------- + f2 AVG(f3) +--------------------------------------------------------- + y 3250.000000 + q 3000.000000 + t 2500.000000 + p 2900.000000 + +echo select f2,avg(f3) from t1 where f3>=3000 group by f2 ; +--------------------------------------------------------- + f2 AVG(f3) +--------------------------------------------------------- + y 4000.000000 + q 4000.000000 + p 3500.000000 + +echo select f2,avg(f3) from t1 where f3>=2000 group by f2 having avg(f3)>3000; +--------------------------------------------------------- + f2 AVG(f3) +--------------------------------------------------------- + y 3600.000000 + q 4000.000000 + +echo select f2,avg(f3) from t1 where f3>=2000 group by f2 having avg(f3)>3000 limit 1; +--------------------------------------------------------- + f2 AVG(f3) +--------------------------------------------------------- + y 3600.000000 + +echo select f2,avg(f3) from t1 where f3>=2000 or f2 = 'y' group by f2 having avg(f3)>3000; +--------------------------------------------------------- + f2 AVG(f3) +--------------------------------------------------------- + y 3250.000000 + q 4000.000000 + +echo select f1,f2,avg(f3) from t1 where f3>=2000 or f2 = 'y' group by f1,f2 having avg(f3)>3000 ; +--------------------------------------------------------- + f1 f2 AVG(f3) +--------------------------------------------------------- + s y 4000.000000 + p q 4000.000000 + c q 4000.000000 + c y 5000.000000 + c p 3500.000000 + +echo select f2,f1,avg(f3) from t1 where f3>=2000 or f2 = 'y' group by f1,f2 having avg(f3)>3000; +--------------------------------------------------------- + f2 f1 AVG(f3) +--------------------------------------------------------- + y s 4000.000000 + q p 4000.000000 + q c 4000.000000 + y c 5000.000000 + p c 3500.000000 + +echo select f2,f1,avg(f3) from t1 where f3>=2000 or f2 = 'y' group by f1,f2 having avg(f3)>2000 ; +--------------------------------------------------------- + f2 f1 AVG(f3) +--------------------------------------------------------- + y s 4000.000000 + q p 4000.000000 + y p 3000.000000 + t c 2500.000000 + p s 2300.000000 + q c 4000.000000 + y c 5000.000000 + p c 3500.000000 + +echo select f2,f1,avg(f3) from t1 where f3>=2000 or f2 = 'y' group by f1,f2 having avg(f3)>2000 limit 3 offset 2; +--------------------------------------------------------- + f2 f1 AVG(f3) +--------------------------------------------------------- + y p 3000.000000 + t c 2500.000000 + p s 2300.000000 + +Statement Executed diff --git a/test/sql/Aggregate/exp.test015.ksh b/test/sql/Aggregate/exp.test015.ksh new file mode 100644 index 00000000..1bf8b4e0 --- /dev/null +++ b/test/sql/Aggregate/exp.test015.ksh @@ -0,0 +1,39 @@ +Statement Executed +Statement Executed +Statement Executed +Statement Executed +Statement Executed +Statement Executed +Statement Executed +Statement Executed +Statement Executed +--------------------------------------------------------- + COUNT(*) +--------------------------------------------------------- + 1000 + +--------------------------------------------------------- + SUM(T1.f1) +--------------------------------------------------------- + 500500 + +--------------------------------------------------------- + MIN(T1.f1) +--------------------------------------------------------- + 1 + +--------------------------------------------------------- + AVG(T1.f1) +--------------------------------------------------------- + 500.500000 + +--------------------------------------------------------- + MAX(T1.f1) +--------------------------------------------------------- + 1000 + +Statement Executed +Statement Executed +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Aggregate/exp.test016.ksh b/test/sql/Aggregate/exp.test016.ksh new file mode 100644 index 00000000..feff7f70 --- /dev/null +++ b/test/sql/Aggregate/exp.test016.ksh @@ -0,0 +1,66 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 +--------------------------------------------------------- + 98 1 10 + 99 NULL 20 + 100 3 30 + 101 4 NULL + 102 5 50 + +--------------------------------------------------------- + t2.f1 t2.f2 t2.f3 +--------------------------------------------------------- + 98 1 10 + 99 2 20 + 100 NULL NULL + 101 4 40 + 102 NULL 50 + +echo select * from t1,t2; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t2.f1 t2.f2 t2.f3 +--------------------------------------------------------- + 98 1 10 98 1 10 + 98 1 10 99 2 20 + 98 1 10 100 NULL NULL + 98 1 10 101 4 40 + 98 1 10 102 NULL 50 + 99 NULL 20 98 1 10 + 99 NULL 20 99 2 20 + 99 NULL 20 100 NULL NULL + 99 NULL 20 101 4 40 + 99 NULL 20 102 NULL 50 + 100 3 30 98 1 10 + 100 3 30 99 2 20 + 100 3 30 100 NULL NULL + 100 3 30 101 4 40 + 100 3 30 102 NULL 50 + 101 4 NULL 98 1 10 + 101 4 NULL 99 2 20 + 101 4 NULL 100 NULL NULL + 101 4 NULL 101 4 40 + 101 4 NULL 102 NULL 50 + 102 5 50 98 1 10 + 102 5 50 99 2 20 + 102 5 50 100 NULL NULL + 102 5 50 101 4 40 + 102 5 50 102 NULL 50 + +echo select f2 from t1,t2; +Statement prepare failed with error -19 +echo select avg(f2) from t1,t2; +Statement prepare failed with error -19 +Statement Executed +Statement Executed diff --git a/test/sql/Aggregate/exp.test025.ksh b/test/sql/Aggregate/exp.test025.ksh new file mode 100644 index 00000000..fe6f38ae --- /dev/null +++ b/test/sql/Aggregate/exp.test025.ksh @@ -0,0 +1,250 @@ +echo Create table client_master(clientno char(6), name char(20) NOT NULL, address1 char(30), address2 char(30), city char(15), pincode int, state char(15), baldue float,PRIMARY KEY(clientno)); +Statement Executed +echo Create table product_master(productno char(6), description char(15) NOT NULL,profitpercent float NOT NULL,unitmeasure char(10) NOT NULL,qtyonhand int NOT NULL,reorderlvl int NOT NULL,selprice float NOT NULL,costprice float NOT NULL, PRIMARY KEY(productno)); +Statement Executed +echo Create table salesman_master(salesmanno char(6),salesmanname char(20) NOT NULL,address1 char(30) NOT NULL,address2 char(30),city char(20),pincode char(8),state char(20),salamt float NOT NULL,tgttoget float NOT NULL,ytdsales float NOT NULL,remarks char(30),PRIMARY KEY(salesmanno)); +Statement Executed +echo Create table sales_order(orderno char(6),orderdate date,clientno char(6),delyaddr char(25),delytype char(1),billedyn char(1),salesmanno char(6),delydate date,orderstatus char(10),PRIMARY KEY(orderno),FOREIGN KEY(clientno) REFERENCES client_master(clientno),FOREIGN KEY(salesmanno) REFERENCES salesman_master(salesmanno)); +Statement Executed +echo Create table sales_order_details(orderno char(6),productno char(6),qtyordered int,qtydisp int,productrate float,FOREIGN KEY(orderno) REFERENCES sales_order(orderno),FOREIGN KEY(productno) REFERENCES product_master(productno)); +Statement Executed +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00001','Ivan Bayross','Mumbai',400054,'Maharastra',15000); +Statement Executed: Rows Affected = 1 +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00002','mamta Muzumdar','Madras',780001,'Tamil Nadu',0); +Statement Executed: Rows Affected = 1 +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00003','Chhaya Bankar','Mumbai',400057,'Maharastra',5000); +Statement Executed: Rows Affected = 1 +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00004','Ashwini Joshi','Bangalore',560001,'MKarnataka',0); +Statement Executed: Rows Affected = 1 +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00005','Hansel Colaco','Mumbai',400060,'Maharastra',2000); +Statement Executed: Rows Affected = 1 +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00006','Deepak Sharma','Mangalore',560050,'Karnatakaa',0); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P00001','T-Shirts',5,'Piece',200,50,350,250); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P03453','Shirts',6,'Piece',150,50,500,350); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P06734','Cotton Jeans',5,'Piece',100,20,60,450); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P07865','Jeans',5,'Piece',100,20,750,500); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P07868','Trousers',2,'Piece',150,50,850,550); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P07885','Pull Overs',2.5,'Piece',80,30,700,450); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P07965','Denim Shirts',4,'Piece',100,40,350,250); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P07975','Lycra Tops',5,'Piece',70,30,300,175); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P08865','Skirts',5,'Piece',75,30,450,300); +Statement Executed: Rows Affected = 1 +echo insert into salesman_master values('S00001','Aman','A/14','Worli','Mumbai',400002,'Maharastra',3000,100,50,'Good'); +Statement Executed: Rows Affected = 1 +echo insert into salesman_master values('S00002','Omkar','65','Nariman','Mumbai',400001,'maharastra',3000,200,100,'Good'); +Statement Executed: Rows Affected = 1 +echo insert into salesman_master values('S00003','Raj','P-7','Banfra','Mumbai',400032,'Maharastra',3000,200,100,'Good'); +Statement Executed: Rows Affected = 1 +echo insert into salesman_master values('S00004','Ashish','A/5','Juhu','Bombay',400044,'Maharastra',3500,200,150,'Good'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19001','2002-06-12','C00001','F','N','S00001','2002-07-20','In Process'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19002','2002-06-25','C00002','P','N','S00002','2002-06-27','Cancelled'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O46865','2002-02-18','C00003','F','Y','S00003','2002-02-20','Fulfilled'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19003','2002-04-03','C00001','F','Y','S00001','2002-04-07','Fulfilled'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O46866','2002-05-20','C00004','P','N','S00002','2002-05-22','Cancelled'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19008','2002-05-24','C00005','F','N','S00004','2002-07-26','In Process'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19001','P00001',4,4,525); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19001','P07965',2,1,8400); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19001','P07885',2,1,5250); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19002','P00001',10,0,525); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P07868',3,3,3150); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P07885',3,1,5250); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P00001',10,10,525); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P03453',4,4,1050); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19003','P03453',2,2,1050); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19003','P06734',1,1,12000); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46866','P07965',1,0,8400); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46866','P07975',1,0,1050); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19008','P00001',10,5,525); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19008','P07975',5,3,1050); +Statement Executed: Rows Affected = 1 +echo select * from client_master; +--------------------------------------------------------- + client_master.clientno client_master.name client_master.address1 client_master.address2 client_master.city client_master.pincode client_master.state client_master.baldue +--------------------------------------------------------- + C00001 Ivan Bayross NULL NULL Mumbai 400054 Maharastra 15000.000000 + C00002 mamta Muzumdar NULL NULL Madras 780001 Tamil Nadu 0.000000 + C00003 Chhaya Bankar NULL NULL Mumbai 400057 Maharastra 5000.000000 + C00004 Ashwini Joshi NULL NULL Bangalore 560001 MKarnataka 0.000000 + C00005 Hansel Colaco NULL NULL Mumbai 400060 Maharastra 2000.000000 + C00006 Deepak Sharma NULL NULL Mangalore 560050 Karnatakaa 0.000000 + +echo select * from product_master; +--------------------------------------------------------- + product_master.productno product_master.description product_master.profitpercent product_master.unitmeasure product_master.qtyonhand product_master.reorderlvl product_master.selprice product_master.costprice +--------------------------------------------------------- + P00001 T-Shirts 5.000000 Piece 200 50 350.000000 250.000000 + P03453 Shirts 6.000000 Piece 150 50 500.000000 350.000000 + P06734 Cotton Jeans 5.000000 Piece 100 20 60.000000 450.000000 + P07865 Jeans 5.000000 Piece 100 20 750.000000 500.000000 + P07868 Trousers 2.000000 Piece 150 50 850.000000 550.000000 + P07885 Pull Overs 2.500000 Piece 80 30 700.000000 450.000000 + P07965 Denim Shirts 4.000000 Piece 100 40 350.000000 250.000000 + P07975 Lycra Tops 5.000000 Piece 70 30 300.000000 175.000000 + P08865 Skirts 5.000000 Piece 75 30 450.000000 300.000000 + +echo select * from salesman_master; +--------------------------------------------------------- + salesman_master.salesmanno salesman_master.salesmanname salesman_master.address1 salesman_master.address2 salesman_master.city salesman_master.pincode salesman_master.state salesman_master.salamt salesman_master.tgttoget salesman_master.ytdsales salesman_master.remarks +--------------------------------------------------------- + S00001 Aman A/14 Worli Mumbai 400002 Maharastra 3000.000000 100.000000 50.000000 Good + S00002 Omkar 65 Nariman Mumbai 400001 maharastra 3000.000000 200.000000 100.000000 Good + S00003 Raj P-7 Banfra Mumbai 400032 Maharastra 3000.000000 200.000000 100.000000 Good + S00004 Ashish A/5 Juhu Bombay 400044 Maharastra 3500.000000 200.000000 150.000000 Good + +echo select * from sales_order; +--------------------------------------------------------- + sales_order.orderno sales_order.orderdate sales_order.clientno sales_order.delyaddr sales_order.delytype sales_order.billedyn sales_order.salesmanno sales_order.delydate sales_order.orderstatus +--------------------------------------------------------- + O19001 2002/6/12 C00001 NULL F N S00001 2002/7/20 In Process + O19002 2002/6/25 C00002 NULL P N S00002 2002/6/27 Cancelled + O46865 2002/2/18 C00003 NULL F Y S00003 2002/2/20 Fulfilled + O19003 2002/4/3 C00001 NULL F Y S00001 2002/4/7 Fulfilled + O46866 2002/5/20 C00004 NULL P N S00002 2002/5/22 Cancelled + O19008 2002/5/24 C00005 NULL F N S00004 2002/7/26 In Process + +echo select * from sales_order_details; +--------------------------------------------------------- + sales_order_details.orderno sales_order_details.productno sales_order_details.qtyordered sales_order_details.qtydisp sales_order_details.productrate +--------------------------------------------------------- + O19001 P00001 4 4 525.000000 + O19001 P07965 2 1 8400.000000 + O19001 P07885 2 1 5250.000000 + O19002 P00001 10 0 525.000000 + O46865 P07868 3 3 3150.000000 + O46865 P07885 3 1 5250.000000 + O46865 P00001 10 10 525.000000 + O46865 P03453 4 4 1050.000000 + O19003 P03453 2 2 1050.000000 + O19003 P06734 1 1 12000.000000 + O46866 P07965 1 0 8400.000000 + O46866 P07975 1 0 1050.000000 + O19008 P00001 10 5 525.000000 + O19008 P07975 5 3 1050.000000 + +echo select client_master.clientno,name,count(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name; +--------------------------------------------------------- + client_master.clientno name COUNT(qtydisp) +--------------------------------------------------------- + C00001 Ivan Bayross 5 + C00002 mamta Muzumdar 1 + C00003 Chhaya Bankar 4 + C00004 Ashwini Joshi 2 + C00005 Hansel Colaco 2 + +echo select client_master.clientno,name,count(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name having count(qtydisp)>3; +--------------------------------------------------------- + client_master.clientno name COUNT(qtydisp) +--------------------------------------------------------- + C00001 Ivan Bayross 5 + C00003 Chhaya Bankar 4 + +echo select client_master.clientno,name,min(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name; +--------------------------------------------------------- + client_master.clientno name MIN(qtydisp) +--------------------------------------------------------- + C00001 Ivan Bayross 1 + C00002 mamta Muzumdar 0 + C00003 Chhaya Bankar 1 + C00004 Ashwini Joshi 0 + C00005 Hansel Colaco 3 + +echo select client_master.clientno,name,min(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name having min(qtydisp)<3; +--------------------------------------------------------- + client_master.clientno name MIN(qtydisp) +--------------------------------------------------------- + C00001 Ivan Bayross 1 + C00002 mamta Muzumdar 0 + C00003 Chhaya Bankar 1 + C00004 Ashwini Joshi 0 + +echo select client_master.clientno,name,max(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name; +--------------------------------------------------------- + client_master.clientno name MAX(qtydisp) +--------------------------------------------------------- + C00001 Ivan Bayross 4 + C00002 mamta Muzumdar 0 + C00003 Chhaya Bankar 10 + C00004 Ashwini Joshi 0 + C00005 Hansel Colaco 5 + +echo select client_master.clientno,name,max(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name having max(qtydisp)>4; +--------------------------------------------------------- + client_master.clientno name MAX(qtydisp) +--------------------------------------------------------- + C00003 Chhaya Bankar 10 + C00005 Hansel Colaco 5 + +echo select client_master.clientno,name,sum(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name; +--------------------------------------------------------- + client_master.clientno name SUM(qtydisp) +--------------------------------------------------------- + C00001 Ivan Bayross 9 + C00002 mamta Muzumdar 0 + C00003 Chhaya Bankar 18 + C00004 Ashwini Joshi 0 + C00005 Hansel Colaco 8 + +echo select client_master.clientno,name,sum(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name having sum(qtydisp)>3; +--------------------------------------------------------- + client_master.clientno name SUM(qtydisp) +--------------------------------------------------------- + C00001 Ivan Bayross 9 + C00003 Chhaya Bankar 18 + C00005 Hansel Colaco 8 + +echo select client_master.clientno,name,avg(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name; +--------------------------------------------------------- + client_master.clientno name AVG(qtydisp) +--------------------------------------------------------- + C00001 Ivan Bayross 1.800000 + C00002 mamta Muzumdar 0.000000 + C00003 Chhaya Bankar 4.500000 + C00004 Ashwini Joshi 0.000000 + C00005 Hansel Colaco 4.000000 + +echo select client_master.clientno,name,avg(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name having avg(qtydisp)>3; +--------------------------------------------------------- + client_master.clientno name AVG(qtydisp) +--------------------------------------------------------- + C00003 Chhaya Bankar 4.500000 + C00005 Hansel Colaco 4.000000 + +echo drop table sales_order_details; +Statement Executed +echo drop table sales_order; +Statement Executed +echo drop table salesman_master; +Statement Executed +echo drop table product_master; +Statement Executed +echo drop table client_master; +Statement Executed diff --git a/test/sql/Aggregate/exp.test026.ksh b/test/sql/Aggregate/exp.test026.ksh new file mode 100644 index 00000000..d21db4f5 --- /dev/null +++ b/test/sql/Aggregate/exp.test026.ksh @@ -0,0 +1,193 @@ +echo Create table client_master(clientno char(6), name char(20) NOT NULL, address1 char(30), address2 char(30), city char(15), pincode int, state char(15), baldue float,PRIMARY KEY(clientno)); +Statement Executed +echo Create table product_master(productno char(6), description char(15) NOT NULL,profitpercent float NOT NULL,unitmeasure char(10) NOT NULL,qtyonhand int NOT NULL,reorderlvl int NOT NULL,selprice float NOT NULL,costprice float NOT NULL, PRIMARY KEY(productno)); +Statement Executed +echo Create table salesman_master(salesmanno char(6),salesmanname char(20) NOT NULL,address1 char(30) NOT NULL,address2 char(30),city char(20),pincode char(8),state char(20),salamt float NOT NULL,tgttoget float NOT NULL,ytdsales float NOT NULL,remarks char(30),PRIMARY KEY(salesmanno)); +Statement Executed +echo Create table sales_order(orderno char(6),orderdate date,clientno char(6),delyaddr char(25),delytype char(1),billedyn char(1),salesmanno char(6),delydate date,orderstatus char(10),PRIMARY KEY(orderno),FOREIGN KEY(clientno) REFERENCES client_master(clientno),FOREIGN KEY(salesmanno) REFERENCES salesman_master(salesmanno)); +Statement Executed +echo Create table sales_order_details(orderno char(6),productno char(6),qtyordered int,qtydisp int,productrate float,FOREIGN KEY(orderno) REFERENCES sales_order(orderno),FOREIGN KEY(productno) REFERENCES product_master(productno)); +Statement Executed +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00001','Ivan Bayross','Mumbai',400054,'Maharastra',15000); +Statement Executed: Rows Affected = 1 +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00002','mamta Muzumdar','Madras',780001,'Tamil Nadu',0); +Statement Executed: Rows Affected = 1 +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00003','Chhaya Bankar','Mumbai',400057,'Maharastra',5000); +Statement Executed: Rows Affected = 1 +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00004','Ashwini Joshi','Bangalore',560001,'MKarnataka',0); +Statement Executed: Rows Affected = 1 +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00005','Hansel Colaco','Mumbai',400060,'Maharastra',2000); +Statement Executed: Rows Affected = 1 +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00006','Deepak Sharma','Mangalore',560050,'Karnatakaa',0); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P00001','T-Shirts',5,'Piece',200,50,350,250); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P03453','Shirts',6,'Piece',150,50,500,350); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P06734','Cotton Jeans',5,'Piece',100,20,60,450); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P07865','Jeans',5,'Piece',100,20,750,500); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P07868','Trousers',2,'Piece',150,50,850,550); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P07885','Pull Overs',2.5,'Piece',80,30,700,450); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P07965','Denim Shirts',4,'Piece',100,40,350,250); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P07975','Lycra Tops',5,'Piece',70,30,300,175); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P08865','Skirts',5,'Piece',75,30,450,300); +Statement Executed: Rows Affected = 1 +echo insert into salesman_master values('S00001','Aman','A/14','Worli','Mumbai',400002,'Maharastra',3000,100,50,'Good'); +Statement Executed: Rows Affected = 1 +echo insert into salesman_master values('S00002','Omkar','65','Nariman','Mumbai',400001,'maharastra',3000,200,100,'Good'); +Statement Executed: Rows Affected = 1 +echo insert into salesman_master values('S00003','Raj','P-7','Banfra','Mumbai',400032,'Maharastra',3000,200,100,'Good'); +Statement Executed: Rows Affected = 1 +echo insert into salesman_master values('S00004','Ashish','A/5','Juhu','Bombay',400044,'Maharastra',3500,200,150,'Good'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19001','2002-06-12','C00001','F','N','S00001','2002-07-20','In Process'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19002','2002-06-25','C00002','P','N','S00002','2002-06-27','Cancelled'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O46865','2002-02-18','C00003','F','Y','S00003','2002-02-20','Fulfilled'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19003','2002-04-03','C00001','F','Y','S00001','2002-04-07','Fulfilled'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O46866','2002-05-20','C00004','P','N','S00002','2002-05-22','Cancelled'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19008','2002-05-24','C00005','F','N','S00004','2002-07-26','In Process'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19001','P00001',4,4,525); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19001','P07965',2,1,8400); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19001','P07885',2,1,5250); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19002','P00001',10,0,525); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P07868',3,3,3150); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P07885',3,1,5250); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P00001',10,10,525); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P03453',4,4,1050); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19003','P03453',2,2,1050); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19003','P06734',1,1,12000); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46866','P07965',1,0,8400); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46866','P07975',1,0,1050); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19008','P00001',10,5,525); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19008','P07975',5,3,1050); +Statement Executed: Rows Affected = 1 +echo select * from client_master; +--------------------------------------------------------- + client_master.clientno client_master.name client_master.address1 client_master.address2 client_master.city client_master.pincode client_master.state client_master.baldue +--------------------------------------------------------- + C00001 Ivan Bayross NULL NULL Mumbai 400054 Maharastra 15000.000000 + C00002 mamta Muzumdar NULL NULL Madras 780001 Tamil Nadu 0.000000 + C00003 Chhaya Bankar NULL NULL Mumbai 400057 Maharastra 5000.000000 + C00004 Ashwini Joshi NULL NULL Bangalore 560001 MKarnataka 0.000000 + C00005 Hansel Colaco NULL NULL Mumbai 400060 Maharastra 2000.000000 + C00006 Deepak Sharma NULL NULL Mangalore 560050 Karnatakaa 0.000000 + +echo select * from product_master; +--------------------------------------------------------- + product_master.productno product_master.description product_master.profitpercent product_master.unitmeasure product_master.qtyonhand product_master.reorderlvl product_master.selprice product_master.costprice +--------------------------------------------------------- + P00001 T-Shirts 5.000000 Piece 200 50 350.000000 250.000000 + P03453 Shirts 6.000000 Piece 150 50 500.000000 350.000000 + P06734 Cotton Jeans 5.000000 Piece 100 20 60.000000 450.000000 + P07865 Jeans 5.000000 Piece 100 20 750.000000 500.000000 + P07868 Trousers 2.000000 Piece 150 50 850.000000 550.000000 + P07885 Pull Overs 2.500000 Piece 80 30 700.000000 450.000000 + P07965 Denim Shirts 4.000000 Piece 100 40 350.000000 250.000000 + P07975 Lycra Tops 5.000000 Piece 70 30 300.000000 175.000000 + P08865 Skirts 5.000000 Piece 75 30 450.000000 300.000000 + +echo select * from salesman_master; +--------------------------------------------------------- + salesman_master.salesmanno salesman_master.salesmanname salesman_master.address1 salesman_master.address2 salesman_master.city salesman_master.pincode salesman_master.state salesman_master.salamt salesman_master.tgttoget salesman_master.ytdsales salesman_master.remarks +--------------------------------------------------------- + S00001 Aman A/14 Worli Mumbai 400002 Maharastra 3000.000000 100.000000 50.000000 Good + S00002 Omkar 65 Nariman Mumbai 400001 maharastra 3000.000000 200.000000 100.000000 Good + S00003 Raj P-7 Banfra Mumbai 400032 Maharastra 3000.000000 200.000000 100.000000 Good + S00004 Ashish A/5 Juhu Bombay 400044 Maharastra 3500.000000 200.000000 150.000000 Good + +echo select * from sales_order; +--------------------------------------------------------- + sales_order.orderno sales_order.orderdate sales_order.clientno sales_order.delyaddr sales_order.delytype sales_order.billedyn sales_order.salesmanno sales_order.delydate sales_order.orderstatus +--------------------------------------------------------- + O19001 2002/6/12 C00001 NULL F N S00001 2002/7/20 In Process + O19002 2002/6/25 C00002 NULL P N S00002 2002/6/27 Cancelled + O46865 2002/2/18 C00003 NULL F Y S00003 2002/2/20 Fulfilled + O19003 2002/4/3 C00001 NULL F Y S00001 2002/4/7 Fulfilled + O46866 2002/5/20 C00004 NULL P N S00002 2002/5/22 Cancelled + O19008 2002/5/24 C00005 NULL F N S00004 2002/7/26 In Process + +echo select * from sales_order_details; +--------------------------------------------------------- + sales_order_details.orderno sales_order_details.productno sales_order_details.qtyordered sales_order_details.qtydisp sales_order_details.productrate +--------------------------------------------------------- + O19001 P00001 4 4 525.000000 + O19001 P07965 2 1 8400.000000 + O19001 P07885 2 1 5250.000000 + O19002 P00001 10 0 525.000000 + O46865 P07868 3 3 3150.000000 + O46865 P07885 3 1 5250.000000 + O46865 P00001 10 10 525.000000 + O46865 P03453 4 4 1050.000000 + O19003 P03453 2 2 1050.000000 + O19003 P06734 1 1 12000.000000 + O46866 P07965 1 0 8400.000000 + O46866 P07975 1 0 1050.000000 + O19008 P00001 10 5 525.000000 + O19008 P07975 5 3 1050.000000 + +echo select sales_order_details.productno,description,qtyordered,orderdate from sales_order_details,sales_order,product_master where product_master.productno=sales_order_details.productno and sales_order.orderno=sales_order_details.orderno and orderdate >= '2002-04-01' and orderdate <= '2002-05-31'; +--------------------------------------------------------- + sales_order_details.productno description qtyordered +--------------------------------------------------------- + P00001 T-Shirts 4 + P07965 Denim Shirts 2 + P07885 Pull Overs 2 + P00001 T-Shirts 10 + P07868 Trousers 3 + P07885 Pull Overs 3 + P00001 T-Shirts 10 + P03453 Shirts 4 + P03453 Shirts 2 + P06734 Cotton Jeans 1 + P07965 Denim Shirts 1 + P07975 Lycra Tops 1 + P00001 T-Shirts 10 + P07975 Lycra Tops 5 + +echo select sales_order_details.productno, description, min(qtyordered), max(qtyordered), count(qtyordered), sum(qtyordered) from sales_order_details,sales_order,product_master where product_master.productno=sales_order_details.productno and sales_order.orderno=sales_order_details.orderno group by sales_order_details.productno,description; +--------------------------------------------------------- + sales_order_details.productno description MIN(qtyordered) MAX(qtyordered) COUNT(qtyordered) SUM(qtyordered) +--------------------------------------------------------- + P00001 T-Shirts 4 10 4 34 + P07965 Denim Shirts 1 2 2 3 + P07885 Pull Overs 2 3 2 5 + P07868 Trousers 3 3 1 3 + P03453 Shirts 2 4 2 6 + P06734 Cotton Jeans 1 1 1 1 + P07975 Lycra Tops 1 5 2 6 + +echo drop table sales_order_details; +Statement Executed +echo drop table sales_order; +Statement Executed +echo drop table salesman_master; +Statement Executed +echo drop table product_master; +Statement Executed +echo drop table client_master; +Statement Executed diff --git a/test/sql/Aggregate/exp.test028.ksh b/test/sql/Aggregate/exp.test028.ksh new file mode 100644 index 00000000..cb1c77e5 --- /dev/null +++ b/test/sql/Aggregate/exp.test028.ksh @@ -0,0 +1,224 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 t1.f5 t1.f6 t1.f7 t1.f8 t1.f9 +--------------------------------------------------------- + 10 100 1000 Bijay 1000.000000 100000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + 11 110 1100 Jitendr 2000.000000 200000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 12 120 1000 Nihar 3000.000000 300000.000000 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 NULL Kishor 4000.000000 400000.000000 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 + 14 100 1000 Praba 5000.000000 500000.000000 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 + 15 110 1100 Sanjit 6000.000000 600000.000000 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 + 16 120 1000 Sanjay NULL 700000.000000 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 + 17 130 1100 Arindam 8000.000000 800000.000000 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 + 10 100 1000 Bijay 9000.000000 900000.000000 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 + 11 NULL 1100 Jitendr 1000.000000 100000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 12 120 1000 Nihar 2000.000000 200000.000000 2009/3/3 NULL 2009/3/3 11:59:59.0 + 13 130 1100 Kishor 3000.000000 300000.000000 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 + 14 100 1000 Praba 4000.000000 400000.000000 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 + 15 110 NULL Sanjit 5000.000000 500000.000000 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 + 16 120 1000 Sanjay 6000.000000 600000.000000 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 + 17 130 1100 Arindam 7000.000000 700000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + +echo select f1,f2,f3,f4,count(f5),sum(f5), count(f6),sum(f6) from t1 group by f1,f2,f3,f4; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) SUM(f5) COUNT(f6) SUM(f6) +--------------------------------------------------------- + 10 100 1000 Bijay 2 10000.000000 2 1000000.000000 + 11 110 1100 Jitendr 1 2000.000000 1 200000.000000 + 12 120 1000 Nihar 2 5000.000000 2 500000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 9000.000000 2 900000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 1300000.000000 + 17 130 1100 Arindam 2 15000.000000 2 1500000.000000 + 11 NULL 1100 Jitendr 1 1000.000000 1 100000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f2,f1,f4,f3,count(f5),sum(f5), count(f6),sum(f6) from t1 group by f1,f2,f3,f4; +--------------------------------------------------------- + f2 f1 f4 f3 COUNT(f5) SUM(f5) COUNT(f6) SUM(f6) +--------------------------------------------------------- + 100 10 Bijay 1000 2 10000.000000 2 1000000.000000 + 110 11 Jitendr 1100 1 2000.000000 1 200000.000000 + 120 12 Nihar 1000 2 5000.000000 2 500000.000000 + 130 13 Kishor NULL 1 4000.000000 1 400000.000000 + 100 14 Praba 1000 2 9000.000000 2 900000.000000 + 110 15 Sanjit 1100 1 6000.000000 1 600000.000000 + 120 16 Sanjay 1000 1 6000.000000 2 1300000.000000 + 130 17 Arindam 1100 2 15000.000000 2 1500000.000000 + NULL 11 Jitendr 1100 1 1000.000000 1 100000.000000 + 130 13 Kishor 1100 1 3000.000000 1 300000.000000 + 110 15 Sanjit NULL 1 5000.000000 1 500000.000000 + +echo select f3,f1,f4,f2,count(f5),sum(f5), count(f6),sum(f6) from t1 group by f1,f2,f3,f4; +--------------------------------------------------------- + f3 f1 f4 f2 COUNT(f5) SUM(f5) COUNT(f6) SUM(f6) +--------------------------------------------------------- + 1000 10 Bijay 100 2 10000.000000 2 1000000.000000 + 1100 11 Jitendr 110 1 2000.000000 1 200000.000000 + 1000 12 Nihar 120 2 5000.000000 2 500000.000000 + NULL 13 Kishor 130 1 4000.000000 1 400000.000000 + 1000 14 Praba 100 2 9000.000000 2 900000.000000 + 1100 15 Sanjit 110 1 6000.000000 1 600000.000000 + 1000 16 Sanjay 120 1 6000.000000 2 1300000.000000 + 1100 17 Arindam 130 2 15000.000000 2 1500000.000000 + 1100 11 Jitendr NULL 1 1000.000000 1 100000.000000 + 1100 13 Kishor 130 1 3000.000000 1 300000.000000 + NULL 15 Sanjit 110 1 5000.000000 1 500000.000000 + +echo select f4,f3,f2,f1,count(f5),sum(f5), count(f6),sum(f6) from t1 group by f1,f2,f3,f4; +--------------------------------------------------------- + f4 f3 f2 f1 COUNT(f5) SUM(f5) COUNT(f6) SUM(f6) +--------------------------------------------------------- + Bijay 1000 100 10 2 10000.000000 2 1000000.000000 + Jitendr 1100 110 11 1 2000.000000 1 200000.000000 + Nihar 1000 120 12 2 5000.000000 2 500000.000000 + Kishor NULL 130 13 1 4000.000000 1 400000.000000 + Praba 1000 100 14 2 9000.000000 2 900000.000000 + Sanjit 1100 110 15 1 6000.000000 1 600000.000000 + Sanjay 1000 120 16 1 6000.000000 2 1300000.000000 + Arindam 1100 130 17 2 15000.000000 2 1500000.000000 + Jitendr 1100 NULL 11 1 1000.000000 1 100000.000000 + Kishor 1100 130 13 1 3000.000000 1 300000.000000 + Sanjit NULL 110 15 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),sum(f5), count(f6),sum(f6) from t1 group by f1,f2,f3,f4 having sum(f5)>=5000; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) SUM(f5) COUNT(f6) SUM(f6) +--------------------------------------------------------- + 10 100 1000 Bijay 2 10000.000000 2 1000000.000000 + 12 120 1000 Nihar 2 5000.000000 2 500000.000000 + 14 100 1000 Praba 2 9000.000000 2 900000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 1300000.000000 + 17 130 1100 Arindam 2 15000.000000 2 1500000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 group by f1,f2,f3,f4; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) SUM(f5) COUNT(f6) SUM(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 5000.000000 2 500000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 9000.000000 2 900000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 1300000.000000 + 17 130 1100 Arindam 2 15000.000000 2 1500000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f4,f3,f1,f2,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 group by f1,f2,f3,f4; +--------------------------------------------------------- + f4 f3 f1 f2 COUNT(f5) SUM(f5) COUNT(f6) SUM(f6) +--------------------------------------------------------- + Nihar 1000 12 120 2 5000.000000 2 500000.000000 + Kishor NULL 13 130 1 4000.000000 1 400000.000000 + Praba 1000 14 100 2 9000.000000 2 900000.000000 + Sanjit 1100 15 110 1 6000.000000 1 600000.000000 + Sanjay 1000 16 120 1 6000.000000 2 1300000.000000 + Arindam 1100 17 130 2 15000.000000 2 1500000.000000 + Kishor 1100 13 130 1 3000.000000 1 300000.000000 + Sanjit NULL 15 110 1 5000.000000 1 500000.000000 + +echo select f4,f1,f2,f3,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 group by f1,f2,f3,f4; +--------------------------------------------------------- + f4 f1 f2 f3 COUNT(f5) SUM(f5) COUNT(f6) SUM(f6) +--------------------------------------------------------- + Nihar 12 120 1000 2 5000.000000 2 500000.000000 + Kishor 13 130 NULL 1 4000.000000 1 400000.000000 + Praba 14 100 1000 2 9000.000000 2 900000.000000 + Sanjit 15 110 1100 1 6000.000000 1 600000.000000 + Sanjay 16 120 1000 1 6000.000000 2 1300000.000000 + Arindam 17 130 1100 2 15000.000000 2 1500000.000000 + Kishor 13 130 1100 1 3000.000000 1 300000.000000 + Sanjit 15 110 NULL 1 5000.000000 1 500000.000000 + +echo select f4,f3,f1,f2,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 group by f1,f2,f3,f4; +--------------------------------------------------------- + f4 f3 f1 f2 COUNT(f5) SUM(f5) COUNT(f6) SUM(f6) +--------------------------------------------------------- + Nihar 1000 12 120 2 5000.000000 2 500000.000000 + Kishor NULL 13 130 1 4000.000000 1 400000.000000 + Praba 1000 14 100 2 9000.000000 2 900000.000000 + Sanjit 1100 15 110 1 6000.000000 1 600000.000000 + Sanjay 1000 16 120 1 6000.000000 2 1300000.000000 + Arindam 1100 17 130 2 15000.000000 2 1500000.000000 + Kishor 1100 13 130 1 3000.000000 1 300000.000000 + Sanjit NULL 15 110 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) SUM(f5) COUNT(f6) SUM(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 5000.000000 2 500000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 9000.000000 2 900000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + +echo select f2,f3,f4,f1,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4; +--------------------------------------------------------- + f2 f3 f4 f1 COUNT(f5) SUM(f5) COUNT(f6) SUM(f6) +--------------------------------------------------------- + 120 1000 Nihar 12 2 5000.000000 2 500000.000000 + 130 NULL Kishor 13 1 4000.000000 1 400000.000000 + 100 1000 Praba 14 2 9000.000000 2 900000.000000 + 130 1100 Kishor 13 1 3000.000000 1 300000.000000 + +echo select f1,f2,f3,f4,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) SUM(f5) COUNT(f6) SUM(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 5000.000000 2 500000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 9000.000000 2 900000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + +echo select f1,f2,f3,f4,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4 having sum(f5)>=4000 and sum(f5)<6000; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) SUM(f5) COUNT(f6) SUM(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 5000.000000 2 500000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + +echo select f1,f2,f3,f4,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 and f2<=130 group by f1,f2,f3,f4; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) SUM(f5) COUNT(f6) SUM(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 5000.000000 2 500000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 9000.000000 2 900000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 1300000.000000 + 17 130 1100 Arindam 2 15000.000000 2 1500000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 and f2<=130 group by f1,f2,f3,f4 having sum(f5)>=5000 and sum(f5)<10000; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) SUM(f5) COUNT(f6) SUM(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 5000.000000 2 500000.000000 + 14 100 1000 Praba 2 9000.000000 2 900000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 1300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +Statement Executed diff --git a/test/sql/Aggregate/exp.test029.ksh b/test/sql/Aggregate/exp.test029.ksh new file mode 100644 index 00000000..0062bac5 --- /dev/null +++ b/test/sql/Aggregate/exp.test029.ksh @@ -0,0 +1,220 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 t1.f5 t1.f6 t1.f7 t1.f8 t1.f9 +--------------------------------------------------------- + 10 100 1000 Bijay 1000.000000 100000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + 11 110 1100 Jitendr 2000.000000 200000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 12 120 1000 Nihar 3000.000000 300000.000000 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 NULL Kishor 4000.000000 400000.000000 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 + 14 100 1000 Praba 5000.000000 500000.000000 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 + 15 110 1100 Sanjit 6000.000000 600000.000000 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 + 16 120 1000 Sanjay NULL 700000.000000 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 + 17 130 1100 Arindam 8000.000000 800000.000000 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 + 10 100 1000 Bijay 9000.000000 900000.000000 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 + 11 NULL 1100 Jitendr 1000.000000 100000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 12 120 1000 Nihar 2000.000000 200000.000000 2009/3/3 NULL 2009/3/3 11:59:59.0 + 13 130 1100 Kishor 3000.000000 300000.000000 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 + 14 100 1000 Praba 4000.000000 400000.000000 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 + 15 110 NULL Sanjit 5000.000000 500000.000000 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 + 16 120 1000 Sanjay 6000.000000 600000.000000 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 + 17 130 1100 Arindam 7000.000000 700000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 group by f1,f2,f3,f4; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MIN(f5) COUNT(f6) MIN(f6) +--------------------------------------------------------- + 10 100 1000 Bijay 2 1000.000000 2 100000.000000 + 11 110 1100 Jitendr 1 2000.000000 1 200000.000000 + 12 120 1000 Nihar 2 2000.000000 2 200000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 4000.000000 2 400000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 600000.000000 + 17 130 1100 Arindam 2 7000.000000 2 700000.000000 + 11 NULL 1100 Jitendr 1 1000.000000 1 100000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 group by f2,f1,f4,f3; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MIN(f5) COUNT(f6) MIN(f6) +--------------------------------------------------------- + 10 100 1000 Bijay 2 1000.000000 2 100000.000000 + 11 110 1100 Jitendr 1 2000.000000 1 200000.000000 + 12 120 1000 Nihar 2 2000.000000 2 200000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 4000.000000 2 400000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 600000.000000 + 17 130 1100 Arindam 2 7000.000000 2 700000.000000 + 11 NULL 1100 Jitendr 1 1000.000000 1 100000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 group by f3,f1,f4,f2; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MIN(f5) COUNT(f6) MIN(f6) +--------------------------------------------------------- + 10 100 1000 Bijay 2 1000.000000 2 100000.000000 + 11 110 1100 Jitendr 1 2000.000000 1 200000.000000 + 12 120 1000 Nihar 2 2000.000000 2 200000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 4000.000000 2 400000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 600000.000000 + 17 130 1100 Arindam 2 7000.000000 2 700000.000000 + 11 NULL 1100 Jitendr 1 1000.000000 1 100000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 group by f4,f3,f2,f1; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MIN(f5) COUNT(f6) MIN(f6) +--------------------------------------------------------- + 10 100 1000 Bijay 2 1000.000000 2 100000.000000 + 11 110 1100 Jitendr 1 2000.000000 1 200000.000000 + 12 120 1000 Nihar 2 2000.000000 2 200000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 4000.000000 2 400000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 600000.000000 + 17 130 1100 Arindam 2 7000.000000 2 700000.000000 + 11 NULL 1100 Jitendr 1 1000.000000 1 100000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 group by f1,f2,f3,f4 having min(f5)>=5000; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MIN(f5) COUNT(f6) MIN(f6) +--------------------------------------------------------- + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 600000.000000 + 17 130 1100 Arindam 2 7000.000000 2 700000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 group by f1,f2,f3,f4; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MIN(f5) COUNT(f6) MIN(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 2000.000000 2 200000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 4000.000000 2 400000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 600000.000000 + 17 130 1100 Arindam 2 7000.000000 2 700000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 group by f4,f3,f1,f2; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MIN(f5) COUNT(f6) MIN(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 2000.000000 2 200000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 4000.000000 2 400000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 600000.000000 + 17 130 1100 Arindam 2 7000.000000 2 700000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 group by f4,f1,f2,f3; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MIN(f5) COUNT(f6) MIN(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 2000.000000 2 200000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 4000.000000 2 400000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 600000.000000 + 17 130 1100 Arindam 2 7000.000000 2 700000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 group by f4,f3,f1,f2; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MIN(f5) COUNT(f6) MIN(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 2000.000000 2 200000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 4000.000000 2 400000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 600000.000000 + 17 130 1100 Arindam 2 7000.000000 2 700000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MIN(f5) COUNT(f6) MIN(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 2000.000000 2 200000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 4000.000000 2 400000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 and f1<15 group by f2,f3,f4,f1; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MIN(f5) COUNT(f6) MIN(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 2000.000000 2 200000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 4000.000000 2 400000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f4,f3; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MIN(f5) COUNT(f6) MIN(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 2000.000000 2 200000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 4000.000000 2 400000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4 having min(f5)>=4000 and min(f5)<6000; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MIN(f5) COUNT(f6) MIN(f6) +--------------------------------------------------------- + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 4000.000000 2 400000.000000 + +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 and f2<=130 group by f1,f2,f3,f4; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MIN(f5) COUNT(f6) MIN(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 2000.000000 2 200000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 4000.000000 2 400000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 600000.000000 + 17 130 1100 Arindam 2 7000.000000 2 700000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 and f2<=130 group by f1,f2,f3,f4 having min(f5)>=5000 and min(f5)<10000; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MIN(f5) COUNT(f6) MIN(f6) +--------------------------------------------------------- + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 600000.000000 + 17 130 1100 Arindam 2 7000.000000 2 700000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +Statement Executed diff --git a/test/sql/Aggregate/exp.test030.ksh b/test/sql/Aggregate/exp.test030.ksh new file mode 100644 index 00000000..ff05a323 --- /dev/null +++ b/test/sql/Aggregate/exp.test030.ksh @@ -0,0 +1,223 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 t1.f5 t1.f6 t1.f7 t1.f8 t1.f9 +--------------------------------------------------------- + 10 100 1000 Bijay 1000.000000 100000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + 11 110 1100 Jitendr 2000.000000 200000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 12 120 1000 Nihar 3000.000000 300000.000000 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 NULL Kishor 4000.000000 400000.000000 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 + 14 100 1000 Praba 5000.000000 500000.000000 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 + 15 110 1100 Sanjit 6000.000000 600000.000000 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 + 16 120 1000 Sanjay NULL 700000.000000 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 + 17 130 1100 Arindam 8000.000000 800000.000000 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 + 10 100 1000 Bijay 9000.000000 900000.000000 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 + 11 NULL 1100 Jitendr 1000.000000 100000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 12 120 1000 Nihar 2000.000000 200000.000000 2009/3/3 NULL 2009/3/3 11:59:59.0 + 13 130 1100 Kishor 3000.000000 300000.000000 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 + 14 100 1000 Praba 4000.000000 400000.000000 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 + 15 110 NULL Sanjit 5000.000000 500000.000000 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 + 16 120 1000 Sanjay 6000.000000 600000.000000 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 + 17 130 1100 Arindam 7000.000000 700000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 group by f1,f2,f3,f4; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MAX(f5) COUNT(f6) MAX(f6) +--------------------------------------------------------- + 10 100 1000 Bijay 2 9000.000000 2 900000.000000 + 11 110 1100 Jitendr 1 2000.000000 1 200000.000000 + 12 120 1000 Nihar 2 3000.000000 2 300000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 5000.000000 2 500000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 700000.000000 + 17 130 1100 Arindam 2 8000.000000 2 800000.000000 + 11 NULL 1100 Jitendr 1 1000.000000 1 100000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 group by f2,f1,f4,f3; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MAX(f5) COUNT(f6) MAX(f6) +--------------------------------------------------------- + 10 100 1000 Bijay 2 9000.000000 2 900000.000000 + 11 110 1100 Jitendr 1 2000.000000 1 200000.000000 + 12 120 1000 Nihar 2 3000.000000 2 300000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 5000.000000 2 500000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 700000.000000 + 17 130 1100 Arindam 2 8000.000000 2 800000.000000 + 11 NULL 1100 Jitendr 1 1000.000000 1 100000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 group by f3,f1,f4,f2; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MAX(f5) COUNT(f6) MAX(f6) +--------------------------------------------------------- + 10 100 1000 Bijay 2 9000.000000 2 900000.000000 + 11 110 1100 Jitendr 1 2000.000000 1 200000.000000 + 12 120 1000 Nihar 2 3000.000000 2 300000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 5000.000000 2 500000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 700000.000000 + 17 130 1100 Arindam 2 8000.000000 2 800000.000000 + 11 NULL 1100 Jitendr 1 1000.000000 1 100000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 group by f4,f3,f2,f1; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MAX(f5) COUNT(f6) MAX(f6) +--------------------------------------------------------- + 10 100 1000 Bijay 2 9000.000000 2 900000.000000 + 11 110 1100 Jitendr 1 2000.000000 1 200000.000000 + 12 120 1000 Nihar 2 3000.000000 2 300000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 5000.000000 2 500000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 700000.000000 + 17 130 1100 Arindam 2 8000.000000 2 800000.000000 + 11 NULL 1100 Jitendr 1 1000.000000 1 100000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 group by f1,f2,f3,f4 having max(f5)>=5000; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MAX(f5) COUNT(f6) MAX(f6) +--------------------------------------------------------- + 10 100 1000 Bijay 2 9000.000000 2 900000.000000 + 14 100 1000 Praba 2 5000.000000 2 500000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 700000.000000 + 17 130 1100 Arindam 2 8000.000000 2 800000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 group by f1,f2,f3,f4; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MAX(f5) COUNT(f6) MAX(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 3000.000000 2 300000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 5000.000000 2 500000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 700000.000000 + 17 130 1100 Arindam 2 8000.000000 2 800000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 group by f4,f3,f1,f2; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MAX(f5) COUNT(f6) MAX(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 3000.000000 2 300000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 5000.000000 2 500000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 700000.000000 + 17 130 1100 Arindam 2 8000.000000 2 800000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 group by f4,f1,f2,f3; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MAX(f5) COUNT(f6) MAX(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 3000.000000 2 300000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 5000.000000 2 500000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 700000.000000 + 17 130 1100 Arindam 2 8000.000000 2 800000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 group by f4,f3,f1,f2; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MAX(f5) COUNT(f6) MAX(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 3000.000000 2 300000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 5000.000000 2 500000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 700000.000000 + 17 130 1100 Arindam 2 8000.000000 2 800000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MAX(f5) COUNT(f6) MAX(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 3000.000000 2 300000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 5000.000000 2 500000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 and f1<15 group by f2,f3,f4,f1; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MAX(f5) COUNT(f6) MAX(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 3000.000000 2 300000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 5000.000000 2 500000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f4,f3; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MAX(f5) COUNT(f6) MAX(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 3000.000000 2 300000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 5000.000000 2 500000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4 having max(f5)>=4000 and max(f5)<6000; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MAX(f5) COUNT(f6) MAX(f6) +--------------------------------------------------------- + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 5000.000000 2 500000.000000 + +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 and f2<=130 group by f1,f2,f3,f4; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MAX(f5) COUNT(f6) MAX(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 3000.000000 2 300000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 5000.000000 2 500000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 700000.000000 + 17 130 1100 Arindam 2 8000.000000 2 800000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 and f2<=130 group by f1,f2,f3,f4 having max(f5)>=5000 and max(f5)<10000; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MAX(f5) COUNT(f6) MAX(f6) +--------------------------------------------------------- + 14 100 1000 Praba 2 5000.000000 2 500000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 700000.000000 + 17 130 1100 Arindam 2 8000.000000 2 800000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +Statement Executed diff --git a/test/sql/Aggregate/exp.test031.ksh b/test/sql/Aggregate/exp.test031.ksh new file mode 100644 index 00000000..fc967fb6 --- /dev/null +++ b/test/sql/Aggregate/exp.test031.ksh @@ -0,0 +1,221 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 t1.f5 t1.f6 t1.f7 t1.f8 t1.f9 +--------------------------------------------------------- + 10 100 1000 Bijay 1000.000000 100000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + 11 110 1100 Jitendr 2000.000000 200000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 12 120 1000 Nihar 3000.000000 300000.000000 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 NULL Kishor 4000.000000 400000.000000 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 + 14 100 1000 Praba 5000.000000 500000.000000 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 + 15 110 1100 Sanjit 6000.000000 600000.000000 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 + 16 120 1000 Sanjay NULL 700000.000000 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 + 17 130 1100 Arindam 8000.000000 800000.000000 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 + 10 100 1000 Bijay 9000.000000 900000.000000 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 + 11 NULL 1100 Jitendr 1000.000000 100000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 12 120 1000 Nihar 2000.000000 200000.000000 2009/3/3 NULL 2009/3/3 11:59:59.0 + 13 130 1100 Kishor 3000.000000 300000.000000 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 + 14 100 1000 Praba 4000.000000 400000.000000 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 + 15 110 NULL Sanjit 5000.000000 500000.000000 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 + 16 120 1000 Sanjay 6000.000000 600000.000000 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 + 17 130 1100 Arindam 7000.000000 700000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 group by f1,f2,f3,f4; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) COUNT(f6) +--------------------------------------------------------- + 10 100 1000 Bijay 2 2 + 11 110 1100 Jitendr 1 1 + 12 120 1000 Nihar 2 2 + 13 130 NULL Kishor 1 1 + 14 100 1000 Praba 2 2 + 15 110 1100 Sanjit 1 1 + 16 120 1000 Sanjay 1 2 + 17 130 1100 Arindam 2 2 + 11 NULL 1100 Jitendr 1 1 + 13 130 1100 Kishor 1 1 + 15 110 NULL Sanjit 1 1 + +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 group by f2,f1,f4,f3; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) COUNT(f6) +--------------------------------------------------------- + 10 100 1000 Bijay 2 2 + 11 110 1100 Jitendr 1 1 + 12 120 1000 Nihar 2 2 + 13 130 NULL Kishor 1 1 + 14 100 1000 Praba 2 2 + 15 110 1100 Sanjit 1 1 + 16 120 1000 Sanjay 1 2 + 17 130 1100 Arindam 2 2 + 11 NULL 1100 Jitendr 1 1 + 13 130 1100 Kishor 1 1 + 15 110 NULL Sanjit 1 1 + +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 group by f3,f1,f4,f2; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) COUNT(f6) +--------------------------------------------------------- + 10 100 1000 Bijay 2 2 + 11 110 1100 Jitendr 1 1 + 12 120 1000 Nihar 2 2 + 13 130 NULL Kishor 1 1 + 14 100 1000 Praba 2 2 + 15 110 1100 Sanjit 1 1 + 16 120 1000 Sanjay 1 2 + 17 130 1100 Arindam 2 2 + 11 NULL 1100 Jitendr 1 1 + 13 130 1100 Kishor 1 1 + 15 110 NULL Sanjit 1 1 + +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 group by f4,f3,f2,f1; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) COUNT(f6) +--------------------------------------------------------- + 10 100 1000 Bijay 2 2 + 11 110 1100 Jitendr 1 1 + 12 120 1000 Nihar 2 2 + 13 130 NULL Kishor 1 1 + 14 100 1000 Praba 2 2 + 15 110 1100 Sanjit 1 1 + 16 120 1000 Sanjay 1 2 + 17 130 1100 Arindam 2 2 + 11 NULL 1100 Jitendr 1 1 + 13 130 1100 Kishor 1 1 + 15 110 NULL Sanjit 1 1 + +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 group by f1,f2,f3,f4 having count(f5)>=2; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) COUNT(f6) +--------------------------------------------------------- + 10 100 1000 Bijay 2 2 + 12 120 1000 Nihar 2 2 + 14 100 1000 Praba 2 2 + 17 130 1100 Arindam 2 2 + +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 group by f1,f2,f3,f4; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) COUNT(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 2 + 13 130 NULL Kishor 1 1 + 14 100 1000 Praba 2 2 + 15 110 1100 Sanjit 1 1 + 16 120 1000 Sanjay 1 2 + 17 130 1100 Arindam 2 2 + 13 130 1100 Kishor 1 1 + 15 110 NULL Sanjit 1 1 + +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 group by f4,f3,f1,f2; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) COUNT(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 2 + 13 130 NULL Kishor 1 1 + 14 100 1000 Praba 2 2 + 15 110 1100 Sanjit 1 1 + 16 120 1000 Sanjay 1 2 + 17 130 1100 Arindam 2 2 + 13 130 1100 Kishor 1 1 + 15 110 NULL Sanjit 1 1 + +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 group by f4,f1,f2,f3; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) COUNT(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 2 + 13 130 NULL Kishor 1 1 + 14 100 1000 Praba 2 2 + 15 110 1100 Sanjit 1 1 + 16 120 1000 Sanjay 1 2 + 17 130 1100 Arindam 2 2 + 13 130 1100 Kishor 1 1 + 15 110 NULL Sanjit 1 1 + +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 group by f4,f3,f1,f2; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) COUNT(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 2 + 13 130 NULL Kishor 1 1 + 14 100 1000 Praba 2 2 + 15 110 1100 Sanjit 1 1 + 16 120 1000 Sanjay 1 2 + 17 130 1100 Arindam 2 2 + 13 130 1100 Kishor 1 1 + 15 110 NULL Sanjit 1 1 + +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) COUNT(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 2 + 13 130 NULL Kishor 1 1 + 14 100 1000 Praba 2 2 + 13 130 1100 Kishor 1 1 + +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 and f1<15 group by f2,f3,f4,f1; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) COUNT(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 2 + 13 130 NULL Kishor 1 1 + 14 100 1000 Praba 2 2 + 13 130 1100 Kishor 1 1 + +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f4,f3; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) COUNT(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 2 + 13 130 NULL Kishor 1 1 + 14 100 1000 Praba 2 2 + 13 130 1100 Kishor 1 1 + +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4 having count(f5)>=0 and count(f5)<2; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) COUNT(f6) +--------------------------------------------------------- + 13 130 NULL Kishor 1 1 + 13 130 1100 Kishor 1 1 + +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 and f2<=130 group by f1,f2,f3,f4; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) COUNT(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 2 + 13 130 NULL Kishor 1 1 + 14 100 1000 Praba 2 2 + 15 110 1100 Sanjit 1 1 + 16 120 1000 Sanjay 1 2 + 17 130 1100 Arindam 2 2 + 13 130 1100 Kishor 1 1 + 15 110 NULL Sanjit 1 1 + +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 and f2<=130 group by f1,f2,f3,f4 having count(f5)>=0 and count(f5)<2; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) COUNT(f6) +--------------------------------------------------------- + 13 130 NULL Kishor 1 1 + 15 110 1100 Sanjit 1 1 + 16 120 1000 Sanjay 1 2 + 13 130 1100 Kishor 1 1 + 15 110 NULL Sanjit 1 1 + +Statement Executed diff --git a/test/sql/Aggregate/exp.test032.ksh b/test/sql/Aggregate/exp.test032.ksh new file mode 100644 index 00000000..bf5cf724 --- /dev/null +++ b/test/sql/Aggregate/exp.test032.ksh @@ -0,0 +1,30 @@ +echo CREATE TABLE writer (poet char(50) , anthology char(40) , copies_in_stock tinyint(4)) ; +Statement Executed +echo INSERT INTO writer VALUES ('Mongane Wally Serote','Tstetlo',3); +Statement Executed: Rows Affected = 1 +echo INSERT INTO writer VALUES ('Douglas Livingstone', 'The Skull in the Mud',21); +Statement Executed: Rows Affected = 1 +echo INSERT INTO writer VALUES ('Mongane Wally Serote', 'No Baby Must Weep',8); +Statement Executed: Rows Affected = 1 +echo INSERT INTO writer VALUES ('Douglas Livingstone', 'A Littoral Zone',2); +Statement Executed: Rows Affected = 1 +echo INSERT INTO writer VALUES ('Mongane Wally Serote', 'A Tough Tale',2); +Statement Executed: Rows Affected = 1 +echo SELECT * FROM writer; +--------------------------------------------------------- + writer.poet writer.anthology writer.copies_in_stock +--------------------------------------------------------- + Mongane Wally Serote Tstetlo 3 + Douglas Livingstone The Skull in the Mud 21 + Mongane Wally Serote No Baby Must Weep 8 + Douglas Livingstone A Littoral Zone 2 + Mongane Wally Serote A Tough Tale 2 + +echo SELECT poet, MAX(copies_in_stock) , MIN(copies_in_stock) , AVG(copies_in_stock) , SUM(copies_in_stock) FROM writer GROUP BY poet; +--------------------------------------------------------- + poet MAX(copies_in_stock) MIN(copies_in_stock) AVG(copies_in_stock) SUM(copies_in_stock) +--------------------------------------------------------- + Mongane Wally Serote 8 2 4.333333 13 + Douglas Livingstone 21 2 11.500000 23 + +Statement Executed diff --git a/test/sql/Aggregate/exp.test033.ksh b/test/sql/Aggregate/exp.test033.ksh new file mode 100644 index 00000000..cf33615e --- /dev/null +++ b/test/sql/Aggregate/exp.test033.ksh @@ -0,0 +1,281 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 t1.f5 t1.f6 t1.f7 t1.f8 t1.f9 +--------------------------------------------------------- + 10 100 1000 Bijay 1000.000000 100000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + 11 110 1100 Jitendr 2000.000000 200000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 12 120 1000 Nihar 3000.000000 300000.000000 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 NULL Kishor 4000.000000 400000.000000 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 + 14 100 1000 Praba 5000.000000 500000.000000 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 + 15 110 1100 Sanjit 6000.000000 600000.000000 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 + 16 120 1000 Sanjay NULL 700000.000000 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 + 17 130 1100 Arindam 8000.000000 800000.000000 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 + 10 100 1000 Bijay 9000.000000 900000.000000 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 + 11 NULL 1100 Jitendr 1000.000000 100000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 12 120 1000 Nihar 2000.000000 200000.000000 2009/3/3 NULL 2009/3/3 11:59:59.0 + 13 130 1100 Kishor 3000.000000 300000.000000 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 + 14 100 1000 Praba 4000.000000 400000.000000 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 + 15 110 NULL Sanjit 5000.000000 500000.000000 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 + 16 120 1000 Sanjay 6000.000000 600000.000000 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 + 17 130 1100 Arindam 7000.000000 700000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + +echo select f1,f2,min(f4),min(f7),min(f8),min(f9) from t1 group by f1,f2; +--------------------------------------------------------- + f1 f2 MIN(f4) MIN(f7) MIN(f8) MIN(f9) +--------------------------------------------------------- + 10 100 Bijay 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 + 11 110 Jitendr 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 12 120 Nihar 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 Kishor 2009/3/4 11:59:56.0 2009/3/4 11:59:59.0 + 14 100 Praba 2009/3/1 11:59:55.0 2009/3/1 11:59:59.0 + 15 110 Sanjit 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 + 16 120 Sanjay 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 + 17 130 Arindam 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 + 11 NULL Jitendr 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + +echo select f1,f2,min(f4),min(f7),min(f8),min(f9) from t1 group by f1,f2 having min(f4)>='K'; +--------------------------------------------------------- + f1 f2 MIN(f4) MIN(f7) MIN(f8) MIN(f9) +--------------------------------------------------------- + 12 120 Nihar 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 Kishor 2009/3/4 11:59:56.0 2009/3/4 11:59:59.0 + 14 100 Praba 2009/3/1 11:59:55.0 2009/3/1 11:59:59.0 + 15 110 Sanjit 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 + 16 120 Sanjay 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 + +echo select f1,f2,min(f4),min(f7),min(f8),min(f9) from t1 where f1 >= 12 group by f1,f2; +--------------------------------------------------------- + f1 f2 MIN(f4) MIN(f7) MIN(f8) MIN(f9) +--------------------------------------------------------- + 12 120 Nihar 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 Kishor 2009/3/4 11:59:56.0 2009/3/4 11:59:59.0 + 14 100 Praba 2009/3/1 11:59:55.0 2009/3/1 11:59:59.0 + 15 110 Sanjit 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 + 16 120 Sanjay 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 + 17 130 Arindam 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 + +echo select f1,f2,min(f4),min(f7),min(f8),min(f9) from t1 where f1 >= 12 group by f1,f2 having min(f8)>='11:59:55'; +--------------------------------------------------------- + f1 f2 MIN(f4) MIN(f7) MIN(f8) MIN(f9) +--------------------------------------------------------- + 12 120 Nihar 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 Kishor 2009/3/4 11:59:56.0 2009/3/4 11:59:59.0 + 14 100 Praba 2009/3/1 11:59:55.0 2009/3/1 11:59:59.0 + 15 110 Sanjit 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 + 16 120 Sanjay 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 + 17 130 Arindam 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 + +echo select f1,f2,min(f4),min(f7),min(f8),min(f9) from t1 where f1 >= 12 and f1<15 group by f1,f2; +--------------------------------------------------------- + f1 f2 MIN(f4) MIN(f7) MIN(f8) MIN(f9) +--------------------------------------------------------- + 12 120 Nihar 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 Kishor 2009/3/4 11:59:56.0 2009/3/4 11:59:59.0 + 14 100 Praba 2009/3/1 11:59:55.0 2009/3/1 11:59:59.0 + +echo select f1,f2,min(f4),min(f7),min(f8),min(f9) from t1 where f1 >= 12 and f1<15 group by f1,f2 having min(f9)>='2009-03-03 11:59:59'; +--------------------------------------------------------- + f1 f2 MIN(f4) MIN(f7) MIN(f8) MIN(f9) +--------------------------------------------------------- + 12 120 Nihar 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 Kishor 2009/3/4 11:59:56.0 2009/3/4 11:59:59.0 + +echo select f1,f2,min(f4),min(f7),min(f8),min(f9) from t1 where f1 >= 12 and f1<15 group by f1,f2 having min(f4)>='K' and min(f8) <'11:59:56'; +--------------------------------------------------------- + f1 f2 MIN(f4) MIN(f7) MIN(f8) MIN(f9) +--------------------------------------------------------- + 14 100 Praba 2009/3/1 11:59:55.0 2009/3/1 11:59:59.0 + +echo select f1,f2,min(f4),min(f7),min(f8),min(f9) from t1 where f1 >= 12 and f2<130 group by f1,f2 ; +--------------------------------------------------------- + f1 f2 MIN(f4) MIN(f7) MIN(f8) MIN(f9) +--------------------------------------------------------- + 12 120 Nihar 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 14 100 Praba 2009/3/1 11:59:55.0 2009/3/1 11:59:59.0 + 15 110 Sanjit 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 + 16 120 Sanjay 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 + +echo select f1,f2,min(f4),min(f7),min(f8),min(f9) from t1 where f1 >= 12 and f2<130 group by f1,f2 having min(f7)>='2009/3/2' and min(f9)<>'2009-03-01 11:59:59'; +--------------------------------------------------------- + f1 f2 MIN(f4) MIN(f7) MIN(f8) MIN(f9) +--------------------------------------------------------- + 12 120 Nihar 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 16 120 Sanjay 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 + +echo select f7,f8,f9,min(f4) from t1 group by f7,f8,f9; +--------------------------------------------------------- + f7 f8 f9 MIN(f4) +--------------------------------------------------------- + 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 Arindam + 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 Jitendr + 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 Nihar + 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 Kishor + 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 Praba + 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 Sanjit + 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 Sanjay + 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 Arindam + 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 Bijay + 2009/3/3 NULL 2009/3/3 11:59:59.0 Nihar + 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 Kishor + 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 Praba + 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 Sanjit + 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 Sanjay + +echo select f9,f7,f8,min(f4) from t1 group by f7,f8,f9; +--------------------------------------------------------- + f9 f7 f8 MIN(f4) +--------------------------------------------------------- + 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 Arindam + 2009/3/2 11:59:59.0 2009/3/2 11:59:58.0 Jitendr + 2009/3/3 11:59:59.0 2009/3/3 11:59:57.0 Nihar + 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 Kishor + 2009/3/1 11:59:59.0 2009/3/1 11:59:58.0 Praba + 2009/3/2 11:59:59.0 2009/3/2 11:59:57.0 Sanjit + 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 Sanjay + 2009/3/4 11:59:59.0 2009/3/4 11:59:58.0 Arindam + 2009/3/1 11:59:59.0 2009/3/1 11:59:57.0 Bijay + 2009/3/3 11:59:59.0 2009/3/3 NULL Nihar + 2009/3/5 11:59:59.0 2009/3/5 11:59:56.0 Kishor + 2009/3/4 11:59:59.0 2009/3/1 11:59:55.0 Praba + 2009/3/1 11:59:59.0 2009/3/2 11:59:56.0 Sanjit + 2009/3/3 11:59:59.0 2009/3/3 11:59:55.0 Sanjay + +echo select f7,f8,f9,min(f4) from t1 group by f7,f9,f8; +--------------------------------------------------------- + f7 f8 f9 MIN(f4) +--------------------------------------------------------- + 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 Arindam + 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 Jitendr + 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 Nihar + 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 Kishor + 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 Praba + 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 Sanjit + 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 Sanjay + 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 Arindam + 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 Bijay + 2009/3/3 NULL 2009/3/3 11:59:59.0 Nihar + 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 Kishor + 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 Praba + 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 Sanjit + 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 Sanjay + +echo select f7,f8,f9,min(f4) from t1 group by f7,f9,f8 having min(f4)>='K' and min(f4) <'Q'; +--------------------------------------------------------- + f7 f8 f9 MIN(f4) +--------------------------------------------------------- + 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 Nihar + 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 Kishor + 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 Praba + 2009/3/3 NULL 2009/3/3 11:59:59.0 Nihar + 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 Kishor + 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 Praba + +echo select f4,f8,f9,min(f7) from t1 group by f4,f8,f9; +--------------------------------------------------------- + f4 f8 f9 MIN(f7) +--------------------------------------------------------- + Bijay 11:59:59.0 2009/3/1 11:59:59.0 2009/3/1 + Jitendr 11:59:58.0 2009/3/2 11:59:59.0 2009/3/2 + Nihar 11:59:57.0 2009/3/3 11:59:59.0 2009/3/3 + Kishor 11:59:59.0 2009/3/4 11:59:59.0 2009/3/4 + Praba 11:59:58.0 2009/3/1 11:59:59.0 2009/3/1 + Sanjit 11:59:57.0 2009/3/2 11:59:59.0 2009/3/2 + Sanjay 11:59:59.0 2009/3/3 11:59:59.0 2009/3/3 + Arindam 11:59:58.0 2009/3/4 11:59:59.0 2009/3/4 + Bijay 11:59:57.0 2009/3/1 11:59:59.0 2009/3/1 + Nihar NULL 2009/3/3 11:59:59.0 2009/3/3 + Kishor 11:59:56.0 2009/3/5 11:59:59.0 2009/3/5 + Praba 11:59:55.0 2009/3/4 11:59:59.0 2009/3/1 + Sanjit 11:59:56.0 2009/3/1 11:59:59.0 2009/3/2 + Sanjay 11:59:55.0 2009/3/3 11:59:59.0 2009/3/3 + Arindam 11:59:59.0 2009/3/1 11:59:59.0 2009/3/1 + +echo select f4,f8,f9,min(f7) from t1 group by f4,f8,f9 having min(f7)<='2009-03-04' and min(f7) >'2009-03-02' ; +--------------------------------------------------------- + f4 f8 f9 MIN(f7) +--------------------------------------------------------- + Nihar 11:59:57.0 2009/3/3 11:59:59.0 2009/3/3 + Kishor 11:59:59.0 2009/3/4 11:59:59.0 2009/3/4 + Sanjay 11:59:59.0 2009/3/3 11:59:59.0 2009/3/3 + Arindam 11:59:58.0 2009/3/4 11:59:59.0 2009/3/4 + Nihar NULL 2009/3/3 11:59:59.0 2009/3/3 + Sanjay 11:59:55.0 2009/3/3 11:59:59.0 2009/3/3 + +echo select f9,f7,f4,min(f8) from t1 group by f4,f7,f9; +--------------------------------------------------------- + f9 f7 f4 MIN(f8) +--------------------------------------------------------- + 2009/3/1 11:59:59.0 2009/3/1 Bijay 11:59:57.0 + 2009/3/2 11:59:59.0 2009/3/2 Jitendr 11:59:58.0 + 2009/3/3 11:59:59.0 2009/3/3 Nihar 11:59:57.0 + 2009/3/4 11:59:59.0 2009/3/4 Kishor 11:59:59.0 + 2009/3/1 11:59:59.0 2009/3/1 Praba 11:59:58.0 + 2009/3/2 11:59:59.0 2009/3/2 Sanjit 11:59:57.0 + 2009/3/3 11:59:59.0 2009/3/3 Sanjay 11:59:55.0 + 2009/3/4 11:59:59.0 2009/3/4 Arindam 11:59:58.0 + 2009/3/5 11:59:59.0 2009/3/5 Kishor 11:59:56.0 + 2009/3/4 11:59:59.0 2009/3/1 Praba 11:59:55.0 + 2009/3/1 11:59:59.0 2009/3/2 Sanjit 11:59:56.0 + 2009/3/1 11:59:59.0 2009/3/1 Arindam 11:59:59.0 + +echo select f9,f7,f4,min(f8) from t1 group by f4,f7,f9 having min(f8)<='11:59:59' and min(f8) >'11:59:57' ; +--------------------------------------------------------- + f9 f7 f4 MIN(f8) +--------------------------------------------------------- + 2009/3/2 11:59:59.0 2009/3/2 Jitendr 11:59:58.0 + 2009/3/4 11:59:59.0 2009/3/4 Kishor 11:59:59.0 + 2009/3/1 11:59:59.0 2009/3/1 Praba 11:59:58.0 + 2009/3/4 11:59:59.0 2009/3/4 Arindam 11:59:58.0 + 2009/3/1 11:59:59.0 2009/3/1 Arindam 11:59:59.0 + +echo select f7,f8,f4,min(f9) from t1 group by f4,f7,f8; +--------------------------------------------------------- + f7 f8 f4 MIN(f9) +--------------------------------------------------------- + 2009/3/1 11:59:59.0 Bijay 2009/3/1 11:59:59.0 + 2009/3/2 11:59:58.0 Jitendr 2009/3/2 11:59:59.0 + 2009/3/3 11:59:57.0 Nihar 2009/3/3 11:59:59.0 + 2009/3/4 11:59:59.0 Kishor 2009/3/4 11:59:59.0 + 2009/3/1 11:59:58.0 Praba 2009/3/1 11:59:59.0 + 2009/3/2 11:59:57.0 Sanjit 2009/3/2 11:59:59.0 + 2009/3/3 11:59:59.0 Sanjay 2009/3/3 11:59:59.0 + 2009/3/4 11:59:58.0 Arindam 2009/3/4 11:59:59.0 + 2009/3/1 11:59:57.0 Bijay 2009/3/1 11:59:59.0 + 2009/3/3 NULL Nihar 2009/3/3 11:59:59.0 + 2009/3/5 11:59:56.0 Kishor 2009/3/5 11:59:59.0 + 2009/3/1 11:59:55.0 Praba 2009/3/4 11:59:59.0 + 2009/3/2 11:59:56.0 Sanjit 2009/3/1 11:59:59.0 + 2009/3/3 11:59:55.0 Sanjay 2009/3/3 11:59:59.0 + 2009/3/1 11:59:59.0 Arindam 2009/3/1 11:59:59.0 + +echo select f7,f8,f4,min(f9) from t1 group by f4,f7,f8 having min(f9)<='2009-03-05 11:59:59' and min(f9) >'2009-03-02 11:59:59' ; +--------------------------------------------------------- + f7 f8 f4 MIN(f9) +--------------------------------------------------------- + 2009/3/3 11:59:57.0 Nihar 2009/3/3 11:59:59.0 + 2009/3/4 11:59:59.0 Kishor 2009/3/4 11:59:59.0 + 2009/3/3 11:59:59.0 Sanjay 2009/3/3 11:59:59.0 + 2009/3/4 11:59:58.0 Arindam 2009/3/4 11:59:59.0 + 2009/3/3 NULL Nihar 2009/3/3 11:59:59.0 + 2009/3/5 11:59:56.0 Kishor 2009/3/5 11:59:59.0 + 2009/3/1 11:59:55.0 Praba 2009/3/4 11:59:59.0 + 2009/3/3 11:59:55.0 Sanjay 2009/3/3 11:59:59.0 + +Statement Executed diff --git a/test/sql/Aggregate/exp.test034.ksh b/test/sql/Aggregate/exp.test034.ksh new file mode 100644 index 00000000..7b081f4d --- /dev/null +++ b/test/sql/Aggregate/exp.test034.ksh @@ -0,0 +1,285 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 t1.f5 t1.f6 t1.f7 t1.f8 t1.f9 +--------------------------------------------------------- + 10 100 1000 Bijay 1000.000000 100000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + 11 110 1100 Jitendr 2000.000000 200000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 12 120 1000 Nihar 3000.000000 300000.000000 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 NULL Kishor 4000.000000 400000.000000 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 + 14 100 1000 Praba 5000.000000 500000.000000 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 + 15 110 1100 Sanjit 6000.000000 600000.000000 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 + 16 120 1000 Sanjay NULL 700000.000000 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 + 17 130 1100 Arindam 8000.000000 800000.000000 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 + 10 100 1000 Bijay 9000.000000 900000.000000 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 + 11 NULL 1100 Jitendr 1000.000000 100000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 12 120 1000 Nihar 2000.000000 200000.000000 2009/3/3 NULL 2009/3/3 11:59:59.0 + 13 130 1100 Kishor 3000.000000 300000.000000 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 + 14 100 1000 Praba 4000.000000 400000.000000 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 + 15 110 NULL Sanjit 5000.000000 500000.000000 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 + 16 120 1000 Sanjay 6000.000000 600000.000000 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 + 17 130 1100 Arindam 7000.000000 700000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + +echo select f1,f2,max(f4),max(f7),max(f8),max(f9) from t1 group by f1,f2; +--------------------------------------------------------- + f1 f2 MAX(f4) MAX(f7) MAX(f8) MAX(f9) +--------------------------------------------------------- + 10 100 Bijay 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + 11 110 Jitendr 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 12 120 Nihar 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 Kishor 2009/3/5 11:59:59.0 2009/3/5 11:59:59.0 + 14 100 Praba 2009/3/1 11:59:58.0 2009/3/4 11:59:59.0 + 15 110 Sanjit 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 + 16 120 Sanjay 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 + 17 130 Arindam 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 + 11 NULL Jitendr 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + +echo select f1,f2,max(f4),max(f7),max(f8),max(f9) from t1 group by f1,f2 having max(f4)>='K'; +--------------------------------------------------------- + f1 f2 MAX(f4) MAX(f7) MAX(f8) MAX(f9) +--------------------------------------------------------- + 12 120 Nihar 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 Kishor 2009/3/5 11:59:59.0 2009/3/5 11:59:59.0 + 14 100 Praba 2009/3/1 11:59:58.0 2009/3/4 11:59:59.0 + 15 110 Sanjit 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 + 16 120 Sanjay 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 + +echo select f1,f2,max(f4),max(f7),max(f8),max(f9) from t1 where f1 >= 12 group by f1,f2; +--------------------------------------------------------- + f1 f2 MAX(f4) MAX(f7) MAX(f8) MAX(f9) +--------------------------------------------------------- + 12 120 Nihar 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 Kishor 2009/3/5 11:59:59.0 2009/3/5 11:59:59.0 + 14 100 Praba 2009/3/1 11:59:58.0 2009/3/4 11:59:59.0 + 15 110 Sanjit 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 + 16 120 Sanjay 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 + 17 130 Arindam 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 + +echo select f1,f2,max(f4),max(f7),max(f8),max(f9) from t1 where f1 >= 12 group by f1,f2 having max(f8)>='11:59:55'; +--------------------------------------------------------- + f1 f2 MAX(f4) MAX(f7) MAX(f8) MAX(f9) +--------------------------------------------------------- + 12 120 Nihar 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 Kishor 2009/3/5 11:59:59.0 2009/3/5 11:59:59.0 + 14 100 Praba 2009/3/1 11:59:58.0 2009/3/4 11:59:59.0 + 15 110 Sanjit 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 + 16 120 Sanjay 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 + 17 130 Arindam 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 + +echo select f1,f2,max(f4),max(f7),max(f8),max(f9) from t1 where f1 >= 12 and f1<15 group by f1,f2; +--------------------------------------------------------- + f1 f2 MAX(f4) MAX(f7) MAX(f8) MAX(f9) +--------------------------------------------------------- + 12 120 Nihar 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 Kishor 2009/3/5 11:59:59.0 2009/3/5 11:59:59.0 + 14 100 Praba 2009/3/1 11:59:58.0 2009/3/4 11:59:59.0 + +echo select f1,f2,max(f4),max(f7),max(f8),max(f9) from t1 where f1 >= 12 and f1<15 group by f1,f2 having max(f9)>='2009-03-03 11:59:59'; +--------------------------------------------------------- + f1 f2 MAX(f4) MAX(f7) MAX(f8) MAX(f9) +--------------------------------------------------------- + 12 120 Nihar 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 Kishor 2009/3/5 11:59:59.0 2009/3/5 11:59:59.0 + 14 100 Praba 2009/3/1 11:59:58.0 2009/3/4 11:59:59.0 + +echo select f1,f2,max(f4),max(f7),max(f8),max(f9) from t1 where f1 >= 12 and f1<15 group by f1,f2 having max(f4)>='K' and max(f8) <'11:59:58'; +--------------------------------------------------------- + f1 f2 MAX(f4) MAX(f7) MAX(f8) MAX(f9) +--------------------------------------------------------- + 12 120 Nihar 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + +echo select f1,f2,max(f4),max(f7),max(f8),max(f9) from t1 where f1 >= 12 and f2<130 group by f1,f2 ; +--------------------------------------------------------- + f1 f2 MAX(f4) MAX(f7) MAX(f8) MAX(f9) +--------------------------------------------------------- + 12 120 Nihar 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 14 100 Praba 2009/3/1 11:59:58.0 2009/3/4 11:59:59.0 + 15 110 Sanjit 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 + 16 120 Sanjay 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 + +echo select f1,f2,max(f4),max(f7),max(f8),max(f9) from t1 where f1 >= 12 and f2<130 group by f1,f2 having max(f7)>='2009/3/2' and max(f9)<>'2009-03-01 11:59:59'; +--------------------------------------------------------- + f1 f2 MAX(f4) MAX(f7) MAX(f8) MAX(f9) +--------------------------------------------------------- + 12 120 Nihar 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 15 110 Sanjit 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 + 16 120 Sanjay 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 + +echo select f7,f8,f9,max(f4) from t1 group by f7,f8,f9; +--------------------------------------------------------- + f7 f8 f9 MAX(f4) +--------------------------------------------------------- + 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 Bijay + 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 Jitendr + 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 Nihar + 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 Kishor + 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 Praba + 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 Sanjit + 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 Sanjay + 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 Arindam + 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 Bijay + 2009/3/3 NULL 2009/3/3 11:59:59.0 Nihar + 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 Kishor + 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 Praba + 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 Sanjit + 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 Sanjay + +echo select f9,f7,f8,max(f4) from t1 group by f7,f8,f9; +--------------------------------------------------------- + f9 f7 f8 MAX(f4) +--------------------------------------------------------- + 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 Bijay + 2009/3/2 11:59:59.0 2009/3/2 11:59:58.0 Jitendr + 2009/3/3 11:59:59.0 2009/3/3 11:59:57.0 Nihar + 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 Kishor + 2009/3/1 11:59:59.0 2009/3/1 11:59:58.0 Praba + 2009/3/2 11:59:59.0 2009/3/2 11:59:57.0 Sanjit + 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 Sanjay + 2009/3/4 11:59:59.0 2009/3/4 11:59:58.0 Arindam + 2009/3/1 11:59:59.0 2009/3/1 11:59:57.0 Bijay + 2009/3/3 11:59:59.0 2009/3/3 NULL Nihar + 2009/3/5 11:59:59.0 2009/3/5 11:59:56.0 Kishor + 2009/3/4 11:59:59.0 2009/3/1 11:59:55.0 Praba + 2009/3/1 11:59:59.0 2009/3/2 11:59:56.0 Sanjit + 2009/3/3 11:59:59.0 2009/3/3 11:59:55.0 Sanjay + +echo select f7,f8,f9,max(f4) from t1 group by f7,f9,f8; +--------------------------------------------------------- + f7 f8 f9 MAX(f4) +--------------------------------------------------------- + 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 Bijay + 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 Jitendr + 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 Nihar + 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 Kishor + 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 Praba + 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 Sanjit + 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 Sanjay + 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 Arindam + 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 Bijay + 2009/3/3 NULL 2009/3/3 11:59:59.0 Nihar + 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 Kishor + 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 Praba + 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 Sanjit + 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 Sanjay + +echo select f7,f8,f9,max(f4) from t1 group by f7,f9,f8 having max(f4)>='K' and max(f4) <'Q'; +--------------------------------------------------------- + f7 f8 f9 MAX(f4) +--------------------------------------------------------- + 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 Nihar + 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 Kishor + 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 Praba + 2009/3/3 NULL 2009/3/3 11:59:59.0 Nihar + 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 Kishor + 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 Praba + +echo select f4,f8,f9,max(f7) from t1 group by f4,f8,f9; +--------------------------------------------------------- + f4 f8 f9 MAX(f7) +--------------------------------------------------------- + Bijay 11:59:59.0 2009/3/1 11:59:59.0 2009/3/1 + Jitendr 11:59:58.0 2009/3/2 11:59:59.0 2009/3/2 + Nihar 11:59:57.0 2009/3/3 11:59:59.0 2009/3/3 + Kishor 11:59:59.0 2009/3/4 11:59:59.0 2009/3/4 + Praba 11:59:58.0 2009/3/1 11:59:59.0 2009/3/1 + Sanjit 11:59:57.0 2009/3/2 11:59:59.0 2009/3/2 + Sanjay 11:59:59.0 2009/3/3 11:59:59.0 2009/3/3 + Arindam 11:59:58.0 2009/3/4 11:59:59.0 2009/3/4 + Bijay 11:59:57.0 2009/3/1 11:59:59.0 2009/3/1 + Nihar NULL 2009/3/3 11:59:59.0 2009/3/3 + Kishor 11:59:56.0 2009/3/5 11:59:59.0 2009/3/5 + Praba 11:59:55.0 2009/3/4 11:59:59.0 2009/3/1 + Sanjit 11:59:56.0 2009/3/1 11:59:59.0 2009/3/2 + Sanjay 11:59:55.0 2009/3/3 11:59:59.0 2009/3/3 + Arindam 11:59:59.0 2009/3/1 11:59:59.0 2009/3/1 + +echo select f4,f8,f9,max(f7) from t1 group by f4,f8,f9 having max(f7)<='2009-03-04' and max(f7) >'2009-03-02' ; +--------------------------------------------------------- + f4 f8 f9 MAX(f7) +--------------------------------------------------------- + Nihar 11:59:57.0 2009/3/3 11:59:59.0 2009/3/3 + Kishor 11:59:59.0 2009/3/4 11:59:59.0 2009/3/4 + Sanjay 11:59:59.0 2009/3/3 11:59:59.0 2009/3/3 + Arindam 11:59:58.0 2009/3/4 11:59:59.0 2009/3/4 + Nihar NULL 2009/3/3 11:59:59.0 2009/3/3 + Sanjay 11:59:55.0 2009/3/3 11:59:59.0 2009/3/3 + +echo select f9,f7,f4,max(f8) from t1 group by f4,f7,f9; +--------------------------------------------------------- + f9 f7 f4 MAX(f8) +--------------------------------------------------------- + 2009/3/1 11:59:59.0 2009/3/1 Bijay 11:59:59.0 + 2009/3/2 11:59:59.0 2009/3/2 Jitendr 11:59:58.0 + 2009/3/3 11:59:59.0 2009/3/3 Nihar 11:59:57.0 + 2009/3/4 11:59:59.0 2009/3/4 Kishor 11:59:59.0 + 2009/3/1 11:59:59.0 2009/3/1 Praba 11:59:58.0 + 2009/3/2 11:59:59.0 2009/3/2 Sanjit 11:59:57.0 + 2009/3/3 11:59:59.0 2009/3/3 Sanjay 11:59:59.0 + 2009/3/4 11:59:59.0 2009/3/4 Arindam 11:59:58.0 + 2009/3/5 11:59:59.0 2009/3/5 Kishor 11:59:56.0 + 2009/3/4 11:59:59.0 2009/3/1 Praba 11:59:55.0 + 2009/3/1 11:59:59.0 2009/3/2 Sanjit 11:59:56.0 + 2009/3/1 11:59:59.0 2009/3/1 Arindam 11:59:59.0 + +echo select f9,f7,f4,max(f8) from t1 group by f4,f7,f9 having max(f8)<='11:59:59' and max(f8) >'11:59:57' ; +--------------------------------------------------------- + f9 f7 f4 MAX(f8) +--------------------------------------------------------- + 2009/3/1 11:59:59.0 2009/3/1 Bijay 11:59:59.0 + 2009/3/2 11:59:59.0 2009/3/2 Jitendr 11:59:58.0 + 2009/3/4 11:59:59.0 2009/3/4 Kishor 11:59:59.0 + 2009/3/1 11:59:59.0 2009/3/1 Praba 11:59:58.0 + 2009/3/3 11:59:59.0 2009/3/3 Sanjay 11:59:59.0 + 2009/3/4 11:59:59.0 2009/3/4 Arindam 11:59:58.0 + 2009/3/1 11:59:59.0 2009/3/1 Arindam 11:59:59.0 + +echo select f7,f8,f4,max(f9) from t1 group by f4,f7,f8; +--------------------------------------------------------- + f7 f8 f4 MAX(f9) +--------------------------------------------------------- + 2009/3/1 11:59:59.0 Bijay 2009/3/1 11:59:59.0 + 2009/3/2 11:59:58.0 Jitendr 2009/3/2 11:59:59.0 + 2009/3/3 11:59:57.0 Nihar 2009/3/3 11:59:59.0 + 2009/3/4 11:59:59.0 Kishor 2009/3/4 11:59:59.0 + 2009/3/1 11:59:58.0 Praba 2009/3/1 11:59:59.0 + 2009/3/2 11:59:57.0 Sanjit 2009/3/2 11:59:59.0 + 2009/3/3 11:59:59.0 Sanjay 2009/3/3 11:59:59.0 + 2009/3/4 11:59:58.0 Arindam 2009/3/4 11:59:59.0 + 2009/3/1 11:59:57.0 Bijay 2009/3/1 11:59:59.0 + 2009/3/3 NULL Nihar 2009/3/3 11:59:59.0 + 2009/3/5 11:59:56.0 Kishor 2009/3/5 11:59:59.0 + 2009/3/1 11:59:55.0 Praba 2009/3/4 11:59:59.0 + 2009/3/2 11:59:56.0 Sanjit 2009/3/1 11:59:59.0 + 2009/3/3 11:59:55.0 Sanjay 2009/3/3 11:59:59.0 + 2009/3/1 11:59:59.0 Arindam 2009/3/1 11:59:59.0 + +echo select f7,f8,f4,max(f9) from t1 group by f4,f7,f8 having max(f9)<='2009-03-05 11:59:59' and max(f9) >'2009-03-02 11:59:59' ; +--------------------------------------------------------- + f7 f8 f4 MAX(f9) +--------------------------------------------------------- + 2009/3/3 11:59:57.0 Nihar 2009/3/3 11:59:59.0 + 2009/3/4 11:59:59.0 Kishor 2009/3/4 11:59:59.0 + 2009/3/3 11:59:59.0 Sanjay 2009/3/3 11:59:59.0 + 2009/3/4 11:59:58.0 Arindam 2009/3/4 11:59:59.0 + 2009/3/3 NULL Nihar 2009/3/3 11:59:59.0 + 2009/3/5 11:59:56.0 Kishor 2009/3/5 11:59:59.0 + 2009/3/1 11:59:55.0 Praba 2009/3/4 11:59:59.0 + 2009/3/3 11:59:55.0 Sanjay 2009/3/3 11:59:59.0 + +Statement Executed diff --git a/test/sql/Aggregate/exp.test035.ksh b/test/sql/Aggregate/exp.test035.ksh new file mode 100644 index 00000000..af162acc --- /dev/null +++ b/test/sql/Aggregate/exp.test035.ksh @@ -0,0 +1,275 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 t1.f5 t1.f6 t1.f7 t1.f8 t1.f9 +--------------------------------------------------------- + 10 100 1000 Bijay 1000.000000 100000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + 11 110 1100 Jitendr 2000.000000 200000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 12 120 1000 Nihar 3000.000000 300000.000000 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 NULL Kishor 4000.000000 400000.000000 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 + 14 100 1000 Praba 5000.000000 500000.000000 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 + 15 110 1100 Sanjit 6000.000000 600000.000000 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 + 16 120 1000 Sanjay NULL 700000.000000 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 + 17 130 1100 Arindam 8000.000000 800000.000000 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 + 10 100 1000 Bijay 9000.000000 900000.000000 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 + 11 NULL 1100 Jitendr 1000.000000 100000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 12 120 1000 Nihar 2000.000000 200000.000000 2009/3/3 NULL 2009/3/3 11:59:59.0 + 13 130 1100 Kishor 3000.000000 300000.000000 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 + 14 100 1000 Praba 4000.000000 400000.000000 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 + 15 110 NULL Sanjit 5000.000000 500000.000000 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 + 16 120 1000 Sanjay 6000.000000 600000.000000 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 + 17 130 1100 Arindam 7000.000000 700000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + +echo select f1,f2,count(f4),count(f7),count(f8),count(f9) from t1 group by f1,f2; +--------------------------------------------------------- + f1 f2 COUNT(f4) COUNT(f7) COUNT(f8) COUNT(f9) +--------------------------------------------------------- + 10 100 2 2 2 2 + 11 110 1 1 1 1 + 12 120 2 2 1 2 + 13 130 2 2 2 2 + 14 100 2 2 2 2 + 15 110 2 2 2 2 + 16 120 2 2 2 2 + 17 130 2 2 2 2 + 11 NULL 1 1 1 1 + +echo select f1,f2,count(f4),count(f7),count(f8),count(f9) from t1 group by f1,f2 having count(f4)>=2; +--------------------------------------------------------- + f1 f2 COUNT(f4) COUNT(f7) COUNT(f8) COUNT(f9) +--------------------------------------------------------- + 10 100 2 2 2 2 + 12 120 2 2 1 2 + 13 130 2 2 2 2 + 14 100 2 2 2 2 + 15 110 2 2 2 2 + 16 120 2 2 2 2 + 17 130 2 2 2 2 + +echo select f1,f2,count(f4),count(f7),count(f8),count(f9) from t1 where f1 >= 12 group by f1,f2; +--------------------------------------------------------- + f1 f2 COUNT(f4) COUNT(f7) COUNT(f8) COUNT(f9) +--------------------------------------------------------- + 12 120 2 2 1 2 + 13 130 2 2 2 2 + 14 100 2 2 2 2 + 15 110 2 2 2 2 + 16 120 2 2 2 2 + 17 130 2 2 2 2 + +echo select f1,f2,count(f4),count(f7),count(f8),count(f9) from t1 where f1 >= 12 group by f1,f2 having count(f8)>=1; +--------------------------------------------------------- + f1 f2 COUNT(f4) COUNT(f7) COUNT(f8) COUNT(f9) +--------------------------------------------------------- + 12 120 2 2 1 2 + 13 130 2 2 2 2 + 14 100 2 2 2 2 + 15 110 2 2 2 2 + 16 120 2 2 2 2 + 17 130 2 2 2 2 + +echo select f1,f2,count(f4),count(f7),count(f8),count(f9) from t1 where f1 >= 12 and f1<15 group by f1,f2; +--------------------------------------------------------- + f1 f2 COUNT(f4) COUNT(f7) COUNT(f8) COUNT(f9) +--------------------------------------------------------- + 12 120 2 2 1 2 + 13 130 2 2 2 2 + 14 100 2 2 2 2 + +echo select f1,f2,count(f4),count(f7),count(f8),count(f9) from t1 where f1 >= 12 and f1<15 group by f1,f2 having count(f9)>=2; +--------------------------------------------------------- + f1 f2 COUNT(f4) COUNT(f7) COUNT(f8) COUNT(f9) +--------------------------------------------------------- + 12 120 2 2 1 2 + 13 130 2 2 2 2 + 14 100 2 2 2 2 + +echo select f1,f2,count(f4),count(f7),count(f8),count(f9) from t1 where f1 >= 12 and f1<15 group by f1,f2 having count(f4)>=2 and count(f8) <2; +--------------------------------------------------------- + f1 f2 COUNT(f4) COUNT(f7) COUNT(f8) COUNT(f9) +--------------------------------------------------------- + 12 120 2 2 1 2 + +echo select f1,f2,count(f4),count(f7),count(f8),count(f9) from t1 where f1 >= 12 and f2<130 group by f1,f2 ; +--------------------------------------------------------- + f1 f2 COUNT(f4) COUNT(f7) COUNT(f8) COUNT(f9) +--------------------------------------------------------- + 12 120 2 2 1 2 + 14 100 2 2 2 2 + 15 110 2 2 2 2 + 16 120 2 2 2 2 + +echo select f1,f2,count(f4),count(f7),count(f8),count(f9) from t1 where f1 >= 12 and f2<130 group by f1,f2 having count(f7)>=2 and count(f8)<>2; +--------------------------------------------------------- + f1 f2 COUNT(f4) COUNT(f7) COUNT(f8) COUNT(f9) +--------------------------------------------------------- + 12 120 2 2 1 2 + +echo select f7,f8,f9,count(f4) from t1 group by f7,f8,f9; +--------------------------------------------------------- + f7 f8 f9 COUNT(f4) +--------------------------------------------------------- + 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 2 + 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 2 + 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 1 + 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 1 + 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 1 + 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 1 + 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 1 + 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 1 + 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 1 + 2009/3/3 NULL 2009/3/3 11:59:59.0 1 + 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 1 + 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 1 + 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 1 + 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 1 + +echo select f9,f7,f8,count(f4) from t1 group by f7,f8,f9; +--------------------------------------------------------- + f9 f7 f8 COUNT(f4) +--------------------------------------------------------- + 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 2 + 2009/3/2 11:59:59.0 2009/3/2 11:59:58.0 2 + 2009/3/3 11:59:59.0 2009/3/3 11:59:57.0 1 + 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 1 + 2009/3/1 11:59:59.0 2009/3/1 11:59:58.0 1 + 2009/3/2 11:59:59.0 2009/3/2 11:59:57.0 1 + 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 1 + 2009/3/4 11:59:59.0 2009/3/4 11:59:58.0 1 + 2009/3/1 11:59:59.0 2009/3/1 11:59:57.0 1 + 2009/3/3 11:59:59.0 2009/3/3 NULL 1 + 2009/3/5 11:59:59.0 2009/3/5 11:59:56.0 1 + 2009/3/4 11:59:59.0 2009/3/1 11:59:55.0 1 + 2009/3/1 11:59:59.0 2009/3/2 11:59:56.0 1 + 2009/3/3 11:59:59.0 2009/3/3 11:59:55.0 1 + +echo select f7,f8,f9,count(f4) from t1 group by f7,f9,f8; +--------------------------------------------------------- + f7 f8 f9 COUNT(f4) +--------------------------------------------------------- + 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 2 + 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 2 + 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 1 + 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 1 + 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 1 + 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 1 + 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 1 + 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 1 + 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 1 + 2009/3/3 NULL 2009/3/3 11:59:59.0 1 + 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 1 + 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 1 + 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 1 + 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 1 + +echo select f7,f8,f9,count(f4) from t1 group by f7,f9,f8 having count(f4)>=1 and count(f4) <2; +--------------------------------------------------------- + f7 f8 f9 COUNT(f4) +--------------------------------------------------------- + 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 1 + 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 1 + 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 1 + 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 1 + 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 1 + 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 1 + 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 1 + 2009/3/3 NULL 2009/3/3 11:59:59.0 1 + 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 1 + 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 1 + 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 1 + 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 1 + +echo select f4,f8,f9,count(f7) from t1 group by f4,f8,f9; +--------------------------------------------------------- + f4 f8 f9 COUNT(f7) +--------------------------------------------------------- + Bijay 11:59:59.0 2009/3/1 11:59:59.0 1 + Jitendr 11:59:58.0 2009/3/2 11:59:59.0 2 + Nihar 11:59:57.0 2009/3/3 11:59:59.0 1 + Kishor 11:59:59.0 2009/3/4 11:59:59.0 1 + Praba 11:59:58.0 2009/3/1 11:59:59.0 1 + Sanjit 11:59:57.0 2009/3/2 11:59:59.0 1 + Sanjay 11:59:59.0 2009/3/3 11:59:59.0 1 + Arindam 11:59:58.0 2009/3/4 11:59:59.0 1 + Bijay 11:59:57.0 2009/3/1 11:59:59.0 1 + Nihar NULL 2009/3/3 11:59:59.0 1 + Kishor 11:59:56.0 2009/3/5 11:59:59.0 1 + Praba 11:59:55.0 2009/3/4 11:59:59.0 1 + Sanjit 11:59:56.0 2009/3/1 11:59:59.0 1 + Sanjay 11:59:55.0 2009/3/3 11:59:59.0 1 + Arindam 11:59:59.0 2009/3/1 11:59:59.0 1 + +echo select f4,f8,f9,count(f7) from t1 group by f4,f8,f9 having count(f7)<=2 and count(f7) >1 ; +--------------------------------------------------------- + f4 f8 f9 COUNT(f7) +--------------------------------------------------------- + Jitendr 11:59:58.0 2009/3/2 11:59:59.0 2 + +echo select f9,f7,f4,count(f8) from t1 group by f4,f7,f9; +--------------------------------------------------------- + f9 f7 f4 COUNT(f8) +--------------------------------------------------------- + 2009/3/1 11:59:59.0 2009/3/1 Bijay 2 + 2009/3/2 11:59:59.0 2009/3/2 Jitendr 2 + 2009/3/3 11:59:59.0 2009/3/3 Nihar 1 + 2009/3/4 11:59:59.0 2009/3/4 Kishor 1 + 2009/3/1 11:59:59.0 2009/3/1 Praba 1 + 2009/3/2 11:59:59.0 2009/3/2 Sanjit 1 + 2009/3/3 11:59:59.0 2009/3/3 Sanjay 2 + 2009/3/4 11:59:59.0 2009/3/4 Arindam 1 + 2009/3/5 11:59:59.0 2009/3/5 Kishor 1 + 2009/3/4 11:59:59.0 2009/3/1 Praba 1 + 2009/3/1 11:59:59.0 2009/3/2 Sanjit 1 + 2009/3/1 11:59:59.0 2009/3/1 Arindam 1 + +echo select f9,f7,f4,count(f8) from t1 group by f4,f7,f9 having count(f8)<=2 and count(f8) >=2 ; +--------------------------------------------------------- + f9 f7 f4 COUNT(f8) +--------------------------------------------------------- + 2009/3/1 11:59:59.0 2009/3/1 Bijay 2 + 2009/3/2 11:59:59.0 2009/3/2 Jitendr 2 + 2009/3/3 11:59:59.0 2009/3/3 Sanjay 2 + +echo select f7,f8,f4,count(f9) from t1 group by f4,f7,f8; +--------------------------------------------------------- + f7 f8 f4 COUNT(f9) +--------------------------------------------------------- + 2009/3/1 11:59:59.0 Bijay 1 + 2009/3/2 11:59:58.0 Jitendr 2 + 2009/3/3 11:59:57.0 Nihar 1 + 2009/3/4 11:59:59.0 Kishor 1 + 2009/3/1 11:59:58.0 Praba 1 + 2009/3/2 11:59:57.0 Sanjit 1 + 2009/3/3 11:59:59.0 Sanjay 1 + 2009/3/4 11:59:58.0 Arindam 1 + 2009/3/1 11:59:57.0 Bijay 1 + 2009/3/3 NULL Nihar 1 + 2009/3/5 11:59:56.0 Kishor 1 + 2009/3/1 11:59:55.0 Praba 1 + 2009/3/2 11:59:56.0 Sanjit 1 + 2009/3/3 11:59:55.0 Sanjay 1 + 2009/3/1 11:59:59.0 Arindam 1 + +echo select f7,f8,f4,count(f9) from t1 group by f4,f7,f8 having count(f9)<=2 and count(f9) >=2 ; +--------------------------------------------------------- + f7 f8 f4 COUNT(f9) +--------------------------------------------------------- + 2009/3/2 11:59:58.0 Jitendr 2 + +Statement Executed diff --git a/test/sql/Aggregate/exp.test036.ksh b/test/sql/Aggregate/exp.test036.ksh new file mode 100644 index 00000000..4d79b85f --- /dev/null +++ b/test/sql/Aggregate/exp.test036.ksh @@ -0,0 +1,63 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo SELECT * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 +--------------------------------------------------------- + 1 70 Nihar Pital NULL + 2 70 Bijay Sahoo MGR + 3 60 Kisor Ambli Developer + 2 90 Jiten Lenka S/W + 3 80 Papu Paital NULL + 4 90 Bhahmananda MKTING + +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo SELECT * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 +--------------------------------------------------------- + 1 70 Nihar Pital NULL + 2 70 Bijay Sahoo MGR + 3 60 Kisor Ambli Developer + 2 90 Jiten Lenka S/W + 3 80 Papu Paital NULL + 4 90 Bhahmananda MKTING + +echo select t1.f1,t1.f2,count(t1.f4),count(t2.f3) from t1,t2 group by t1.f1,t1.f2 ; +--------------------------------------------------------- + t1.f1 t1.f2 COUNT(t1.f4) COUNT(t2.f3) +--------------------------------------------------------- + 1 70 0 7 + 2 70 7 7 + 3 60 7 7 + 2 90 7 7 + 3 80 0 7 + 4 90 7 7 + +echo select t1.f1,t1.f2,count(t1.f4),count(t2.f3) from t1,t2 group by t1.f1,t1.f2 having count(t1.f4)<6 and count(t2.f3) >=7; +--------------------------------------------------------- + t1.f1 t1.f2 COUNT(t1.f4) COUNT(t2.f3) +--------------------------------------------------------- + 1 70 0 7 + 3 80 0 7 + +echo select t1.f1,t1.f2,count(t1.f3),count(t2.f3) from t1,t2 group by t1.f1,t1.f2 having avg(t1.f2)<70; +--------------------------------------------------------- + t1.f1 t1.f2 COUNT(t1.f3) COUNT(t2.f3) +--------------------------------------------------------- + 3 60 7 7 + +Statement Executed +Statement Executed diff --git a/test/sql/Aggregate/exp.test037.ksh b/test/sql/Aggregate/exp.test037.ksh new file mode 100644 index 00000000..daae16b4 --- /dev/null +++ b/test/sql/Aggregate/exp.test037.ksh @@ -0,0 +1,84 @@ +echo create table emp(id int,name char(20),job char(10),salary double,doj date,deptno int,mgrno int); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from emp; +--------------------------------------------------------- + emp.id emp.name emp.job emp.salary emp.doj emp.deptno emp.mgrno +--------------------------------------------------------- + 1 Allen Sales 10000.000000 2006/3/3 10 4 + 2 Piter IT 10000.000000 2005/3/3 20 3 + 3 Jack Mkting 9000.000000 2006/3/3 30 6 + 4 Tom Clerk 7000.000000 2004/3/3 10 1 + 5 Harry IT 25000.000000 2005/3/3 20 5 + 6 Dick Sales 15000.000000 2005/3/3 30 7 + 7 Boyee Mentain 20000.000000 2005/3/3 20 2 + 3 Jack IT 9000.000000 2006/3/3 30 6 + 2 Piter Mkting 10000.000000 2005/3/3 20 3 + +echo select a.deptno,a.name,b.name from emp as a,emp as b where a.id=b.mgrno; +--------------------------------------------------------- + a.deptno a.name b.name +--------------------------------------------------------- + 10 Allen Tom + 20 Piter Boyee + 30 Jack Piter + 30 Jack Piter + 10 Tom Allen + 20 Harry Harry + 30 Dick Jack + 30 Dick Jack + 20 Boyee Dick + 30 Jack Piter + 30 Jack Piter + 20 Piter Boyee + +echo select a.deptno,a.name,b.name from emp as a,emp as b where a.id=b.mgrno group by a.deptno,a.name,b.name; +--------------------------------------------------------- + a.deptno a.name b.name +--------------------------------------------------------- + 10 Allen Tom + 20 Piter Boyee + 30 Jack Piter + 10 Tom Allen + 20 Harry Harry + 30 Dick Jack + 20 Boyee Dick + +echo select a.deptno,a.name,b.name,count(a.salary),sum(b.salary) from emp as a,emp as b where a.id=b.mgrno group by a.deptno,a.name,b.name; +--------------------------------------------------------- + a.deptno a.name b.name COUNT(a.salary) SUM(b.salary) +--------------------------------------------------------- + 10 Allen Tom 1 7000.000000 + 20 Piter Boyee 2 40000.000000 + 30 Jack Piter 4 40000.000000 + 10 Tom Allen 1 10000.000000 + 20 Harry Harry 1 25000.000000 + 30 Dick Jack 2 18000.000000 + 20 Boyee Dick 1 15000.000000 + +echo select a.deptno,a.name,b.name,count(a.salary),sum(b.salary) from emp as a,emp as b where a.id=b.mgrno group by a.deptno,a.name,b.name having count(a.salary)<2 or count(a.salary)>2; +--------------------------------------------------------- + a.deptno a.name b.name COUNT(a.salary) SUM(b.salary) +--------------------------------------------------------- + 10 Allen Tom 1 7000.000000 + 30 Jack Piter 4 40000.000000 + 10 Tom Allen 1 10000.000000 + 20 Harry Harry 1 25000.000000 + 20 Boyee Dick 1 15000.000000 + +echo select a.deptno,a.name,b.name,count(a.salary),sum(b.salary) from emp as a,emp as b where a.id=b.mgrno group by a.deptno,a.name,b.name having (count(a.salary)<2 or count(a.salary)>2) and sum(b.salary)>15000; +--------------------------------------------------------- + a.deptno a.name b.name COUNT(a.salary) SUM(b.salary) +--------------------------------------------------------- + 30 Jack Piter 4 40000.000000 + 20 Harry Harry 1 25000.000000 + +Statement Executed diff --git a/test/sql/Aggregate/exp.testnw001.ksh b/test/sql/Aggregate/exp.testnw001.ksh new file mode 100644 index 00000000..1c00cbbc --- /dev/null +++ b/test/sql/Aggregate/exp.testnw001.ksh @@ -0,0 +1,33 @@ +Network CSql +echo select count(f1) from t2; +Statement prepare failed with error -5 +echo select count(f1) from t1; +--------------------------------------------------------- + COUNT(f1) +--------------------------------------------------------- + 5 + +echo select sum(f1) from t1; +--------------------------------------------------------- + SUM(f1) +--------------------------------------------------------- + 500 + +echo select avg(f1) from t1; +--------------------------------------------------------- + AVG(f1) +--------------------------------------------------------- + 100.000000 + +echo select min(f1) from t1; +--------------------------------------------------------- + MIN(f1) +--------------------------------------------------------- + 98 + +echo select max(f1) from t1; +--------------------------------------------------------- + MAX(f1) +--------------------------------------------------------- + 102 + diff --git a/test/sql/Aggregate/exp.testnw002.ksh b/test/sql/Aggregate/exp.testnw002.ksh new file mode 100644 index 00000000..b0119423 --- /dev/null +++ b/test/sql/Aggregate/exp.testnw002.ksh @@ -0,0 +1,49 @@ +Network CSql +echo select count(f1) from t1; +--------------------------------------------------------- + COUNT(t1.f1) +--------------------------------------------------------- + 5 + +echo select count(*) from t1 where f4='AAA'; +--------------------------------------------------------- + COUNT(*) +--------------------------------------------------------- + 2 + +echo select sum(f1) from t1; +--------------------------------------------------------- + SUM(t1.f1) +--------------------------------------------------------- + 500 + +echo select avg(f1) from t1; +--------------------------------------------------------- + AVG(t1.f1) +--------------------------------------------------------- + 100.000000 + +echo select min(t1.f1) from t1; +--------------------------------------------------------- + MIN(t1.f1) +--------------------------------------------------------- + 98 + +echo select min(f4) from t1; +--------------------------------------------------------- + MIN(f4) +--------------------------------------------------------- + AAA + +echo select max(t1.f1) from t1; +--------------------------------------------------------- + MAX(t1.f1) +--------------------------------------------------------- + 102 + +echo select max(f4) from t1; +--------------------------------------------------------- + MAX(f4) +--------------------------------------------------------- + CCC + diff --git a/test/sql/Aggregate/exp.testnw004.ksh b/test/sql/Aggregate/exp.testnw004.ksh new file mode 100644 index 00000000..f1e84b45 --- /dev/null +++ b/test/sql/Aggregate/exp.testnw004.ksh @@ -0,0 +1,18 @@ +Network CSql +echo select min(t1.notexist) from t1; +Statement prepare failed with error -19 +echo select max(t1.f1), sum(t2.f1) from t1,t2 where t1.f1 = t2.f1 and t1.f1 <100; +--------------------------------------------------------- + MAX(t1.f1) SUM(t2.f1) +--------------------------------------------------------- + 99 197 + +echo select max(t1.f1), sum(t2.f1) from t1,t2 where t1.f1 = t2.f1 and t1.f1 <100 group by t1.f2; +--------------------------------------------------------- + MAX(t1.f1) SUM(t2.f1) +--------------------------------------------------------- + 98 98 + 99 99 + +echo select max(t1.f1), max(t2.notexist) from t1,t2 group by t1.f2; +Statement prepare failed with error -19 diff --git a/test/sql/Aggregate/exp.testnw005.ksh b/test/sql/Aggregate/exp.testnw005.ksh new file mode 100644 index 00000000..f5fd6406 --- /dev/null +++ b/test/sql/Aggregate/exp.testnw005.ksh @@ -0,0 +1,55 @@ +Network CSql +echo select t1.f2, t1.f1, t2.f1 from t1,t2; +--------------------------------------------------------- + t1.f2 t1.f1 t2.f1 +--------------------------------------------------------- + 1 98 98 + 1 98 99 + 1 98 100 + 1 98 101 + 1 98 102 + 2 99 98 + 2 99 99 + 2 99 100 + 2 99 101 + 2 99 102 + 3 100 98 + 3 100 99 + 3 100 100 + 3 100 101 + 3 100 102 + 4 101 98 + 4 101 99 + 4 101 100 + 4 101 101 + 4 101 102 + 5 102 98 + 5 102 99 + 5 102 100 + 5 102 101 + 5 102 102 + +echo select t1.f2, t1.f1, t2.f1 from t1,t2 group by t1.f2; +Statement prepare failed with error -19 +echo select t1.f2, max(t1.f1), sum(t2.f1) from t1, t2 group by t1.f2; +--------------------------------------------------------- + t1.f2 MAX(t1.f1) SUM(t2.f1) +--------------------------------------------------------- + 1 98 500 + 2 99 500 + 3 100 500 + 4 101 500 + 5 102 500 + +echo select f1, f2 from t1 group by f1,f2; +--------------------------------------------------------- + f1 f2 +--------------------------------------------------------- + 98 1 + 99 2 + 100 3 + 101 4 + 102 5 + +echo select f1, sum(f2) from t1 group by f3; +Statement prepare failed with error -19 diff --git a/test/sql/Aggregate/exp.testnw006.ksh b/test/sql/Aggregate/exp.testnw006.ksh new file mode 100644 index 00000000..8e4ca933 --- /dev/null +++ b/test/sql/Aggregate/exp.testnw006.ksh @@ -0,0 +1,37 @@ +Network CSql +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 +--------------------------------------------------------- + 98 1 10 + 99 2 20 + 100 3 30 + 101 4 40 + 102 5 50 + +echo select min(t1.f2) from t1 group by t1.f1; +--------------------------------------------------------- + MIN(t1.f2) +--------------------------------------------------------- + 1 + 2 + 3 + 4 + 5 + +echo select avg(t1.f2) from t1 group by t1.f1; +--------------------------------------------------------- + AVG(t1.f2) +--------------------------------------------------------- + 1.000000 + 2.000000 + 3.000000 + 4.000000 + 5.000000 + +echo select sum(t1.f2) from t1 group by notexist; +Statement prepare failed with error -19 +echo select sum(t1.f2) from t1 group by t1.notexist; +Statement prepare failed with error -19 +echo select sum(t1.f2) from t1 group by notexist.f1; +Statement prepare failed with error -19 diff --git a/test/sql/Aggregate/exp.testnw007.ksh b/test/sql/Aggregate/exp.testnw007.ksh new file mode 100644 index 00000000..b23b8583 --- /dev/null +++ b/test/sql/Aggregate/exp.testnw007.ksh @@ -0,0 +1,7 @@ +select count(*),min(f1),sum(f1) from t1 : +Network CSql +--------------------------------------------------------- + COUNT(*) MIN(f1) SUM(f1) +--------------------------------------------------------- + 5 98 500 + diff --git a/test/sql/Aggregate/exp.testnw008.ksh b/test/sql/Aggregate/exp.testnw008.ksh new file mode 100644 index 00000000..671092c9 --- /dev/null +++ b/test/sql/Aggregate/exp.testnw008.ksh @@ -0,0 +1,3 @@ +select min(nonexist.f1) from t1 : +Network CSql +Statement prepare failed with error -19 diff --git a/test/sql/Aggregate/exp.testnw009.ksh b/test/sql/Aggregate/exp.testnw009.ksh new file mode 100644 index 00000000..4267b455 --- /dev/null +++ b/test/sql/Aggregate/exp.testnw009.ksh @@ -0,0 +1,3 @@ +select sum(12*f1) where f4='BBB': +Network CSql +Statement prepare failed with error -19 diff --git a/test/sql/Aggregate/exp.testnw010.ksh b/test/sql/Aggregate/exp.testnw010.ksh new file mode 100644 index 00000000..4b2f769f --- /dev/null +++ b/test/sql/Aggregate/exp.testnw010.ksh @@ -0,0 +1,118 @@ +Network CSql +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 +--------------------------------------------------------- + 98 1 10 + 99 NULL 20 + 100 3 30 + 101 4 NULL + 102 5 50 + +--------------------------------------------------------- + t2.f1 t2.f2 t2.f3 +--------------------------------------------------------- + 98 1 10 + 99 2 20 + 100 NULL NULL + 101 4 40 + 102 NULL 50 + +Network CSql +echo select count(f1) from t1; +--------------------------------------------------------- + COUNT(f1) +--------------------------------------------------------- + 5 + +echo select count(f2) from t1; +--------------------------------------------------------- + COUNT(f2) +--------------------------------------------------------- + 4 + +echo select sum(f1) from t1; +--------------------------------------------------------- + SUM(f1) +--------------------------------------------------------- + 500 + +echo select sum(f3) from t1; +--------------------------------------------------------- + SUM(f3) +--------------------------------------------------------- + 110 + +echo select avg(f1) from t1; +--------------------------------------------------------- + AVG(f1) +--------------------------------------------------------- + 100.000000 + +echo select avg(f2) from t1; +--------------------------------------------------------- + AVG(f2) +--------------------------------------------------------- + 3.250000 + +echo select min(f2) from t1; +--------------------------------------------------------- + MIN(f2) +--------------------------------------------------------- + 1 + +echo select max(f3) from t1; +--------------------------------------------------------- + MAX(f3) +--------------------------------------------------------- + 50 + +echo select avg(t1.f2) from t1; +--------------------------------------------------------- + AVG(t1.f2) +--------------------------------------------------------- + 3.250000 + +echo select count(t1.f3) from t1; +--------------------------------------------------------- + COUNT(t1.f3) +--------------------------------------------------------- + 4 + +echo select min(t1.f3) from t1; +--------------------------------------------------------- + MIN(t1.f3) +--------------------------------------------------------- + 10 + +echo select avg(t1.f2), min(f3), count(t1.f1) from t1; +--------------------------------------------------------- + AVG(t1.f2) MIN(f3) COUNT(t1.f1) +--------------------------------------------------------- + 3.250000 10 5 + +echo select avg(t1.f2),avg(t2.f2) from t1,t2; +--------------------------------------------------------- + AVG(t1.f2) AVG(t2.f2) +--------------------------------------------------------- + 3.250000 2.333333 + +echo select avg(t1.f2), min(t2.f2), max(t1.f2), count(t2.f3), sum(t1.f1) from t1,t2; +--------------------------------------------------------- + AVG(t1.f2) MIN(t2.f2) MAX(t1.f2) COUNT(t2.f3) SUM(t1.f1) +--------------------------------------------------------- + 3.250000 1 5 20 2500 + +Statement Executed +Statement Executed diff --git a/test/sql/Aggregate/exp.testnw011.ksh b/test/sql/Aggregate/exp.testnw011.ksh new file mode 100644 index 00000000..6f8ec989 --- /dev/null +++ b/test/sql/Aggregate/exp.testnw011.ksh @@ -0,0 +1,191 @@ +Network CSql +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 +--------------------------------------------------------- + 1 10 100 + 2 20 200 + 3 30 300 + NULL 20 500 + 12 20 500 + 1 NULL 400 + 1 11 500 + 13 30 200 + 14 31 300 + +Network CSql +echo select f3, avg(f1) from t1 group by f3; +--------------------------------------------------------- + f3 AVG(f1) +--------------------------------------------------------- + 100 1.000000 + 200 7.500000 + 300 8.500000 + 500 6.500000 + 400 1.000000 + +echo select f3, min(f2) from t1 group by f3; +--------------------------------------------------------- + f3 MIN(f2) +--------------------------------------------------------- + 100 10 + 200 20 + 300 30 + 500 11 + 400 NULL + +echo select f3, count(f1) from t1 group by f3; +--------------------------------------------------------- + f3 COUNT(f1) +--------------------------------------------------------- + 100 1 + 200 2 + 300 2 + 500 2 + 400 1 + +echo select f3, sum(f2) from t1 group by f3; +--------------------------------------------------------- + f3 SUM(f2) +--------------------------------------------------------- + 100 10 + 200 50 + 300 61 + 500 51 + 400 NULL + +echo select f3, max(f1) from t1 group by f3; +--------------------------------------------------------- + f3 MAX(f1) +--------------------------------------------------------- + 100 1 + 200 13 + 300 14 + 500 12 + 400 1 + +echo select f1, avg(f2) from t1 group by f1; +--------------------------------------------------------- + f1 AVG(f2) +--------------------------------------------------------- + 1 10.500000 + 2 20.000000 + 3 30.000000 + NULL 20.000000 + 12 20.000000 + 13 30.000000 + 14 31.000000 + +echo select f1, count(f3) from t1 group by f1; +--------------------------------------------------------- + f1 COUNT(f3) +--------------------------------------------------------- + 1 3 + 2 1 + 3 1 + NULL 1 + 12 1 + 13 1 + 14 1 + +echo select f1, min(f2) from t1 group by f1; +--------------------------------------------------------- + f1 MIN(f2) +--------------------------------------------------------- + 1 10 + 2 20 + 3 30 + NULL 20 + 12 20 + 13 30 + 14 31 + +echo select f1, sum(f3) from t1 group by f1; +--------------------------------------------------------- + f1 SUM(f3) +--------------------------------------------------------- + 1 1000 + 2 200 + 3 300 + NULL 500 + 12 500 + 13 200 + 14 300 + +echo select f1, max(f1) from t1 group by f1; +--------------------------------------------------------- + f1 MAX(f1) +--------------------------------------------------------- + 1 1 + 2 2 + 3 3 + NULL NULL + 12 12 + 13 13 + 14 14 + +echo select f2, avg(f2) from t1 group by f2; +--------------------------------------------------------- + f2 AVG(f2) +--------------------------------------------------------- + 10 10.000000 + 20 20.000000 + 30 30.000000 + NULL NULL + 11 11.000000 + 31 31.000000 + +echo select f2, count(f2) from t1 group by f2; +--------------------------------------------------------- + f2 COUNT(f2) +--------------------------------------------------------- + 10 1 + 20 3 + 30 2 + NULL 0 + 11 1 + 31 1 + +echo select f2, min(f2) from t1 group by f2; +--------------------------------------------------------- + f2 MIN(f2) +--------------------------------------------------------- + 10 10 + 20 20 + 30 30 + NULL NULL + 11 11 + 31 31 + +echo select f2, sum(f2) from t1 group by f2; +--------------------------------------------------------- + f2 SUM(f2) +--------------------------------------------------------- + 10 10 + 20 60 + 30 60 + NULL NULL + 11 11 + 31 31 + +echo select f2, max(f2) from t1 group by f2; +--------------------------------------------------------- + f2 MAX(f2) +--------------------------------------------------------- + 10 10 + 20 20 + 30 30 + NULL NULL + 11 11 + 31 31 + +Statement Executed diff --git a/test/sql/Aggregate/exp.testnw012.ksh b/test/sql/Aggregate/exp.testnw012.ksh new file mode 100644 index 00000000..5a1b65c8 --- /dev/null +++ b/test/sql/Aggregate/exp.testnw012.ksh @@ -0,0 +1,82 @@ +Network CSql +echo CREATE TABLE t1(f1 int,f2 int,f3 char(15)); +Statement Executed +echo INSERT INTO t1 VALUES(1,70,'Nihar Pital'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(2,70,'Bijay Sahoo'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(3,60,'Kisor Ambli'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(2,90,'Jiten Lenka'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(3,80,'Papu Paital'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(1,80,'Bijay Sahoo'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(2,70,'Jiten Lenka'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(1,70,'Bijay Sahoo'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(2,70,'Bijay Sahoo'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(3,60,'Papu Paital'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(1,70,'Nihar Pital'); +Statement Executed: Rows Affected = 1 +echo SELECT * FROM t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 +--------------------------------------------------------- + 1 70 Nihar Pital + 2 70 Bijay Sahoo + 3 60 Kisor Ambli + 2 91 Jiten Lenka + 3 81 Papu Paital + 1 80 Bijay Sahoo + 2 70 Jiten Lenka + 1 72 Bijay Sahoo + 2 70 Bijay Sahoo + 3 60 Papu Paital + 1 71 Nihar Pital + +echo SELECT f1,sum(f2),count(f2),avg(f2),min(f2),max(f2),count(f3) from t1 GROUP BY f1; +--------------------------------------------------------- + f1 SUM(f2) COUNT(f2) AVG(f2) MIN(f2) MAX(f2) COUNT(f3) +--------------------------------------------------------- + 1 293 4 73.250000 70 80 4 + 2 301 4 75.250000 70 91 4 + 3 201 3 67.000000 60 81 3 + +echo SELECT f3,count(f1),sum(f2),count(f2),avg(f2),min(f2),max(f2) from t1 GROUP BY f3; +--------------------------------------------------------- + f3 COUNT(f1) SUM(f2) COUNT(f2) AVG(f2) MIN(f2) MAX(f2) +--------------------------------------------------------- + Nihar Pital 2 141 2 70.500000 70 71 + Bijay Sahoo 4 292 4 73.000000 70 80 + Kisor Ambli 1 60 1 60.000000 60 60 + Jiten Lenka 2 161 2 80.500000 70 91 + Papu Paital 2 141 2 70.500000 60 81 + +echo SELECT f1,sum(f2),count(f2),avg(f2),min(f2),max(f2) from t1 GROUP BY f1,f3; +--------------------------------------------------------- + f1 SUM(f2) COUNT(f2) AVG(f2) MIN(f2) MAX(f2) +--------------------------------------------------------- + 1 141 2 70.500000 70 71 + 2 140 2 70.000000 70 70 + 3 60 1 60.000000 60 60 + 2 161 2 80.500000 70 91 + 3 141 2 70.500000 60 81 + 1 152 2 76.000000 72 80 + +echo SELECT f1,f3,sum(f2),count(f2),avg(f2),min(f2),max(f2) from t1 GROUP BY f1,f3; +--------------------------------------------------------- + f1 f3 SUM(f2) COUNT(f2) AVG(f2) MIN(f2) MAX(f2) +--------------------------------------------------------- + 1 Nihar Pital 141 2 70.500000 70 71 + 2 Bijay Sahoo 140 2 70.000000 70 70 + 3 Kisor Ambli 60 1 60.000000 60 60 + 2 Jiten Lenka 161 2 80.500000 70 91 + 3 Papu Paital 141 2 70.500000 60 81 + 1 Bijay Sahoo 152 2 76.000000 72 80 + +Statement Executed diff --git a/test/sql/Aggregate/exp.testnw013.ksh b/test/sql/Aggregate/exp.testnw013.ksh new file mode 100644 index 00000000..fc3f3422 --- /dev/null +++ b/test/sql/Aggregate/exp.testnw013.ksh @@ -0,0 +1,73 @@ +Network CSql +echo CREATE TABLE t1(f1 int,f2 int,f3 char(15)); +Statement Executed +echo INSERT INTO t1 VALUES(1,70,'Nihar Pital'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(2,70,'Bijay Sahoo'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(3,60,'Kisor Ambli'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(2,90,'Jiten Lenka'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(3,80,'Papu Paital'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(1,80,'Bijay Sahoo'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(2,70,'Jiten Lenka'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(1,70,'Bijay Sahoo'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(2,70,'Bijay Sahoo'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(3,60,'Papu Paital'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(1,70,'Nihar Pital'); +Statement Executed: Rows Affected = 1 +echo SELECT * FROM t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 +--------------------------------------------------------- + 1 70 Nihar Pital + 2 70 Bijay Sahoo + 3 60 Kisor Ambli + 2 91 Jiten Lenka + 3 81 Papu Paital + 1 80 Bijay Sahoo + 2 70 Jiten Lenka + 1 72 Bijay Sahoo + 2 70 Bijay Sahoo + 3 60 Papu Paital + 1 71 Nihar Pital + +echo SELECT f1,sum(f2),count(f2),avg(f2),min(f2),max(f2),count(f3) from t1 GROUP BY f1 having sum(f2) >300 ; +--------------------------------------------------------- + f1 SUM(f2) COUNT(f2) AVG(f2) MIN(f2) MAX(f2) COUNT(f3) +--------------------------------------------------------- + 2 301 4 75.250000 70 91 4 + +echo SELECT f3,count(f1),sum(f2),count(f2),avg(f2),min(f2),max(f2) from t1 GROUP BY f3 having avg(f2) <75; +--------------------------------------------------------- + f3 COUNT(f1) SUM(f2) COUNT(f2) AVG(f2) MIN(f2) MAX(f2) +--------------------------------------------------------- + Nihar Pital 2 141 2 70.500000 70 71 + Bijay Sahoo 4 292 4 73.000000 70 80 + Kisor Ambli 1 60 1 60.000000 60 60 + Papu Paital 2 141 2 70.500000 60 81 + +echo SELECT f1,sum(f2),count(f2),avg(f2),min(f2),max(f2) from t1 GROUP BY f1; +--------------------------------------------------------- + f1 SUM(f2) COUNT(f2) AVG(f2) MIN(f2) MAX(f2) +--------------------------------------------------------- + 1 293 4 73.250000 70 80 + 2 301 4 75.250000 70 91 + 3 201 3 67.000000 60 81 + +echo SELECT f1,sum(f2),count(f2),avg(f2),min(f2),max(f2) from t1 GROUP BY f1 having avg(f2) <70 or min(f2)=70; +--------------------------------------------------------- + f1 SUM(f2) COUNT(f2) AVG(f2) MIN(f2) MAX(f2) +--------------------------------------------------------- + 1 293 4 73.250000 70 80 + 2 301 4 75.250000 70 91 + 3 201 3 67.000000 60 81 + +Statement Executed diff --git a/test/sql/Aggregate/exp.testnw014.ksh b/test/sql/Aggregate/exp.testnw014.ksh new file mode 100644 index 00000000..a8d09084 --- /dev/null +++ b/test/sql/Aggregate/exp.testnw014.ksh @@ -0,0 +1,111 @@ +Network CSql +echo create table t1(f1 char(10),f2 char(10),f3 int); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 +--------------------------------------------------------- + s y 5000 + p q 4000 + z y 2000 + p y 3000 + c q 1000 + z y 1500 + s y 3000 + c t 2500 + s p 2300 + c q 4000 + c y 5000 + c p 3500 + +echo select f2,avg(f3) from t1 group by f2; +--------------------------------------------------------- + f2 AVG(f3) +--------------------------------------------------------- + y 3250.000000 + q 3000.000000 + t 2500.000000 + p 2900.000000 + +echo select f2,avg(f3) from t1 where f3>=3000 group by f2 ; +--------------------------------------------------------- + f2 AVG(f3) +--------------------------------------------------------- + y 4000.000000 + q 4000.000000 + p 3500.000000 + +echo select f2,avg(f3) from t1 where f3>=2000 group by f2 having avg(f3)>3000; +--------------------------------------------------------- + f2 AVG(f3) +--------------------------------------------------------- + y 3600.000000 + q 4000.000000 + +echo select f2,avg(f3) from t1 where f3>=2000 group by f2 having avg(f3)>3000 limit 1; +--------------------------------------------------------- + f2 AVG(f3) +--------------------------------------------------------- + y 3600.000000 + +echo select f2,avg(f3) from t1 where f3>=2000 or f2 = 'y' group by f2 having avg(f3)>3000; +--------------------------------------------------------- + f2 AVG(f3) +--------------------------------------------------------- + y 3250.000000 + q 4000.000000 + +echo select f1,f2,avg(f3) from t1 where f3>=2000 or f2 = 'y' group by f1,f2 having avg(f3)>3000 ; +--------------------------------------------------------- + f1 f2 AVG(f3) +--------------------------------------------------------- + s y 4000.000000 + p q 4000.000000 + c q 4000.000000 + c y 5000.000000 + c p 3500.000000 + +echo select f2,f1,avg(f3) from t1 where f3>=2000 or f2 = 'y' group by f1,f2 having avg(f3)>3000; +--------------------------------------------------------- + f2 f1 AVG(f3) +--------------------------------------------------------- + y s 4000.000000 + q p 4000.000000 + q c 4000.000000 + y c 5000.000000 + p c 3500.000000 + +echo select f2,f1,avg(f3) from t1 where f3>=2000 or f2 = 'y' group by f1,f2 having avg(f3)>2000 ; +--------------------------------------------------------- + f2 f1 AVG(f3) +--------------------------------------------------------- + y s 4000.000000 + q p 4000.000000 + y p 3000.000000 + t c 2500.000000 + p s 2300.000000 + q c 4000.000000 + y c 5000.000000 + p c 3500.000000 + +echo select f2,f1,avg(f3) from t1 where f3>=2000 or f2 = 'y' group by f1,f2 having avg(f3)>2000 limit 3 offset 2; +--------------------------------------------------------- + f2 f1 AVG(f3) +--------------------------------------------------------- + y p 3000.000000 + t c 2500.000000 + p s 2300.000000 + +Statement Executed diff --git a/test/sql/Aggregate/exp.testnw015.ksh b/test/sql/Aggregate/exp.testnw015.ksh new file mode 100644 index 00000000..95d6aef5 --- /dev/null +++ b/test/sql/Aggregate/exp.testnw015.ksh @@ -0,0 +1,41 @@ +Network CSql +Statement Executed +Statement Executed +Statement Executed +Statement Executed +Statement Executed +Statement Executed +Statement Executed +Statement Executed +Statement Executed +Network CSql +--------------------------------------------------------- + COUNT(*) +--------------------------------------------------------- + 1000 + +--------------------------------------------------------- + SUM(T1.f1) +--------------------------------------------------------- + 500500 + +--------------------------------------------------------- + MIN(T1.f1) +--------------------------------------------------------- + 1 + +--------------------------------------------------------- + AVG(T1.f1) +--------------------------------------------------------- + 500.500000 + +--------------------------------------------------------- + MAX(T1.f1) +--------------------------------------------------------- + 1000 + +Statement Executed +Statement Executed +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Aggregate/exp.testnw016.ksh b/test/sql/Aggregate/exp.testnw016.ksh new file mode 100644 index 00000000..72cfd44b --- /dev/null +++ b/test/sql/Aggregate/exp.testnw016.ksh @@ -0,0 +1,68 @@ +Network CSql +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 +--------------------------------------------------------- + 98 1 10 + 99 NULL 20 + 100 3 30 + 101 4 NULL + 102 5 50 + +--------------------------------------------------------- + t2.f1 t2.f2 t2.f3 +--------------------------------------------------------- + 98 1 10 + 99 2 20 + 100 NULL NULL + 101 4 40 + 102 NULL 50 + +Network CSql +echo select * from t1,t2; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t2.f1 t2.f2 t2.f3 +--------------------------------------------------------- + 98 1 10 98 1 10 + 98 1 10 99 2 20 + 98 1 10 100 NULL NULL + 98 1 10 101 4 40 + 98 1 10 102 NULL 50 + 99 NULL 20 98 1 10 + 99 NULL 20 99 2 20 + 99 NULL 20 100 NULL NULL + 99 NULL 20 101 4 40 + 99 NULL 20 102 NULL 50 + 100 3 30 98 1 10 + 100 3 30 99 2 20 + 100 3 30 100 NULL NULL + 100 3 30 101 4 40 + 100 3 30 102 NULL 50 + 101 4 NULL 98 1 10 + 101 4 NULL 99 2 20 + 101 4 NULL 100 NULL NULL + 101 4 NULL 101 4 40 + 101 4 NULL 102 NULL 50 + 102 5 50 98 1 10 + 102 5 50 99 2 20 + 102 5 50 100 NULL NULL + 102 5 50 101 4 40 + 102 5 50 102 NULL 50 + +echo select f2 from t1,t2; +Statement prepare failed with error -19 +echo select avg(f2) from t1,t2; +Statement prepare failed with error -19 +Statement Executed +Statement Executed diff --git a/test/sql/Aggregate/exp.testnw025.ksh b/test/sql/Aggregate/exp.testnw025.ksh new file mode 100644 index 00000000..696bcbf4 --- /dev/null +++ b/test/sql/Aggregate/exp.testnw025.ksh @@ -0,0 +1,252 @@ +Network CSql +echo Create table client_master(clientno char(6), name char(20) NOT NULL, address1 char(30), address2 char(30), city char(15), pincode int, state char(15), baldue float,PRIMARY KEY(clientno)); +Statement Executed +echo Create table product_master(productno char(6), description char(15) NOT NULL,profitpercent float NOT NULL,unitmeasure char(10) NOT NULL,qtyonhand int NOT NULL,reorderlvl int NOT NULL,selprice float NOT NULL,costprice float NOT NULL, PRIMARY KEY(productno)); +Statement Executed +echo Create table salesman_master(salesmanno char(6),salesmanname char(20) NOT NULL,address1 char(30) NOT NULL,address2 char(30),city char(20),pincode char(8),state char(20),salamt float NOT NULL,tgttoget float NOT NULL,ytdsales float NOT NULL,remarks char(30),PRIMARY KEY(salesmanno)); +Statement Executed +echo Create table sales_order(orderno char(6),orderdate date,clientno char(6),delyaddr char(25),delytype char(1),billedyn char(1),salesmanno char(6),delydate date,orderstatus char(10),PRIMARY KEY(orderno),FOREIGN KEY(clientno) REFERENCES client_master(clientno),FOREIGN KEY(salesmanno) REFERENCES salesman_master(salesmanno)); +Statement Executed +echo Create table sales_order_details(orderno char(6),productno char(6),qtyordered int,qtydisp int,productrate float,FOREIGN KEY(orderno) REFERENCES sales_order(orderno),FOREIGN KEY(productno) REFERENCES product_master(productno)); +Statement Executed +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00001','Ivan Bayross','Mumbai',400054,'Maharastra',15000); +Statement Executed: Rows Affected = 1 +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00002','mamta Muzumdar','Madras',780001,'Tamil Nadu',0); +Statement Executed: Rows Affected = 1 +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00003','Chhaya Bankar','Mumbai',400057,'Maharastra',5000); +Statement Executed: Rows Affected = 1 +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00004','Ashwini Joshi','Bangalore',560001,'MKarnataka',0); +Statement Executed: Rows Affected = 1 +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00005','Hansel Colaco','Mumbai',400060,'Maharastra',2000); +Statement Executed: Rows Affected = 1 +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00006','Deepak Sharma','Mangalore',560050,'Karnatakaa',0); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P00001','T-Shirts',5,'Piece',200,50,350,250); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P03453','Shirts',6,'Piece',150,50,500,350); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P06734','Cotton Jeans',5,'Piece',100,20,60,450); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P07865','Jeans',5,'Piece',100,20,750,500); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P07868','Trousers',2,'Piece',150,50,850,550); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P07885','Pull Overs',2.5,'Piece',80,30,700,450); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P07965','Denim Shirts',4,'Piece',100,40,350,250); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P07975','Lycra Tops',5,'Piece',70,30,300,175); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P08865','Skirts',5,'Piece',75,30,450,300); +Statement Executed: Rows Affected = 1 +echo insert into salesman_master values('S00001','Aman','A/14','Worli','Mumbai',400002,'Maharastra',3000,100,50,'Good'); +Statement Executed: Rows Affected = 1 +echo insert into salesman_master values('S00002','Omkar','65','Nariman','Mumbai',400001,'maharastra',3000,200,100,'Good'); +Statement Executed: Rows Affected = 1 +echo insert into salesman_master values('S00003','Raj','P-7','Banfra','Mumbai',400032,'Maharastra',3000,200,100,'Good'); +Statement Executed: Rows Affected = 1 +echo insert into salesman_master values('S00004','Ashish','A/5','Juhu','Bombay',400044,'Maharastra',3500,200,150,'Good'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19001','2002-06-12','C00001','F','N','S00001','2002-07-20','In Process'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19002','2002-06-25','C00002','P','N','S00002','2002-06-27','Cancelled'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O46865','2002-02-18','C00003','F','Y','S00003','2002-02-20','Fulfilled'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19003','2002-04-03','C00001','F','Y','S00001','2002-04-07','Fulfilled'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O46866','2002-05-20','C00004','P','N','S00002','2002-05-22','Cancelled'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19008','2002-05-24','C00005','F','N','S00004','2002-07-26','In Process'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19001','P00001',4,4,525); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19001','P07965',2,1,8400); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19001','P07885',2,1,5250); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19002','P00001',10,0,525); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P07868',3,3,3150); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P07885',3,1,5250); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P00001',10,10,525); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P03453',4,4,1050); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19003','P03453',2,2,1050); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19003','P06734',1,1,12000); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46866','P07965',1,0,8400); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46866','P07975',1,0,1050); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19008','P00001',10,5,525); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19008','P07975',5,3,1050); +Statement Executed: Rows Affected = 1 +echo select * from client_master; +--------------------------------------------------------- + client_master.clientno client_master.name client_master.address1 client_master.address2 client_master.city client_master.pincode client_master.state client_master.baldue +--------------------------------------------------------- + C00001 Ivan Bayross NULL NULL Mumbai 400054 Maharastra 15000.000000 + C00002 mamta Muzumdar NULL NULL Madras 780001 Tamil Nadu 0.000000 + C00003 Chhaya Bankar NULL NULL Mumbai 400057 Maharastra 5000.000000 + C00004 Ashwini Joshi NULL NULL Bangalore 560001 MKarnataka 0.000000 + C00005 Hansel Colaco NULL NULL Mumbai 400060 Maharastra 2000.000000 + C00006 Deepak Sharma NULL NULL Mangalore 560050 Karnatakaa 0.000000 + +echo select * from product_master; +--------------------------------------------------------- + product_master.productno product_master.description product_master.profitpercent product_master.unitmeasure product_master.qtyonhand product_master.reorderlvl product_master.selprice product_master.costprice +--------------------------------------------------------- + P00001 T-Shirts 5.000000 Piece 200 50 350.000000 250.000000 + P03453 Shirts 6.000000 Piece 150 50 500.000000 350.000000 + P06734 Cotton Jeans 5.000000 Piece 100 20 60.000000 450.000000 + P07865 Jeans 5.000000 Piece 100 20 750.000000 500.000000 + P07868 Trousers 2.000000 Piece 150 50 850.000000 550.000000 + P07885 Pull Overs 2.500000 Piece 80 30 700.000000 450.000000 + P07965 Denim Shirts 4.000000 Piece 100 40 350.000000 250.000000 + P07975 Lycra Tops 5.000000 Piece 70 30 300.000000 175.000000 + P08865 Skirts 5.000000 Piece 75 30 450.000000 300.000000 + +echo select * from salesman_master; +--------------------------------------------------------- + salesman_master.salesmanno salesman_master.salesmanname salesman_master.address1 salesman_master.address2 salesman_master.city salesman_master.pincode salesman_master.state salesman_master.salamt salesman_master.tgttoget salesman_master.ytdsales salesman_master.remarks +--------------------------------------------------------- + S00001 Aman A/14 Worli Mumbai 400002 Maharastra 3000.000000 100.000000 50.000000 Good + S00002 Omkar 65 Nariman Mumbai 400001 maharastra 3000.000000 200.000000 100.000000 Good + S00003 Raj P-7 Banfra Mumbai 400032 Maharastra 3000.000000 200.000000 100.000000 Good + S00004 Ashish A/5 Juhu Bombay 400044 Maharastra 3500.000000 200.000000 150.000000 Good + +echo select * from sales_order; +--------------------------------------------------------- + sales_order.orderno sales_order.orderdate sales_order.clientno sales_order.delyaddr sales_order.delytype sales_order.billedyn sales_order.salesmanno sales_order.delydate sales_order.orderstatus +--------------------------------------------------------- + O19001 2002/6/12 C00001 NULL F N S00001 2002/7/20 In Process + O19002 2002/6/25 C00002 NULL P N S00002 2002/6/27 Cancelled + O46865 2002/2/18 C00003 NULL F Y S00003 2002/2/20 Fulfilled + O19003 2002/4/3 C00001 NULL F Y S00001 2002/4/7 Fulfilled + O46866 2002/5/20 C00004 NULL P N S00002 2002/5/22 Cancelled + O19008 2002/5/24 C00005 NULL F N S00004 2002/7/26 In Process + +echo select * from sales_order_details; +--------------------------------------------------------- + sales_order_details.orderno sales_order_details.productno sales_order_details.qtyordered sales_order_details.qtydisp sales_order_details.productrate +--------------------------------------------------------- + O19001 P00001 4 4 525.000000 + O19001 P07965 2 1 8400.000000 + O19001 P07885 2 1 5250.000000 + O19002 P00001 10 0 525.000000 + O46865 P07868 3 3 3150.000000 + O46865 P07885 3 1 5250.000000 + O46865 P00001 10 10 525.000000 + O46865 P03453 4 4 1050.000000 + O19003 P03453 2 2 1050.000000 + O19003 P06734 1 1 12000.000000 + O46866 P07965 1 0 8400.000000 + O46866 P07975 1 0 1050.000000 + O19008 P00001 10 5 525.000000 + O19008 P07975 5 3 1050.000000 + +Network CSql +echo select client_master.clientno,name,count(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name; +--------------------------------------------------------- + client_master.clientno name COUNT(qtydisp) +--------------------------------------------------------- + C00001 Ivan Bayross 5 + C00002 mamta Muzumdar 1 + C00003 Chhaya Bankar 4 + C00004 Ashwini Joshi 2 + C00005 Hansel Colaco 2 + +echo select client_master.clientno,name,count(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name having count(qtydisp)>3; +--------------------------------------------------------- + client_master.clientno name COUNT(qtydisp) +--------------------------------------------------------- + C00001 Ivan Bayross 5 + C00003 Chhaya Bankar 4 + +echo select client_master.clientno,name,min(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name; +--------------------------------------------------------- + client_master.clientno name MIN(qtydisp) +--------------------------------------------------------- + C00001 Ivan Bayross 1 + C00002 mamta Muzumdar 0 + C00003 Chhaya Bankar 1 + C00004 Ashwini Joshi 0 + C00005 Hansel Colaco 3 + +echo select client_master.clientno,name,min(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name having min(qtydisp)<3; +--------------------------------------------------------- + client_master.clientno name MIN(qtydisp) +--------------------------------------------------------- + C00001 Ivan Bayross 1 + C00002 mamta Muzumdar 0 + C00003 Chhaya Bankar 1 + C00004 Ashwini Joshi 0 + +echo select client_master.clientno,name,max(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name; +--------------------------------------------------------- + client_master.clientno name MAX(qtydisp) +--------------------------------------------------------- + C00001 Ivan Bayross 4 + C00002 mamta Muzumdar 0 + C00003 Chhaya Bankar 10 + C00004 Ashwini Joshi 0 + C00005 Hansel Colaco 5 + +echo select client_master.clientno,name,max(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name having max(qtydisp)>4; +--------------------------------------------------------- + client_master.clientno name MAX(qtydisp) +--------------------------------------------------------- + C00003 Chhaya Bankar 10 + C00005 Hansel Colaco 5 + +echo select client_master.clientno,name,sum(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name; +--------------------------------------------------------- + client_master.clientno name SUM(qtydisp) +--------------------------------------------------------- + C00001 Ivan Bayross 9 + C00002 mamta Muzumdar 0 + C00003 Chhaya Bankar 18 + C00004 Ashwini Joshi 0 + C00005 Hansel Colaco 8 + +echo select client_master.clientno,name,sum(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name having sum(qtydisp)>3; +--------------------------------------------------------- + client_master.clientno name SUM(qtydisp) +--------------------------------------------------------- + C00001 Ivan Bayross 9 + C00003 Chhaya Bankar 18 + C00005 Hansel Colaco 8 + +echo select client_master.clientno,name,avg(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name; +--------------------------------------------------------- + client_master.clientno name AVG(qtydisp) +--------------------------------------------------------- + C00001 Ivan Bayross 1.800000 + C00002 mamta Muzumdar 0.000000 + C00003 Chhaya Bankar 4.500000 + C00004 Ashwini Joshi 0.000000 + C00005 Hansel Colaco 4.000000 + +echo select client_master.clientno,name,avg(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name having avg(qtydisp)>3; +--------------------------------------------------------- + client_master.clientno name AVG(qtydisp) +--------------------------------------------------------- + C00003 Chhaya Bankar 4.500000 + C00005 Hansel Colaco 4.000000 + +echo drop table sales_order_details; +Statement Executed +echo drop table sales_order; +Statement Executed +echo drop table salesman_master; +Statement Executed +echo drop table product_master; +Statement Executed +echo drop table client_master; +Statement Executed diff --git a/test/sql/Aggregate/exp.testnw026.ksh b/test/sql/Aggregate/exp.testnw026.ksh new file mode 100644 index 00000000..c311049c --- /dev/null +++ b/test/sql/Aggregate/exp.testnw026.ksh @@ -0,0 +1,195 @@ +Network CSql +echo Create table client_master(clientno char(6), name char(20) NOT NULL, address1 char(30), address2 char(30), city char(15), pincode int, state char(15), baldue float,PRIMARY KEY(clientno)); +Statement Executed +echo Create table product_master(productno char(6), description char(15) NOT NULL,profitpercent float NOT NULL,unitmeasure char(10) NOT NULL,qtyonhand int NOT NULL,reorderlvl int NOT NULL,selprice float NOT NULL,costprice float NOT NULL, PRIMARY KEY(productno)); +Statement Executed +echo Create table salesman_master(salesmanno char(6),salesmanname char(20) NOT NULL,address1 char(30) NOT NULL,address2 char(30),city char(20),pincode char(8),state char(20),salamt float NOT NULL,tgttoget float NOT NULL,ytdsales float NOT NULL,remarks char(30),PRIMARY KEY(salesmanno)); +Statement Executed +echo Create table sales_order(orderno char(6),orderdate date,clientno char(6),delyaddr char(25),delytype char(1),billedyn char(1),salesmanno char(6),delydate date,orderstatus char(10),PRIMARY KEY(orderno),FOREIGN KEY(clientno) REFERENCES client_master(clientno),FOREIGN KEY(salesmanno) REFERENCES salesman_master(salesmanno)); +Statement Executed +echo Create table sales_order_details(orderno char(6),productno char(6),qtyordered int,qtydisp int,productrate float,FOREIGN KEY(orderno) REFERENCES sales_order(orderno),FOREIGN KEY(productno) REFERENCES product_master(productno)); +Statement Executed +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00001','Ivan Bayross','Mumbai',400054,'Maharastra',15000); +Statement Executed: Rows Affected = 1 +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00002','mamta Muzumdar','Madras',780001,'Tamil Nadu',0); +Statement Executed: Rows Affected = 1 +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00003','Chhaya Bankar','Mumbai',400057,'Maharastra',5000); +Statement Executed: Rows Affected = 1 +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00004','Ashwini Joshi','Bangalore',560001,'MKarnataka',0); +Statement Executed: Rows Affected = 1 +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00005','Hansel Colaco','Mumbai',400060,'Maharastra',2000); +Statement Executed: Rows Affected = 1 +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00006','Deepak Sharma','Mangalore',560050,'Karnatakaa',0); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P00001','T-Shirts',5,'Piece',200,50,350,250); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P03453','Shirts',6,'Piece',150,50,500,350); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P06734','Cotton Jeans',5,'Piece',100,20,60,450); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P07865','Jeans',5,'Piece',100,20,750,500); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P07868','Trousers',2,'Piece',150,50,850,550); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P07885','Pull Overs',2.5,'Piece',80,30,700,450); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P07965','Denim Shirts',4,'Piece',100,40,350,250); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P07975','Lycra Tops',5,'Piece',70,30,300,175); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P08865','Skirts',5,'Piece',75,30,450,300); +Statement Executed: Rows Affected = 1 +echo insert into salesman_master values('S00001','Aman','A/14','Worli','Mumbai',400002,'Maharastra',3000,100,50,'Good'); +Statement Executed: Rows Affected = 1 +echo insert into salesman_master values('S00002','Omkar','65','Nariman','Mumbai',400001,'maharastra',3000,200,100,'Good'); +Statement Executed: Rows Affected = 1 +echo insert into salesman_master values('S00003','Raj','P-7','Banfra','Mumbai',400032,'Maharastra',3000,200,100,'Good'); +Statement Executed: Rows Affected = 1 +echo insert into salesman_master values('S00004','Ashish','A/5','Juhu','Bombay',400044,'Maharastra',3500,200,150,'Good'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19001','2002-06-12','C00001','F','N','S00001','2002-07-20','In Process'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19002','2002-06-25','C00002','P','N','S00002','2002-06-27','Cancelled'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O46865','2002-02-18','C00003','F','Y','S00003','2002-02-20','Fulfilled'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19003','2002-04-03','C00001','F','Y','S00001','2002-04-07','Fulfilled'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O46866','2002-05-20','C00004','P','N','S00002','2002-05-22','Cancelled'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19008','2002-05-24','C00005','F','N','S00004','2002-07-26','In Process'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19001','P00001',4,4,525); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19001','P07965',2,1,8400); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19001','P07885',2,1,5250); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19002','P00001',10,0,525); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P07868',3,3,3150); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P07885',3,1,5250); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P00001',10,10,525); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P03453',4,4,1050); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19003','P03453',2,2,1050); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19003','P06734',1,1,12000); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46866','P07965',1,0,8400); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46866','P07975',1,0,1050); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19008','P00001',10,5,525); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19008','P07975',5,3,1050); +Statement Executed: Rows Affected = 1 +echo select * from client_master; +--------------------------------------------------------- + client_master.clientno client_master.name client_master.address1 client_master.address2 client_master.city client_master.pincode client_master.state client_master.baldue +--------------------------------------------------------- + C00001 Ivan Bayross NULL NULL Mumbai 400054 Maharastra 15000.000000 + C00002 mamta Muzumdar NULL NULL Madras 780001 Tamil Nadu 0.000000 + C00003 Chhaya Bankar NULL NULL Mumbai 400057 Maharastra 5000.000000 + C00004 Ashwini Joshi NULL NULL Bangalore 560001 MKarnataka 0.000000 + C00005 Hansel Colaco NULL NULL Mumbai 400060 Maharastra 2000.000000 + C00006 Deepak Sharma NULL NULL Mangalore 560050 Karnatakaa 0.000000 + +echo select * from product_master; +--------------------------------------------------------- + product_master.productno product_master.description product_master.profitpercent product_master.unitmeasure product_master.qtyonhand product_master.reorderlvl product_master.selprice product_master.costprice +--------------------------------------------------------- + P00001 T-Shirts 5.000000 Piece 200 50 350.000000 250.000000 + P03453 Shirts 6.000000 Piece 150 50 500.000000 350.000000 + P06734 Cotton Jeans 5.000000 Piece 100 20 60.000000 450.000000 + P07865 Jeans 5.000000 Piece 100 20 750.000000 500.000000 + P07868 Trousers 2.000000 Piece 150 50 850.000000 550.000000 + P07885 Pull Overs 2.500000 Piece 80 30 700.000000 450.000000 + P07965 Denim Shirts 4.000000 Piece 100 40 350.000000 250.000000 + P07975 Lycra Tops 5.000000 Piece 70 30 300.000000 175.000000 + P08865 Skirts 5.000000 Piece 75 30 450.000000 300.000000 + +echo select * from salesman_master; +--------------------------------------------------------- + salesman_master.salesmanno salesman_master.salesmanname salesman_master.address1 salesman_master.address2 salesman_master.city salesman_master.pincode salesman_master.state salesman_master.salamt salesman_master.tgttoget salesman_master.ytdsales salesman_master.remarks +--------------------------------------------------------- + S00001 Aman A/14 Worli Mumbai 400002 Maharastra 3000.000000 100.000000 50.000000 Good + S00002 Omkar 65 Nariman Mumbai 400001 maharastra 3000.000000 200.000000 100.000000 Good + S00003 Raj P-7 Banfra Mumbai 400032 Maharastra 3000.000000 200.000000 100.000000 Good + S00004 Ashish A/5 Juhu Bombay 400044 Maharastra 3500.000000 200.000000 150.000000 Good + +echo select * from sales_order; +--------------------------------------------------------- + sales_order.orderno sales_order.orderdate sales_order.clientno sales_order.delyaddr sales_order.delytype sales_order.billedyn sales_order.salesmanno sales_order.delydate sales_order.orderstatus +--------------------------------------------------------- + O19001 2002/6/12 C00001 NULL F N S00001 2002/7/20 In Process + O19002 2002/6/25 C00002 NULL P N S00002 2002/6/27 Cancelled + O46865 2002/2/18 C00003 NULL F Y S00003 2002/2/20 Fulfilled + O19003 2002/4/3 C00001 NULL F Y S00001 2002/4/7 Fulfilled + O46866 2002/5/20 C00004 NULL P N S00002 2002/5/22 Cancelled + O19008 2002/5/24 C00005 NULL F N S00004 2002/7/26 In Process + +echo select * from sales_order_details; +--------------------------------------------------------- + sales_order_details.orderno sales_order_details.productno sales_order_details.qtyordered sales_order_details.qtydisp sales_order_details.productrate +--------------------------------------------------------- + O19001 P00001 4 4 525.000000 + O19001 P07965 2 1 8400.000000 + O19001 P07885 2 1 5250.000000 + O19002 P00001 10 0 525.000000 + O46865 P07868 3 3 3150.000000 + O46865 P07885 3 1 5250.000000 + O46865 P00001 10 10 525.000000 + O46865 P03453 4 4 1050.000000 + O19003 P03453 2 2 1050.000000 + O19003 P06734 1 1 12000.000000 + O46866 P07965 1 0 8400.000000 + O46866 P07975 1 0 1050.000000 + O19008 P00001 10 5 525.000000 + O19008 P07975 5 3 1050.000000 + +Network CSql +echo select sales_order_details.productno,description,qtyordered,orderdate from sales_order_details,sales_order,product_master where product_master.productno=sales_order_details.productno and sales_order.orderno=sales_order_details.orderno and orderdate >= '2002-04-01' and orderdate <= '2002-05-31'; +--------------------------------------------------------- + sales_order_details.productno description qtyordered +--------------------------------------------------------- + P00001 T-Shirts 4 + P07965 Denim Shirts 2 + P07885 Pull Overs 2 + P00001 T-Shirts 10 + P07868 Trousers 3 + P07885 Pull Overs 3 + P00001 T-Shirts 10 + P03453 Shirts 4 + P03453 Shirts 2 + P06734 Cotton Jeans 1 + P07965 Denim Shirts 1 + P07975 Lycra Tops 1 + P00001 T-Shirts 10 + P07975 Lycra Tops 5 + +echo select sales_order_details.productno, description, min(qtyordered), max(qtyordered), count(qtyordered), sum(qtyordered) from sales_order_details,sales_order,product_master where product_master.productno=sales_order_details.productno and sales_order.orderno=sales_order_details.orderno group by sales_order_details.productno,description; +--------------------------------------------------------- + sales_order_details.productno description MIN(qtyordered) MAX(qtyordered) COUNT(qtyordered) SUM(qtyordered) +--------------------------------------------------------- + P00001 T-Shirts 4 10 4 34 + P07965 Denim Shirts 1 2 2 3 + P07885 Pull Overs 2 3 2 5 + P07868 Trousers 3 3 1 3 + P03453 Shirts 2 4 2 6 + P06734 Cotton Jeans 1 1 1 1 + P07975 Lycra Tops 1 5 2 6 + +echo drop table sales_order_details; +Statement Executed +echo drop table sales_order; +Statement Executed +echo drop table salesman_master; +Statement Executed +echo drop table product_master; +Statement Executed +echo drop table client_master; +Statement Executed diff --git a/test/sql/Aggregate/exp.testnw027.ksh b/test/sql/Aggregate/exp.testnw027.ksh new file mode 100644 index 00000000..7ef270a2 --- /dev/null +++ b/test/sql/Aggregate/exp.testnw027.ksh @@ -0,0 +1,195 @@ +Network CSql +echo Create table client_master(clientno char(6), name char(20) NOT NULL, address1 char(30), address2 char(30), city char(15), pincode int, state char(15), baldue float,PRIMARY KEY(clientno)); +Statement Executed +echo Create table product_master(productno char(6), description char(15) NOT NULL,profitpercent float NOT NULL,unitmeasure char(10) NOT NULL,qtyonhand int NOT NULL,reorderlvl int NOT NULL,selprice float NOT NULL,costprice float NOT NULL, PRIMARY KEY(productno)); +Statement Executed +echo Create table salesman_master(salesmanno char(6),salesmanname char(20) NOT NULL,address1 char(30) NOT NULL,address2 char(30),city char(20),pincode char(8),state char(20),salamt float NOT NULL,tgttoget float NOT NULL,ytdsales float NOT NULL,remarks char(30),PRIMARY KEY(salesmanno)); +Statement Executed +echo Create table sales_order(orderno char(6),orderdate date,clientno char(6),delyaddr char(25),delytype char(1),billedyn char(1),salesmanno char(6),delydate date,orderstatus char(10),PRIMARY KEY(orderno),FOREIGN KEY(clientno) REFERENCES client_master(clientno),FOREIGN KEY(salesmanno) REFERENCES salesman_master(salesmanno)); +Statement Executed +echo Create table sales_order_details(orderno char(6),productno char(6),qtyordered int,qtydisp int,productrate float,FOREIGN KEY(orderno) REFERENCES sales_order(orderno),FOREIGN KEY(productno) REFERENCES product_master(productno)); +Statement Executed +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00001','Ivan Bayross','Mumbai',400054,'Maharastra',15000); +Statement Executed: Rows Affected = 1 +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00002','mamta Muzumdar','Madras',780001,'Tamil Nadu',0); +Statement Executed: Rows Affected = 1 +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00003','Chhaya Bankar','Mumbai',400057,'Maharastra',5000); +Statement Executed: Rows Affected = 1 +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00004','Ashwini Joshi','Bangalore',560001,'MKarnataka',0); +Statement Executed: Rows Affected = 1 +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00005','Hansel Colaco','Mumbai',400060,'Maharastra',2000); +Statement Executed: Rows Affected = 1 +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00006','Deepak Sharma','Mangalore',560050,'Karnatakaa',0); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P00001','T-Shirts',5,'Piece',200,50,350,250); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P03453','Shirts',6,'Piece',150,50,500,350); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P06734','Cotton Jeans',5,'Piece',100,20,60,450); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P07865','Jeans',5,'Piece',100,20,750,500); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P07868','Trousers',2,'Piece',150,50,850,550); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P07885','Pull Overs',2.5,'Piece',80,30,700,450); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P07965','Denim Shirts',4,'Piece',100,40,350,250); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P07975','Lycra Tops',5,'Piece',70,30,300,175); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P08865','Skirts',5,'Piece',75,30,450,300); +Statement Executed: Rows Affected = 1 +echo insert into salesman_master values('S00001','Aman','A/14','Worli','Mumbai',400002,'Maharastra',3000,100,50,'Good'); +Statement Executed: Rows Affected = 1 +echo insert into salesman_master values('S00002','Omkar','65','Nariman','Mumbai',400001,'maharastra',3000,200,100,'Good'); +Statement Executed: Rows Affected = 1 +echo insert into salesman_master values('S00003','Raj','P-7','Banfra','Mumbai',400032,'Maharastra',3000,200,100,'Good'); +Statement Executed: Rows Affected = 1 +echo insert into salesman_master values('S00004','Ashish','A/5','Juhu','Bombay',400044,'Maharastra',3500,200,150,'Good'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19001','2002-06-12','C00001','F','N','S00001','2002-07-20','In Process'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19002','2002-06-25','C00002','P','N','S00002','2002-06-27','Cancelled'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O46865','2002-02-18','C00003','F','Y','S00003','2002-02-20','Fulfilled'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19003','2002-04-03','C00001','F','Y','S00001','2002-04-07','Fulfilled'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O46866','2002-05-20','C00004','P','N','S00002','2002-05-22','Cancelled'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19008','2002-05-24','C00005','F','N','S00004','2002-07-26','In Process'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19001','P00001',4,4,525); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19001','P07965',2,1,8400); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19001','P07885',2,1,5250); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19002','P00001',10,0,525); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P07868',3,3,3150); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P07885',3,1,5250); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P00001',10,10,525); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P03453',4,4,1050); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19003','P03453',2,2,1050); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19003','P06734',1,1,12000); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46866','P07965',1,0,8400); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46866','P07975',1,0,1050); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19008','P00001',10,5,525); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19008','P07975',5,3,1050); +Statement Executed: Rows Affected = 1 +echo select * from client_master; +--------------------------------------------------------- + client_master.clientno client_master.name client_master.address1 client_master.address2 client_master.city client_master.pincode client_master.state client_master.baldue +--------------------------------------------------------- + C00001 Ivan Bayross NULL NULL Mumbai 400054 Maharastra 15000.000000 + C00002 mamta Muzumdar NULL NULL Madras 780001 Tamil Nadu 0.000000 + C00003 Chhaya Bankar NULL NULL Mumbai 400057 Maharastra 5000.000000 + C00004 Ashwini Joshi NULL NULL Bangalore 560001 MKarnataka 0.000000 + C00005 Hansel Colaco NULL NULL Mumbai 400060 Maharastra 2000.000000 + C00006 Deepak Sharma NULL NULL Mangalore 560050 Karnatakaa 0.000000 + +echo select * from product_master; +--------------------------------------------------------- + product_master.productno product_master.description product_master.profitpercent product_master.unitmeasure product_master.qtyonhand product_master.reorderlvl product_master.selprice product_master.costprice +--------------------------------------------------------- + P00001 T-Shirts 5.000000 Piece 200 50 350.000000 250.000000 + P03453 Shirts 6.000000 Piece 150 50 500.000000 350.000000 + P06734 Cotton Jeans 5.000000 Piece 100 20 60.000000 450.000000 + P07865 Jeans 5.000000 Piece 100 20 750.000000 500.000000 + P07868 Trousers 2.000000 Piece 150 50 850.000000 550.000000 + P07885 Pull Overs 2.500000 Piece 80 30 700.000000 450.000000 + P07965 Denim Shirts 4.000000 Piece 100 40 350.000000 250.000000 + P07975 Lycra Tops 5.000000 Piece 70 30 300.000000 175.000000 + P08865 Skirts 5.000000 Piece 75 30 450.000000 300.000000 + +echo select * from salesman_master; +--------------------------------------------------------- + salesman_master.salesmanno salesman_master.salesmanname salesman_master.address1 salesman_master.address2 salesman_master.city salesman_master.pincode salesman_master.state salesman_master.salamt salesman_master.tgttoget salesman_master.ytdsales salesman_master.remarks +--------------------------------------------------------- + S00001 Aman A/14 Worli Mumbai 400002 Maharastra 3000.000000 100.000000 50.000000 Good + S00002 Omkar 65 Nariman Mumbai 400001 maharastra 3000.000000 200.000000 100.000000 Good + S00003 Raj P-7 Banfra Mumbai 400032 Maharastra 3000.000000 200.000000 100.000000 Good + S00004 Ashish A/5 Juhu Bombay 400044 Maharastra 3500.000000 200.000000 150.000000 Good + +echo select * from sales_order; +--------------------------------------------------------- + sales_order.orderno sales_order.orderdate sales_order.clientno sales_order.delyaddr sales_order.delytype sales_order.billedyn sales_order.salesmanno sales_order.delydate sales_order.orderstatus +--------------------------------------------------------- + O19001 2002/6/12 C00001 NULL F N S00001 2002/7/20 In Process + O19002 2002/6/25 C00002 NULL P N S00002 2002/6/27 Cancelled + O46865 2002/2/18 C00003 NULL F Y S00003 2002/2/20 Fulfilled + O19003 2002/4/3 C00001 NULL F Y S00001 2002/4/7 Fulfilled + O46866 2002/5/20 C00004 NULL P N S00002 2002/5/22 Cancelled + O19008 2002/5/24 C00005 NULL F N S00004 2002/7/26 In Process + +echo select * from sales_order_details; +--------------------------------------------------------- + sales_order_details.orderno sales_order_details.productno sales_order_details.qtyordered sales_order_details.qtydisp sales_order_details.productrate +--------------------------------------------------------- + O19001 P00001 4 4 525.000000 + O19001 P07965 2 1 8400.000000 + O19001 P07885 2 1 5250.000000 + O19002 P00001 10 0 525.000000 + O46865 P07868 3 3 3150.000000 + O46865 P07885 3 1 5250.000000 + O46865 P00001 10 10 525.000000 + O46865 P03453 4 4 1050.000000 + O19003 P03453 2 2 1050.000000 + O19003 P06734 1 1 12000.000000 + O46866 P07965 1 0 8400.000000 + O46866 P07975 1 0 1050.000000 + O19008 P00001 10 5 525.000000 + O19008 P07975 5 3 1050.000000 + +Network CSql +echo select sales_order_details.productno,description,qtyordered,name from sales_order_details, sales_order, product_master, client_master where sales_order.orderno=sales_order_details.orderno and product_master.productno=sales_order_details.productno and client_master.clientno=sales_order.clientno and name='Ivan Bayross' and name='Mamta Muzumdar'; +--------------------------------------------------------- + sales_order_details.productno description qtyordered name +--------------------------------------------------------- + P00001 T-Shirts 4 Ivan Bayross + P07965 Denim Shirts 2 Ivan Bayross + P07885 Pull Overs 2 Ivan Bayross + P00001 T-Shirts 10 mamta Muzumdar + P07868 Trousers 3 Chhaya Bankar + P07885 Pull Overs 3 Chhaya Bankar + P00001 T-Shirts 10 Chhaya Bankar + P03453 Shirts 4 Chhaya Bankar + P03453 Shirts 2 Ivan Bayross + P06734 Cotton Jeans 1 Ivan Bayross + P07965 Denim Shirts 1 Ashwini Joshi + P07975 Lycra Tops 1 Ashwini Joshi + P00001 T-Shirts 10 Hansel Colaco + P07975 Lycra Tops 5 Hansel Colaco + +echo select sales_order_details.productno,description,min(qtyordered), max(qtyordered), count(qtyordered), sum(qtyordered) from sales_order_details, sales_order, product_master, client_master where sales_order.orderno=sales_order_details.orderno and product_master.productno=sales_order_details.productno and client_master.clientno=sales_order.clientno and name='Ivan Bayross' and name='Mamta Muzumdar' group by sales_order_details.productno,description; +--------------------------------------------------------- + sales_order_details.productno description MIN(qtyordered) MAX(qtyordered) COUNT(qtyordered) SUM(qtyordered) +--------------------------------------------------------- + P00001 T-Shirts 4 10 4 34 + P07965 Denim Shirts 1 2 2 3 + P07885 Pull Overs 2 3 2 5 + P07868 Trousers 3 3 1 3 + P03453 Shirts 2 4 2 6 + P06734 Cotton Jeans 1 1 1 1 + P07975 Lycra Tops 1 5 2 6 + +echo drop table sales_order_details; +Statement Executed +echo drop table sales_order; +Statement Executed +echo drop table salesman_master; +Statement Executed +echo drop table product_master; +Statement Executed +echo drop table client_master; +Statement Executed diff --git a/test/sql/Aggregate/exp.testnw028.ksh b/test/sql/Aggregate/exp.testnw028.ksh new file mode 100644 index 00000000..93068c8a --- /dev/null +++ b/test/sql/Aggregate/exp.testnw028.ksh @@ -0,0 +1,226 @@ +Network CSql +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 t1.f5 t1.f6 t1.f7 t1.f8 t1.f9 +--------------------------------------------------------- + 10 100 1000 Bijay 1000.000000 100000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + 11 110 1100 Jitendr 2000.000000 200000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 12 120 1000 Nihar 3000.000000 300000.000000 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 NULL Kishor 4000.000000 400000.000000 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 + 14 100 1000 Praba 5000.000000 500000.000000 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 + 15 110 1100 Sanjit 6000.000000 600000.000000 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 + 16 120 1000 Sanjay NULL 700000.000000 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 + 17 130 1100 Arindam 8000.000000 800000.000000 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 + 10 100 1000 Bijay 9000.000000 900000.000000 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 + 11 NULL 1100 Jitendr 1000.000000 100000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 12 120 1000 Nihar 2000.000000 200000.000000 2009/3/3 NULL 2009/3/3 11:59:59.0 + 13 130 1100 Kishor 3000.000000 300000.000000 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 + 14 100 1000 Praba 4000.000000 400000.000000 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 + 15 110 NULL Sanjit 5000.000000 500000.000000 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 + 16 120 1000 Sanjay 6000.000000 600000.000000 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 + 17 130 1100 Arindam 7000.000000 700000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + +Network CSql +echo select f1,f2,f3,f4,count(f5),sum(f5), count(f6),sum(f6) from t1 group by f1,f2,f3,f4; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) SUM(f5) COUNT(f6) SUM(f6) +--------------------------------------------------------- + 10 100 1000 Bijay 2 10000.000000 2 1000000.000000 + 11 110 1100 Jitendr 1 2000.000000 1 200000.000000 + 12 120 1000 Nihar 2 5000.000000 2 500000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 9000.000000 2 900000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 1300000.000000 + 17 130 1100 Arindam 2 15000.000000 2 1500000.000000 + 11 NULL 1100 Jitendr 1 1000.000000 1 100000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f2,f1,f4,f3,count(f5),sum(f5), count(f6),sum(f6) from t1 group by f1,f2,f3,f4; +--------------------------------------------------------- + f2 f1 f4 f3 COUNT(f5) SUM(f5) COUNT(f6) SUM(f6) +--------------------------------------------------------- + 100 10 Bijay 1000 2 10000.000000 2 1000000.000000 + 110 11 Jitendr 1100 1 2000.000000 1 200000.000000 + 120 12 Nihar 1000 2 5000.000000 2 500000.000000 + 130 13 Kishor NULL 1 4000.000000 1 400000.000000 + 100 14 Praba 1000 2 9000.000000 2 900000.000000 + 110 15 Sanjit 1100 1 6000.000000 1 600000.000000 + 120 16 Sanjay 1000 1 6000.000000 2 1300000.000000 + 130 17 Arindam 1100 2 15000.000000 2 1500000.000000 + NULL 11 Jitendr 1100 1 1000.000000 1 100000.000000 + 130 13 Kishor 1100 1 3000.000000 1 300000.000000 + 110 15 Sanjit NULL 1 5000.000000 1 500000.000000 + +echo select f3,f1,f4,f2,count(f5),sum(f5), count(f6),sum(f6) from t1 group by f1,f2,f3,f4; +--------------------------------------------------------- + f3 f1 f4 f2 COUNT(f5) SUM(f5) COUNT(f6) SUM(f6) +--------------------------------------------------------- + 1000 10 Bijay 100 2 10000.000000 2 1000000.000000 + 1100 11 Jitendr 110 1 2000.000000 1 200000.000000 + 1000 12 Nihar 120 2 5000.000000 2 500000.000000 + NULL 13 Kishor 130 1 4000.000000 1 400000.000000 + 1000 14 Praba 100 2 9000.000000 2 900000.000000 + 1100 15 Sanjit 110 1 6000.000000 1 600000.000000 + 1000 16 Sanjay 120 1 6000.000000 2 1300000.000000 + 1100 17 Arindam 130 2 15000.000000 2 1500000.000000 + 1100 11 Jitendr NULL 1 1000.000000 1 100000.000000 + 1100 13 Kishor 130 1 3000.000000 1 300000.000000 + NULL 15 Sanjit 110 1 5000.000000 1 500000.000000 + +echo select f4,f3,f2,f1,count(f5),sum(f5), count(f6),sum(f6) from t1 group by f1,f2,f3,f4; +--------------------------------------------------------- + f4 f3 f2 f1 COUNT(f5) SUM(f5) COUNT(f6) SUM(f6) +--------------------------------------------------------- + Bijay 1000 100 10 2 10000.000000 2 1000000.000000 + Jitendr 1100 110 11 1 2000.000000 1 200000.000000 + Nihar 1000 120 12 2 5000.000000 2 500000.000000 + Kishor NULL 130 13 1 4000.000000 1 400000.000000 + Praba 1000 100 14 2 9000.000000 2 900000.000000 + Sanjit 1100 110 15 1 6000.000000 1 600000.000000 + Sanjay 1000 120 16 1 6000.000000 2 1300000.000000 + Arindam 1100 130 17 2 15000.000000 2 1500000.000000 + Jitendr 1100 NULL 11 1 1000.000000 1 100000.000000 + Kishor 1100 130 13 1 3000.000000 1 300000.000000 + Sanjit NULL 110 15 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),sum(f5), count(f6),sum(f6) from t1 group by f1,f2,f3,f4 having sum(f5)>=5000; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) SUM(f5) COUNT(f6) SUM(f6) +--------------------------------------------------------- + 10 100 1000 Bijay 2 10000.000000 2 1000000.000000 + 12 120 1000 Nihar 2 5000.000000 2 500000.000000 + 14 100 1000 Praba 2 9000.000000 2 900000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 1300000.000000 + 17 130 1100 Arindam 2 15000.000000 2 1500000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 group by f1,f2,f3,f4; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) SUM(f5) COUNT(f6) SUM(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 5000.000000 2 500000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 9000.000000 2 900000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 1300000.000000 + 17 130 1100 Arindam 2 15000.000000 2 1500000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f4,f3,f1,f2,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 group by f1,f2,f3,f4; +--------------------------------------------------------- + f4 f3 f1 f2 COUNT(f5) SUM(f5) COUNT(f6) SUM(f6) +--------------------------------------------------------- + Nihar 1000 12 120 2 5000.000000 2 500000.000000 + Kishor NULL 13 130 1 4000.000000 1 400000.000000 + Praba 1000 14 100 2 9000.000000 2 900000.000000 + Sanjit 1100 15 110 1 6000.000000 1 600000.000000 + Sanjay 1000 16 120 1 6000.000000 2 1300000.000000 + Arindam 1100 17 130 2 15000.000000 2 1500000.000000 + Kishor 1100 13 130 1 3000.000000 1 300000.000000 + Sanjit NULL 15 110 1 5000.000000 1 500000.000000 + +echo select f4,f1,f2,f3,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 group by f1,f2,f3,f4; +--------------------------------------------------------- + f4 f1 f2 f3 COUNT(f5) SUM(f5) COUNT(f6) SUM(f6) +--------------------------------------------------------- + Nihar 12 120 1000 2 5000.000000 2 500000.000000 + Kishor 13 130 NULL 1 4000.000000 1 400000.000000 + Praba 14 100 1000 2 9000.000000 2 900000.000000 + Sanjit 15 110 1100 1 6000.000000 1 600000.000000 + Sanjay 16 120 1000 1 6000.000000 2 1300000.000000 + Arindam 17 130 1100 2 15000.000000 2 1500000.000000 + Kishor 13 130 1100 1 3000.000000 1 300000.000000 + Sanjit 15 110 NULL 1 5000.000000 1 500000.000000 + +echo select f4,f3,f1,f2,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 group by f1,f2,f3,f4; +--------------------------------------------------------- + f4 f3 f1 f2 COUNT(f5) SUM(f5) COUNT(f6) SUM(f6) +--------------------------------------------------------- + Nihar 1000 12 120 2 5000.000000 2 500000.000000 + Kishor NULL 13 130 1 4000.000000 1 400000.000000 + Praba 1000 14 100 2 9000.000000 2 900000.000000 + Sanjit 1100 15 110 1 6000.000000 1 600000.000000 + Sanjay 1000 16 120 1 6000.000000 2 1300000.000000 + Arindam 1100 17 130 2 15000.000000 2 1500000.000000 + Kishor 1100 13 130 1 3000.000000 1 300000.000000 + Sanjit NULL 15 110 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) SUM(f5) COUNT(f6) SUM(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 5000.000000 2 500000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 9000.000000 2 900000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + +echo select f2,f3,f4,f1,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4; +--------------------------------------------------------- + f2 f3 f4 f1 COUNT(f5) SUM(f5) COUNT(f6) SUM(f6) +--------------------------------------------------------- + 120 1000 Nihar 12 2 5000.000000 2 500000.000000 + 130 NULL Kishor 13 1 4000.000000 1 400000.000000 + 100 1000 Praba 14 2 9000.000000 2 900000.000000 + 130 1100 Kishor 13 1 3000.000000 1 300000.000000 + +echo select f1,f2,f3,f4,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) SUM(f5) COUNT(f6) SUM(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 5000.000000 2 500000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 9000.000000 2 900000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + +echo select f1,f2,f3,f4,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4 having sum(f5)>=4000 and sum(f5)<6000; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) SUM(f5) COUNT(f6) SUM(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 5000.000000 2 500000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + +echo select f1,f2,f3,f4,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 and f2<=130 group by f1,f2,f3,f4; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) SUM(f5) COUNT(f6) SUM(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 5000.000000 2 500000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 9000.000000 2 900000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 1300000.000000 + 17 130 1100 Arindam 2 15000.000000 2 1500000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),sum(f5), count(f6),sum(f6) from t1 where f1 >= 12 and f2<=130 group by f1,f2,f3,f4 having sum(f5)>=5000 and sum(f5)<10000; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) SUM(f5) COUNT(f6) SUM(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 5000.000000 2 500000.000000 + 14 100 1000 Praba 2 9000.000000 2 900000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 1300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +Statement Executed diff --git a/test/sql/Aggregate/exp.testnw029.ksh b/test/sql/Aggregate/exp.testnw029.ksh new file mode 100644 index 00000000..46d3b9c6 --- /dev/null +++ b/test/sql/Aggregate/exp.testnw029.ksh @@ -0,0 +1,222 @@ +Network CSql +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 t1.f5 t1.f6 t1.f7 t1.f8 t1.f9 +--------------------------------------------------------- + 10 100 1000 Bijay 1000.000000 100000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + 11 110 1100 Jitendr 2000.000000 200000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 12 120 1000 Nihar 3000.000000 300000.000000 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 NULL Kishor 4000.000000 400000.000000 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 + 14 100 1000 Praba 5000.000000 500000.000000 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 + 15 110 1100 Sanjit 6000.000000 600000.000000 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 + 16 120 1000 Sanjay NULL 700000.000000 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 + 17 130 1100 Arindam 8000.000000 800000.000000 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 + 10 100 1000 Bijay 9000.000000 900000.000000 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 + 11 NULL 1100 Jitendr 1000.000000 100000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 12 120 1000 Nihar 2000.000000 200000.000000 2009/3/3 NULL 2009/3/3 11:59:59.0 + 13 130 1100 Kishor 3000.000000 300000.000000 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 + 14 100 1000 Praba 4000.000000 400000.000000 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 + 15 110 NULL Sanjit 5000.000000 500000.000000 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 + 16 120 1000 Sanjay 6000.000000 600000.000000 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 + 17 130 1100 Arindam 7000.000000 700000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + +Network CSql +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 group by f1,f2,f3,f4; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MIN(f5) COUNT(f6) MIN(f6) +--------------------------------------------------------- + 10 100 1000 Bijay 2 1000.000000 2 100000.000000 + 11 110 1100 Jitendr 1 2000.000000 1 200000.000000 + 12 120 1000 Nihar 2 2000.000000 2 200000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 4000.000000 2 400000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 600000.000000 + 17 130 1100 Arindam 2 7000.000000 2 700000.000000 + 11 NULL 1100 Jitendr 1 1000.000000 1 100000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 group by f2,f1,f4,f3; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MIN(f5) COUNT(f6) MIN(f6) +--------------------------------------------------------- + 10 100 1000 Bijay 2 1000.000000 2 100000.000000 + 11 110 1100 Jitendr 1 2000.000000 1 200000.000000 + 12 120 1000 Nihar 2 2000.000000 2 200000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 4000.000000 2 400000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 600000.000000 + 17 130 1100 Arindam 2 7000.000000 2 700000.000000 + 11 NULL 1100 Jitendr 1 1000.000000 1 100000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 group by f3,f1,f4,f2; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MIN(f5) COUNT(f6) MIN(f6) +--------------------------------------------------------- + 10 100 1000 Bijay 2 1000.000000 2 100000.000000 + 11 110 1100 Jitendr 1 2000.000000 1 200000.000000 + 12 120 1000 Nihar 2 2000.000000 2 200000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 4000.000000 2 400000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 600000.000000 + 17 130 1100 Arindam 2 7000.000000 2 700000.000000 + 11 NULL 1100 Jitendr 1 1000.000000 1 100000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 group by f4,f3,f2,f1; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MIN(f5) COUNT(f6) MIN(f6) +--------------------------------------------------------- + 10 100 1000 Bijay 2 1000.000000 2 100000.000000 + 11 110 1100 Jitendr 1 2000.000000 1 200000.000000 + 12 120 1000 Nihar 2 2000.000000 2 200000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 4000.000000 2 400000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 600000.000000 + 17 130 1100 Arindam 2 7000.000000 2 700000.000000 + 11 NULL 1100 Jitendr 1 1000.000000 1 100000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 group by f1,f2,f3,f4 having min(f5)>=5000; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MIN(f5) COUNT(f6) MIN(f6) +--------------------------------------------------------- + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 600000.000000 + 17 130 1100 Arindam 2 7000.000000 2 700000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 group by f1,f2,f3,f4; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MIN(f5) COUNT(f6) MIN(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 2000.000000 2 200000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 4000.000000 2 400000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 600000.000000 + 17 130 1100 Arindam 2 7000.000000 2 700000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 group by f4,f3,f1,f2; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MIN(f5) COUNT(f6) MIN(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 2000.000000 2 200000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 4000.000000 2 400000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 600000.000000 + 17 130 1100 Arindam 2 7000.000000 2 700000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 group by f4,f1,f2,f3; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MIN(f5) COUNT(f6) MIN(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 2000.000000 2 200000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 4000.000000 2 400000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 600000.000000 + 17 130 1100 Arindam 2 7000.000000 2 700000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 group by f4,f3,f1,f2; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MIN(f5) COUNT(f6) MIN(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 2000.000000 2 200000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 4000.000000 2 400000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 600000.000000 + 17 130 1100 Arindam 2 7000.000000 2 700000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MIN(f5) COUNT(f6) MIN(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 2000.000000 2 200000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 4000.000000 2 400000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 and f1<15 group by f2,f3,f4,f1; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MIN(f5) COUNT(f6) MIN(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 2000.000000 2 200000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 4000.000000 2 400000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f4,f3; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MIN(f5) COUNT(f6) MIN(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 2000.000000 2 200000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 4000.000000 2 400000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4 having min(f5)>=4000 and min(f5)<6000; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MIN(f5) COUNT(f6) MIN(f6) +--------------------------------------------------------- + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 4000.000000 2 400000.000000 + +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 and f2<=130 group by f1,f2,f3,f4; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MIN(f5) COUNT(f6) MIN(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 2000.000000 2 200000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 4000.000000 2 400000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 600000.000000 + 17 130 1100 Arindam 2 7000.000000 2 700000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),min(f5) ,count(f6),min(f6) from t1 where f1 >= 12 and f2<=130 group by f1,f2,f3,f4 having min(f5)>=5000 and min(f5)<10000; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MIN(f5) COUNT(f6) MIN(f6) +--------------------------------------------------------- + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 600000.000000 + 17 130 1100 Arindam 2 7000.000000 2 700000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +Statement Executed diff --git a/test/sql/Aggregate/exp.testnw030.ksh b/test/sql/Aggregate/exp.testnw030.ksh new file mode 100644 index 00000000..897007a4 --- /dev/null +++ b/test/sql/Aggregate/exp.testnw030.ksh @@ -0,0 +1,225 @@ +Network CSql +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 t1.f5 t1.f6 t1.f7 t1.f8 t1.f9 +--------------------------------------------------------- + 10 100 1000 Bijay 1000.000000 100000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + 11 110 1100 Jitendr 2000.000000 200000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 12 120 1000 Nihar 3000.000000 300000.000000 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 NULL Kishor 4000.000000 400000.000000 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 + 14 100 1000 Praba 5000.000000 500000.000000 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 + 15 110 1100 Sanjit 6000.000000 600000.000000 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 + 16 120 1000 Sanjay NULL 700000.000000 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 + 17 130 1100 Arindam 8000.000000 800000.000000 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 + 10 100 1000 Bijay 9000.000000 900000.000000 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 + 11 NULL 1100 Jitendr 1000.000000 100000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 12 120 1000 Nihar 2000.000000 200000.000000 2009/3/3 NULL 2009/3/3 11:59:59.0 + 13 130 1100 Kishor 3000.000000 300000.000000 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 + 14 100 1000 Praba 4000.000000 400000.000000 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 + 15 110 NULL Sanjit 5000.000000 500000.000000 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 + 16 120 1000 Sanjay 6000.000000 600000.000000 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 + 17 130 1100 Arindam 7000.000000 700000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + +Network CSql +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 group by f1,f2,f3,f4; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MAX(f5) COUNT(f6) MAX(f6) +--------------------------------------------------------- + 10 100 1000 Bijay 2 9000.000000 2 900000.000000 + 11 110 1100 Jitendr 1 2000.000000 1 200000.000000 + 12 120 1000 Nihar 2 3000.000000 2 300000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 5000.000000 2 500000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 700000.000000 + 17 130 1100 Arindam 2 8000.000000 2 800000.000000 + 11 NULL 1100 Jitendr 1 1000.000000 1 100000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 group by f2,f1,f4,f3; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MAX(f5) COUNT(f6) MAX(f6) +--------------------------------------------------------- + 10 100 1000 Bijay 2 9000.000000 2 900000.000000 + 11 110 1100 Jitendr 1 2000.000000 1 200000.000000 + 12 120 1000 Nihar 2 3000.000000 2 300000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 5000.000000 2 500000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 700000.000000 + 17 130 1100 Arindam 2 8000.000000 2 800000.000000 + 11 NULL 1100 Jitendr 1 1000.000000 1 100000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 group by f3,f1,f4,f2; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MAX(f5) COUNT(f6) MAX(f6) +--------------------------------------------------------- + 10 100 1000 Bijay 2 9000.000000 2 900000.000000 + 11 110 1100 Jitendr 1 2000.000000 1 200000.000000 + 12 120 1000 Nihar 2 3000.000000 2 300000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 5000.000000 2 500000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 700000.000000 + 17 130 1100 Arindam 2 8000.000000 2 800000.000000 + 11 NULL 1100 Jitendr 1 1000.000000 1 100000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 group by f4,f3,f2,f1; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MAX(f5) COUNT(f6) MAX(f6) +--------------------------------------------------------- + 10 100 1000 Bijay 2 9000.000000 2 900000.000000 + 11 110 1100 Jitendr 1 2000.000000 1 200000.000000 + 12 120 1000 Nihar 2 3000.000000 2 300000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 5000.000000 2 500000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 700000.000000 + 17 130 1100 Arindam 2 8000.000000 2 800000.000000 + 11 NULL 1100 Jitendr 1 1000.000000 1 100000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 group by f1,f2,f3,f4 having max(f5)>=5000; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MAX(f5) COUNT(f6) MAX(f6) +--------------------------------------------------------- + 10 100 1000 Bijay 2 9000.000000 2 900000.000000 + 14 100 1000 Praba 2 5000.000000 2 500000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 700000.000000 + 17 130 1100 Arindam 2 8000.000000 2 800000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 group by f1,f2,f3,f4; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MAX(f5) COUNT(f6) MAX(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 3000.000000 2 300000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 5000.000000 2 500000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 700000.000000 + 17 130 1100 Arindam 2 8000.000000 2 800000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 group by f4,f3,f1,f2; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MAX(f5) COUNT(f6) MAX(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 3000.000000 2 300000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 5000.000000 2 500000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 700000.000000 + 17 130 1100 Arindam 2 8000.000000 2 800000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 group by f4,f1,f2,f3; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MAX(f5) COUNT(f6) MAX(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 3000.000000 2 300000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 5000.000000 2 500000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 700000.000000 + 17 130 1100 Arindam 2 8000.000000 2 800000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 group by f4,f3,f1,f2; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MAX(f5) COUNT(f6) MAX(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 3000.000000 2 300000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 5000.000000 2 500000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 700000.000000 + 17 130 1100 Arindam 2 8000.000000 2 800000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MAX(f5) COUNT(f6) MAX(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 3000.000000 2 300000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 5000.000000 2 500000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 and f1<15 group by f2,f3,f4,f1; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MAX(f5) COUNT(f6) MAX(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 3000.000000 2 300000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 5000.000000 2 500000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f4,f3; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MAX(f5) COUNT(f6) MAX(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 3000.000000 2 300000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 5000.000000 2 500000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4 having max(f5)>=4000 and max(f5)<6000; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MAX(f5) COUNT(f6) MAX(f6) +--------------------------------------------------------- + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 5000.000000 2 500000.000000 + +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 and f2<=130 group by f1,f2,f3,f4; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MAX(f5) COUNT(f6) MAX(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 3000.000000 2 300000.000000 + 13 130 NULL Kishor 1 4000.000000 1 400000.000000 + 14 100 1000 Praba 2 5000.000000 2 500000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 700000.000000 + 17 130 1100 Arindam 2 8000.000000 2 800000.000000 + 13 130 1100 Kishor 1 3000.000000 1 300000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +echo select f1,f2,f3,f4,count(f5),max(f5) ,count(f6),max(f6) from t1 where f1 >= 12 and f2<=130 group by f1,f2,f3,f4 having max(f5)>=5000 and max(f5)<10000; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) MAX(f5) COUNT(f6) MAX(f6) +--------------------------------------------------------- + 14 100 1000 Praba 2 5000.000000 2 500000.000000 + 15 110 1100 Sanjit 1 6000.000000 1 600000.000000 + 16 120 1000 Sanjay 1 6000.000000 2 700000.000000 + 17 130 1100 Arindam 2 8000.000000 2 800000.000000 + 15 110 NULL Sanjit 1 5000.000000 1 500000.000000 + +Statement Executed diff --git a/test/sql/Aggregate/exp.testnw031.ksh b/test/sql/Aggregate/exp.testnw031.ksh new file mode 100644 index 00000000..cb5cb3fa --- /dev/null +++ b/test/sql/Aggregate/exp.testnw031.ksh @@ -0,0 +1,223 @@ +Network CSql +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 t1.f5 t1.f6 t1.f7 t1.f8 t1.f9 +--------------------------------------------------------- + 10 100 1000 Bijay 1000.000000 100000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + 11 110 1100 Jitendr 2000.000000 200000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 12 120 1000 Nihar 3000.000000 300000.000000 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 NULL Kishor 4000.000000 400000.000000 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 + 14 100 1000 Praba 5000.000000 500000.000000 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 + 15 110 1100 Sanjit 6000.000000 600000.000000 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 + 16 120 1000 Sanjay NULL 700000.000000 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 + 17 130 1100 Arindam 8000.000000 800000.000000 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 + 10 100 1000 Bijay 9000.000000 900000.000000 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 + 11 NULL 1100 Jitendr 1000.000000 100000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 12 120 1000 Nihar 2000.000000 200000.000000 2009/3/3 NULL 2009/3/3 11:59:59.0 + 13 130 1100 Kishor 3000.000000 300000.000000 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 + 14 100 1000 Praba 4000.000000 400000.000000 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 + 15 110 NULL Sanjit 5000.000000 500000.000000 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 + 16 120 1000 Sanjay 6000.000000 600000.000000 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 + 17 130 1100 Arindam 7000.000000 700000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + +Network CSql +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 group by f1,f2,f3,f4; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) COUNT(f6) +--------------------------------------------------------- + 10 100 1000 Bijay 2 2 + 11 110 1100 Jitendr 1 1 + 12 120 1000 Nihar 2 2 + 13 130 NULL Kishor 1 1 + 14 100 1000 Praba 2 2 + 15 110 1100 Sanjit 1 1 + 16 120 1000 Sanjay 1 2 + 17 130 1100 Arindam 2 2 + 11 NULL 1100 Jitendr 1 1 + 13 130 1100 Kishor 1 1 + 15 110 NULL Sanjit 1 1 + +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 group by f2,f1,f4,f3; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) COUNT(f6) +--------------------------------------------------------- + 10 100 1000 Bijay 2 2 + 11 110 1100 Jitendr 1 1 + 12 120 1000 Nihar 2 2 + 13 130 NULL Kishor 1 1 + 14 100 1000 Praba 2 2 + 15 110 1100 Sanjit 1 1 + 16 120 1000 Sanjay 1 2 + 17 130 1100 Arindam 2 2 + 11 NULL 1100 Jitendr 1 1 + 13 130 1100 Kishor 1 1 + 15 110 NULL Sanjit 1 1 + +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 group by f3,f1,f4,f2; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) COUNT(f6) +--------------------------------------------------------- + 10 100 1000 Bijay 2 2 + 11 110 1100 Jitendr 1 1 + 12 120 1000 Nihar 2 2 + 13 130 NULL Kishor 1 1 + 14 100 1000 Praba 2 2 + 15 110 1100 Sanjit 1 1 + 16 120 1000 Sanjay 1 2 + 17 130 1100 Arindam 2 2 + 11 NULL 1100 Jitendr 1 1 + 13 130 1100 Kishor 1 1 + 15 110 NULL Sanjit 1 1 + +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 group by f4,f3,f2,f1; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) COUNT(f6) +--------------------------------------------------------- + 10 100 1000 Bijay 2 2 + 11 110 1100 Jitendr 1 1 + 12 120 1000 Nihar 2 2 + 13 130 NULL Kishor 1 1 + 14 100 1000 Praba 2 2 + 15 110 1100 Sanjit 1 1 + 16 120 1000 Sanjay 1 2 + 17 130 1100 Arindam 2 2 + 11 NULL 1100 Jitendr 1 1 + 13 130 1100 Kishor 1 1 + 15 110 NULL Sanjit 1 1 + +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 group by f1,f2,f3,f4 having count(f5)>=2; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) COUNT(f6) +--------------------------------------------------------- + 10 100 1000 Bijay 2 2 + 12 120 1000 Nihar 2 2 + 14 100 1000 Praba 2 2 + 17 130 1100 Arindam 2 2 + +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 group by f1,f2,f3,f4; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) COUNT(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 2 + 13 130 NULL Kishor 1 1 + 14 100 1000 Praba 2 2 + 15 110 1100 Sanjit 1 1 + 16 120 1000 Sanjay 1 2 + 17 130 1100 Arindam 2 2 + 13 130 1100 Kishor 1 1 + 15 110 NULL Sanjit 1 1 + +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 group by f4,f3,f1,f2; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) COUNT(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 2 + 13 130 NULL Kishor 1 1 + 14 100 1000 Praba 2 2 + 15 110 1100 Sanjit 1 1 + 16 120 1000 Sanjay 1 2 + 17 130 1100 Arindam 2 2 + 13 130 1100 Kishor 1 1 + 15 110 NULL Sanjit 1 1 + +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 group by f4,f1,f2,f3; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) COUNT(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 2 + 13 130 NULL Kishor 1 1 + 14 100 1000 Praba 2 2 + 15 110 1100 Sanjit 1 1 + 16 120 1000 Sanjay 1 2 + 17 130 1100 Arindam 2 2 + 13 130 1100 Kishor 1 1 + 15 110 NULL Sanjit 1 1 + +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 group by f4,f3,f1,f2; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) COUNT(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 2 + 13 130 NULL Kishor 1 1 + 14 100 1000 Praba 2 2 + 15 110 1100 Sanjit 1 1 + 16 120 1000 Sanjay 1 2 + 17 130 1100 Arindam 2 2 + 13 130 1100 Kishor 1 1 + 15 110 NULL Sanjit 1 1 + +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) COUNT(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 2 + 13 130 NULL Kishor 1 1 + 14 100 1000 Praba 2 2 + 13 130 1100 Kishor 1 1 + +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 and f1<15 group by f2,f3,f4,f1; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) COUNT(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 2 + 13 130 NULL Kishor 1 1 + 14 100 1000 Praba 2 2 + 13 130 1100 Kishor 1 1 + +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f4,f3; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) COUNT(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 2 + 13 130 NULL Kishor 1 1 + 14 100 1000 Praba 2 2 + 13 130 1100 Kishor 1 1 + +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 and f1<15 group by f1,f2,f3,f4 having count(f5)>=0 and count(f5)<2; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) COUNT(f6) +--------------------------------------------------------- + 13 130 NULL Kishor 1 1 + 13 130 1100 Kishor 1 1 + +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 and f2<=130 group by f1,f2,f3,f4; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) COUNT(f6) +--------------------------------------------------------- + 12 120 1000 Nihar 2 2 + 13 130 NULL Kishor 1 1 + 14 100 1000 Praba 2 2 + 15 110 1100 Sanjit 1 1 + 16 120 1000 Sanjay 1 2 + 17 130 1100 Arindam 2 2 + 13 130 1100 Kishor 1 1 + 15 110 NULL Sanjit 1 1 + +echo select f1,f2,f3,f4,count(f5),count(f6) from t1 where f1 >= 12 and f2<=130 group by f1,f2,f3,f4 having count(f5)>=0 and count(f5)<2; +--------------------------------------------------------- + f1 f2 f3 f4 COUNT(f5) COUNT(f6) +--------------------------------------------------------- + 13 130 NULL Kishor 1 1 + 15 110 1100 Sanjit 1 1 + 16 120 1000 Sanjay 1 2 + 13 130 1100 Kishor 1 1 + 15 110 NULL Sanjit 1 1 + +Statement Executed diff --git a/test/sql/Aggregate/exp.testnw032.ksh b/test/sql/Aggregate/exp.testnw032.ksh new file mode 100644 index 00000000..6dcf4d48 --- /dev/null +++ b/test/sql/Aggregate/exp.testnw032.ksh @@ -0,0 +1,32 @@ +Network CSql +echo CREATE TABLE writer (poet char(50) , anthology char(40) , copies_in_stock tinyint(4)) ; +Statement Executed +echo INSERT INTO writer VALUES ('Mongane Wally Serote','Tstetlo',3); +Statement Executed: Rows Affected = 1 +echo INSERT INTO writer VALUES ('Douglas Livingstone', 'The Skull in the Mud',21); +Statement Executed: Rows Affected = 1 +echo INSERT INTO writer VALUES ('Mongane Wally Serote', 'No Baby Must Weep',8); +Statement Executed: Rows Affected = 1 +echo INSERT INTO writer VALUES ('Douglas Livingstone', 'A Littoral Zone',2); +Statement Executed: Rows Affected = 1 +echo INSERT INTO writer VALUES ('Mongane Wally Serote', 'A Tough Tale',2); +Statement Executed: Rows Affected = 1 +echo SELECT * FROM writer; +--------------------------------------------------------- + writer.poet writer.anthology writer.copies_in_stock +--------------------------------------------------------- + Mongane Wally Serote Tstetlo 3 + Douglas Livingstone The Skull in the Mud 21 + Mongane Wally Serote No Baby Must Weep 8 + Douglas Livingstone A Littoral Zone 2 + Mongane Wally Serote A Tough Tale 2 + +echo SELECT poet, MAX(copies_in_stock) , MIN(copies_in_stock) , AVG(copies_in_stock) , SUM(copies_in_stock) FROM writer GROUP BY poet; +--------------------------------------------------------- + poet MAX(copies_in_stock) MIN(copies_in_stock) AVG(copies_in_stock) SUM(copies_in_stock) +--------------------------------------------------------- + Mongane Wally Serote 8 2 4.333333 13 + Douglas Livingstone 21 2 11.500000 23 + +Network CSql +Statement Executed diff --git a/test/sql/Aggregate/exp.testnw033.ksh b/test/sql/Aggregate/exp.testnw033.ksh new file mode 100644 index 00000000..11166186 --- /dev/null +++ b/test/sql/Aggregate/exp.testnw033.ksh @@ -0,0 +1,283 @@ +Network CSql +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 t1.f5 t1.f6 t1.f7 t1.f8 t1.f9 +--------------------------------------------------------- + 10 100 1000 Bijay 1000.000000 100000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + 11 110 1100 Jitendr 2000.000000 200000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 12 120 1000 Nihar 3000.000000 300000.000000 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 NULL Kishor 4000.000000 400000.000000 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 + 14 100 1000 Praba 5000.000000 500000.000000 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 + 15 110 1100 Sanjit 6000.000000 600000.000000 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 + 16 120 1000 Sanjay NULL 700000.000000 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 + 17 130 1100 Arindam 8000.000000 800000.000000 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 + 10 100 1000 Bijay 9000.000000 900000.000000 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 + 11 NULL 1100 Jitendr 1000.000000 100000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 12 120 1000 Nihar 2000.000000 200000.000000 2009/3/3 NULL 2009/3/3 11:59:59.0 + 13 130 1100 Kishor 3000.000000 300000.000000 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 + 14 100 1000 Praba 4000.000000 400000.000000 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 + 15 110 NULL Sanjit 5000.000000 500000.000000 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 + 16 120 1000 Sanjay 6000.000000 600000.000000 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 + 17 130 1100 Arindam 7000.000000 700000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + +Network CSql +echo select f1,f2,min(f4),min(f7),min(f8),min(f9) from t1 group by f1,f2; +--------------------------------------------------------- + f1 f2 MIN(f4) MIN(f7) MIN(f8) MIN(f9) +--------------------------------------------------------- + 10 100 Bijay 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 + 11 110 Jitendr 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 12 120 Nihar 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 Kishor 2009/3/4 11:59:56.0 2009/3/4 11:59:59.0 + 14 100 Praba 2009/3/1 11:59:55.0 2009/3/1 11:59:59.0 + 15 110 Sanjit 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 + 16 120 Sanjay 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 + 17 130 Arindam 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 + 11 NULL Jitendr 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + +echo select f1,f2,min(f4),min(f7),min(f8),min(f9) from t1 group by f1,f2 having min(f4)>='K'; +--------------------------------------------------------- + f1 f2 MIN(f4) MIN(f7) MIN(f8) MIN(f9) +--------------------------------------------------------- + 12 120 Nihar 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 Kishor 2009/3/4 11:59:56.0 2009/3/4 11:59:59.0 + 14 100 Praba 2009/3/1 11:59:55.0 2009/3/1 11:59:59.0 + 15 110 Sanjit 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 + 16 120 Sanjay 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 + +echo select f1,f2,min(f4),min(f7),min(f8),min(f9) from t1 where f1 >= 12 group by f1,f2; +--------------------------------------------------------- + f1 f2 MIN(f4) MIN(f7) MIN(f8) MIN(f9) +--------------------------------------------------------- + 12 120 Nihar 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 Kishor 2009/3/4 11:59:56.0 2009/3/4 11:59:59.0 + 14 100 Praba 2009/3/1 11:59:55.0 2009/3/1 11:59:59.0 + 15 110 Sanjit 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 + 16 120 Sanjay 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 + 17 130 Arindam 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 + +echo select f1,f2,min(f4),min(f7),min(f8),min(f9) from t1 where f1 >= 12 group by f1,f2 having min(f8)>='11:59:55'; +--------------------------------------------------------- + f1 f2 MIN(f4) MIN(f7) MIN(f8) MIN(f9) +--------------------------------------------------------- + 12 120 Nihar 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 Kishor 2009/3/4 11:59:56.0 2009/3/4 11:59:59.0 + 14 100 Praba 2009/3/1 11:59:55.0 2009/3/1 11:59:59.0 + 15 110 Sanjit 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 + 16 120 Sanjay 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 + 17 130 Arindam 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 + +echo select f1,f2,min(f4),min(f7),min(f8),min(f9) from t1 where f1 >= 12 and f1<15 group by f1,f2; +--------------------------------------------------------- + f1 f2 MIN(f4) MIN(f7) MIN(f8) MIN(f9) +--------------------------------------------------------- + 12 120 Nihar 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 Kishor 2009/3/4 11:59:56.0 2009/3/4 11:59:59.0 + 14 100 Praba 2009/3/1 11:59:55.0 2009/3/1 11:59:59.0 + +echo select f1,f2,min(f4),min(f7),min(f8),min(f9) from t1 where f1 >= 12 and f1<15 group by f1,f2 having min(f9)>='2009-03-03 11:59:59'; +--------------------------------------------------------- + f1 f2 MIN(f4) MIN(f7) MIN(f8) MIN(f9) +--------------------------------------------------------- + 12 120 Nihar 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 Kishor 2009/3/4 11:59:56.0 2009/3/4 11:59:59.0 + +echo select f1,f2,min(f4),min(f7),min(f8),min(f9) from t1 where f1 >= 12 and f1<15 group by f1,f2 having min(f4)>='K' and min(f8) <'11:59:56'; +--------------------------------------------------------- + f1 f2 MIN(f4) MIN(f7) MIN(f8) MIN(f9) +--------------------------------------------------------- + 14 100 Praba 2009/3/1 11:59:55.0 2009/3/1 11:59:59.0 + +echo select f1,f2,min(f4),min(f7),min(f8),min(f9) from t1 where f1 >= 12 and f2<130 group by f1,f2 ; +--------------------------------------------------------- + f1 f2 MIN(f4) MIN(f7) MIN(f8) MIN(f9) +--------------------------------------------------------- + 12 120 Nihar 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 14 100 Praba 2009/3/1 11:59:55.0 2009/3/1 11:59:59.0 + 15 110 Sanjit 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 + 16 120 Sanjay 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 + +echo select f1,f2,min(f4),min(f7),min(f8),min(f9) from t1 where f1 >= 12 and f2<130 group by f1,f2 having min(f7)>='2009/3/2' and min(f9)<>'2009-03-01 11:59:59'; +--------------------------------------------------------- + f1 f2 MIN(f4) MIN(f7) MIN(f8) MIN(f9) +--------------------------------------------------------- + 12 120 Nihar 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 16 120 Sanjay 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 + +echo select f7,f8,f9,min(f4) from t1 group by f7,f8,f9; +--------------------------------------------------------- + f7 f8 f9 MIN(f4) +--------------------------------------------------------- + 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 Arindam + 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 Jitendr + 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 Nihar + 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 Kishor + 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 Praba + 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 Sanjit + 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 Sanjay + 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 Arindam + 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 Bijay + 2009/3/3 NULL 2009/3/3 11:59:59.0 Nihar + 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 Kishor + 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 Praba + 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 Sanjit + 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 Sanjay + +echo select f9,f7,f8,min(f4) from t1 group by f7,f8,f9; +--------------------------------------------------------- + f9 f7 f8 MIN(f4) +--------------------------------------------------------- + 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 Arindam + 2009/3/2 11:59:59.0 2009/3/2 11:59:58.0 Jitendr + 2009/3/3 11:59:59.0 2009/3/3 11:59:57.0 Nihar + 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 Kishor + 2009/3/1 11:59:59.0 2009/3/1 11:59:58.0 Praba + 2009/3/2 11:59:59.0 2009/3/2 11:59:57.0 Sanjit + 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 Sanjay + 2009/3/4 11:59:59.0 2009/3/4 11:59:58.0 Arindam + 2009/3/1 11:59:59.0 2009/3/1 11:59:57.0 Bijay + 2009/3/3 11:59:59.0 2009/3/3 NULL Nihar + 2009/3/5 11:59:59.0 2009/3/5 11:59:56.0 Kishor + 2009/3/4 11:59:59.0 2009/3/1 11:59:55.0 Praba + 2009/3/1 11:59:59.0 2009/3/2 11:59:56.0 Sanjit + 2009/3/3 11:59:59.0 2009/3/3 11:59:55.0 Sanjay + +echo select f7,f8,f9,min(f4) from t1 group by f7,f9,f8; +--------------------------------------------------------- + f7 f8 f9 MIN(f4) +--------------------------------------------------------- + 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 Arindam + 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 Jitendr + 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 Nihar + 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 Kishor + 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 Praba + 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 Sanjit + 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 Sanjay + 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 Arindam + 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 Bijay + 2009/3/3 NULL 2009/3/3 11:59:59.0 Nihar + 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 Kishor + 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 Praba + 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 Sanjit + 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 Sanjay + +echo select f7,f8,f9,min(f4) from t1 group by f7,f9,f8 having min(f4)>='K' and min(f4) <'Q'; +--------------------------------------------------------- + f7 f8 f9 MIN(f4) +--------------------------------------------------------- + 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 Nihar + 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 Kishor + 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 Praba + 2009/3/3 NULL 2009/3/3 11:59:59.0 Nihar + 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 Kishor + 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 Praba + +echo select f4,f8,f9,min(f7) from t1 group by f4,f8,f9; +--------------------------------------------------------- + f4 f8 f9 MIN(f7) +--------------------------------------------------------- + Bijay 11:59:59.0 2009/3/1 11:59:59.0 2009/3/1 + Jitendr 11:59:58.0 2009/3/2 11:59:59.0 2009/3/2 + Nihar 11:59:57.0 2009/3/3 11:59:59.0 2009/3/3 + Kishor 11:59:59.0 2009/3/4 11:59:59.0 2009/3/4 + Praba 11:59:58.0 2009/3/1 11:59:59.0 2009/3/1 + Sanjit 11:59:57.0 2009/3/2 11:59:59.0 2009/3/2 + Sanjay 11:59:59.0 2009/3/3 11:59:59.0 2009/3/3 + Arindam 11:59:58.0 2009/3/4 11:59:59.0 2009/3/4 + Bijay 11:59:57.0 2009/3/1 11:59:59.0 2009/3/1 + Nihar NULL 2009/3/3 11:59:59.0 2009/3/3 + Kishor 11:59:56.0 2009/3/5 11:59:59.0 2009/3/5 + Praba 11:59:55.0 2009/3/4 11:59:59.0 2009/3/1 + Sanjit 11:59:56.0 2009/3/1 11:59:59.0 2009/3/2 + Sanjay 11:59:55.0 2009/3/3 11:59:59.0 2009/3/3 + Arindam 11:59:59.0 2009/3/1 11:59:59.0 2009/3/1 + +echo select f4,f8,f9,min(f7) from t1 group by f4,f8,f9 having min(f7)<='2009-03-04' and min(f7) >'2009-03-02' ; +--------------------------------------------------------- + f4 f8 f9 MIN(f7) +--------------------------------------------------------- + Nihar 11:59:57.0 2009/3/3 11:59:59.0 2009/3/3 + Kishor 11:59:59.0 2009/3/4 11:59:59.0 2009/3/4 + Sanjay 11:59:59.0 2009/3/3 11:59:59.0 2009/3/3 + Arindam 11:59:58.0 2009/3/4 11:59:59.0 2009/3/4 + Nihar NULL 2009/3/3 11:59:59.0 2009/3/3 + Sanjay 11:59:55.0 2009/3/3 11:59:59.0 2009/3/3 + +echo select f9,f7,f4,min(f8) from t1 group by f4,f7,f9; +--------------------------------------------------------- + f9 f7 f4 MIN(f8) +--------------------------------------------------------- + 2009/3/1 11:59:59.0 2009/3/1 Bijay 11:59:57.0 + 2009/3/2 11:59:59.0 2009/3/2 Jitendr 11:59:58.0 + 2009/3/3 11:59:59.0 2009/3/3 Nihar 11:59:57.0 + 2009/3/4 11:59:59.0 2009/3/4 Kishor 11:59:59.0 + 2009/3/1 11:59:59.0 2009/3/1 Praba 11:59:58.0 + 2009/3/2 11:59:59.0 2009/3/2 Sanjit 11:59:57.0 + 2009/3/3 11:59:59.0 2009/3/3 Sanjay 11:59:55.0 + 2009/3/4 11:59:59.0 2009/3/4 Arindam 11:59:58.0 + 2009/3/5 11:59:59.0 2009/3/5 Kishor 11:59:56.0 + 2009/3/4 11:59:59.0 2009/3/1 Praba 11:59:55.0 + 2009/3/1 11:59:59.0 2009/3/2 Sanjit 11:59:56.0 + 2009/3/1 11:59:59.0 2009/3/1 Arindam 11:59:59.0 + +echo select f9,f7,f4,min(f8) from t1 group by f4,f7,f9 having min(f8)<='11:59:59' and min(f8) >'11:59:57' ; +--------------------------------------------------------- + f9 f7 f4 MIN(f8) +--------------------------------------------------------- + 2009/3/2 11:59:59.0 2009/3/2 Jitendr 11:59:58.0 + 2009/3/4 11:59:59.0 2009/3/4 Kishor 11:59:59.0 + 2009/3/1 11:59:59.0 2009/3/1 Praba 11:59:58.0 + 2009/3/4 11:59:59.0 2009/3/4 Arindam 11:59:58.0 + 2009/3/1 11:59:59.0 2009/3/1 Arindam 11:59:59.0 + +echo select f7,f8,f4,min(f9) from t1 group by f4,f7,f8; +--------------------------------------------------------- + f7 f8 f4 MIN(f9) +--------------------------------------------------------- + 2009/3/1 11:59:59.0 Bijay 2009/3/1 11:59:59.0 + 2009/3/2 11:59:58.0 Jitendr 2009/3/2 11:59:59.0 + 2009/3/3 11:59:57.0 Nihar 2009/3/3 11:59:59.0 + 2009/3/4 11:59:59.0 Kishor 2009/3/4 11:59:59.0 + 2009/3/1 11:59:58.0 Praba 2009/3/1 11:59:59.0 + 2009/3/2 11:59:57.0 Sanjit 2009/3/2 11:59:59.0 + 2009/3/3 11:59:59.0 Sanjay 2009/3/3 11:59:59.0 + 2009/3/4 11:59:58.0 Arindam 2009/3/4 11:59:59.0 + 2009/3/1 11:59:57.0 Bijay 2009/3/1 11:59:59.0 + 2009/3/3 NULL Nihar 2009/3/3 11:59:59.0 + 2009/3/5 11:59:56.0 Kishor 2009/3/5 11:59:59.0 + 2009/3/1 11:59:55.0 Praba 2009/3/4 11:59:59.0 + 2009/3/2 11:59:56.0 Sanjit 2009/3/1 11:59:59.0 + 2009/3/3 11:59:55.0 Sanjay 2009/3/3 11:59:59.0 + 2009/3/1 11:59:59.0 Arindam 2009/3/1 11:59:59.0 + +echo select f7,f8,f4,min(f9) from t1 group by f4,f7,f8 having min(f9)<='2009-03-05 11:59:59' and min(f9) >'2009-03-02 11:59:59' ; +--------------------------------------------------------- + f7 f8 f4 MIN(f9) +--------------------------------------------------------- + 2009/3/3 11:59:57.0 Nihar 2009/3/3 11:59:59.0 + 2009/3/4 11:59:59.0 Kishor 2009/3/4 11:59:59.0 + 2009/3/3 11:59:59.0 Sanjay 2009/3/3 11:59:59.0 + 2009/3/4 11:59:58.0 Arindam 2009/3/4 11:59:59.0 + 2009/3/3 NULL Nihar 2009/3/3 11:59:59.0 + 2009/3/5 11:59:56.0 Kishor 2009/3/5 11:59:59.0 + 2009/3/1 11:59:55.0 Praba 2009/3/4 11:59:59.0 + 2009/3/3 11:59:55.0 Sanjay 2009/3/3 11:59:59.0 + +Statement Executed diff --git a/test/sql/Aggregate/exp.testnw034.ksh b/test/sql/Aggregate/exp.testnw034.ksh new file mode 100644 index 00000000..5f39c106 --- /dev/null +++ b/test/sql/Aggregate/exp.testnw034.ksh @@ -0,0 +1,287 @@ +Network CSql +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 t1.f5 t1.f6 t1.f7 t1.f8 t1.f9 +--------------------------------------------------------- + 10 100 1000 Bijay 1000.000000 100000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + 11 110 1100 Jitendr 2000.000000 200000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 12 120 1000 Nihar 3000.000000 300000.000000 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 NULL Kishor 4000.000000 400000.000000 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 + 14 100 1000 Praba 5000.000000 500000.000000 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 + 15 110 1100 Sanjit 6000.000000 600000.000000 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 + 16 120 1000 Sanjay NULL 700000.000000 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 + 17 130 1100 Arindam 8000.000000 800000.000000 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 + 10 100 1000 Bijay 9000.000000 900000.000000 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 + 11 NULL 1100 Jitendr 1000.000000 100000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 12 120 1000 Nihar 2000.000000 200000.000000 2009/3/3 NULL 2009/3/3 11:59:59.0 + 13 130 1100 Kishor 3000.000000 300000.000000 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 + 14 100 1000 Praba 4000.000000 400000.000000 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 + 15 110 NULL Sanjit 5000.000000 500000.000000 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 + 16 120 1000 Sanjay 6000.000000 600000.000000 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 + 17 130 1100 Arindam 7000.000000 700000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + +Network CSql +echo select f1,f2,max(f4),max(f7),max(f8),max(f9) from t1 group by f1,f2; +--------------------------------------------------------- + f1 f2 MAX(f4) MAX(f7) MAX(f8) MAX(f9) +--------------------------------------------------------- + 10 100 Bijay 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + 11 110 Jitendr 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 12 120 Nihar 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 Kishor 2009/3/5 11:59:59.0 2009/3/5 11:59:59.0 + 14 100 Praba 2009/3/1 11:59:58.0 2009/3/4 11:59:59.0 + 15 110 Sanjit 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 + 16 120 Sanjay 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 + 17 130 Arindam 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 + 11 NULL Jitendr 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + +echo select f1,f2,max(f4),max(f7),max(f8),max(f9) from t1 group by f1,f2 having max(f4)>='K'; +--------------------------------------------------------- + f1 f2 MAX(f4) MAX(f7) MAX(f8) MAX(f9) +--------------------------------------------------------- + 12 120 Nihar 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 Kishor 2009/3/5 11:59:59.0 2009/3/5 11:59:59.0 + 14 100 Praba 2009/3/1 11:59:58.0 2009/3/4 11:59:59.0 + 15 110 Sanjit 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 + 16 120 Sanjay 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 + +echo select f1,f2,max(f4),max(f7),max(f8),max(f9) from t1 where f1 >= 12 group by f1,f2; +--------------------------------------------------------- + f1 f2 MAX(f4) MAX(f7) MAX(f8) MAX(f9) +--------------------------------------------------------- + 12 120 Nihar 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 Kishor 2009/3/5 11:59:59.0 2009/3/5 11:59:59.0 + 14 100 Praba 2009/3/1 11:59:58.0 2009/3/4 11:59:59.0 + 15 110 Sanjit 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 + 16 120 Sanjay 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 + 17 130 Arindam 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 + +echo select f1,f2,max(f4),max(f7),max(f8),max(f9) from t1 where f1 >= 12 group by f1,f2 having max(f8)>='11:59:55'; +--------------------------------------------------------- + f1 f2 MAX(f4) MAX(f7) MAX(f8) MAX(f9) +--------------------------------------------------------- + 12 120 Nihar 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 Kishor 2009/3/5 11:59:59.0 2009/3/5 11:59:59.0 + 14 100 Praba 2009/3/1 11:59:58.0 2009/3/4 11:59:59.0 + 15 110 Sanjit 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 + 16 120 Sanjay 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 + 17 130 Arindam 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 + +echo select f1,f2,max(f4),max(f7),max(f8),max(f9) from t1 where f1 >= 12 and f1<15 group by f1,f2; +--------------------------------------------------------- + f1 f2 MAX(f4) MAX(f7) MAX(f8) MAX(f9) +--------------------------------------------------------- + 12 120 Nihar 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 Kishor 2009/3/5 11:59:59.0 2009/3/5 11:59:59.0 + 14 100 Praba 2009/3/1 11:59:58.0 2009/3/4 11:59:59.0 + +echo select f1,f2,max(f4),max(f7),max(f8),max(f9) from t1 where f1 >= 12 and f1<15 group by f1,f2 having max(f9)>='2009-03-03 11:59:59'; +--------------------------------------------------------- + f1 f2 MAX(f4) MAX(f7) MAX(f8) MAX(f9) +--------------------------------------------------------- + 12 120 Nihar 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 Kishor 2009/3/5 11:59:59.0 2009/3/5 11:59:59.0 + 14 100 Praba 2009/3/1 11:59:58.0 2009/3/4 11:59:59.0 + +echo select f1,f2,max(f4),max(f7),max(f8),max(f9) from t1 where f1 >= 12 and f1<15 group by f1,f2 having max(f4)>='K' and max(f8) <'11:59:58'; +--------------------------------------------------------- + f1 f2 MAX(f4) MAX(f7) MAX(f8) MAX(f9) +--------------------------------------------------------- + 12 120 Nihar 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + +echo select f1,f2,max(f4),max(f7),max(f8),max(f9) from t1 where f1 >= 12 and f2<130 group by f1,f2 ; +--------------------------------------------------------- + f1 f2 MAX(f4) MAX(f7) MAX(f8) MAX(f9) +--------------------------------------------------------- + 12 120 Nihar 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 14 100 Praba 2009/3/1 11:59:58.0 2009/3/4 11:59:59.0 + 15 110 Sanjit 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 + 16 120 Sanjay 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 + +echo select f1,f2,max(f4),max(f7),max(f8),max(f9) from t1 where f1 >= 12 and f2<130 group by f1,f2 having max(f7)>='2009/3/2' and max(f9)<>'2009-03-01 11:59:59'; +--------------------------------------------------------- + f1 f2 MAX(f4) MAX(f7) MAX(f8) MAX(f9) +--------------------------------------------------------- + 12 120 Nihar 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 15 110 Sanjit 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 + 16 120 Sanjay 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 + +echo select f7,f8,f9,max(f4) from t1 group by f7,f8,f9; +--------------------------------------------------------- + f7 f8 f9 MAX(f4) +--------------------------------------------------------- + 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 Bijay + 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 Jitendr + 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 Nihar + 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 Kishor + 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 Praba + 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 Sanjit + 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 Sanjay + 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 Arindam + 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 Bijay + 2009/3/3 NULL 2009/3/3 11:59:59.0 Nihar + 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 Kishor + 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 Praba + 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 Sanjit + 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 Sanjay + +echo select f9,f7,f8,max(f4) from t1 group by f7,f8,f9; +--------------------------------------------------------- + f9 f7 f8 MAX(f4) +--------------------------------------------------------- + 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 Bijay + 2009/3/2 11:59:59.0 2009/3/2 11:59:58.0 Jitendr + 2009/3/3 11:59:59.0 2009/3/3 11:59:57.0 Nihar + 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 Kishor + 2009/3/1 11:59:59.0 2009/3/1 11:59:58.0 Praba + 2009/3/2 11:59:59.0 2009/3/2 11:59:57.0 Sanjit + 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 Sanjay + 2009/3/4 11:59:59.0 2009/3/4 11:59:58.0 Arindam + 2009/3/1 11:59:59.0 2009/3/1 11:59:57.0 Bijay + 2009/3/3 11:59:59.0 2009/3/3 NULL Nihar + 2009/3/5 11:59:59.0 2009/3/5 11:59:56.0 Kishor + 2009/3/4 11:59:59.0 2009/3/1 11:59:55.0 Praba + 2009/3/1 11:59:59.0 2009/3/2 11:59:56.0 Sanjit + 2009/3/3 11:59:59.0 2009/3/3 11:59:55.0 Sanjay + +echo select f7,f8,f9,max(f4) from t1 group by f7,f9,f8; +--------------------------------------------------------- + f7 f8 f9 MAX(f4) +--------------------------------------------------------- + 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 Bijay + 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 Jitendr + 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 Nihar + 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 Kishor + 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 Praba + 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 Sanjit + 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 Sanjay + 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 Arindam + 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 Bijay + 2009/3/3 NULL 2009/3/3 11:59:59.0 Nihar + 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 Kishor + 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 Praba + 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 Sanjit + 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 Sanjay + +echo select f7,f8,f9,max(f4) from t1 group by f7,f9,f8 having max(f4)>='K' and max(f4) <'Q'; +--------------------------------------------------------- + f7 f8 f9 MAX(f4) +--------------------------------------------------------- + 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 Nihar + 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 Kishor + 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 Praba + 2009/3/3 NULL 2009/3/3 11:59:59.0 Nihar + 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 Kishor + 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 Praba + +echo select f4,f8,f9,max(f7) from t1 group by f4,f8,f9; +--------------------------------------------------------- + f4 f8 f9 MAX(f7) +--------------------------------------------------------- + Bijay 11:59:59.0 2009/3/1 11:59:59.0 2009/3/1 + Jitendr 11:59:58.0 2009/3/2 11:59:59.0 2009/3/2 + Nihar 11:59:57.0 2009/3/3 11:59:59.0 2009/3/3 + Kishor 11:59:59.0 2009/3/4 11:59:59.0 2009/3/4 + Praba 11:59:58.0 2009/3/1 11:59:59.0 2009/3/1 + Sanjit 11:59:57.0 2009/3/2 11:59:59.0 2009/3/2 + Sanjay 11:59:59.0 2009/3/3 11:59:59.0 2009/3/3 + Arindam 11:59:58.0 2009/3/4 11:59:59.0 2009/3/4 + Bijay 11:59:57.0 2009/3/1 11:59:59.0 2009/3/1 + Nihar NULL 2009/3/3 11:59:59.0 2009/3/3 + Kishor 11:59:56.0 2009/3/5 11:59:59.0 2009/3/5 + Praba 11:59:55.0 2009/3/4 11:59:59.0 2009/3/1 + Sanjit 11:59:56.0 2009/3/1 11:59:59.0 2009/3/2 + Sanjay 11:59:55.0 2009/3/3 11:59:59.0 2009/3/3 + Arindam 11:59:59.0 2009/3/1 11:59:59.0 2009/3/1 + +echo select f4,f8,f9,max(f7) from t1 group by f4,f8,f9 having max(f7)<='2009-03-04' and max(f7) >'2009-03-02' ; +--------------------------------------------------------- + f4 f8 f9 MAX(f7) +--------------------------------------------------------- + Nihar 11:59:57.0 2009/3/3 11:59:59.0 2009/3/3 + Kishor 11:59:59.0 2009/3/4 11:59:59.0 2009/3/4 + Sanjay 11:59:59.0 2009/3/3 11:59:59.0 2009/3/3 + Arindam 11:59:58.0 2009/3/4 11:59:59.0 2009/3/4 + Nihar NULL 2009/3/3 11:59:59.0 2009/3/3 + Sanjay 11:59:55.0 2009/3/3 11:59:59.0 2009/3/3 + +echo select f9,f7,f4,max(f8) from t1 group by f4,f7,f9; +--------------------------------------------------------- + f9 f7 f4 MAX(f8) +--------------------------------------------------------- + 2009/3/1 11:59:59.0 2009/3/1 Bijay 11:59:59.0 + 2009/3/2 11:59:59.0 2009/3/2 Jitendr 11:59:58.0 + 2009/3/3 11:59:59.0 2009/3/3 Nihar 11:59:57.0 + 2009/3/4 11:59:59.0 2009/3/4 Kishor 11:59:59.0 + 2009/3/1 11:59:59.0 2009/3/1 Praba 11:59:58.0 + 2009/3/2 11:59:59.0 2009/3/2 Sanjit 11:59:57.0 + 2009/3/3 11:59:59.0 2009/3/3 Sanjay 11:59:59.0 + 2009/3/4 11:59:59.0 2009/3/4 Arindam 11:59:58.0 + 2009/3/5 11:59:59.0 2009/3/5 Kishor 11:59:56.0 + 2009/3/4 11:59:59.0 2009/3/1 Praba 11:59:55.0 + 2009/3/1 11:59:59.0 2009/3/2 Sanjit 11:59:56.0 + 2009/3/1 11:59:59.0 2009/3/1 Arindam 11:59:59.0 + +echo select f9,f7,f4,max(f8) from t1 group by f4,f7,f9 having max(f8)<='11:59:59' and max(f8) >'11:59:57' ; +--------------------------------------------------------- + f9 f7 f4 MAX(f8) +--------------------------------------------------------- + 2009/3/1 11:59:59.0 2009/3/1 Bijay 11:59:59.0 + 2009/3/2 11:59:59.0 2009/3/2 Jitendr 11:59:58.0 + 2009/3/4 11:59:59.0 2009/3/4 Kishor 11:59:59.0 + 2009/3/1 11:59:59.0 2009/3/1 Praba 11:59:58.0 + 2009/3/3 11:59:59.0 2009/3/3 Sanjay 11:59:59.0 + 2009/3/4 11:59:59.0 2009/3/4 Arindam 11:59:58.0 + 2009/3/1 11:59:59.0 2009/3/1 Arindam 11:59:59.0 + +echo select f7,f8,f4,max(f9) from t1 group by f4,f7,f8; +--------------------------------------------------------- + f7 f8 f4 MAX(f9) +--------------------------------------------------------- + 2009/3/1 11:59:59.0 Bijay 2009/3/1 11:59:59.0 + 2009/3/2 11:59:58.0 Jitendr 2009/3/2 11:59:59.0 + 2009/3/3 11:59:57.0 Nihar 2009/3/3 11:59:59.0 + 2009/3/4 11:59:59.0 Kishor 2009/3/4 11:59:59.0 + 2009/3/1 11:59:58.0 Praba 2009/3/1 11:59:59.0 + 2009/3/2 11:59:57.0 Sanjit 2009/3/2 11:59:59.0 + 2009/3/3 11:59:59.0 Sanjay 2009/3/3 11:59:59.0 + 2009/3/4 11:59:58.0 Arindam 2009/3/4 11:59:59.0 + 2009/3/1 11:59:57.0 Bijay 2009/3/1 11:59:59.0 + 2009/3/3 NULL Nihar 2009/3/3 11:59:59.0 + 2009/3/5 11:59:56.0 Kishor 2009/3/5 11:59:59.0 + 2009/3/1 11:59:55.0 Praba 2009/3/4 11:59:59.0 + 2009/3/2 11:59:56.0 Sanjit 2009/3/1 11:59:59.0 + 2009/3/3 11:59:55.0 Sanjay 2009/3/3 11:59:59.0 + 2009/3/1 11:59:59.0 Arindam 2009/3/1 11:59:59.0 + +echo select f7,f8,f4,max(f9) from t1 group by f4,f7,f8 having max(f9)<='2009-03-05 11:59:59' and max(f9) >'2009-03-02 11:59:59' ; +--------------------------------------------------------- + f7 f8 f4 MAX(f9) +--------------------------------------------------------- + 2009/3/3 11:59:57.0 Nihar 2009/3/3 11:59:59.0 + 2009/3/4 11:59:59.0 Kishor 2009/3/4 11:59:59.0 + 2009/3/3 11:59:59.0 Sanjay 2009/3/3 11:59:59.0 + 2009/3/4 11:59:58.0 Arindam 2009/3/4 11:59:59.0 + 2009/3/3 NULL Nihar 2009/3/3 11:59:59.0 + 2009/3/5 11:59:56.0 Kishor 2009/3/5 11:59:59.0 + 2009/3/1 11:59:55.0 Praba 2009/3/4 11:59:59.0 + 2009/3/3 11:59:55.0 Sanjay 2009/3/3 11:59:59.0 + +Statement Executed diff --git a/test/sql/Aggregate/exp.testnw035.ksh b/test/sql/Aggregate/exp.testnw035.ksh new file mode 100644 index 00000000..e558655b --- /dev/null +++ b/test/sql/Aggregate/exp.testnw035.ksh @@ -0,0 +1,277 @@ +Network CSql +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 t1.f5 t1.f6 t1.f7 t1.f8 t1.f9 +--------------------------------------------------------- + 10 100 1000 Bijay 1000.000000 100000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + 11 110 1100 Jitendr 2000.000000 200000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 12 120 1000 Nihar 3000.000000 300000.000000 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 NULL Kishor 4000.000000 400000.000000 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 + 14 100 1000 Praba 5000.000000 500000.000000 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 + 15 110 1100 Sanjit 6000.000000 600000.000000 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 + 16 120 1000 Sanjay NULL 700000.000000 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 + 17 130 1100 Arindam 8000.000000 800000.000000 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 + 10 100 1000 Bijay 9000.000000 900000.000000 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 + 11 NULL 1100 Jitendr 1000.000000 100000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 12 120 1000 Nihar 2000.000000 200000.000000 2009/3/3 NULL 2009/3/3 11:59:59.0 + 13 130 1100 Kishor 3000.000000 300000.000000 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 + 14 100 1000 Praba 4000.000000 400000.000000 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 + 15 110 NULL Sanjit 5000.000000 500000.000000 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 + 16 120 1000 Sanjay 6000.000000 600000.000000 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 + 17 130 1100 Arindam 7000.000000 700000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + +Network CSql +echo select f1,f2,count(f4),count(f7),count(f8),count(f9) from t1 group by f1,f2; +--------------------------------------------------------- + f1 f2 COUNT(f4) COUNT(f7) COUNT(f8) COUNT(f9) +--------------------------------------------------------- + 10 100 2 2 2 2 + 11 110 1 1 1 1 + 12 120 2 2 1 2 + 13 130 2 2 2 2 + 14 100 2 2 2 2 + 15 110 2 2 2 2 + 16 120 2 2 2 2 + 17 130 2 2 2 2 + 11 NULL 1 1 1 1 + +echo select f1,f2,count(f4),count(f7),count(f8),count(f9) from t1 group by f1,f2 having count(f4)>=2; +--------------------------------------------------------- + f1 f2 COUNT(f4) COUNT(f7) COUNT(f8) COUNT(f9) +--------------------------------------------------------- + 10 100 2 2 2 2 + 12 120 2 2 1 2 + 13 130 2 2 2 2 + 14 100 2 2 2 2 + 15 110 2 2 2 2 + 16 120 2 2 2 2 + 17 130 2 2 2 2 + +echo select f1,f2,count(f4),count(f7),count(f8),count(f9) from t1 where f1 >= 12 group by f1,f2; +--------------------------------------------------------- + f1 f2 COUNT(f4) COUNT(f7) COUNT(f8) COUNT(f9) +--------------------------------------------------------- + 12 120 2 2 1 2 + 13 130 2 2 2 2 + 14 100 2 2 2 2 + 15 110 2 2 2 2 + 16 120 2 2 2 2 + 17 130 2 2 2 2 + +echo select f1,f2,count(f4),count(f7),count(f8),count(f9) from t1 where f1 >= 12 group by f1,f2 having count(f8)>=1; +--------------------------------------------------------- + f1 f2 COUNT(f4) COUNT(f7) COUNT(f8) COUNT(f9) +--------------------------------------------------------- + 12 120 2 2 1 2 + 13 130 2 2 2 2 + 14 100 2 2 2 2 + 15 110 2 2 2 2 + 16 120 2 2 2 2 + 17 130 2 2 2 2 + +echo select f1,f2,count(f4),count(f7),count(f8),count(f9) from t1 where f1 >= 12 and f1<15 group by f1,f2; +--------------------------------------------------------- + f1 f2 COUNT(f4) COUNT(f7) COUNT(f8) COUNT(f9) +--------------------------------------------------------- + 12 120 2 2 1 2 + 13 130 2 2 2 2 + 14 100 2 2 2 2 + +echo select f1,f2,count(f4),count(f7),count(f8),count(f9) from t1 where f1 >= 12 and f1<15 group by f1,f2 having count(f9)>=2; +--------------------------------------------------------- + f1 f2 COUNT(f4) COUNT(f7) COUNT(f8) COUNT(f9) +--------------------------------------------------------- + 12 120 2 2 1 2 + 13 130 2 2 2 2 + 14 100 2 2 2 2 + +echo select f1,f2,count(f4),count(f7),count(f8),count(f9) from t1 where f1 >= 12 and f1<15 group by f1,f2 having count(f4)>=2 and count(f8) <2; +--------------------------------------------------------- + f1 f2 COUNT(f4) COUNT(f7) COUNT(f8) COUNT(f9) +--------------------------------------------------------- + 12 120 2 2 1 2 + +echo select f1,f2,count(f4),count(f7),count(f8),count(f9) from t1 where f1 >= 12 and f2<130 group by f1,f2 ; +--------------------------------------------------------- + f1 f2 COUNT(f4) COUNT(f7) COUNT(f8) COUNT(f9) +--------------------------------------------------------- + 12 120 2 2 1 2 + 14 100 2 2 2 2 + 15 110 2 2 2 2 + 16 120 2 2 2 2 + +echo select f1,f2,count(f4),count(f7),count(f8),count(f9) from t1 where f1 >= 12 and f2<130 group by f1,f2 having count(f7)>=2 and count(f8)<>2; +--------------------------------------------------------- + f1 f2 COUNT(f4) COUNT(f7) COUNT(f8) COUNT(f9) +--------------------------------------------------------- + 12 120 2 2 1 2 + +echo select f7,f8,f9,count(f4) from t1 group by f7,f8,f9; +--------------------------------------------------------- + f7 f8 f9 COUNT(f4) +--------------------------------------------------------- + 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 2 + 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 2 + 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 1 + 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 1 + 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 1 + 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 1 + 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 1 + 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 1 + 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 1 + 2009/3/3 NULL 2009/3/3 11:59:59.0 1 + 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 1 + 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 1 + 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 1 + 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 1 + +echo select f9,f7,f8,count(f4) from t1 group by f7,f8,f9; +--------------------------------------------------------- + f9 f7 f8 COUNT(f4) +--------------------------------------------------------- + 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 2 + 2009/3/2 11:59:59.0 2009/3/2 11:59:58.0 2 + 2009/3/3 11:59:59.0 2009/3/3 11:59:57.0 1 + 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 1 + 2009/3/1 11:59:59.0 2009/3/1 11:59:58.0 1 + 2009/3/2 11:59:59.0 2009/3/2 11:59:57.0 1 + 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 1 + 2009/3/4 11:59:59.0 2009/3/4 11:59:58.0 1 + 2009/3/1 11:59:59.0 2009/3/1 11:59:57.0 1 + 2009/3/3 11:59:59.0 2009/3/3 NULL 1 + 2009/3/5 11:59:59.0 2009/3/5 11:59:56.0 1 + 2009/3/4 11:59:59.0 2009/3/1 11:59:55.0 1 + 2009/3/1 11:59:59.0 2009/3/2 11:59:56.0 1 + 2009/3/3 11:59:59.0 2009/3/3 11:59:55.0 1 + +echo select f7,f8,f9,count(f4) from t1 group by f7,f9,f8; +--------------------------------------------------------- + f7 f8 f9 COUNT(f4) +--------------------------------------------------------- + 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 2 + 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 2 + 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 1 + 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 1 + 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 1 + 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 1 + 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 1 + 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 1 + 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 1 + 2009/3/3 NULL 2009/3/3 11:59:59.0 1 + 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 1 + 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 1 + 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 1 + 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 1 + +echo select f7,f8,f9,count(f4) from t1 group by f7,f9,f8 having count(f4)>=1 and count(f4) <2; +--------------------------------------------------------- + f7 f8 f9 COUNT(f4) +--------------------------------------------------------- + 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 1 + 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 1 + 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 1 + 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 1 + 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 1 + 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 1 + 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 1 + 2009/3/3 NULL 2009/3/3 11:59:59.0 1 + 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 1 + 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 1 + 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 1 + 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 1 + +echo select f4,f8,f9,count(f7) from t1 group by f4,f8,f9; +--------------------------------------------------------- + f4 f8 f9 COUNT(f7) +--------------------------------------------------------- + Bijay 11:59:59.0 2009/3/1 11:59:59.0 1 + Jitendr 11:59:58.0 2009/3/2 11:59:59.0 2 + Nihar 11:59:57.0 2009/3/3 11:59:59.0 1 + Kishor 11:59:59.0 2009/3/4 11:59:59.0 1 + Praba 11:59:58.0 2009/3/1 11:59:59.0 1 + Sanjit 11:59:57.0 2009/3/2 11:59:59.0 1 + Sanjay 11:59:59.0 2009/3/3 11:59:59.0 1 + Arindam 11:59:58.0 2009/3/4 11:59:59.0 1 + Bijay 11:59:57.0 2009/3/1 11:59:59.0 1 + Nihar NULL 2009/3/3 11:59:59.0 1 + Kishor 11:59:56.0 2009/3/5 11:59:59.0 1 + Praba 11:59:55.0 2009/3/4 11:59:59.0 1 + Sanjit 11:59:56.0 2009/3/1 11:59:59.0 1 + Sanjay 11:59:55.0 2009/3/3 11:59:59.0 1 + Arindam 11:59:59.0 2009/3/1 11:59:59.0 1 + +echo select f4,f8,f9,count(f7) from t1 group by f4,f8,f9 having count(f7)<=2 and count(f7) >1 ; +--------------------------------------------------------- + f4 f8 f9 COUNT(f7) +--------------------------------------------------------- + Jitendr 11:59:58.0 2009/3/2 11:59:59.0 2 + +echo select f9,f7,f4,count(f8) from t1 group by f4,f7,f9; +--------------------------------------------------------- + f9 f7 f4 COUNT(f8) +--------------------------------------------------------- + 2009/3/1 11:59:59.0 2009/3/1 Bijay 2 + 2009/3/2 11:59:59.0 2009/3/2 Jitendr 2 + 2009/3/3 11:59:59.0 2009/3/3 Nihar 1 + 2009/3/4 11:59:59.0 2009/3/4 Kishor 1 + 2009/3/1 11:59:59.0 2009/3/1 Praba 1 + 2009/3/2 11:59:59.0 2009/3/2 Sanjit 1 + 2009/3/3 11:59:59.0 2009/3/3 Sanjay 2 + 2009/3/4 11:59:59.0 2009/3/4 Arindam 1 + 2009/3/5 11:59:59.0 2009/3/5 Kishor 1 + 2009/3/4 11:59:59.0 2009/3/1 Praba 1 + 2009/3/1 11:59:59.0 2009/3/2 Sanjit 1 + 2009/3/1 11:59:59.0 2009/3/1 Arindam 1 + +echo select f9,f7,f4,count(f8) from t1 group by f4,f7,f9 having count(f8)<=2 and count(f8) >=2 ; +--------------------------------------------------------- + f9 f7 f4 COUNT(f8) +--------------------------------------------------------- + 2009/3/1 11:59:59.0 2009/3/1 Bijay 2 + 2009/3/2 11:59:59.0 2009/3/2 Jitendr 2 + 2009/3/3 11:59:59.0 2009/3/3 Sanjay 2 + +echo select f7,f8,f4,count(f9) from t1 group by f4,f7,f8; +--------------------------------------------------------- + f7 f8 f4 COUNT(f9) +--------------------------------------------------------- + 2009/3/1 11:59:59.0 Bijay 1 + 2009/3/2 11:59:58.0 Jitendr 2 + 2009/3/3 11:59:57.0 Nihar 1 + 2009/3/4 11:59:59.0 Kishor 1 + 2009/3/1 11:59:58.0 Praba 1 + 2009/3/2 11:59:57.0 Sanjit 1 + 2009/3/3 11:59:59.0 Sanjay 1 + 2009/3/4 11:59:58.0 Arindam 1 + 2009/3/1 11:59:57.0 Bijay 1 + 2009/3/3 NULL Nihar 1 + 2009/3/5 11:59:56.0 Kishor 1 + 2009/3/1 11:59:55.0 Praba 1 + 2009/3/2 11:59:56.0 Sanjit 1 + 2009/3/3 11:59:55.0 Sanjay 1 + 2009/3/1 11:59:59.0 Arindam 1 + +echo select f7,f8,f4,count(f9) from t1 group by f4,f7,f8 having count(f9)<=2 and count(f9) >=2 ; +--------------------------------------------------------- + f7 f8 f4 COUNT(f9) +--------------------------------------------------------- + 2009/3/2 11:59:58.0 Jitendr 2 + +Statement Executed diff --git a/test/sql/Aggregate/exp.testnw036.ksh b/test/sql/Aggregate/exp.testnw036.ksh new file mode 100644 index 00000000..6c638505 --- /dev/null +++ b/test/sql/Aggregate/exp.testnw036.ksh @@ -0,0 +1,64 @@ +Network CSql +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo SELECT * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 +--------------------------------------------------------- + 1 70 Nihar Pital NULL + 2 70 Bijay Sahoo MGR + 3 60 Kisor Ambli Developer + 2 90 Jiten Lenka S/W + 3 80 Papu Paital NULL + 4 90 Bhahmananda MKTING + +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo SELECT * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 +--------------------------------------------------------- + 1 70 Nihar Pital NULL + 2 70 Bijay Sahoo MGR + 3 60 Kisor Ambli Developer + 2 90 Jiten Lenka S/W + 3 80 Papu Paital NULL + 4 90 Bhahmananda MKTING + +echo select t1.f1,t1.f2,count(t1.f4),count(t2.f3) from t1,t2 group by t1.f1,t1.f2 ; +--------------------------------------------------------- + t1.f1 t1.f2 COUNT(t1.f4) COUNT(t2.f3) +--------------------------------------------------------- + 1 70 0 7 + 2 70 7 7 + 3 60 7 7 + 2 90 7 7 + 3 80 0 7 + 4 90 7 7 + +echo select t1.f1,t1.f2,count(t1.f4),count(t2.f3) from t1,t2 group by t1.f1,t1.f2 having count(t1.f4)<6 and count(t2.f3) >=7; +--------------------------------------------------------- + t1.f1 t1.f2 COUNT(t1.f4) COUNT(t2.f3) +--------------------------------------------------------- + 1 70 0 7 + 3 80 0 7 + +echo select t1.f1,t1.f2,count(t1.f3),count(t2.f3) from t1,t2 group by t1.f1,t1.f2 having avg(t1.f2)<70; +--------------------------------------------------------- + t1.f1 t1.f2 COUNT(t1.f3) COUNT(t2.f3) +--------------------------------------------------------- + 3 60 7 7 + +Statement Executed +Statement Executed diff --git a/test/sql/Aggregate/groupby1.sql b/test/sql/Aggregate/groupby1.sql new file mode 100644 index 00000000..325b81db --- /dev/null +++ b/test/sql/Aggregate/groupby1.sql @@ -0,0 +1,34 @@ +echo CREATE TABLE t1(f1 int,f2 int,f3 char(15)); +CREATE TABLE t1(f1 int,f2 int,f3 char(15)); +echo INSERT INTO t1 VALUES(1,70,'Nihar Pital'); +INSERT INTO t1 VALUES(1,70,'Nihar Pital'); +echo INSERT INTO t1 VALUES(2,70,'Bijay Sahoo'); +INSERT INTO t1 VALUES(2,70,'Bijay Sahoo'); +echo INSERT INTO t1 VALUES(3,60,'Kisor Ambli'); +INSERT INTO t1 VALUES(3,60,'Kisor Ambli'); +echo INSERT INTO t1 VALUES(2,90,'Jiten Lenka'); +INSERT INTO t1 VALUES(2,91,'Jiten Lenka'); +echo INSERT INTO t1 VALUES(3,80,'Papu Paital'); +INSERT INTO t1 VALUES(3,81,'Papu Paital'); +echo INSERT INTO t1 VALUES(1,80,'Bijay Sahoo'); +INSERT INTO t1 VALUES(1,80,'Bijay Sahoo'); +echo INSERT INTO t1 VALUES(2,70,'Jiten Lenka'); +INSERT INTO t1 VALUES(2,70,'Jiten Lenka'); +echo INSERT INTO t1 VALUES(1,70,'Bijay Sahoo'); +INSERT INTO t1 VALUES(1,72,'Bijay Sahoo'); +echo INSERT INTO t1 VALUES(2,70,'Bijay Sahoo'); +INSERT INTO t1 VALUES(2,70,'Bijay Sahoo'); +echo INSERT INTO t1 VALUES(3,60,'Papu Paital'); +INSERT INTO t1 VALUES(3,60,'Papu Paital'); +echo INSERT INTO t1 VALUES(1,70,'Nihar Pital'); +INSERT INTO t1 VALUES(1,71,'Nihar Pital'); +echo SELECT * FROM t1; +SELECT * FROM t1; +echo SELECT f1,sum(f2),count(f2),avg(f2),min(f2),max(f2),count(f3) from t1 GROUP BY f1; +SELECT f1,sum(f2),count(f2),avg(f2),min(f2),max(f2),count(f3) from t1 GROUP BY f1; +echo SELECT f3,count(f1),sum(f2),count(f2),avg(f2),min(f2),max(f2) from t1 GROUP BY f3; +SELECT f3,count(f1),sum(f2),count(f2),avg(f2),min(f2),max(f2) from t1 GROUP BY f3; +echo SELECT f1,sum(f2),count(f2),avg(f2),min(f2),max(f2) from t1 GROUP BY f1,f3; +SELECT f1,sum(f2),count(f2),avg(f2),min(f2),max(f2) from t1 GROUP BY f1,f3; +echo SELECT f1,f3,sum(f2),count(f2),avg(f2),min(f2),max(f2) from t1 GROUP BY f1,f3; +SELECT f1,f3,sum(f2),count(f2),avg(f2),min(f2),max(f2) from t1 GROUP BY f1,f3; diff --git a/test/sql/Aggregate/having1.sql b/test/sql/Aggregate/having1.sql new file mode 100644 index 00000000..b66dacc4 --- /dev/null +++ b/test/sql/Aggregate/having1.sql @@ -0,0 +1,34 @@ +echo CREATE TABLE t1(f1 int,f2 int,f3 char(15)); +CREATE TABLE t1(f1 int,f2 int,f3 char(15)); +echo INSERT INTO t1 VALUES(1,70,'Nihar Pital'); +INSERT INTO t1 VALUES(1,70,'Nihar Pital'); +echo INSERT INTO t1 VALUES(2,70,'Bijay Sahoo'); +INSERT INTO t1 VALUES(2,70,'Bijay Sahoo'); +echo INSERT INTO t1 VALUES(3,60,'Kisor Ambli'); +INSERT INTO t1 VALUES(3,60,'Kisor Ambli'); +echo INSERT INTO t1 VALUES(2,90,'Jiten Lenka'); +INSERT INTO t1 VALUES(2,91,'Jiten Lenka'); +echo INSERT INTO t1 VALUES(3,80,'Papu Paital'); +INSERT INTO t1 VALUES(3,81,'Papu Paital'); +echo INSERT INTO t1 VALUES(1,80,'Bijay Sahoo'); +INSERT INTO t1 VALUES(1,80,'Bijay Sahoo'); +echo INSERT INTO t1 VALUES(2,70,'Jiten Lenka'); +INSERT INTO t1 VALUES(2,70,'Jiten Lenka'); +echo INSERT INTO t1 VALUES(1,70,'Bijay Sahoo'); +INSERT INTO t1 VALUES(1,72,'Bijay Sahoo'); +echo INSERT INTO t1 VALUES(2,70,'Bijay Sahoo'); +INSERT INTO t1 VALUES(2,70,'Bijay Sahoo'); +echo INSERT INTO t1 VALUES(3,60,'Papu Paital'); +INSERT INTO t1 VALUES(3,60,'Papu Paital'); +echo INSERT INTO t1 VALUES(1,70,'Nihar Pital'); +INSERT INTO t1 VALUES(1,71,'Nihar Pital'); +echo SELECT * FROM t1; +SELECT * FROM t1; +echo SELECT f1,sum(f2),count(f2),avg(f2),min(f2),max(f2),count(f3) from t1 GROUP BY f1 having sum(f2) >300 ; +SELECT f1,sum(f2),count(f2),avg(f2),min(f2),max(f2),count(f3) from t1 GROUP BY f1 having sum(f2) >300; +echo SELECT f3,count(f1),sum(f2),count(f2),avg(f2),min(f2),max(f2) from t1 GROUP BY f3 having avg(f2) <75; +SELECT f3,count(f1),sum(f2),count(f2),avg(f2),min(f2),max(f2) from t1 GROUP BY f3 having avg(f2) <75; +echo SELECT f1,sum(f2),count(f2),avg(f2),min(f2),max(f2) from t1 GROUP BY f1; +SELECT f1,sum(f2),count(f2),avg(f2),min(f2),max(f2) from t1 GROUP BY f1; +echo SELECT f1,sum(f2),count(f2),avg(f2),min(f2),max(f2) from t1 GROUP BY f1 having avg(f2) <70 or min(f2)=70; +SELECT f1,sum(f2),count(f2),avg(f2),min(f2),max(f2) from t1 GROUP BY f1 having avg(f2) <70 or min(f2)=70; diff --git a/test/sql/Aggregate/innerjoin_aggregate.sql b/test/sql/Aggregate/innerjoin_aggregate.sql new file mode 100644 index 00000000..cd344cab --- /dev/null +++ b/test/sql/Aggregate/innerjoin_aggregate.sql @@ -0,0 +1,25 @@ +CREATE TABLE t1(f1 int,f2 int,f3 char(15),f4 char(12)); +INSERT INTO t1 VALUES(1,70,'Nihar Pital',NULL); +INSERT INTO t1 VALUES(2,70,'Bijay Sahoo','MGR'); +INSERT INTO t1 VALUES(3,60,'Kisor Ambli','Developer'); +INSERT INTO t1 VALUES(2,90,'Jiten Lenka','S/W'); +INSERT INTO t1 VALUES(3,80,'Papu Paital',NULL); +INSERT INTO t1 VALUES(4,90,'Bhahmananda','MKTING'); +echo SELECT * from t1; +SELECT * from t1; +CREATE TABLE t2(f1 int,f2 int,f3 char(15)); +INSERT INTO t2 VALUES(1,30,'Nihar'); +INSERT INTO t2 VALUES(20,7,'Bijay'); +INSERT INTO t2 VALUES(3,60,'Kisor'); +INSERT INTO t2 VALUES(2,40,'Jiten'); +INSERT INTO t2 VALUES(3,8,'Papu '); +INSERT INTO t2 VALUES(1,80,'Bijay'); +INSERT INTO t2 VALUES(2,7,'Rameswar'); +echo SELECT * from t1; +SELECT * from t1; +echo select t1.f1,t1.f2,count(t1.f4),count(t2.f3) from t1,t2 group by t1.f1,t1.f2 ; +select t1.f1,t1.f2,count(t1.f4),count(t2.f3) from t1,t2 group by t1.f1,t1.f2 ; +echo select t1.f1,t1.f2,count(t1.f4),count(t2.f3) from t1,t2 group by t1.f1,t1.f2 having count(t1.f4)<6 and count(t2.f3) >=7; +select t1.f1,t1.f2,count(t1.f4),count(t2.f3) from t1,t2 group by t1.f1,t1.f2 having count(t1.f4)<6 and count(t2.f3) >=7; +echo select t1.f1,t1.f2,count(t1.f3),count(t2.f3) from t1,t2 group by t1.f1,t1.f2 having avg(t1.f2)<70; +select t1.f1,t1.f2,count(t1.f3),count(t2.f3) from t1,t2 group by t1.f1,t1.f2 having avg(t1.f2)<70; diff --git a/test/sql/Aggregate/nulltest1.sql b/test/sql/Aggregate/nulltest1.sql new file mode 100644 index 00000000..e4074fd9 --- /dev/null +++ b/test/sql/Aggregate/nulltest1.sql @@ -0,0 +1,15 @@ +create table t1(f1 int,f2 int,f3 int); +insert into t1 values(98, 1, 10); +insert into t1 values(99, NULL, 20); +insert into t1 values(100, 3, 30); +insert into t1 values(101, 4, NULL); +insert into t1 values(102, 5, 50); +create table t2(f1 int,f2 int,f3 int); +insert into t2 values(98, 1, 10); +insert into t2 values(99, 2, 20); +insert into t2 values(100, NULL, NULL); +insert into t2 values(101, 4, 40); +insert into t2 values(102, NULL, 50); +select * from t1; +select * from t2; + diff --git a/test/sql/Aggregate/nulltest2.sql b/test/sql/Aggregate/nulltest2.sql new file mode 100644 index 00000000..181b6a58 --- /dev/null +++ b/test/sql/Aggregate/nulltest2.sql @@ -0,0 +1,11 @@ +create table t1(f1 int,f2 int,f3 int); +insert into t1 values(1, 10, 100); +insert into t1 values(2, 20, 200); +insert into t1 values(3, 30, 300); +insert into t1 values(NULL, 20, 500); +insert into t1 values(12, 20, 500); +insert into t1 values(1, NULL, 400); +insert into t1 values(1, 11, 500); +insert into t1 values(13, 30, 200); +insert into t1 values(14, 31, 300); +select * from t1; diff --git a/test/sql/Aggregate/projfield.sql b/test/sql/Aggregate/projfield.sql new file mode 100644 index 00000000..93f039f6 --- /dev/null +++ b/test/sql/Aggregate/projfield.sql @@ -0,0 +1,6 @@ +echo select * from t1,t2; +select * from t1,t2; +echo select f2 from t1,t2; +select f2 from t1,t2; +echo select avg(f2) from t1,t2; +select avg(f2) from t1,t2; diff --git a/test/sql/Aggregate/quit.sql b/test/sql/Aggregate/quit.sql new file mode 100644 index 00000000..8c0cb686 --- /dev/null +++ b/test/sql/Aggregate/quit.sql @@ -0,0 +1 @@ +quit; diff --git a/test/sql/Aggregate/sales_join_aggregate.sql b/test/sql/Aggregate/sales_join_aggregate.sql new file mode 100644 index 00000000..2203d92f --- /dev/null +++ b/test/sql/Aggregate/sales_join_aggregate.sql @@ -0,0 +1,20 @@ +echo select client_master.clientno,name,count(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name; +select client_master.clientno,name,count(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name; +echo select client_master.clientno,name,count(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name having count(qtydisp)>3; +select client_master.clientno,name,count(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name having count(qtydisp)>3; +echo select client_master.clientno,name,min(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name; +select client_master.clientno,name,min(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name; +echo select client_master.clientno,name,min(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name having min(qtydisp)<3; +select client_master.clientno,name,min(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name having min(qtydisp)<3; +echo select client_master.clientno,name,max(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name; +select client_master.clientno,name,max(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name; +echo select client_master.clientno,name,max(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name having max(qtydisp)>4; +select client_master.clientno,name,max(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name having max(qtydisp)>4; +echo select client_master.clientno,name,sum(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name; +select client_master.clientno,name,sum(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name; +echo select client_master.clientno,name,sum(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name having sum(qtydisp)>3; +select client_master.clientno,name,sum(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name having sum(qtydisp)>3; +echo select client_master.clientno,name,avg(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name; +select client_master.clientno,name,avg(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name; +echo select client_master.clientno,name,avg(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name having avg(qtydisp)>3; +select client_master.clientno,name,avg(qtydisp) from sales_order_details,sales_order,client_master where client_master.clientno=sales_order.clientno and sales_order.orderno=sales_order_details.orderno group by client_master.clientno,name having avg(qtydisp)>3; diff --git a/test/sql/Aggregate/sales_join_aggregate1.sql b/test/sql/Aggregate/sales_join_aggregate1.sql new file mode 100644 index 00000000..0b1aae3e --- /dev/null +++ b/test/sql/Aggregate/sales_join_aggregate1.sql @@ -0,0 +1,8 @@ +echo select sales_order_details.productno,description,qtyordered,orderdate from sales_order_details,sales_order,product_master where product_master.productno=sales_order_details.productno and sales_order.orderno=sales_order_details.orderno and orderdate >= '2002-04-01' and orderdate <= '2002-05-31'; + +select sales_order_details.productno,description,qtyordered from sales_order_details,sales_order,product_master where product_master.productno=sales_order_details.productno and sales_order.orderno=sales_order_details.orderno; + +echo select sales_order_details.productno, description, min(qtyordered), max(qtyordered), count(qtyordered), sum(qtyordered) from sales_order_details,sales_order,product_master where product_master.productno=sales_order_details.productno and sales_order.orderno=sales_order_details.orderno group by sales_order_details.productno,description; + +select sales_order_details.productno, description, min(qtyordered), max(qtyordered), count(qtyordered), sum(qtyordered) from sales_order_details,sales_order,product_master where product_master.productno=sales_order_details.productno and sales_order.orderno=sales_order_details.orderno group by sales_order_details.productno,description; + diff --git a/test/sql/Aggregate/sales_join_aggregate2.sql b/test/sql/Aggregate/sales_join_aggregate2.sql new file mode 100644 index 00000000..ef8893a0 --- /dev/null +++ b/test/sql/Aggregate/sales_join_aggregate2.sql @@ -0,0 +1,5 @@ +echo select sales_order_details.productno,description,qtyordered,name from sales_order_details, sales_order, product_master, client_master where sales_order.orderno=sales_order_details.orderno and product_master.productno=sales_order_details.productno and client_master.clientno=sales_order.clientno and name='Ivan Bayross' and name='Mamta Muzumdar'; +select sales_order_details.productno,description,qtyordered,name from sales_order_details, sales_order, product_master, client_master where sales_order.orderno=sales_order_details.orderno and product_master.productno=sales_order_details.productno and client_master.clientno=sales_order.clientno and name='Ivan Bayross' and name='Mamta Muzumdar'; + +echo select sales_order_details.productno,description,min(qtyordered), max(qtyordered), count(qtyordered), sum(qtyordered) from sales_order_details, sales_order, product_master, client_master where sales_order.orderno=sales_order_details.orderno and product_master.productno=sales_order_details.productno and client_master.clientno=sales_order.clientno and name='Ivan Bayross' and name='Mamta Muzumdar' group by sales_order_details.productno,description; +select sales_order_details.productno,description,min(qtyordered), max(qtyordered), count(qtyordered), sum(qtyordered) from sales_order_details, sales_order, product_master, client_master where sales_order.orderno=sales_order_details.orderno and product_master.productno=sales_order_details.productno and client_master.clientno=sales_order.clientno and name='Ivan Bayross' and name='Mamta Muzumdar' group by sales_order_details.productno,description; diff --git a/test/sql/Aggregate/sales_table_drop.sql b/test/sql/Aggregate/sales_table_drop.sql new file mode 100644 index 00000000..504b7c40 --- /dev/null +++ b/test/sql/Aggregate/sales_table_drop.sql @@ -0,0 +1,10 @@ +echo drop table sales_order_details; +drop table sales_order_details; +echo drop table sales_order; +drop table sales_order; +echo drop table salesman_master; +drop table salesman_master; +echo drop table product_master; +drop table product_master; +echo drop table client_master; +drop table client_master; diff --git a/test/sql/Aggregate/sales_tables.sql b/test/sql/Aggregate/sales_tables.sql new file mode 100644 index 00000000..6d5eead2 --- /dev/null +++ b/test/sql/Aggregate/sales_tables.sql @@ -0,0 +1,98 @@ +echo Create table client_master(clientno char(6), name char(20) NOT NULL, address1 char(30), address2 char(30), city char(15), pincode int, state char(15), baldue float,PRIMARY KEY(clientno)); +Create table client_master(clientno char(6), name char(20) NOT NULL, address1 char(30), address2 char(30), city char(15), pincode int, state char(15), baldue float,PRIMARY KEY(clientno)); +echo Create table product_master(productno char(6), description char(15) NOT NULL,profitpercent float NOT NULL,unitmeasure char(10) NOT NULL,qtyonhand int NOT NULL,reorderlvl int NOT NULL,selprice float NOT NULL,costprice float NOT NULL, PRIMARY KEY(productno)); +Create table product_master(productno char(6), description char(15) NOT NULL,profitpercent float NOT NULL,unitmeasure char(10) NOT NULL,qtyonhand int NOT NULL,reorderlvl int NOT NULL,selprice float NOT NULL,costprice float NOT NULL, PRIMARY KEY(productno)); +echo Create table salesman_master(salesmanno char(6),salesmanname char(20) NOT NULL,address1 char(30) NOT NULL,address2 char(30),city char(20),pincode char(8),state char(20),salamt float NOT NULL,tgttoget float NOT NULL,ytdsales float NOT NULL,remarks char(30),PRIMARY KEY(salesmanno)); +Create table salesman_master(salesmanno char(6),salesmanname char(20) NOT NULL,address1 char(30) NOT NULL,address2 char(30),city char(20),pincode char(8),state char(20),salamt float NOT NULL,tgttoget float NOT NULL,ytdsales float NOT NULL,remarks char(30),PRIMARY KEY(salesmanno)); +echo Create table sales_order(orderno char(6),orderdate date,clientno char(6),delyaddr char(25),delytype char(1),billedyn char(1),salesmanno char(6),delydate date,orderstatus char(10),PRIMARY KEY(orderno),FOREIGN KEY(clientno) REFERENCES client_master(clientno),FOREIGN KEY(salesmanno) REFERENCES salesman_master(salesmanno)); +Create table sales_order(orderno char(6),orderdate date,clientno char(6),delyaddr char(25),delytype char(1),billedyn char(1),salesmanno char(6),delydate date,orderstatus char(10),PRIMARY KEY(orderno),FOREIGN KEY(clientno) REFERENCES client_master(clientno),FOREIGN KEY(salesmanno) REFERENCES salesman_master(salesmanno)); +echo Create table sales_order_details(orderno char(6),productno char(6),qtyordered int,qtydisp int,productrate float,FOREIGN KEY(orderno) REFERENCES sales_order(orderno),FOREIGN KEY(productno) REFERENCES product_master(productno)); +Create table sales_order_details(orderno char(6),productno char(6),qtyordered int,qtydisp int,productrate float,FOREIGN KEY(orderno) REFERENCES sales_order(orderno),FOREIGN KEY(productno) REFERENCES product_master(productno)); +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00001','Ivan Bayross','Mumbai',400054,'Maharastra',15000); +insert into client_master(clientno,name,city,pincode,state,baldue) values('C00001','Ivan Bayross','Mumbai',400054,'Maharastra',15000); +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00002','mamta Muzumdar','Madras',780001,'Tamil Nadu',0); +insert into client_master(clientno,name,city,pincode,state,baldue) values('C00002','mamta Muzumdar','Madras',780001,'Tamil Nadu',0); +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00003','Chhaya Bankar','Mumbai',400057,'Maharastra',5000); +insert into client_master(clientno,name,city,pincode,state,baldue) values('C00003','Chhaya Bankar','Mumbai',400057,'Maharastra',5000); +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00004','Ashwini Joshi','Bangalore',560001,'MKarnataka',0); +insert into client_master(clientno,name,city,pincode,state,baldue) values('C00004','Ashwini Joshi','Bangalore',560001,'MKarnataka',0); +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00005','Hansel Colaco','Mumbai',400060,'Maharastra',2000); +insert into client_master(clientno,name,city,pincode,state,baldue) values('C00005','Hansel Colaco','Mumbai',400060,'Maharastra',2000); +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00006','Deepak Sharma','Mangalore',560050,'Karnatakaa',0); +insert into client_master(clientno,name,city,pincode,state,baldue) values('C00006','Deepak Sharma','Mangalore',560050,'Karnatakaa',0); +echo insert into product_master values('P00001','T-Shirts',5,'Piece',200,50,350,250); +insert into product_master values('P00001','T-Shirts',5,'Piece',200,50,350,250); +echo insert into product_master values('P03453','Shirts',6,'Piece',150,50,500,350); +insert into product_master values('P03453','Shirts',6,'Piece',150,50,500,350); +echo insert into product_master values('P06734','Cotton Jeans',5,'Piece',100,20,60,450); +insert into product_master values('P06734','Cotton Jeans',5,'Piece',100,20,60,450); +echo insert into product_master values('P07865','Jeans',5,'Piece',100,20,750,500); +insert into product_master values('P07865','Jeans',5,'Piece',100,20,750,500); +echo insert into product_master values('P07868','Trousers',2,'Piece',150,50,850,550); +insert into product_master values('P07868','Trousers',2,'Piece',150,50,850,550); +echo insert into product_master values('P07885','Pull Overs',2.5,'Piece',80,30,700,450); +insert into product_master values('P07885','Pull Overs',2.5,'Piece',80,30,700,450); +echo insert into product_master values('P07965','Denim Shirts',4,'Piece',100,40,350,250); +insert into product_master values('P07965','Denim Shirts',4,'Piece',100,40,350,250); +echo insert into product_master values('P07975','Lycra Tops',5,'Piece',70,30,300,175); +insert into product_master values('P07975','Lycra Tops',5,'Piece',70,30,300,175); +echo insert into product_master values('P08865','Skirts',5,'Piece',75,30,450,300); +insert into product_master values('P08865','Skirts',5,'Piece',75,30,450,300); +echo insert into salesman_master values('S00001','Aman','A/14','Worli','Mumbai',400002,'Maharastra',3000,100,50,'Good'); +insert into salesman_master values('S00001','Aman','A/14','Worli','Mumbai',400002,'Maharastra',3000,100,50,'Good'); +echo insert into salesman_master values('S00002','Omkar','65','Nariman','Mumbai',400001,'maharastra',3000,200,100,'Good'); +insert into salesman_master values('S00002','Omkar','65','Nariman','Mumbai',400001,'maharastra',3000,200,100,'Good'); +echo insert into salesman_master values('S00003','Raj','P-7','Banfra','Mumbai',400032,'Maharastra',3000,200,100,'Good'); +insert into salesman_master values('S00003','Raj','P-7','Banfra','Mumbai',400032,'Maharastra',3000,200,100,'Good'); +echo insert into salesman_master values('S00004','Ashish','A/5','Juhu','Bombay',400044,'Maharastra',3500,200,150,'Good'); +insert into salesman_master values('S00004','Ashish','A/5','Juhu','Bombay',400044,'Maharastra',3500,200,150,'Good'); +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19001','2002-06-12','C00001','F','N','S00001','2002-07-20','In Process'); +insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19001','2002-06-12','C00001','F','N','S00001','2002-07-20','In Process'); +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19002','2002-06-25','C00002','P','N','S00002','2002-06-27','Cancelled'); +insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19002','2002-06-25','C00002','P','N','S00002','2002-06-27','Cancelled'); +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O46865','2002-02-18','C00003','F','Y','S00003','2002-02-20','Fulfilled'); +insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O46865','2002-02-18','C00003','F','Y','S00003','2002-02-20','Fulfilled'); +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19003','2002-04-03','C00001','F','Y','S00001','2002-04-07','Fulfilled'); +insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19003','2002-04-03','C00001','F','Y','S00001','2002-04-07','Fulfilled'); +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O46866','2002-05-20','C00004','P','N','S00002','2002-05-22','Cancelled'); +insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O46866','2002-05-20','C00004','P','N','S00002','2002-05-22','Cancelled'); +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19008','2002-05-24','C00005','F','N','S00004','2002-07-26','In Process'); +insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19008','2002-05-24','C00005','F','N','S00004','2002-07-26','In Process'); +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19001','P00001',4,4,525); +insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19001','P00001',4,4,525); +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19001','P07965',2,1,8400); +insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19001','P07965',2,1,8400); +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19001','P07885',2,1,5250); +insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19001','P07885',2,1,5250); +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19002','P00001',10,0,525); +insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19002','P00001',10,0,525); +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P07868',3,3,3150); +insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P07868',3,3,3150); +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P07885',3,1,5250); +insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P07885',3,1,5250); +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P00001',10,10,525); +insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P00001',10,10,525); +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P03453',4,4,1050); +insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P03453',4,4,1050); +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19003','P03453',2,2,1050); +insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19003','P03453',2,2,1050); +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19003','P06734',1,1,12000); +insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19003','P06734',1,1,12000); +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46866','P07965',1,0,8400); +insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46866','P07965',1,0,8400); +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46866','P07975',1,0,1050); +insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46866','P07975',1,0,1050); +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19008','P00001',10,5,525); +insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19008','P00001',10,5,525); +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19008','P07975',5,3,1050); +insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19008','P07975',5,3,1050); +echo select * from client_master; +select * from client_master; +echo select * from product_master; +select * from product_master; +echo select * from salesman_master; +select * from salesman_master; +echo select * from sales_order; +select * from sales_order; +echo select * from sales_order_details; +select * from sales_order_details; diff --git a/test/sql/Aggregate/selfjoin_aggregate.sql b/test/sql/Aggregate/selfjoin_aggregate.sql new file mode 100644 index 00000000..007f81b8 --- /dev/null +++ b/test/sql/Aggregate/selfjoin_aggregate.sql @@ -0,0 +1,23 @@ +echo create table emp(id int,name char(20),job char(10),salary double,doj date,deptno int,mgrno int); +create table emp(id int,name char(20),job char(10),salary double,doj date,deptno int,mgrno int); +insert into emp values(1,'Allen','Sales' ,10000,'2006-03-03',10,4); +insert into emp values(2,'Piter', 'IT' ,10000,'2005-03-03',20,3); +insert into emp values(3,'Jack' ,'Mkting' ,9000 ,'2006-03-03',30,6); +insert into emp values(4,'Tom', 'Clerk' ,7000 ,'2004-03-03',10,1); +insert into emp values(5,'Harry ','IT',25000,'2005-03-03',20,5); +insert into emp values(6,'Dick' ,'Sales' ,15000,'2005-03-03',30,7); +insert into emp values(7,'Boyee' ,'Mentain',20000,'2005-03-03',20,2); +insert into emp values(3,'Jack' , 'IT' ,9000 ,'2006-03-03',30,6); +insert into emp values(2,'Piter', 'Mkting',10000,'2005-03-03',20,3); +echo select * from emp; +select * from emp; +echo select a.deptno,a.name,b.name from emp as a,emp as b where a.id=b.mgrno; +select a.deptno,a.name,b.name from emp as a,emp as b where a.id=b.mgrno; +echo select a.deptno,a.name,b.name from emp as a,emp as b where a.id=b.mgrno group by a.deptno,a.name,b.name; +select a.deptno,a.name,b.name from emp as a,emp as b where a.id=b.mgrno group by a.deptno,a.name,b.name; +echo select a.deptno,a.name,b.name,count(a.salary),sum(b.salary) from emp as a,emp as b where a.id=b.mgrno group by a.deptno,a.name,b.name; +select a.deptno,a.name,b.name,count(a.salary),sum(b.salary) from emp as a,emp as b where a.id=b.mgrno group by a.deptno,a.name,b.name; +echo select a.deptno,a.name,b.name,count(a.salary),sum(b.salary) from emp as a,emp as b where a.id=b.mgrno group by a.deptno,a.name,b.name having count(a.salary)<2 or count(a.salary)>2; +select a.deptno,a.name,b.name,count(a.salary),sum(b.salary) from emp as a,emp as b where a.id=b.mgrno group by a.deptno,a.name,b.name having count(a.salary)<2 or count(a.salary)>2; +echo select a.deptno,a.name,b.name,count(a.salary),sum(b.salary) from emp as a,emp as b where a.id=b.mgrno group by a.deptno,a.name,b.name having (count(a.salary)<2 or count(a.salary)>2) and sum(b.salary)>15000; +select a.deptno,a.name,b.name,count(a.salary),sum(b.salary) from emp as a,emp as b where a.id=b.mgrno group by a.deptno,a.name,b.name having (count(a.salary)<2 or count(a.salary)>2) and sum(b.salary)>15000; diff --git a/test/sql/Aggregate/test001.ksh b/test/sql/Aggregate/test001.ksh new file mode 100755 index 00000000..572e4239 --- /dev/null +++ b/test/sql/Aggregate/test001.ksh @@ -0,0 +1,30 @@ +#!/bin/ksh +#Test Case +# Create table t1 with 5 records in csql database. +# select query with count,sum,avg,min,max. + +# Author : Jitendra Lenka + +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/createt1.sql > /dev/null 2>&1 +if [ $? -ne 0 ] + then + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/aggregate1.sql +if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql > /dev/null 2>&1 + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql > /dev/null 2>&1 +exit 0; + diff --git a/test/sql/Aggregate/test002.ksh b/test/sql/Aggregate/test002.ksh new file mode 100755 index 00000000..83f0fdc5 --- /dev/null +++ b/test/sql/Aggregate/test002.ksh @@ -0,0 +1,29 @@ +#!/bin/ksh +#Test Case +# Create table t1 with 5 records in csql database. +# select query with count,sum,avg,min,max.Field name is passed to functions as tablename.fieldname + +# Author : Jitendra Lenka + +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/createt1.sql > /dev/null 2>&1 +if [ $? -ne 0 ] + then + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/aggregate2.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql > /dev/null 2>&1 + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql > /dev/null 2>&1 +exit 0; + diff --git a/test/sql/Aggregate/test004.ksh b/test/sql/Aggregate/test004.ksh new file mode 100755 index 00000000..51b32a36 --- /dev/null +++ b/test/sql/Aggregate/test004.ksh @@ -0,0 +1,32 @@ +#!/bin/ksh +#Test Case +# create table t1(f1 int,f2 int,f3 int,primary key(f1)); +# create table t2(f1 int,f2 int,f3 int,primary key(f1)); +# Insert 5 records in each. +# Test all aggregate functions applying conditions +# Test all aggregate functions applying conditions and group by. +# +# Author : Jitendra Lenka + +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/createt1t2.sql > /dev/null 2>&1 +if [ $? -ne 0 ] + then + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/aggregate4.sql +if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2.sql > /dev/null 2>&1 + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2.sql > /dev/null 2>&1 +exit 0; + diff --git a/test/sql/Aggregate/test005.ksh b/test/sql/Aggregate/test005.ksh new file mode 100755 index 00000000..cd49f234 --- /dev/null +++ b/test/sql/Aggregate/test005.ksh @@ -0,0 +1,30 @@ +#!/bin/ksh +# create table t1(f1 int,f2 int,f3 int,primary key(f1)); +# create table t2(f1 int,f2 int,f3 int,primary key(f1)); +# Insert 5 records in each. +# select query with count,sum,avg,min,max.and Group By. + +# Author : Jitendra Lenka + +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/createt1t2.sql > /dev/null 2>&1 +if [ $? -ne 0 ] + then + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/aggregate5.sql +if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2.sql > /dev/null 2>&1 + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2.sql > /dev/null 2>&1 +exit 0; diff --git a/test/sql/Aggregate/test006.ksh b/test/sql/Aggregate/test006.ksh new file mode 100755 index 00000000..c080a358 --- /dev/null +++ b/test/sql/Aggregate/test006.ksh @@ -0,0 +1,33 @@ +#!/bin/ksh +#Test Case +# create table t1(f1 int,f2 int,f3 int,primary key(f1)); +# create table t2(f1 int,f2 int,f3 int,primary key(f1)); +# Insert 5 records in each. +# select query with count,sum,avg,min,max and Group By. +# select query with count,sum,avg,min,max and Group By on non existing field. +# +# Author : Jitendra Lenka + +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/createt1t2.sql > /dev/null 2>&1 +if [ $? -ne 0 ] + then + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/aggregate6.sql +if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2.sql > /dev/null 2>&1 + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2.sql > /dev/null 2>&1 +exit 0; + diff --git a/test/sql/Aggregate/test007.ksh b/test/sql/Aggregate/test007.ksh new file mode 100755 index 00000000..e20497b0 --- /dev/null +++ b/test/sql/Aggregate/test007.ksh @@ -0,0 +1,32 @@ +#!/bin/ksh +#Test Case +# Create table t1 with 5 records in csql database. +# Test "select count(*),min(f1),sum(f1) from t1" + +# Author : Jitendra Lenka + +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/createt1.sql > /dev/null 2>&1 +if [ $? -ne 0 ] + then + exit 1; +fi + + +echo "select count(*),min(f1),sum(f1) from t1 :" +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/agg1.sql +if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql > /dev/null 2>&1 + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql > /dev/null 2>&1 +exit 0 ; + diff --git a/test/sql/Aggregate/test008.ksh b/test/sql/Aggregate/test008.ksh new file mode 100755 index 00000000..0e5abdaa --- /dev/null +++ b/test/sql/Aggregate/test008.ksh @@ -0,0 +1,35 @@ +#!/bin/ksh +#Test Case +# create table t1(f1 int,f2 int,f3 int,primary key(f1)); +# create table t2(f1 int,f2 int,f3 int,primary key(f1)); +# Insert 5 records in each. +# Test "select min(nonexist.f1) from t1" +# Author : Jitendra Lenka + +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/createt1t2.sql > /dev/null 2>&1 +if [ $? -ne 0 ] + then + exit 1; +fi + + +echo "select min(nonexist.f1) from t1 :" +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/aggmin4.sql +if [ $? -ne 0 ] + then + + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2.sql > /dev/null 2>&1 + exit 2; +fi + + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2.sql > /dev/null 2>&1 +exit 0; + diff --git a/test/sql/Aggregate/test009.ksh b/test/sql/Aggregate/test009.ksh new file mode 100755 index 00000000..297c78c3 --- /dev/null +++ b/test/sql/Aggregate/test009.ksh @@ -0,0 +1,36 @@ +#!/bin/ksh +#Test Case +# Create table t1 with 5 records in csql database. +# select query with expression in aggregate +# as we do not support expressions in aggregate, it should give syntax error + + +# Author : Jitendra Lenka + +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/createt1.sql > /dev/null 2>&1 +if [ $? -ne 0 ] + then + exit 1; +fi + + +echo "select sum(12*f1) where f4='BBB':" +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/aggsum3.sql +if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql > /dev/null 2>&1 + exit 2; + fi + + + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql > /dev/null 2>&1 +exit 0; + diff --git a/test/sql/Aggregate/test010.ksh b/test/sql/Aggregate/test010.ksh new file mode 100755 index 00000000..ce04fde8 --- /dev/null +++ b/test/sql/Aggregate/test010.ksh @@ -0,0 +1,31 @@ +#!/bin/ksh +#Test Case +# Create table t1 with 5 records in csql database. +# Insert 10-11 records with null value in some of the records. +# Test all aggregate functions on the fields having null values + +# Author : Jitendra Lenka + +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/nulltest1.sql +if [ $? -ne 0 ] + then + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/aggregate7.sql +if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2.sql + exit 2; + fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2.sql +exit 0; + diff --git a/test/sql/Aggregate/test011.ksh b/test/sql/Aggregate/test011.ksh new file mode 100755 index 00000000..8be538a4 --- /dev/null +++ b/test/sql/Aggregate/test011.ksh @@ -0,0 +1,31 @@ +#!/bin/ksh +#Test Case + +# Create table t1 with 5 records in csql database. +# Insert 10-11 records with null value in some of the records. +# Test group by all aggregate functions on the fields having null values +# Author : Jitendra Lenka + +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/nulltest2.sql +if [ $? -ne 0 ] + then + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/aggregate_groupby1.sql +if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql + exit 2; + fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql +exit 0; + diff --git a/test/sql/Aggregate/test012.ksh b/test/sql/Aggregate/test012.ksh new file mode 100755 index 00000000..6618c413 --- /dev/null +++ b/test/sql/Aggregate/test012.ksh @@ -0,0 +1,24 @@ +#!/bin/ksh +# Testing Group By on Multiple fields +# +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/groupby1.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Aggregate/test013.ksh b/test/sql/Aggregate/test013.ksh new file mode 100755 index 00000000..2d7c387d --- /dev/null +++ b/test/sql/Aggregate/test013.ksh @@ -0,0 +1,24 @@ +#!/bin/ksh +# Testing Group By with having on Multiple conditions +# +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/having1.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Aggregate/test014.ksh b/test/sql/Aggregate/test014.ksh new file mode 100755 index 00000000..6e525536 --- /dev/null +++ b/test/sql/Aggregate/test014.ksh @@ -0,0 +1,25 @@ +#!/bin/ksh +# Create a table . Insert 10-12 rows. +# Test where, group by, having and limit in one select statement +# +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/wher_grp_having_limit.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Aggregate/test015.ksh b/test/sql/Aggregate/test015.ksh new file mode 100755 index 00000000..f44afeeb --- /dev/null +++ b/test/sql/Aggregate/test015.ksh @@ -0,0 +1,85 @@ +#!/bin/ksh +#Test Case +# CREATE TABLE T1(f1 int,f2 int,f3 int,f4 int,f5 int); +#CREATE INDEX idx1 on T1(f2); +#CREATE INDEX idx2 on T1(f3); +#CREATE INDEX idx3 on T1(f4); +#CREATE INDEX idx4 on T1(f5); +#CREATE TABLE T2(f1 int,f2 int,primary key(f2)); +#CREATE TABLE T3(f1 int,f3 int,primary key(f3)); +#CREATE TABLE T4(f1 int,f4 int,primary key(f4)); +#CREATE TABLE T5(f1 int,f5 int,primary key(f5)); +# +#2) Insert 10k records in T1, +#1k records in T2 +#1k records in T3 +#1k records in T4 +#1k records in T5 +# +#3) Execute the following join statements. +#select COUNT(*) from T1,T2,T3,T4,T5 where T1.f2=T2.f2 and T1.f3=T3.f3 and T1.f4=T4.f4 and T1.f5=T5.f5; +#select SUM(T1.f1) from T1,T2,T3,T4,T5 where T1.f2=T2.f2 and T1.f3=T3.f3 and T1.f4=T4.f4 and T1.f5=T5.f5; +#select MIN(T1.f1) from T1,T2,T3,T4,T5 where T1.f2=T2.f2 and T1.f3=T3.f3 and T1.f4=T4.f4 and T1.f5=T5.f5; +#select AVG(T1.f1) from T1,T2,T3,T4,T5 where T1.f2=T2.f2 and T1.f3=T3.f3 and T1.f4=T4.f4 and T1.f5=T5.f5; +#select MAX(T1.f1) from T1,T2,T3,T4,T5 where T1.f2=T2.f2 and T1.f3=T3.f3 and T1.f4=T4.f4 and T1.f5=T5.f5; +# + +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/bigtable.sql +if [ $? -ne 0 ] + then + exit 1; +fi +for (( i=1 ; i<=10000 ; i++ )) +do + echo "insert into T1 values ($i,$i,$i,$i,$i);" >>$REL_PATH/T1.sql +done + +for (( i=1 ; i<=1000 ; i++ )) +do + echo "insert into T2 values($i,$i);" + echo "insert into T3 values($i,$i);" + echo "insert into T4 values($i,$i);" + echo "insert into T5 values($i,$i);" +done >>$REL_PATH/T11.sql + +for (( i=1 ; i<=5 ; i++ )) +do +echo "DROP TABLE T$i;" +done >>$REL_PATH/drop_all_table.sql + + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/T1.sql >/dev/null 2>&1 +if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_all_table.sql + rm -f $REL_PATH/T1.sql $REL_PATH/T11.sql $REL_PATH/drop_all_table.sql + exit 2; + fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/T11.sql >/dev/null 2>&1 +if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_all_table.sql + rm -f $REL_PATH/T1.sql $REL_PATH/T11.sql $REL_PATH/drop_all_table.sql + exit 3; + fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/all_agg.sql +if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_all_table.sql + rm -f $REL_PATH/T1.sql $REL_PATH/T11.sql $REL_PATH/drop_all_table.sql + exit 4; + fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_all_table.sql +rm -f $REL_PATH/T1.sql $REL_PATH/T11.sql $REL_PATH/drop_all_table.sql +exit 0; + diff --git a/test/sql/Aggregate/test016.ksh b/test/sql/Aggregate/test016.ksh new file mode 100755 index 00000000..faa81e96 --- /dev/null +++ b/test/sql/Aggregate/test016.ksh @@ -0,0 +1,41 @@ +#!/bin/ksh +# Create two tables, having same fieldnames say f1,f2 in both the tables. +# Testing projection fieldname without tablename in joinint the two table. +# for ex : select f1 from t1,t2; +# select sum(f2) from t1,t2; +# +# Author : Jitendra Lenka + +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/nulltest1.sql 2> $0.valgr +else + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/nulltest1.sql + if [ $? -ne 0 ] + then + exit 1; + fi +fi + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/projfield.sql 2>> $0.valgr +else + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/projfield.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2.sql + exit 2; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2.sql +exit 0; + diff --git a/test/sql/Aggregate/test025.ksh b/test/sql/Aggregate/test025.ksh new file mode 100755 index 00000000..fc849c04 --- /dev/null +++ b/test/sql/Aggregate/test025.ksh @@ -0,0 +1,35 @@ +#!/bin/ksh +# Testing Join on 5 sales tables. +# Create 5 tables like client_master,product_master,salesman_master,sales_order,sales_order_details. +# populate the above tables with required values. +# Test join, aggregate and having on them by executing the following query: +# List average qty sold for each client that has average of qty sold >3average of qty sold >3. Same apply for count,min,max and sum. +# +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/sales_tables.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/sales_table_drop.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/sales_join_aggregate.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/sales_table_drop.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/sales_table_drop.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Aggregate/test026.ksh b/test/sql/Aggregate/test026.ksh new file mode 100755 index 00000000..b192f84f --- /dev/null +++ b/test/sql/Aggregate/test026.ksh @@ -0,0 +1,35 @@ +#!/bin/ksh +# Testing Join on 5 sales tables. +# Create 5 tables like client_master,product_master,salesman_master,sales_order,sales_order_details. +# populate the above tables with required values. +# Test join, aggregate and having on them by executing the following query: +# List the productno , descriptions and their totally_ordered_quantities(sum).test count,min,max also. +# +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/sales_tables.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/sales_table_drop.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/sales_join_aggregate1.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/sales_table_drop.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/sales_table_drop.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Aggregate/test027.ksh b/test/sql/Aggregate/test027.ksh new file mode 100755 index 00000000..a8a8aceb --- /dev/null +++ b/test/sql/Aggregate/test027.ksh @@ -0,0 +1,35 @@ +#!/bin/ksh +# Testing Join on 5 sales tables. +# Create 5 tables like client_master,product_master,salesman_master,sales_order,sales_order_details. +# populate the above tables with required values. +# Test join, aggregate and having on them by executing the following query: +# List the productno,Description and their quantities for the orders placed by 'Ivan Bayross' and Mamta Muzumdar' +# +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/sales_tables.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/sales_table_drop.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/sales_join_aggregate2.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/sales_table_drop.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/sales_table_drop.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Aggregate/test028.ksh b/test/sql/Aggregate/test028.ksh new file mode 100755 index 00000000..dbf42b93 --- /dev/null +++ b/test/sql/Aggregate/test028.ksh @@ -0,0 +1,48 @@ +#!/bin/ksh +# Testing Join on 5 sales tables. +# Create table with all datatypes except float and double. +# Insert 20 records with null value in some fields. +# Select records using Group by. +# Select records using Group by and having. +# Select records using Group by on multiple fields in different combination. +# Select records using Group by on multiple fields and having on sum(). +# Test group by on NULL fields. +# +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/alldatatype.sql 2> $0.valgr +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/alldatatype.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/alldatatype_aggregate_sum.sql 2>> $0.valgr +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/alldatatype_aggregate_sum.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 2; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Aggregate/test029.ksh b/test/sql/Aggregate/test029.ksh new file mode 100755 index 00000000..41f13779 --- /dev/null +++ b/test/sql/Aggregate/test029.ksh @@ -0,0 +1,38 @@ +#!/bin/ksh +# Testing Join on 5 sales tables. +# Create table with all datatypes except float and double. +# Insert 20 records with null value in some fields. +# Select records using Group by. +# Select records using Group by and having. +# Select records using Group by on multiple fields in different combination. +# Select records using Group by on multiple fields and having on min(). +# Test group by on NULL fields. +# +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/alldatatype.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/alldatatype_aggregate_min.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Aggregate/test030.ksh b/test/sql/Aggregate/test030.ksh new file mode 100755 index 00000000..ea4fd260 --- /dev/null +++ b/test/sql/Aggregate/test030.ksh @@ -0,0 +1,38 @@ +#!/bin/ksh +# Testing Join on 5 sales tables. +# Create table with all datatypes except float and double. +# Insert 20 records with null value in some fields. +# Select records using Group by. +# Select records using Group by and having. +# Select records using Group by on multiple fields in different combination. +# Select records using Group by on multiple fields and having on max(). +# Test group by on NULL fields. +# +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/alldatatype.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/alldatatype_aggregate_max.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Aggregate/test031.ksh b/test/sql/Aggregate/test031.ksh new file mode 100755 index 00000000..d9ce0766 --- /dev/null +++ b/test/sql/Aggregate/test031.ksh @@ -0,0 +1,38 @@ +#!/bin/ksh +# Testing Join on 5 sales tables. +# Create table with all datatypes except float and double. +# Insert 20 records with Null value in some field. +# Select records using Group by. +# Select records using Group by and having. +# Select records using Group by on multiple fields in different combination. +# Select records using Group by on multiple fields and having on count(). +# Test group by on NULL fields. +# +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/alldatatype.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/alldatatype_aggregate_count.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Aggregate/test032.ksh b/test/sql/Aggregate/test032.ksh new file mode 100755 index 00000000..c310de96 --- /dev/null +++ b/test/sql/Aggregate/test032.ksh @@ -0,0 +1,37 @@ +#!/bin/ksh +# Testing Join on 5 sales tables. +# CREATE TABLE writer (poet varchar(50) , anthology varchar(40) default NULL, copies_in_stock tinyint(4)) ; +# INSERT INTO writer VALUES ('Mongane Wally Serote','Tstetlo',3); +# INSERT INTO writer VALUES ('Douglas Livingstone', 'The Skull in the Mud',21); +# INSERT INTO writer VALUES ('Mongane Wally Serote', 'No Baby Must Weep',8); +# INSERT INTO writer VALUES ('Douglas Livingstone', 'A Littoral Zone',2); +# INSERT INTO writer VALUES ('Mongane Wally Serote', 'A Tough Tale',2); +# SELECT poet, MAX(copies_in_stock) , MIN(copies_in_stock) , AVG(copies_in_stock) , SUM(copies_in_stock) FROM writer GROUP BY poet; +# SELECT poet, MAX(copies_in_stock), AVG(copies_in_stock) , SUM(copies_in_stock) FROM writer GROUP BY poet HAVING poet > 'E'; +# This will give wrong value for min(tinyint datatype). +# + +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi +echo "DROP TABLE writer;" >${REL_PATH}/drop_writer.sql +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/writer.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/drop_writer.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_writer.sql +if [ $? -ne 0 ] +then + rm -f ${REL_PATH}/drop_writer.sql + exit 3; +fi + +rm -f ${REL_PATH}/drop_writer.sql +exit 0; diff --git a/test/sql/Aggregate/test033.ksh b/test/sql/Aggregate/test033.ksh new file mode 100755 index 00000000..fbde396f --- /dev/null +++ b/test/sql/Aggregate/test033.ksh @@ -0,0 +1,48 @@ +#!/bin/ksh +# Testing Join on 5 sales tables. +# Create table with all datatypes except float and double. +# Insert 16 records. +# Select records using Group by. +# Select records using Group by and having. +# Test group by on NULL fields. +# Test Aggregate min() on char,date, time and timestamp. +# Select records using Group by on multiple fields and having on min(). . +# +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/alldatatype.sql 2> $0.valgr +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/alldatatype.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/char_datetypes_min.sql 2>> $0.valgr +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/char_datetypes_min.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 2; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Aggregate/test034.ksh b/test/sql/Aggregate/test034.ksh new file mode 100755 index 00000000..59ba64f1 --- /dev/null +++ b/test/sql/Aggregate/test034.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# Testing Join on 5 sales tables. +# Create table with all datatypes except float and double. +# Insert 16 records. +# This test for test max() on char,date,time,timestamp in different combination +# +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/alldatatype.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/char_datetypes_max.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Aggregate/test035.ksh b/test/sql/Aggregate/test035.ksh new file mode 100755 index 00000000..c947f75a --- /dev/null +++ b/test/sql/Aggregate/test035.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# Testing Join on 5 sales tables. +# Create table with all datatypes except float and double. +# Insert 16 records. +# This test for test count() on char,date,time,timestamp in different combination +# +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/alldatatype.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/char_datetypes_count.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Aggregate/test036.ksh b/test/sql/Aggregate/test036.ksh new file mode 100755 index 00000000..4408179e --- /dev/null +++ b/test/sql/Aggregate/test036.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# Testing Join on 5 sales tables. +# select t1.f1,t1.f2,count(t1.f3),count(t2.f3) from t1,t2 group by t1.f1,t1.f2 ; +# This statement should work properly. +# select t1.f1,t1.f2,count(t1.f3),count(t2.f3) from t1,t2 group by t1.f1,t1.f2 having avg(t1.f2)<70; +# This statement should not work becoz expression in having clause not present in projection list. +# + +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/innerjoin_aggregate.sql 2> $0.valgr +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/innerjoin_aggregate.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1t2.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1t2.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Aggregate/test037.ksh b/test/sql/Aggregate/test037.ksh new file mode 100755 index 00000000..c6ffb0cf --- /dev/null +++ b/test/sql/Aggregate/test037.ksh @@ -0,0 +1,25 @@ +#!/bin/ksh +# Testing aggregate on self join. +# + +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/selfjoin_aggregate.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropemp.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropemp.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +exit 0; diff --git a/test/sql/Aggregate/test038.ksh b/test/sql/Aggregate/test038.ksh new file mode 100755 index 00000000..81db89f0 --- /dev/null +++ b/test/sql/Aggregate/test038.ksh @@ -0,0 +1,44 @@ +#!/bin/ksh +# Group by and aggregate function of projection list cannot applied on same field +# + +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +echo "create table t1 (f1 int,f2 int,f3 int);" >${REL_PATH}/grp_agg.sql +echo "insert into t1 values(1,10,100);" >>${REL_PATH}/grp_agg.sql +echo "insert into t1 values(2,20,100);" >>${REL_PATH}/grp_agg.sql +echo "insert into t1 values(1,30,200);" >>${REL_PATH}/grp_agg.sql +echo "insert into t1 values(3,40,200);" >>${REL_PATH}/grp_agg.sql +echo "insert into t1 values(2,50,300);" >>${REL_PATH}/grp_agg.sql +echo "insert into t1 values(1,60,300);" >>${REL_PATH}/grp_agg.sql +echo "select * from t1;" >>${REL_PATH}/grp_agg.sql +echo "select f1,MAX(f1) from t1;" >>${REL_PATH}/grp_agg.sql +echo "select f1,COUNT(f1) from t1 group by f1;" >>${REL_PATH}/grp_agg.sql +echo "select f1,MIN(f1) from t1 group by f1;" >>${REL_PATH}/grp_agg.sql +echo "select f1,MAX(f1) from t1 group by f1;" >>${REL_PATH}/grp_agg.sql +echo "select f1,SUM(f1) from t1 group by f1;" >>${REL_PATH}/grp_agg.sql +echo "select f1,AVG(f1) from t1 group by f1;" >>${REL_PATH}/grp_agg.sql +echo "select f1,MAX(f2) from t1 group by f1;" >>${REL_PATH}/grp_agg.sql + + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/grp_agg.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/grp_agg.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/grp_agg.sql +exit 0; diff --git a/test/sql/Aggregate/testnw001.ksh b/test/sql/Aggregate/testnw001.ksh new file mode 100755 index 00000000..119756c3 --- /dev/null +++ b/test/sql/Aggregate/testnw001.ksh @@ -0,0 +1,30 @@ +#!/bin/ksh +#Test Case +# Create table t1 with 5 records in csql database. +# select query with count,sum,avg,min,max. + +# Author : Jitendra Lenka + +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s $REL_PATH/createt1.sql > /dev/null 2>&1 +if [ $? -ne 0 ] + then + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s $REL_PATH/aggregate1.sql +if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql > /dev/null 2>&1 + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql > /dev/null 2>&1 +exit 0; + diff --git a/test/sql/Aggregate/testnw002.ksh b/test/sql/Aggregate/testnw002.ksh new file mode 100755 index 00000000..dc81f3fb --- /dev/null +++ b/test/sql/Aggregate/testnw002.ksh @@ -0,0 +1,29 @@ +#!/bin/ksh +#Test Case +# Create table t1 with 5 records in csql database. +# select query with count,sum,avg,min,max.Field name is passed to functions as tablename.fieldname + +# Author : Jitendra Lenka + +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s $REL_PATH/createt1.sql > /dev/null 2>&1 +if [ $? -ne 0 ] + then + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s $REL_PATH/aggregate2.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql > /dev/null 2>&1 + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql > /dev/null 2>&1 +exit 0; + diff --git a/test/sql/Aggregate/testnw004.ksh b/test/sql/Aggregate/testnw004.ksh new file mode 100755 index 00000000..098aad41 --- /dev/null +++ b/test/sql/Aggregate/testnw004.ksh @@ -0,0 +1,32 @@ +#!/bin/ksh +#Test Case +# create table t1(f1 int,f2 int,f3 int,primary key(f1)); +# create table t2(f1 int,f2 int,f3 int,primary key(f1)); +# Insert 5 records in each. +# Test all aggregate functions applying conditions +# Test all aggregate functions applying conditions and group by. +# +# Author : Jitendra Lenka + +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/createt1t2.sql > /dev/null 2>&1 +if [ $? -ne 0 ] + then + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s $REL_PATH/aggregate4.sql +if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2.sql > /dev/null 2>&1 + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2.sql > /dev/null 2>&1 +exit 0; + diff --git a/test/sql/Aggregate/testnw005.ksh b/test/sql/Aggregate/testnw005.ksh new file mode 100755 index 00000000..751f554e --- /dev/null +++ b/test/sql/Aggregate/testnw005.ksh @@ -0,0 +1,30 @@ +#!/bin/ksh +# create table t1(f1 int,f2 int,f3 int,primary key(f1)); +# create table t2(f1 int,f2 int,f3 int,primary key(f1)); +# Insert 5 records in each. +# select query with count,sum,avg,min,max.and Group By. + +# Author : Jitendra Lenka + +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/createt1t2.sql > /dev/null 2>&1 +if [ $? -ne 0 ] + then + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s $REL_PATH/aggregate5.sql +if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2.sql > /dev/null 2>&1 + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2.sql > /dev/null 2>&1 +exit 0; diff --git a/test/sql/Aggregate/testnw006.ksh b/test/sql/Aggregate/testnw006.ksh new file mode 100755 index 00000000..f77995e7 --- /dev/null +++ b/test/sql/Aggregate/testnw006.ksh @@ -0,0 +1,33 @@ +#!/bin/ksh +#Test Case +# create table t1(f1 int,f2 int,f3 int,primary key(f1)); +# create table t2(f1 int,f2 int,f3 int,primary key(f1)); +# Insert 5 records in each. +# select query with count,sum,avg,min,max and Group By. +# select query with count,sum,avg,min,max and Group By on non existing field. +# +# Author : Jitendra Lenka + +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/createt1t2.sql > /dev/null 2>&1 +if [ $? -ne 0 ] + then + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s $REL_PATH/aggregate6.sql +if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2.sql > /dev/null 2>&1 + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2.sql > /dev/null 2>&1 +exit 0; + diff --git a/test/sql/Aggregate/testnw007.ksh b/test/sql/Aggregate/testnw007.ksh new file mode 100755 index 00000000..7b6d39d3 --- /dev/null +++ b/test/sql/Aggregate/testnw007.ksh @@ -0,0 +1,32 @@ +#!/bin/ksh +#Test Case +# Create table t1 with 5 records in csql database. +# Test "select count(*),min(f1),sum(f1) from t1" + +# Author : Jitendra Lenka + +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/createt1.sql > /dev/null 2>&1 +if [ $? -ne 0 ] + then + exit 1; +fi + + +echo "select count(*),min(f1),sum(f1) from t1 :" +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s $REL_PATH/agg1.sql +if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql > /dev/null 2>&1 + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql > /dev/null 2>&1 +exit 0 ; + diff --git a/test/sql/Aggregate/testnw008.ksh b/test/sql/Aggregate/testnw008.ksh new file mode 100755 index 00000000..9632f87c --- /dev/null +++ b/test/sql/Aggregate/testnw008.ksh @@ -0,0 +1,35 @@ +#!/bin/ksh +#Test Case +# create table t1(f1 int,f2 int,f3 int,primary key(f1)); +# create table t2(f1 int,f2 int,f3 int,primary key(f1)); +# Insert 5 records in each. +# Test "select min(nonexist.f1) from t1" +# Author : Jitendra Lenka + +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/createt1t2.sql > /dev/null 2>&1 +if [ $? -ne 0 ] + then + exit 1; +fi + + +echo "select min(nonexist.f1) from t1 :" +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s $REL_PATH/aggmin4.sql +if [ $? -ne 0 ] + then + + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2.sql > /dev/null 2>&1 + exit 2; +fi + + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2.sql > /dev/null 2>&1 +exit 0; + diff --git a/test/sql/Aggregate/testnw009.ksh b/test/sql/Aggregate/testnw009.ksh new file mode 100755 index 00000000..259a0d76 --- /dev/null +++ b/test/sql/Aggregate/testnw009.ksh @@ -0,0 +1,36 @@ +#!/bin/ksh +#Test Case +# Create table t1 with 5 records in csql database. +# select query with expression in aggregate +# as we do not support expressions in aggregate, it should give syntax error + + +# Author : Jitendra Lenka + +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/createt1.sql > /dev/null 2>&1 +if [ $? -ne 0 ] + then + exit 1; +fi + + +echo "select sum(12*f1) where f4='BBB':" +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s $REL_PATH/aggsum3.sql +if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql > /dev/null 2>&1 + exit 2; + fi + + + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql > /dev/null 2>&1 +exit 0; + diff --git a/test/sql/Aggregate/testnw010.ksh b/test/sql/Aggregate/testnw010.ksh new file mode 100755 index 00000000..ef366610 --- /dev/null +++ b/test/sql/Aggregate/testnw010.ksh @@ -0,0 +1,31 @@ +#!/bin/ksh +#Test Case +# Create table t1 with 5 records in csql database. +# Insert 10-11 records with null value in some of the records. +# Test all aggregate functions on the fields having null values + +# Author : Jitendra Lenka + +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s $REL_PATH/nulltest1.sql +if [ $? -ne 0 ] + then + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s $REL_PATH/aggregate7.sql +if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2.sql + exit 2; + fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2.sql +exit 0; + diff --git a/test/sql/Aggregate/testnw011.ksh b/test/sql/Aggregate/testnw011.ksh new file mode 100755 index 00000000..b35375a4 --- /dev/null +++ b/test/sql/Aggregate/testnw011.ksh @@ -0,0 +1,31 @@ +#!/bin/ksh +#Test Case + +# Create table t1 with 5 records in csql database. +# Insert 10-11 records with null value in some of the records. +# Test group by all aggregate functions on the fields having null values +# Author : Jitendra Lenka + +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s $REL_PATH/nulltest2.sql +if [ $? -ne 0 ] + then + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s $REL_PATH/aggregate_groupby1.sql +if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql + exit 2; + fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql +exit 0; + diff --git a/test/sql/Aggregate/testnw012.ksh b/test/sql/Aggregate/testnw012.ksh new file mode 100755 index 00000000..8e4424b8 --- /dev/null +++ b/test/sql/Aggregate/testnw012.ksh @@ -0,0 +1,24 @@ +#!/bin/ksh +# Testing Group By on Multiple fields +# +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s ${REL_PATH}/groupby1.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Aggregate/testnw013.ksh b/test/sql/Aggregate/testnw013.ksh new file mode 100755 index 00000000..7aab0b39 --- /dev/null +++ b/test/sql/Aggregate/testnw013.ksh @@ -0,0 +1,24 @@ +#!/bin/ksh +# Testing Group By with having on Multiple conditions +# +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s ${REL_PATH}/having1.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Aggregate/testnw014.ksh b/test/sql/Aggregate/testnw014.ksh new file mode 100755 index 00000000..23ce4503 --- /dev/null +++ b/test/sql/Aggregate/testnw014.ksh @@ -0,0 +1,25 @@ +#!/bin/ksh +# Create a table . Insert 10-12 rows. +# Test where, group by, having and limit in one select statement +# +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s ${REL_PATH}/wher_grp_having_limit.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Aggregate/testnw015.ksh b/test/sql/Aggregate/testnw015.ksh new file mode 100755 index 00000000..f6ee5792 --- /dev/null +++ b/test/sql/Aggregate/testnw015.ksh @@ -0,0 +1,85 @@ +#!/bin/ksh +#Test Case +# CREATE TABLE T1(f1 int,f2 int,f3 int,f4 int,f5 int); +#CREATE INDEX idx1 on T1(f2); +#CREATE INDEX idx2 on T1(f3); +#CREATE INDEX idx3 on T1(f4); +#CREATE INDEX idx4 on T1(f5); +#CREATE TABLE T2(f1 int,f2 int,primary key(f2)); +#CREATE TABLE T3(f1 int,f3 int,primary key(f3)); +#CREATE TABLE T4(f1 int,f4 int,primary key(f4)); +#CREATE TABLE T5(f1 int,f5 int,primary key(f5)); +# +#2) Insert 10k records in T1, +#1k records in T2 +#1k records in T3 +#1k records in T4 +#1k records in T5 +# +#3) Execute the following join statements. +#select COUNT(*) from T1,T2,T3,T4,T5 where T1.f2=T2.f2 and T1.f3=T3.f3 and T1.f4=T4.f4 and T1.f5=T5.f5; +#select SUM(T1.f1) from T1,T2,T3,T4,T5 where T1.f2=T2.f2 and T1.f3=T3.f3 and T1.f4=T4.f4 and T1.f5=T5.f5; +#select MIN(T1.f1) from T1,T2,T3,T4,T5 where T1.f2=T2.f2 and T1.f3=T3.f3 and T1.f4=T4.f4 and T1.f5=T5.f5; +#select AVG(T1.f1) from T1,T2,T3,T4,T5 where T1.f2=T2.f2 and T1.f3=T3.f3 and T1.f4=T4.f4 and T1.f5=T5.f5; +#select MAX(T1.f1) from T1,T2,T3,T4,T5 where T1.f2=T2.f2 and T1.f3=T3.f3 and T1.f4=T4.f4 and T1.f5=T5.f5; +# + +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s $REL_PATH/bigtable.sql +if [ $? -ne 0 ] + then + exit 1; +fi +for (( i=1 ; i<=10000 ; i++ )) +do + echo "insert into T1 values ($i,$i,$i,$i,$i);" >>$REL_PATH/T1.sql +done + +for (( i=1 ; i<=1000 ; i++ )) +do + echo "insert into T2 values($i,$i);" + echo "insert into T3 values($i,$i);" + echo "insert into T4 values($i,$i);" + echo "insert into T5 values($i,$i);" +done >>$REL_PATH/T11.sql + +for (( i=1 ; i<=5 ; i++ )) +do +echo "DROP TABLE T$i;" +done >>$REL_PATH/drop_all_table.sql + + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/T1.sql >/dev/null 2>&1 +if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_all_table.sql + rm -f $REL_PATH/T1.sql $REL_PATH/T11.sql $REL_PATH/drop_all_table.sql + exit 2; + fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/T11.sql >/dev/null 2>&1 +if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_all_table.sql + rm -f $REL_PATH/T1.sql $REL_PATH/T11.sql $REL_PATH/drop_all_table.sql + exit 3; + fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s $REL_PATH/all_agg.sql +if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_all_table.sql + rm -f $REL_PATH/T1.sql $REL_PATH/T11.sql $REL_PATH/drop_all_table.sql + exit 4; + fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_all_table.sql +rm -f $REL_PATH/T1.sql $REL_PATH/T11.sql $REL_PATH/drop_all_table.sql +exit 0; + diff --git a/test/sql/Aggregate/testnw016.ksh b/test/sql/Aggregate/testnw016.ksh new file mode 100755 index 00000000..ef219792 --- /dev/null +++ b/test/sql/Aggregate/testnw016.ksh @@ -0,0 +1,31 @@ +#!/bin/ksh +# Create two tables, having same fieldnames say f1,f2 in both the tables. +# Testing projection fieldname without tablename in joinint the two table. +# for ex : select f1 from t1,t2; +# select sum(f2) from t1,t2; +# +# Author : Jitendra Lenka + +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s $REL_PATH/nulltest1.sql +if [ $? -ne 0 ] + then + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s $REL_PATH/projfield.sql +if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2.sql + exit 2; + fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2.sql +exit 0; + diff --git a/test/sql/Aggregate/testnw025.ksh b/test/sql/Aggregate/testnw025.ksh new file mode 100755 index 00000000..af3ef0e1 --- /dev/null +++ b/test/sql/Aggregate/testnw025.ksh @@ -0,0 +1,35 @@ +#!/bin/ksh +# Testing Join on 5 sales tables. +# Create 5 tables like client_master,product_master,salesman_master,sales_order,sales_order_details. +# populate the above tables with required values. +# Test join, aggregate and having on them by executing the following query: +# List average qty sold for each client that has average of qty sold >3average of qty sold >3. Same apply for count,min,max and sum. +# +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s ${REL_PATH}/sales_tables.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/sales_table_drop.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s ${REL_PATH}/sales_join_aggregate.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/sales_table_drop.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/sales_table_drop.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Aggregate/testnw026.ksh b/test/sql/Aggregate/testnw026.ksh new file mode 100755 index 00000000..8ba98db3 --- /dev/null +++ b/test/sql/Aggregate/testnw026.ksh @@ -0,0 +1,35 @@ +#!/bin/ksh +# Testing Join on 5 sales tables. +# Create 5 tables like client_master,product_master,salesman_master,sales_order,sales_order_details. +# populate the above tables with required values. +# Test join, aggregate and having on them by executing the following query: +# List the productno , descriptions and their totally_ordered_quantities(sum).test count,min,max also. +# +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s ${REL_PATH}/sales_tables.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/sales_table_drop.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s ${REL_PATH}/sales_join_aggregate1.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/sales_table_drop.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/sales_table_drop.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Aggregate/testnw027.ksh b/test/sql/Aggregate/testnw027.ksh new file mode 100755 index 00000000..eb52c7ae --- /dev/null +++ b/test/sql/Aggregate/testnw027.ksh @@ -0,0 +1,35 @@ +#!/bin/ksh +# Testing Join on 5 sales tables. +# Create 5 tables like client_master,product_master,salesman_master,sales_order,sales_order_details. +# populate the above tables with required values. +# Test join, aggregate and having on them by executing the following query: +# List the productno,Description and their quantities for the orders placed by 'Ivan Bayross' and Mamta Muzumdar' +# +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s ${REL_PATH}/sales_tables.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/sales_table_drop.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s ${REL_PATH}/sales_join_aggregate2.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/sales_table_drop.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/sales_table_drop.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Aggregate/testnw028.ksh b/test/sql/Aggregate/testnw028.ksh new file mode 100755 index 00000000..68cc0a09 --- /dev/null +++ b/test/sql/Aggregate/testnw028.ksh @@ -0,0 +1,38 @@ +#!/bin/ksh +# Testing Join on 5 sales tables. +# Create table with all datatypes except float and double. +# Insert 20 records with null value in some fields. +# Select records using Group by. +# Select records using Group by and having. +# Select records using Group by on multiple fields in different combination. +# Select records using Group by on multiple fields and having on sum(). +# Test group by on NULL fields. +# +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s ${REL_PATH}/alldatatype.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s ${REL_PATH}/alldatatype_aggregate_sum.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Aggregate/testnw029.ksh b/test/sql/Aggregate/testnw029.ksh new file mode 100755 index 00000000..aa001dac --- /dev/null +++ b/test/sql/Aggregate/testnw029.ksh @@ -0,0 +1,38 @@ +#!/bin/ksh +# Testing Join on 5 sales tables. +# Create table with all datatypes except float and double. +# Insert 20 records with null value in some fields. +# Select records using Group by. +# Select records using Group by and having. +# Select records using Group by on multiple fields in different combination. +# Select records using Group by on multiple fields and having on min(). +# Test group by on NULL fields. +# +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s ${REL_PATH}/alldatatype.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s ${REL_PATH}/alldatatype_aggregate_min.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Aggregate/testnw030.ksh b/test/sql/Aggregate/testnw030.ksh new file mode 100755 index 00000000..9ec6c09b --- /dev/null +++ b/test/sql/Aggregate/testnw030.ksh @@ -0,0 +1,38 @@ +#!/bin/ksh +# Testing Join on 5 sales tables. +# Create table with all datatypes except float and double. +# Insert 20 records with null value in some fields. +# Select records using Group by. +# Select records using Group by and having. +# Select records using Group by on multiple fields in different combination. +# Select records using Group by on multiple fields and having on max(). +# Test group by on NULL fields. +# +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s ${REL_PATH}/alldatatype.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s ${REL_PATH}/alldatatype_aggregate_max.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Aggregate/testnw031.ksh b/test/sql/Aggregate/testnw031.ksh new file mode 100755 index 00000000..452d22ed --- /dev/null +++ b/test/sql/Aggregate/testnw031.ksh @@ -0,0 +1,38 @@ +#!/bin/ksh +# Testing Join on 5 sales tables. +# Create table with all datatypes except float and double. +# Insert 20 records with Null value in some field. +# Select records using Group by. +# Select records using Group by and having. +# Select records using Group by on multiple fields in different combination. +# Select records using Group by on multiple fields and having on count(). +# Test group by on NULL fields. +# +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s ${REL_PATH}/alldatatype.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s ${REL_PATH}/alldatatype_aggregate_count.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Aggregate/testnw032.ksh b/test/sql/Aggregate/testnw032.ksh new file mode 100755 index 00000000..c75187fa --- /dev/null +++ b/test/sql/Aggregate/testnw032.ksh @@ -0,0 +1,37 @@ +#!/bin/ksh +# Testing Join on 5 sales tables. +# CREATE TABLE writer (poet varchar(50) , anthology varchar(40) default NULL, copies_in_stock tinyint(4)) ; +# INSERT INTO writer VALUES ('Mongane Wally Serote','Tstetlo',3); +# INSERT INTO writer VALUES ('Douglas Livingstone', 'The Skull in the Mud',21); +# INSERT INTO writer VALUES ('Mongane Wally Serote', 'No Baby Must Weep',8); +# INSERT INTO writer VALUES ('Douglas Livingstone', 'A Littoral Zone',2); +# INSERT INTO writer VALUES ('Mongane Wally Serote', 'A Tough Tale',2); +# SELECT poet, MAX(copies_in_stock) , MIN(copies_in_stock) , AVG(copies_in_stock) , SUM(copies_in_stock) FROM writer GROUP BY poet; +# SELECT poet, MAX(copies_in_stock), AVG(copies_in_stock) , SUM(copies_in_stock) FROM writer GROUP BY poet HAVING poet > 'E'; +# This will give wrong value for min(tinyint datatype). +# + +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi +echo "DROP TABLE writer;" >${REL_PATH}/drop_writer.sql +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s ${REL_PATH}/writer.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/drop_writer.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s ${REL_PATH}/drop_writer.sql +if [ $? -ne 0 ] +then + rm -f ${REL_PATH}/drop_writer.sql + exit 3; +fi + +rm -f ${REL_PATH}/drop_writer.sql +exit 0; diff --git a/test/sql/Aggregate/testnw033.ksh b/test/sql/Aggregate/testnw033.ksh new file mode 100755 index 00000000..7d342624 --- /dev/null +++ b/test/sql/Aggregate/testnw033.ksh @@ -0,0 +1,38 @@ +#!/bin/ksh +# Testing Join on 5 sales tables. +# Create table with all datatypes except float and double. +# Insert 16 records. +# Select records using Group by. +# Select records using Group by and having. +# Test group by on NULL fields. +# Test Aggregate min() on char,date, time and timestamp. +# Select records using Group by on multiple fields and having on min(). . +# +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s ${REL_PATH}/alldatatype.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s ${REL_PATH}/char_datetypes_min.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Aggregate/testnw034.ksh b/test/sql/Aggregate/testnw034.ksh new file mode 100755 index 00000000..b4056e9a --- /dev/null +++ b/test/sql/Aggregate/testnw034.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# Testing Join on 5 sales tables. +# Create table with all datatypes except float and double. +# Insert 16 records. +# This test for test max() on char,date,time,timestamp in different combination +# +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s ${REL_PATH}/alldatatype.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s ${REL_PATH}/char_datetypes_max.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Aggregate/testnw035.ksh b/test/sql/Aggregate/testnw035.ksh new file mode 100755 index 00000000..23573c38 --- /dev/null +++ b/test/sql/Aggregate/testnw035.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# Testing Join on 5 sales tables. +# Create table with all datatypes except float and double. +# Insert 16 records. +# This test for test count() on char,date,time,timestamp in different combination +# +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s ${REL_PATH}/alldatatype.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s ${REL_PATH}/char_datetypes_count.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Aggregate/testnw036.ksh b/test/sql/Aggregate/testnw036.ksh new file mode 100755 index 00000000..60a1679d --- /dev/null +++ b/test/sql/Aggregate/testnw036.ksh @@ -0,0 +1,29 @@ +#!/bin/ksh +# Testing Join on 5 sales tables. +# select t1.f1,t1.f2,count(t1.f3),count(t2.f3) from t1,t2 group by t1.f1,t1.f2 ; +# This statement should work properly. +# select t1.f1,t1.f2,count(t1.f3),count(t2.f3) from t1,t2 group by t1.f1,t1.f2 having avg(t1.f2)<70; +# This statement should not work becoz expression in having clause not present in projection list. +# + +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -o 4 -s ${REL_PATH}/innerjoin_aggregate.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1t2.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1t2.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Aggregate/testnw037.ksh b/test/sql/Aggregate/testnw037.ksh new file mode 100755 index 00000000..c6ffb0cf --- /dev/null +++ b/test/sql/Aggregate/testnw037.ksh @@ -0,0 +1,25 @@ +#!/bin/ksh +# Testing aggregate on self join. +# + +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/selfjoin_aggregate.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropemp.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropemp.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +exit 0; diff --git a/test/sql/Aggregate/testnw038.ksh b/test/sql/Aggregate/testnw038.ksh new file mode 100755 index 00000000..81db89f0 --- /dev/null +++ b/test/sql/Aggregate/testnw038.ksh @@ -0,0 +1,44 @@ +#!/bin/ksh +# Group by and aggregate function of projection list cannot applied on same field +# + +QUITFILE=${PWD}/sql/Aggregate/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Aggregate +fi + +echo "create table t1 (f1 int,f2 int,f3 int);" >${REL_PATH}/grp_agg.sql +echo "insert into t1 values(1,10,100);" >>${REL_PATH}/grp_agg.sql +echo "insert into t1 values(2,20,100);" >>${REL_PATH}/grp_agg.sql +echo "insert into t1 values(1,30,200);" >>${REL_PATH}/grp_agg.sql +echo "insert into t1 values(3,40,200);" >>${REL_PATH}/grp_agg.sql +echo "insert into t1 values(2,50,300);" >>${REL_PATH}/grp_agg.sql +echo "insert into t1 values(1,60,300);" >>${REL_PATH}/grp_agg.sql +echo "select * from t1;" >>${REL_PATH}/grp_agg.sql +echo "select f1,MAX(f1) from t1;" >>${REL_PATH}/grp_agg.sql +echo "select f1,COUNT(f1) from t1 group by f1;" >>${REL_PATH}/grp_agg.sql +echo "select f1,MIN(f1) from t1 group by f1;" >>${REL_PATH}/grp_agg.sql +echo "select f1,MAX(f1) from t1 group by f1;" >>${REL_PATH}/grp_agg.sql +echo "select f1,SUM(f1) from t1 group by f1;" >>${REL_PATH}/grp_agg.sql +echo "select f1,AVG(f1) from t1 group by f1;" >>${REL_PATH}/grp_agg.sql +echo "select f1,MAX(f2) from t1 group by f1;" >>${REL_PATH}/grp_agg.sql + + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/grp_agg.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/grp_agg.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/grp_agg.sql +exit 0; diff --git a/test/sql/Aggregate/wher_grp_having_limit.sql b/test/sql/Aggregate/wher_grp_having_limit.sql new file mode 100644 index 00000000..42fcfd3e --- /dev/null +++ b/test/sql/Aggregate/wher_grp_having_limit.sql @@ -0,0 +1,34 @@ +echo create table t1(f1 char(10),f2 char(10),f3 int); +create table t1(f1 char(10),f2 char(10),f3 int); +insert into t1 values('s','y',5000); +insert into t1 values('p','q',4000); +insert into t1 values('z','y',2000); +insert into t1 values('p','y',3000); +insert into t1 values('c','q',1000); +insert into t1 values('z','y',1500); +insert into t1 values('s','y',3000); +insert into t1 values('c','t',2500); +insert into t1 values('s','p',2300); +insert into t1 values('c','q',4000); +insert into t1 values('c','y',5000); +insert into t1 values('c','p',3500); +echo select * from t1; +select * from t1; +echo select f2,avg(f3) from t1 group by f2; +select f2,avg(f3) from t1 group by f2; +echo select f2,avg(f3) from t1 where f3>=3000 group by f2 ; +select f2,avg(f3) from t1 where f3>=3000 group by f2 ; +echo select f2,avg(f3) from t1 where f3>=2000 group by f2 having avg(f3)>3000; +select f2,avg(f3) from t1 where f3>=2000 group by f2 having avg(f3)>3000; +echo select f2,avg(f3) from t1 where f3>=2000 group by f2 having avg(f3)>3000 limit 1; +select f2,avg(f3) from t1 where f3>=2000 group by f2 having avg(f3)>3000 limit 1; +echo select f2,avg(f3) from t1 where f3>=2000 or f2 = 'y' group by f2 having avg(f3)>3000; +select f2,avg(f3) from t1 where f3>=2000 or f2 = 'y' group by f2 having avg(f3)>3000; +echo select f1,f2,avg(f3) from t1 where f3>=2000 or f2 = 'y' group by f1,f2 having avg(f3)>3000 ; +select f1,f2,avg(f3) from t1 where f3>=2000 or f2 = 'y' group by f1,f2 having avg(f3)>3000 ; +echo select f2,f1,avg(f3) from t1 where f3>=2000 or f2 = 'y' group by f1,f2 having avg(f3)>3000; +select f2,f1,avg(f3) from t1 where f3>=2000 or f2 = 'y' group by f1,f2 having avg(f3)>3000; +echo select f2,f1,avg(f3) from t1 where f3>=2000 or f2 = 'y' group by f1,f2 having avg(f3)>2000 ; +select f2,f1,avg(f3) from t1 where f3>=2000 or f2 = 'y' group by f1,f2 having avg(f3)>2000 ; +echo select f2,f1,avg(f3) from t1 where f3>=2000 or f2 = 'y' group by f1,f2 having avg(f3)>2000 limit 3 offset 2; +select f2,f1,avg(f3) from t1 where f3>=2000 or f2 = 'y' group by f1,f2 having avg(f3)>2000 limit 3 offset 2; diff --git a/test/sql/Aggregate/writer.sql b/test/sql/Aggregate/writer.sql new file mode 100644 index 00000000..1a827ac6 --- /dev/null +++ b/test/sql/Aggregate/writer.sql @@ -0,0 +1,16 @@ +echo CREATE TABLE writer (poet char(50) , anthology char(40) , copies_in_stock tinyint(4)) ; +CREATE TABLE writer (poet char(50) , anthology char(40) , copies_in_stock tinyint(4)) ; +echo INSERT INTO writer VALUES ('Mongane Wally Serote','Tstetlo',3); +INSERT INTO writer VALUES ('Mongane Wally Serote','Tstetlo',3); +echo INSERT INTO writer VALUES ('Douglas Livingstone', 'The Skull in the Mud',21); +INSERT INTO writer VALUES ('Douglas Livingstone', 'The Skull in the Mud',21); +echo INSERT INTO writer VALUES ('Mongane Wally Serote', 'No Baby Must Weep',8); +INSERT INTO writer VALUES ('Mongane Wally Serote', 'No Baby Must Weep',8); +echo INSERT INTO writer VALUES ('Douglas Livingstone', 'A Littoral Zone',2); +INSERT INTO writer VALUES ('Douglas Livingstone', 'A Littoral Zone',2); +echo INSERT INTO writer VALUES ('Mongane Wally Serote', 'A Tough Tale',2); +INSERT INTO writer VALUES ('Mongane Wally Serote', 'A Tough Tale',2); +echo SELECT * FROM writer; +SELECT * FROM writer; +echo SELECT poet, MAX(copies_in_stock) , MIN(copies_in_stock) , AVG(copies_in_stock) , SUM(copies_in_stock) FROM writer GROUP BY poet; +SELECT poet, MAX(copies_in_stock) , MIN(copies_in_stock) , AVG(copies_in_stock) , SUM(copies_in_stock) FROM writer GROUP BY poet; diff --git a/test/sql/Alter/TODO b/test/sql/Alter/TODO new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/test/sql/Alter/TODO @@ -0,0 +1 @@ + diff --git a/test/sql/Alter/csql.conf b/test/sql/Alter/csql.conf new file mode 100644 index 00000000..eb9d5a2e --- /dev/null +++ b/test/sql/Alter/csql.conf @@ -0,0 +1,147 @@ +# CSQL System Configuration File + +#####################################Server Section######################## + +# Site ID for this CSQL server +SITE_ID=1 + +#Important: For Server section parameters, make sure that the value is same for the +# server process and all the csql client process which connects to it. otherwise, +# behavior is undefined + +# Page size. Each database is logically divided into pages and allocation happens +# in this unit of pages. Increasing this value will reduce frequent allocation of pages. +PAGE_SIZE= 8192 + +#Total number of client process which can connect and work with the +# database concurrently +MAX_PROCS = 100 + +# Maximum size of the system database. +MAX_SYS_DB_SIZE=1048576 + +#Maximum size of the user database file. +MAX_DB_SIZE=10485760 + +#Shared memory key to be used by the system to create and locate system database. +SYS_DB_KEY=2222 + +#Shared memory key to be used by the system to create and locate user database. +USER_DB_KEY=3333 + +#Log level 0->no logging 1->Fine 2->Finer 3->Finest +LOG_LEVEL=0 + +#Give full path for the log file where important system actions are stored. +LOG_FILE=/tmp/csql/log/log.out + +#The virtual memory start address at which the shared memory segment +# will be created and attached. +MAP_ADDRESS=400000000 + +# Whether to enable durability +DURABILITY=false + +# Whether to enable memory map architecture for user database +MMAP=false + +# Specifies the durability mode for redo log generation +# Valid values are +# 1 ->uses standard redo logging with O_APPEND mode +# 2 ->uses standard logging with serialization +# 3 ->uses O_SYNC flag +# 4 ->uses O_DIRECT flag + +DURABLE_MODE=1 + +#Give full path for the database file where table and record information will +#be stored for durability +DATABASE_FILE=/tmp/csql/db + +#Important: For Server section parameters, make sure that the value is same for the server process and all the csql client process which connects to it. otherwise, behavior is undefined + +# Give full path for the std error file to store all the errors during database operations +STDERR_FILE=stderr + +#####################################Client Section######################## + +#Mutex timeout interval seconds +MUTEX_TIMEOUT_SECS=0 +MUTEX_TIMEOUT_USECS=5000 +MUTEX_TIMEOUT_RETRIES=10 + +#Lock timeout interval seconds +LOCK_TIMEOUT_SECS=0 +LOCK_TIMEOUT_USECS=5000 +LOCK_TIMEOUT_RETRIES=10 + +#Statement Cache Size +STMT_CACHE_SIZE=10 + +#Enable statement cache for statements with no parameters +STMT_CACHE_NOPARAM=false + +#####################################Cache Section######################## + +#Whether to enable caching of tables from target database +CACHE_TABLE=false + +#DSN Name to connect to the target database. +#This should be present in ~/odbc.ini file +DSN=myodbc3 + +# Whethere to enable bidirectional updates for cached tables. +ENABLE_BIDIRECTIONAL_CACHE=false + +CACHE_RECEIVER_WAIT_SECS=10 + +#Mode of operation SYNC or ASYNC +CACHE_MODE=SYNC + +##########################SqlNetworkServer Section######################## + +# Whether to enable SqlNetwork server +CSQL_SQL_SERVER=false + +#Set port for Network access +PORT=5678 + +# Max number of seconds that the network layer waits to receive a pkt +NETWORK_RESPONSE_TIMEOUT=3 + +# Max number of seconds that the network layer waits to connect to sql server +NETWORK_CONNECT_TIMEOUT=5 + +#Whether to enable Replication across the sites +REPLICATION=false + +#No of sites to replicate +REPLICATION_SITES=16 + +#Give full path for the file where all the table information is stored +TABLE_CONFIG_FILE=/tmp/csql/csqltable.conf + +#Give full path of the file where all the DSN information is stored +DS_CONFIG_FILE=/tmp/csql/csqlds.conf + +#Give full path for the file where all the peer site information is stored +NETWORK_CONFIG_FILE=/tmp/csql/csqlnw.conf + +# Give full path for conflict Resolution file +CONFL_RESOL_FILE=/tmp/csql/conflResoFile.txt + +# MSGKEY for creating msg queue for MsgQueue Server +MSG_KEY=2525 + +# Maximum message that the message queue server is able to handle for +# asynchronous updates. This value is is default value of 'kernel.msgmax' +# parameter. +ASYNC_MSGMAX=8192 + +# Maximum number of messages that the message queue server will hold for a site +# that is down in the replication group. +MAX_QUEUE_LOGS=100 + +# Shared memory key for id generators +ID_SHM_KEY=1947 +#####################################End Section######################## diff --git a/test/sql/Alter/exp.test001.ksh b/test/sql/Alter/exp.test001.ksh new file mode 100644 index 00000000..d30a940e --- /dev/null +++ b/test/sql/Alter/exp.test001.ksh @@ -0,0 +1,8 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 0 +3c3 +< t1 +--- +> t2 +Statement Executed diff --git a/test/sql/Alter/exp.test002.ksh b/test/sql/Alter/exp.test002.ksh new file mode 100644 index 00000000..6d186de4 --- /dev/null +++ b/test/sql/Alter/exp.test002.ksh @@ -0,0 +1,5 @@ +Statement Executed +Statement Executed +Statement execute failed with error -4 +Test Passed. +Statement Executed diff --git a/test/sql/Alter/exp.test003.ksh b/test/sql/Alter/exp.test003.ksh new file mode 100644 index 00000000..4c49be52 --- /dev/null +++ b/test/sql/Alter/exp.test003.ksh @@ -0,0 +1,9 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +echo alter table t1 rename column f2 to f3; +Statement Executed: Rows Affected = 0 +14c14 +< f2 +--- +> f3 +Statement Executed diff --git a/test/sql/Alter/exp.test004.ksh b/test/sql/Alter/exp.test004.ksh new file mode 100644 index 00000000..d22733bc --- /dev/null +++ b/test/sql/Alter/exp.test004.ksh @@ -0,0 +1,6 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +echo alter table t1 rename column f2 to f2; +Statement Executed: Rows Affected = 0 +Test Passed. +Statement Executed diff --git a/test/sql/Alter/exp.test005.ksh b/test/sql/Alter/exp.test005.ksh new file mode 100644 index 00000000..042c2fcb --- /dev/null +++ b/test/sql/Alter/exp.test005.ksh @@ -0,0 +1,6 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +echo alter table t1 rename column f2 to inv@lid_name; +Statement prepare failed with error -19 +Test Passed. +Statement Executed diff --git a/test/sql/Alter/exp.test006.ksh b/test/sql/Alter/exp.test006.ksh new file mode 100644 index 00000000..ad8ce957 --- /dev/null +++ b/test/sql/Alter/exp.test006.ksh @@ -0,0 +1,5 @@ +Statement Executed +echo alter table t1 rename column f2 to f3; +Statement execute failed with error -4 +Test Passed. +Statement Executed diff --git a/test/sql/Alter/exp.test008.ksh b/test/sql/Alter/exp.test008.ksh new file mode 100644 index 00000000..448a641f --- /dev/null +++ b/test/sql/Alter/exp.test008.ksh @@ -0,0 +1,5 @@ +Statement Executed +echo alter table t1 add(f2 char(10)); +Statement prepare failed with error -98 +Test Passed. +Statement Executed diff --git a/test/sql/Alter/test001.ksh b/test/sql/Alter/test001.ksh new file mode 100755 index 00000000..dc3f5e8a --- /dev/null +++ b/test/sql/Alter/test001.ksh @@ -0,0 +1,63 @@ +#!/bin/ksh +# Testing rename table +# +CREATEFILE=${PWD}/sql/Alter/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Alter +fi + +echo "create table t1(f1 int,f2 char(20));" >${REL_PATH}/createtable.sql +echo "insert into t1 values(1,'CSQL_LAKSHYA');" >>${REL_PATH}/createtable.sql +echo "rename table t1 to t2;" >${REL_PATH}/renametable.sql +echo "drop table t1;" >${REL_PATH}/dropt1.sql +echo "drop table t2;" >${REL_PATH}/dropt2.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt2.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/createtable.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/createtable.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/renametable.sql + rm -f ${REL_PATH}/dropt1.sql ${REL_PATH}/dropt2.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l >${REL_PATH}/beforealter + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/renametable.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/renametable.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt2.sql + rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/renametable.sql + rm -f ${REL_PATH}/dropt1.sql ${REL_PATH}/dropt2.sql + exit 2; + fi +fi + +$CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l >${REL_PATH}/afteralter + +diff ${REL_PATH}/beforealter ${REL_PATH}/afteralter +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt2.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/renametable.sql +rm -f ${REL_PATH}/dropt1.sql ${REL_PATH}/dropt2.sql +rm -f ${REL_PATH}/beforealter ${REL_PATH}/afteralter + +exit 0; diff --git a/test/sql/Alter/test002.ksh b/test/sql/Alter/test002.ksh new file mode 100755 index 00000000..cb0f7277 --- /dev/null +++ b/test/sql/Alter/test002.ksh @@ -0,0 +1,79 @@ +#!/bin/ksh +# Renaming table name to an existing table name. +# Create table t3(f1 int, f2 char(10)); +# Create table t1(f1 int, f2 char(10)); +# rename table t1 to t3. It sghould be Failed +# +CREATEFILE=${PWD}/sql/Alter/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Alter +fi + +echo "create table t3(f1 int,f2 char(20));" >${REL_PATH}/createtable.sql +echo "create table t1(f1 int,f2 char(20));" >>${REL_PATH}/createtable.sql +echo "rename table t1 to t3;" >${REL_PATH}/renametable.sql +echo "drop table t1;" >${REL_PATH}/dropt1.sql +echo "drop table t3;" >${REL_PATH}/dropt3.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt3.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/createtable.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/createtable.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/renametable.sql + rm -f ${REL_PATH}/dropt1.sql ${REL_PATH}/dropt3.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l >${REL_PATH}/beforealter + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/renametable.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/renametable.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt3.sql + rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/renametable.sql + rm -f ${REL_PATH}/dropt1.sql ${REL_PATH}/dropt3.sql + exit 2; + fi +fi + +$CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l >${REL_PATH}/afteralter + +diff ${REL_PATH}/beforealter ${REL_PATH}/afteralter +if [ $? -eq 0 ] + then + echo Test Passed. + else + echo Test Failed. +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt3.sql >/dev/null 2>&1 +if [ $? -ne 0 ] +then + exit 4; +fi + +rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/renametable.sql +rm -f ${REL_PATH}/dropt1.sql ${REL_PATH}/dropt3.sql +rm -f ${REL_PATH}/beforealter ${REL_PATH}/afteralter + +exit 0; diff --git a/test/sql/Alter/test003.ksh b/test/sql/Alter/test003.ksh new file mode 100755 index 00000000..9702704a --- /dev/null +++ b/test/sql/Alter/test003.ksh @@ -0,0 +1,67 @@ +#!/bin/ksh +# Renaming an existing column_name to new_name. +# Create table t1(f1 int,f2 char(10)); +# Alter table t1 rename column f2 to f3; +# Use csqldump before and after altering the table. +# See the schema of both situation should be consistent. +# +CREATEFILE=${PWD}/sql/Alter/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Alter +fi + +echo "create table t1(f1 int,f2 char(20));" >${REL_PATH}/createtable.sql +echo "insert into t1 values(1,'CSQL_LAKSHYA');" >>${REL_PATH}/createtable.sql +echo "echo alter table t1 rename column f2 to f3;" >${REL_PATH}/renamecolumn.sql +echo "alter table t1 rename column f2 to f3;" >>${REL_PATH}/renamecolumn.sql +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/createtable.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/createtable.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/renamecolumn.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l >${REL_PATH}/beforealter + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/renamecolumn.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/renamecolumn.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/renamecolumn.sql + rm -f ${REL_PATH}/dropt1.sql ${REL_PATH}/beforealter + exit 2; + fi +fi + +$CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l >${REL_PATH}/afteralter + +diff ${REL_PATH}/beforealter ${REL_PATH}/afteralter +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/renamecolumn.sql + rm -f ${REL_PATH}/dropt1.sql ${REL_PATH}/beforealter ${REL_PATH}/afteralter + exit 3; +fi +rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/renamecolumn.sql +rm -f ${REL_PATH}/dropt1.sql ${REL_PATH}/beforealter ${REL_PATH}/afteralter + +exit 0; diff --git a/test/sql/Alter/test004.ksh b/test/sql/Alter/test004.ksh new file mode 100755 index 00000000..7ed29d95 --- /dev/null +++ b/test/sql/Alter/test004.ksh @@ -0,0 +1,72 @@ +#!/bin/ksh +# Renaming an existing column_name to same name. +# Create table t1(f1 int,f2 char(10)); +# Alter table t1 rename column f2 to f2; It should be failed. +# +CREATEFILE=${PWD}/sql/Alter/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Alter +fi + +echo "create table t1(f1 int,f2 char(20));" >${REL_PATH}/createtable.sql +echo "insert into t1 values(1,'CSQL_LAKSHYA');" >>${REL_PATH}/createtable.sql +echo "echo alter table t1 rename column f2 to f2;" >${REL_PATH}/renamecolumn.sql +echo "alter table t1 rename column f2 to f2;" >>${REL_PATH}/renamecolumn.sql +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/createtable.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/createtable.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/renamecolumn.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l >${REL_PATH}/beforealter + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/renamecolumn.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/renamecolumn.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/renamecolumn.sql + rm -f ${REL_PATH}/dropt1.sql ${REL_PATH}/beforealter + exit 2; + fi +fi + +$CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l >${REL_PATH}/afteralter + +diff ${REL_PATH}/beforealter ${REL_PATH}/afteralter +if [ $? -eq 0 ] + then + echo Test Passed. + else + echo Test Failed. +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/renamecolumn.sql + rm -f ${REL_PATH}/dropt1.sql ${REL_PATH}/beforealter ${REL_PATH}/afteralter + exit 3; +fi +rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/renamecolumn.sql +rm -f ${REL_PATH}/dropt1.sql ${REL_PATH}/beforealter ${REL_PATH}/afteralter + +exit 0; diff --git a/test/sql/Alter/test005.ksh b/test/sql/Alter/test005.ksh new file mode 100755 index 00000000..b39477fc --- /dev/null +++ b/test/sql/Alter/test005.ksh @@ -0,0 +1,72 @@ +#!/bin/ksh +# Renaming an existing column_name to an invalid name. +# Create table t1(f1 int,f2 char(10)); +# Alter table t1 rename column f2 to inv@lid_name; It should be failed. +# +CREATEFILE=${PWD}/sql/Alter/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Alter +fi + +echo "create table t1(f1 int,f2 char(20));" >${REL_PATH}/createtable.sql +echo "insert into t1 values(1,'CSQL_LAKSHYA');" >>${REL_PATH}/createtable.sql +echo "echo alter table t1 rename column f2 to inv@lid_name;" >${REL_PATH}/renamecolumn.sql +echo "alter table t1 rename column f2 to inv@lid_name;" >>${REL_PATH}/renamecolumn.sql +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/createtable.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/createtable.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/renamecolumn.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l >${REL_PATH}/beforealter + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/renamecolumn.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/renamecolumn.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/renamecolumn.sql + rm -f ${REL_PATH}/dropt1.sql ${REL_PATH}/beforealter + exit 2; + fi +fi + +$CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l >${REL_PATH}/afteralter + +diff ${REL_PATH}/beforealter ${REL_PATH}/afteralter +if [ $? -eq 0 ] + then + echo Test Passed. + else + echo Test Failed. +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/renamecolumn.sql + rm -f ${REL_PATH}/dropt1.sql ${REL_PATH}/beforealter ${REL_PATH}/afteralter + exit 3; +fi +rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/renamecolumn.sql +rm -f ${REL_PATH}/dropt1.sql ${REL_PATH}/beforealter ${REL_PATH}/afteralter + +exit 0; diff --git a/test/sql/Alter/test006.ksh b/test/sql/Alter/test006.ksh new file mode 100755 index 00000000..89734259 --- /dev/null +++ b/test/sql/Alter/test006.ksh @@ -0,0 +1,76 @@ +#!/bin/ksh +# Renaming an existing column_name to an existing column_name. +# Create table t1(f1 int,f2 char(10), f3 float); +# Alter table t1 rename column f2 to f3; It should be failed. +# +CREATEFILE=${PWD}/sql/Alter/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Alter +fi + +echo "Create table t1(f1 int,f2 char(10), f3 float);" >${REL_PATH}/createtable.sql +echo "echo alter table t1 rename column f2 to f3;" >${REL_PATH}/renamecolumn.sql +echo "alter table t1 rename column f2 to f3;" >>${REL_PATH}/renamecolumn.sql +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/createtable.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/createtable.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/renamecolumn.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l >${REL_PATH}/beforealter + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/renamecolumn.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/renamecolumn.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/renamecolumn.sql + rm -f ${REL_PATH}/dropt1.sql ${REL_PATH}/beforealter + exit 2; + fi +fi + +$CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l >${REL_PATH}/afteralter + +diff ${REL_PATH}/beforealter ${REL_PATH}/afteralter +if [ $? -eq 0 ] + then + echo Test Passed. + else + echo Test Failed. + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/renamecolumn.sql + rm -f ${REL_PATH}/dropt1.sql ${REL_PATH}/beforealter ${REL_PATH}/afteralter + exit 3; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/renamecolumn.sql + rm -f ${REL_PATH}/dropt1.sql ${REL_PATH}/beforealter ${REL_PATH}/afteralter + exit 4; +fi + +rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/renamecolumn.sql +rm -f ${REL_PATH}/dropt1.sql ${REL_PATH}/beforealter ${REL_PATH}/afteralter + +exit 0; diff --git a/test/sql/Alter/test007.ksh b/test/sql/Alter/test007.ksh new file mode 100755 index 00000000..29866424 --- /dev/null +++ b/test/sql/Alter/test007.ksh @@ -0,0 +1,72 @@ +#!/bin/ksh +# Adding new columns to Existing Table. +# Create table t1(f1 int,f2 char(10)); +# Insert a record into t1. +# Alter table t1 add(f3 float); +# Check f3 field of existing record is null or not. +# Run catalog tool to see the shhema. +# +CREATEFILE=${PWD}/sql/Alter/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Alter +fi + +echo "create table t1(f1 int,f2 char(20));" >${REL_PATH}/createtable.sql +echo "insert into t1 values(1,'CSQL_LAKSHYA');" >>${REL_PATH}/createtable.sql +echo "echo alter table t1 add(f3 float);" >${REL_PATH}/addcolumn.sql +echo "alter table t1 add(f3 float);" >>${REL_PATH}/addcolumn.sql +echo "echo select * from t1;" >>${REL_PATH}/addcolumn.sql +echo "select * from t1;" >>${REL_PATH}/addcolumn.sql +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/createtable.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/createtable.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/addcolumn.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l >${REL_PATH}/beforealter + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/addcolumn.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/addcolumn.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/addcolumn.sql + rm -f ${REL_PATH}/dropt1.sql ${REL_PATH}/beforealter + exit 2; + fi +fi + +$CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l >${REL_PATH}/afteralter + +diff ${REL_PATH}/beforealter ${REL_PATH}/afteralter + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/addcolumn.sql + rm -f ${REL_PATH}/dropt1.sql ${REL_PATH}/beforealter ${REL_PATH}/afteralter + exit 3; +fi + +rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/addcolumn.sql +rm -f ${REL_PATH}/dropt1.sql ${REL_PATH}/beforealter ${REL_PATH}/afteralter + +exit 0; diff --git a/test/sql/Alter/test008.ksh b/test/sql/Alter/test008.ksh new file mode 100755 index 00000000..e47f46d7 --- /dev/null +++ b/test/sql/Alter/test008.ksh @@ -0,0 +1,72 @@ +#!/bin/ksh +# Adding new column to a Table in the name of existing column_name. +# Create table t1(f1 int,f2 varchar(10)); +# Alter table t1 add(f2 char(10)); +# It should be failed. +# +CREATEFILE=${PWD}/sql/Alter/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Alter +fi + +echo "Create table t1(f1 int,f2 char(10));" >${REL_PATH}/createtable.sql +echo "echo alter table t1 add(f2 char(10));" >${REL_PATH}/addexistingcolumn.sql +echo "alter table t1 add(f2 char(10));" >>${REL_PATH}/addexistingcolumn.sql +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/createtable.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/createtable.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/addexistingcolumn.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l >${REL_PATH}/beforealter + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/addexistingcolumn.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/addexistingcolumn.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/addexistingcolumn.sql + rm -f ${REL_PATH}/dropt1.sql ${REL_PATH}/beforealter + exit 2; + fi +fi + +$CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l >${REL_PATH}/afteralter + +diff ${REL_PATH}/beforealter ${REL_PATH}/afteralter +if [ $? -eq 0 ] + then + echo Test Passed. + else + echo Test Failed. +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/addexistingcolumn.sql + rm -f ${REL_PATH}/dropt1.sql ${REL_PATH}/beforealter ${REL_PATH}/afteralter + exit 3; +fi +rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/addexistingcolumn.sql +rm -f ${REL_PATH}/dropt1.sql ${REL_PATH}/beforealter ${REL_PATH}/afteralter + +exit 0; diff --git a/test/sql/Alter/test009.ksh b/test/sql/Alter/test009.ksh new file mode 100755 index 00000000..37265939 --- /dev/null +++ b/test/sql/Alter/test009.ksh @@ -0,0 +1,69 @@ +#!/bin/ksh +# Dropping an existing column from a Table. +# Create table t1(f1 int,f2 char(10),f3 float); +# Alter table t1 drop column f3; +# +CREATEFILE=${PWD}/sql/Alter/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Alter +fi + +echo "create table t1(f1 int,f2 char(20), f3 float);" >${REL_PATH}/createtable.sql +echo "insert into t1 values(1,'CSQL_LAKSHYA',50.5);" >>${REL_PATH}/createtable.sql +echo "echo alter table t1 drop column f3;" >${REL_PATH}/dropcolumn.sql +echo "alter table t1 drop column f3;" >>${REL_PATH}/dropcolumn.sql +echo "echo select * from t1;" >>${REL_PATH}/dropcolumn.sql +echo "select * from t1;" >>${REL_PATH}/dropcolumn.sql +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/createtable.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/createtable.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/dropcolumn.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l >${REL_PATH}/beforealter + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropcolumn.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropcolumn.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/dropcolumn.sql + rm -f ${REL_PATH}/dropt1.sql ${REL_PATH}/beforealter + exit 2; + fi +fi + +$CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l >${REL_PATH}/afteralter + +diff ${REL_PATH}/beforealter ${REL_PATH}/afteralter + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/dropcolumn.sql + rm -f ${REL_PATH}/dropt1.sql ${REL_PATH}/beforealter ${REL_PATH}/afteralter + exit 3; +fi + +rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/dropcolumn.sql +rm -f ${REL_PATH}/dropt1.sql ${REL_PATH}/beforealter ${REL_PATH}/afteralter + +exit 0; diff --git a/test/sql/Alter/test010.ksh b/test/sql/Alter/test010.ksh new file mode 100755 index 00000000..36a25b0d --- /dev/null +++ b/test/sql/Alter/test010.ksh @@ -0,0 +1,71 @@ +#!/bin/ksh +# Dropping non-existing column from a Table. +# Create table t1(f1 int,f2 char(10),f3 float); +# Alter table t1 drop column f4; It sholud be failed saying f4 does not exist. +# +CREATEFILE=${PWD}/sql/Alter/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Alter +fi + +echo "Create table t1(f1 int,f2 char(10),f3 float);" >${REL_PATH}/createtable.sql +echo "echo Alter table t1 drop column f4;" >${REL_PATH}/dropnonexisting.sql +echo "Alter table t1 drop column f4;" >>${REL_PATH}/dropnonexisting.sql +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/createtable.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/createtable.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/dropnonexisting.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l >${REL_PATH}/beforealter + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropnonexisting.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropnonexisting.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/dropnonexisting.sql + rm -f ${REL_PATH}/dropt1.sql ${REL_PATH}/beforealter + exit 2; + fi +fi + +$CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l >${REL_PATH}/afteralter + +diff ${REL_PATH}/beforealter ${REL_PATH}/afteralter +if [ $? -eq 0 ] + then + echo Test Passed. + else + echo Test Failed. +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/dropnonexisting.sql + rm -f ${REL_PATH}/dropt1.sql ${REL_PATH}/beforealter ${REL_PATH}/afteralter + exit 3; +fi +rm -f ${REL_PATH}/createtable.sql ${REL_PATH}/dropnonexisting.sql +rm -f ${REL_PATH}/dropt1.sql ${REL_PATH}/beforealter ${REL_PATH}/afteralter + +exit 0; diff --git a/test/sql/DDL/Makefile b/test/sql/DDL/Makefile new file mode 100644 index 00000000..b2d39524 --- /dev/null +++ b/test/sql/DDL/Makefile @@ -0,0 +1,42 @@ +OSNAME = $(shell uname -s) +PlatForm=notsupported +ifeq ($(OSNAME), SunOS) + CPlus = CC + CPlusFlags = -O2 -w $(COMPILER_FLAG) + SYSLIBS=-ldl -lnsl -lsocket -lposix4 + PlatForm=supported +endif +ifeq ($(OSNAME), Linux) + CPlus = g++ + CPlusFlags = -g -w + SYSLIBS= -rdynamic -lrt -lpthread -lcrypt + PlatForm=supported +endif +ifeq ($(OSNAME), FreeBSD) + CPlus = g++ + CPlusFlags = -g -w + SYSLIBS= -rdynamic -lrt -lpthread -lcrypt + PlatForm=supported +endif + + + +JAVAC = javac -g:none +INCL= -I$(CSQL_INSTALL_ROOT)/include -I../../include +LIBS= -L$(CSQL_INSTALL_ROOT)/lib -lcsqlodbc -lcsqlsql -lcsqlsqllog -lcsql -lcsqlnw -lcsqlodbcadapter + +TARGETS = test004 + +ifeq ($(PlatForm), supported) +all: $(TARGETS) +else +all: + echo "CSQL is not supported on $(OSNAME) platform" +endif + +test004: droptest4.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) + +clean: + rm -f $(TARGETS) *.class + diff --git a/test/sql/DDL/aucommitoff_truncate_rollback.sql b/test/sql/DDL/aucommitoff_truncate_rollback.sql new file mode 100644 index 00000000..cd669f04 --- /dev/null +++ b/test/sql/DDL/aucommitoff_truncate_rollback.sql @@ -0,0 +1,15 @@ +echo create table t1(f1 bigint, f2 int, f3 smallint, f4 tinyint, f5 char(10), f6 varchar(10), f7 float,f8 double, f9 time, f10 date, f11 timestamp); +create table t1(f1 bigint, f2 int, f3 smallint, f4 tinyint, f5 char(10), f6 varchar(10), f7 float,f8 double, f9 time, f10 date, f11 timestamp); +echo set autocommit off; +set autocommit off; +insert into t1 values(1001,101,11,1,'CSQL1','Lakshya1',2010,05012010,'10:00:00','2010-01-05','2010-01-05 10:00:00'); +insert into t1 values(1002,102,12,2,'CSQL2','Lakshya2',2010,05012010,'10:00:00','2010-02-05','2010-02-05 10:00:00'); +insert into t1 values(1003,103,13,3,'CSQL3','Lakshya3',2010,05012010,'10:00:00','2010-03-05','2010-03-05 10:00:00'); +echo select * from t1; +select * from t1; +echo truncate table t1; +truncate table t1; +echo rollback; +rollback; +echo select * from t1; +select * from t1; diff --git a/test/sql/DDL/droptest4.c b/test/sql/DDL/droptest4.c new file mode 100644 index 00000000..85732b2a --- /dev/null +++ b/test/sql/DDL/droptest4.c @@ -0,0 +1,50 @@ +#include + +int main(int argc, char **argv) +{ + DbRetVal rv = OK; + struct timeval timeout; + struct timeval timeStamp; + AbsSqlConnection *con = SqlFactory::createConnection(CSql); + rv = con->connect("root","manager"); + if(rv!=OK)return 1; + AbsSqlStatement *stmt = SqlFactory::createStatement(CSql); + stmt->setConnection(con); + AbsSqlStatement *dropstmt = SqlFactory::createStatement(CSql); + dropstmt->setConnection(con); + char statement[200]; + strcpy(statement, "CREATE TABLE t1 (f1 int, f2 int, f3 char(20), primary key (f1));"); + int rows =0; + rv = stmt->prepare(statement); + if (rv != OK) {delete stmt; delete con; return -1; } + rv = stmt->execute(rows); + if (rv != OK) {delete stmt; delete con; return -1; } + stmt->free(); + + // insert into table + strcpy(statement,"INSERT INTO t1 VALUES(1234,5,'CSQL');"); + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 4; } + + strcpy(statement, "DROP TABLE t1"); + rv = dropstmt->prepare(statement); + if (rv != OK) { + printf("DROP table failed\n"); + con->disconnect();delete stmt; delete con; return -1; + } + dropstmt->execute(rows); + dropstmt->free(); + + rv = con->beginTrans(); + rv = stmt->execute(rows); + if (rv != OK) { + printError(rv, "Insert failed with ret val %d", rv); + con->rollback(); + } + else con->commit(); + stmt->free(); + + con->disconnect(); + delete stmt; + delete con; +} diff --git a/test/sql/DDL/exp.test001.ksh b/test/sql/DDL/exp.test001.ksh new file mode 100644 index 00000000..8d2f3cd0 --- /dev/null +++ b/test/sql/DDL/exp.test001.ksh @@ -0,0 +1,21 @@ +echo create table t1(f1 bigint, f2 int, f3 smallint, f4 tinyint, f5 char(10), f6 varchar(10), f7 float,f8 double, f9 time, f10 date, f11 timestamp); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 t1.f5 t1.f6 t1.f7 t1.f8 t1.f9 t1.f10 t1.f11 +--------------------------------------------------------- + 1001 101 11 1 CSQL1 Lakshya1 2010.000000 5012010.000000 10:0:0.0 2010/1/5 2010/1/5 10:0:0.0 + 1002 102 12 2 CSQL2 Lakshya2 2010.000000 5012010.000000 10:0:0.0 2010/2/5 2010/2/5 10:0:0.0 + 1003 103 13 3 CSQL3 Lakshya3 2010.000000 5012010.000000 10:0:0.0 2010/3/5 2010/3/5 10:0:0.0 + +echo truncate table t1; +Statement Executed: Rows Affected = 3 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 t1.f5 t1.f6 t1.f7 t1.f8 t1.f9 t1.f10 t1.f11 +--------------------------------------------------------- + +Statement Executed diff --git a/test/sql/DDL/exp.test002.ksh b/test/sql/DDL/exp.test002.ksh new file mode 100644 index 00000000..df39d629 --- /dev/null +++ b/test/sql/DDL/exp.test002.ksh @@ -0,0 +1,24 @@ +echo create table t1(f1 bigint, f2 int, f3 smallint, f4 tinyint, f5 char(10), f6 varchar(10), f7 float,f8 double, f9 time, f10 date, f11 timestamp); +Statement Executed +echo set autocommit off; +AUTOCOMMIT Mode is set to OFF +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 t1.f5 t1.f6 t1.f7 t1.f8 t1.f9 t1.f10 t1.f11 +--------------------------------------------------------- + 1001 101 11 1 CSQL1 Lakshya1 2010.000000 5012010.000000 10:0:0.0 2010/1/5 2010/1/5 10:0:0.0 + 1002 102 12 2 CSQL2 Lakshya2 2010.000000 5012010.000000 10:0:0.0 2010/2/5 2010/2/5 10:0:0.0 + 1003 103 13 3 CSQL3 Lakshya3 2010.000000 5012010.000000 10:0:0.0 2010/3/5 2010/3/5 10:0:0.0 + +echo truncate table t1; +Statement Executed: Rows Affected = 3 +echo rollback; +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 t1.f5 t1.f6 t1.f7 t1.f8 t1.f9 t1.f10 t1.f11 +--------------------------------------------------------- + +Statement Executed diff --git a/test/sql/DDL/exp.test003.ksh b/test/sql/DDL/exp.test003.ksh new file mode 100644 index 00000000..ab898692 --- /dev/null +++ b/test/sql/DDL/exp.test003.ksh @@ -0,0 +1,51 @@ +echo create table t1(f1 int, f2 varchar(10), primary key(f1)); +Statement Executed +echo create table t2(f1 int, f2 varchar(10), foreign key(f1) references t1(f1)); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1 CSQL1 + 2 CSQL2 + +echo select * from t2; +--------------------------------------------------------- + t2.f1 t2.f2 +--------------------------------------------------------- + 1 Nihar + 2 Bijay + 1 Kishor + 2 Jitendra + +echo truncate table t1; +Statement execute failed with error -36 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1 CSQL1 + 2 CSQL2 + +echo truncate table t2; +Statement Executed: Rows Affected = 4 +echo truncate table t1; +Statement Executed: Rows Affected = 2 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + +echo select * from t2; +--------------------------------------------------------- + t2.f1 t2.f2 +--------------------------------------------------------- + +Statement Executed +Statement Executed diff --git a/test/sql/DDL/test001.ksh b/test/sql/DDL/test001.ksh new file mode 100755 index 00000000..7e27e5e6 --- /dev/null +++ b/test/sql/DDL/test001.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# Testing truncate command. +# Create table t1 with all datatypes. +# insert 2 - 3 records into it. +# Execute truncate table t1; +# it should delete all the records. +# +QUITFILE=${PWD}/sql/DDL/drop.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then +REL_PATH=`pwd`/sql/DDL +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/truncatet1.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/truncatet1.sql + if [ $? -ne 0 ] + then + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql +rm -f ${REL_PATH}/dropt1.sql +exit 0; + diff --git a/test/sql/DDL/test002.ksh b/test/sql/DDL/test002.ksh new file mode 100755 index 00000000..29ed2983 --- /dev/null +++ b/test/sql/DDL/test002.ksh @@ -0,0 +1,36 @@ +#!/bin/ksh +# Testing rollback after truncating table in autocommit off mode. +# Create table t1 with all datatypes. +# Set autocommit off; +# insert 2 - 3 records into it. +# Execute truncate table t1; +# Rollback the transaction. +# There should not be any record in the table. That means after truncate rollback has no effect. +# +QUITFILE=${PWD}/sql/DDL/drop.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then +REL_PATH=`pwd`/sql/DDL +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/aucommitoff_truncate_rollback.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/aucommitoff_truncate_rollback.sql + if [ $? -ne 0 ] + then + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql +rm -f ${REL_PATH}/dropt1.sql +exit 0; + diff --git a/test/sql/DDL/test003.ksh b/test/sql/DDL/test003.ksh new file mode 100755 index 00000000..4248ef89 --- /dev/null +++ b/test/sql/DDL/test003.ksh @@ -0,0 +1,42 @@ +#!/bin/ksh +# Test truncating primary key table having dependancy with foreign key table. +#create table t1(f1 int, f2 varchar(10), primary key(f1)); +#create table t2(f1 int, f2 varchar(10), foreign key(f1) references t1(f1)); +#insert into t1 values(1,'CSQL1'); +#insert into t1 values(2,'CSQL2'); +#insert into t2 values(1,'Nihar'); +#insert into t2 values(2,'Bijay'); +#insert into t2 values(1,'Kishor'); +#insert into t2 values(2,'Jitendra'); +#truncate table t1; truncate should fail due to parent-child dependancy +#truncate table t2; +#truncate table t1; truncate should delete all records from table t1, because table t2 is already truncated. +# +QUITFILE=${PWD}/sql/DDL/drop.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then +REL_PATH=`pwd`/sql/DDL +fi + +echo "drop table t2;" >${REL_PATH}/dropt2t1.sql +echo "drop table t1;">>${REL_PATH}/dropt2t1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt2t1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/truncate_primary.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/truncate_primary.sql + if [ $? -ne 0 ] + then + rm -f ${REL_PATH}/dropt2t1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt2t1.sql +rm -f ${REL_PATH}/dropt2t1.sql +exit 0; + diff --git a/test/sql/DDL/truncate_primary.sql b/test/sql/DDL/truncate_primary.sql new file mode 100644 index 00000000..22efc3ba --- /dev/null +++ b/test/sql/DDL/truncate_primary.sql @@ -0,0 +1,26 @@ +echo create table t1(f1 int, f2 varchar(10), primary key(f1)); +create table t1(f1 int, f2 varchar(10), primary key(f1)); +echo create table t2(f1 int, f2 varchar(10), foreign key(f1) references t1(f1)); +create table t2(f1 int, f2 varchar(10), foreign key(f1) references t1(f1)); +insert into t1 values(1,'CSQL1'); +insert into t1 values(2,'CSQL2'); +insert into t2 values(1,'Nihar'); +insert into t2 values(2,'Bijay'); +insert into t2 values(1,'Kishor'); +insert into t2 values(2,'Jitendra'); +echo select * from t1; +select * from t1; +echo select * from t2; +select * from t2; +echo truncate table t1; +truncate table t1; +echo select * from t1; +select * from t1; +echo truncate table t2; +truncate table t2; +echo truncate table t1; +truncate table t1; +echo select * from t1; +select * from t1; +echo select * from t2; +select * from t2; diff --git a/test/sql/DDL/truncatet1.sql b/test/sql/DDL/truncatet1.sql new file mode 100644 index 00000000..4812a57f --- /dev/null +++ b/test/sql/DDL/truncatet1.sql @@ -0,0 +1,11 @@ +echo create table t1(f1 bigint, f2 int, f3 smallint, f4 tinyint, f5 char(10), f6 varchar(10), f7 float,f8 double, f9 time, f10 date, f11 timestamp); +create table t1(f1 bigint, f2 int, f3 smallint, f4 tinyint, f5 char(10), f6 varchar(10), f7 float,f8 double, f9 time, f10 date, f11 timestamp); +insert into t1 values(1001,101,11,1,'CSQL1','Lakshya1',2010,05012010,'10:00:00','2010-01-05','2010-01-05 10:00:00'); +insert into t1 values(1002,102,12,2,'CSQL2','Lakshya2',2010,05012010,'10:00:00','2010-02-05','2010-02-05 10:00:00'); +insert into t1 values(1003,103,13,3,'CSQL3','Lakshya3',2010,05012010,'10:00:00','2010-03-05','2010-03-05 10:00:00'); +echo select * from t1; +select * from t1; +echo truncate table t1; +truncate table t1; +echo select * from t1; +select * from t1; diff --git a/test/sql/Datatype/TODO b/test/sql/Datatype/TODO new file mode 100644 index 00000000..40dc3e98 --- /dev/null +++ b/test/sql/Datatype/TODO @@ -0,0 +1,3 @@ +1. More cases required for update, delete, + +2. Rollback and commit to be checked in autocommit off mode diff --git a/test/sql/Datatype/csql.conf b/test/sql/Datatype/csql.conf new file mode 100644 index 00000000..eb9d5a2e --- /dev/null +++ b/test/sql/Datatype/csql.conf @@ -0,0 +1,147 @@ +# CSQL System Configuration File + +#####################################Server Section######################## + +# Site ID for this CSQL server +SITE_ID=1 + +#Important: For Server section parameters, make sure that the value is same for the +# server process and all the csql client process which connects to it. otherwise, +# behavior is undefined + +# Page size. Each database is logically divided into pages and allocation happens +# in this unit of pages. Increasing this value will reduce frequent allocation of pages. +PAGE_SIZE= 8192 + +#Total number of client process which can connect and work with the +# database concurrently +MAX_PROCS = 100 + +# Maximum size of the system database. +MAX_SYS_DB_SIZE=1048576 + +#Maximum size of the user database file. +MAX_DB_SIZE=10485760 + +#Shared memory key to be used by the system to create and locate system database. +SYS_DB_KEY=2222 + +#Shared memory key to be used by the system to create and locate user database. +USER_DB_KEY=3333 + +#Log level 0->no logging 1->Fine 2->Finer 3->Finest +LOG_LEVEL=0 + +#Give full path for the log file where important system actions are stored. +LOG_FILE=/tmp/csql/log/log.out + +#The virtual memory start address at which the shared memory segment +# will be created and attached. +MAP_ADDRESS=400000000 + +# Whether to enable durability +DURABILITY=false + +# Whether to enable memory map architecture for user database +MMAP=false + +# Specifies the durability mode for redo log generation +# Valid values are +# 1 ->uses standard redo logging with O_APPEND mode +# 2 ->uses standard logging with serialization +# 3 ->uses O_SYNC flag +# 4 ->uses O_DIRECT flag + +DURABLE_MODE=1 + +#Give full path for the database file where table and record information will +#be stored for durability +DATABASE_FILE=/tmp/csql/db + +#Important: For Server section parameters, make sure that the value is same for the server process and all the csql client process which connects to it. otherwise, behavior is undefined + +# Give full path for the std error file to store all the errors during database operations +STDERR_FILE=stderr + +#####################################Client Section######################## + +#Mutex timeout interval seconds +MUTEX_TIMEOUT_SECS=0 +MUTEX_TIMEOUT_USECS=5000 +MUTEX_TIMEOUT_RETRIES=10 + +#Lock timeout interval seconds +LOCK_TIMEOUT_SECS=0 +LOCK_TIMEOUT_USECS=5000 +LOCK_TIMEOUT_RETRIES=10 + +#Statement Cache Size +STMT_CACHE_SIZE=10 + +#Enable statement cache for statements with no parameters +STMT_CACHE_NOPARAM=false + +#####################################Cache Section######################## + +#Whether to enable caching of tables from target database +CACHE_TABLE=false + +#DSN Name to connect to the target database. +#This should be present in ~/odbc.ini file +DSN=myodbc3 + +# Whethere to enable bidirectional updates for cached tables. +ENABLE_BIDIRECTIONAL_CACHE=false + +CACHE_RECEIVER_WAIT_SECS=10 + +#Mode of operation SYNC or ASYNC +CACHE_MODE=SYNC + +##########################SqlNetworkServer Section######################## + +# Whether to enable SqlNetwork server +CSQL_SQL_SERVER=false + +#Set port for Network access +PORT=5678 + +# Max number of seconds that the network layer waits to receive a pkt +NETWORK_RESPONSE_TIMEOUT=3 + +# Max number of seconds that the network layer waits to connect to sql server +NETWORK_CONNECT_TIMEOUT=5 + +#Whether to enable Replication across the sites +REPLICATION=false + +#No of sites to replicate +REPLICATION_SITES=16 + +#Give full path for the file where all the table information is stored +TABLE_CONFIG_FILE=/tmp/csql/csqltable.conf + +#Give full path of the file where all the DSN information is stored +DS_CONFIG_FILE=/tmp/csql/csqlds.conf + +#Give full path for the file where all the peer site information is stored +NETWORK_CONFIG_FILE=/tmp/csql/csqlnw.conf + +# Give full path for conflict Resolution file +CONFL_RESOL_FILE=/tmp/csql/conflResoFile.txt + +# MSGKEY for creating msg queue for MsgQueue Server +MSG_KEY=2525 + +# Maximum message that the message queue server is able to handle for +# asynchronous updates. This value is is default value of 'kernel.msgmax' +# parameter. +ASYNC_MSGMAX=8192 + +# Maximum number of messages that the message queue server will hold for a site +# that is down in the replication group. +MAX_QUEUE_LOGS=100 + +# Shared memory key for id generators +ID_SHM_KEY=1947 +#####################################End Section######################## diff --git a/test/sql/Datatype/exp.test001.ksh b/test/sql/Datatype/exp.test001.ksh new file mode 100644 index 00000000..6e8c9e4d --- /dev/null +++ b/test/sql/Datatype/exp.test001.ksh @@ -0,0 +1,74 @@ +echo Create table t1(f1 int, f2 varchar(15) default 'CSQL'); +Statement Executed +echo insert into t1 values(1,'Lakshya1'); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(2,NULL); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(3,'Lakshya3'); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(4,NULL); +Statement Executed: Rows Affected = 1 +echo insert into t1(f1) values(5); +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1 Lakshya1 + 2 NULL + 3 Lakshya3 + 4 NULL + 5 CSQL + +echo select * from t1 where f2='CSQL'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 5 CSQL + +echo update t1 set f2=NULL where f2='Lakshya3'; +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1 Lakshya1 + 2 NULL + 3 NULL + 4 NULL + 5 CSQL + +echo select * from t1 where f2 IS NULL; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2 NULL + 3 NULL + 4 NULL + + + + t1 + + f1 + 0 + 4 + 0 + 0 + 0 + + + + f2 + 32 + 16 + 0 + 0 + 1 + CSQL + + +
+ + +Statement Executed diff --git a/test/sql/Datatype/exp.test002.ksh b/test/sql/Datatype/exp.test002.ksh new file mode 100644 index 00000000..946a7c61 --- /dev/null +++ b/test/sql/Datatype/exp.test002.ksh @@ -0,0 +1,51 @@ +echo Create table t1( f1 int, f2 varchar(15) NOT NULL); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement execute failed with error -22 +Statement Executed: Rows Affected = 1 +Statement execute failed with error -22 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1 Lakshya1 + 3 Lakshya3 + 5 Lakshya5 + +echo update t1 set f2=NULL where f1<=3; +Statement prepare failed with error -22 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1 Lakshya1 + 3 Lakshya3 + 5 Lakshya5 + + + + t1 + + f1 + 0 + 4 + 0 + 0 + 0 + + + + f2 + 32 + 16 + 0 + 1 + 0 + + + +
+ + +Statement Executed diff --git a/test/sql/Datatype/exp.test003.ksh b/test/sql/Datatype/exp.test003.ksh new file mode 100644 index 00000000..6bb43338 --- /dev/null +++ b/test/sql/Datatype/exp.test003.ksh @@ -0,0 +1,11 @@ +echo Create table t1( f1 int, f2 varchar(15) AUTO_INCREMENT); +Statement prepare failed with error -19 +echo show tables; +=============TableNames=================== + No tables exist +========================================== + + +
+ + diff --git a/test/sql/Datatype/exp.test004.ksh b/test/sql/Datatype/exp.test004.ksh new file mode 100644 index 00000000..8e608ae4 --- /dev/null +++ b/test/sql/Datatype/exp.test004.ksh @@ -0,0 +1,105 @@ +echo Create table t1 (f1 varchar(10), f2 int, primary key(f1)); +Statement Executed +echo Create table t2 (f1 varchar(10), f2 bigint, foreign key(f1) references t1(f1)); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo insert into t1 values(NULL,3); +Statement execute failed with error -22 +echo insert into t1 values('CSQL2',4); +Statement execute failed with error -21 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + CSQL1 1 + CSQL2 2 + +echo update t1 set f1='CSQL1' where f1='CSQL2'; +Statement prepare failed with error -21 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + CSQL1 1 + CSQL2 2 + +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo insert into t2 values('CSQL3',30); +Statement execute failed with error -35 +echo select * from t2; +--------------------------------------------------------- + t2.f1 t2.f2 +--------------------------------------------------------- + CSQL1 10 + CSQL2 20 + +echo delete from t1 where f1='CSQL1'; +Statement execute failed with error -36 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + CSQL1 1 + CSQL2 2 + +echo select * from t2; +--------------------------------------------------------- + t2.f1 t2.f2 +--------------------------------------------------------- + CSQL1 10 + CSQL2 20 + + + + t1 + + f1 + 32 + 12 + 1 + 1 + 0 + + + + f2 + 0 + 4 + 0 + 0 + 0 + + + + + t2 + + f1 + 32 + 12 + 0 + 0 + 0 + + + + f2 + 2 + 8 + 0 + 0 + 0 + + + +
+ + t1_idx1_Primary + Hash Index + t1
+ f1 +
+Statement Executed +Statement Executed diff --git a/test/sql/Datatype/exp.test005.ksh b/test/sql/Datatype/exp.test005.ksh new file mode 100644 index 00000000..f2ff5deb --- /dev/null +++ b/test/sql/Datatype/exp.test005.ksh @@ -0,0 +1,78 @@ +echo create table t1 (f1 varchar(10), f2 smallint); +Statement Executed +echo create table t2 (f1 varchar(10), f2 smallint); +Statement Executed +echo create index idx1 on t1(f1) hash; +Statement Executed +echo create index idx2 on t2(f1) hash unique; +Statement Executed +Statement Executed: Rows Affected = 1 +echo insert into t2 values('Lakshya1',20); +Statement execute failed with error -21 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + +echo select * from t2; +--------------------------------------------------------- + t2.f1 t2.f2 +--------------------------------------------------------- + Lakshya1 10 + + + + t1 + + f1 + 32 + 12 + 0 + 0 + 0 + + + + f2 + 3 + 4 + 0 + 0 + 0 + + + + + t2 + + f1 + 32 + 12 + 0 + 0 + 0 + + + + f2 + 3 + 4 + 0 + 0 + 0 + + + +
+ + idx1 + Hash Index + t1
+ f1 + idx2 + Hash Index + t2
+ f1 +
+Statement Executed +Statement Executed diff --git a/test/sql/Datatype/exp.test006.ksh b/test/sql/Datatype/exp.test006.ksh new file mode 100644 index 00000000..c86048b1 --- /dev/null +++ b/test/sql/Datatype/exp.test006.ksh @@ -0,0 +1,78 @@ +echo create table t1 (f1 varchar(10), f2 smallint); +Statement Executed +echo create table t2 (f1 varchar(10), f2 smallint); +Statement Executed +echo create index idx1 on t1(f1) tree; +Statement Executed +echo create index idx2 on t2(f1) tree unique; +Statement Executed +Statement Executed: Rows Affected = 1 +echo insert into t2 values('Lakshya1',20); +Statement execute failed with error -21 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + +echo select * from t2; +--------------------------------------------------------- + t2.f1 t2.f2 +--------------------------------------------------------- + Lakshya1 10 + + + + t1 + + f1 + 32 + 12 + 0 + 0 + 0 + + + + f2 + 3 + 4 + 0 + 0 + 0 + + + + + t2 + + f1 + 32 + 12 + 0 + 0 + 0 + + + + f2 + 3 + 4 + 0 + 0 + 0 + + + +
+ + idx1 + Tree Index + t1
+ f1 + idx2 + Tree Index + t2
+ f1 +
+Statement Executed +Statement Executed diff --git a/test/sql/Datatype/exp.test007.ksh b/test/sql/Datatype/exp.test007.ksh new file mode 100644 index 00000000..02d8c886 --- /dev/null +++ b/test/sql/Datatype/exp.test007.ksh @@ -0,0 +1,36 @@ +echo Create table t1(f1 varchar(10), f2 bigint); +Statement Executed +echo alter table t1 rename column f1 to F1; +Statement Executed: Rows Affected = 0 +echo rename table t1 to T1; +Statement Executed: Rows Affected = 0 +echo show tables; +=============TableNames=================== + T1 +========================================== + + + T1 + + F1 + 32 + 12 + 0 + 0 + 0 + + + + f2 + 2 + 8 + 0 + 0 + 0 + + + +
+ + +Statement Executed diff --git a/test/sql/Datatype/exp.test008.ksh b/test/sql/Datatype/exp.test008.ksh new file mode 100644 index 00000000..e42509d9 --- /dev/null +++ b/test/sql/Datatype/exp.test008.ksh @@ -0,0 +1,84 @@ +echo Create table t1(f1 int, f2 varchar(10), f3 char(10), f4 varchar(10)); +Statement Executed +echo Create table t2 as select f2,f1,f4 from t1; +Statement Executed +echo show tables; +=============TableNames=================== + t1 + t2 +========================================== + + + t1 + + f1 + 0 + 4 + 0 + 0 + 0 + + + + f2 + 32 + 12 + 0 + 0 + 0 + + + + f3 + 30 + 12 + 0 + 0 + 0 + + + + f4 + 32 + 12 + 0 + 0 + 0 + + + + + t2 + + f2 + 32 + 12 + 0 + 0 + 0 + + + + f1 + 0 + 4 + 0 + 0 + 0 + + + + f4 + 32 + 12 + 0 + 0 + 0 + + + +
+ + +Statement Executed +Statement Executed diff --git a/test/sql/Datatype/exp.test009.ksh b/test/sql/Datatype/exp.test009.ksh new file mode 100644 index 00000000..8121cc75 --- /dev/null +++ b/test/sql/Datatype/exp.test009.ksh @@ -0,0 +1,164 @@ +echo Create table t1(f1 tinyint, f2 smallint, f3 int, f4 bigint, f5 char(10), f6 varchar(10), f7 float, f8 double,f9 Date, f10 Time, f11 Timestamp); +Statement Executed +echo create index hashidxtinyvar on t1(f1, f6); +Statement Executed +echo create index hashidxsmallvar on t1(f2, f6); +Statement Executed +echo create index hashidxvarint on t1(f6, f3); +Statement Executed +echo create index hashidxvarbig on t1(f6, f4); +Statement Executed +echo create index hashidxcharvar on t1(f5, f6); +Statement Executed +echo create index hashidxvardate on t1(f6, f9); +Statement Executed +echo create index hashidxvartime on t1(f6, f10); +Statement Executed +echo create index hashidxvarfloat on t1(f6, f7); +Statement execute failed with error -16 +echo create index hashidxvardouble on t1(f6, f8); +Statement execute failed with error -16 +echo create index hashidxvartimestamp on t1(f6, f11); +Statement execute failed with error -16 + + + t1 + + f1 + 4 + 4 + 0 + 0 + 0 + + + + f2 + 3 + 4 + 0 + 0 + 0 + + + + f3 + 0 + 4 + 0 + 0 + 0 + + + + f4 + 2 + 8 + 0 + 0 + 0 + + + + f5 + 30 + 12 + 0 + 0 + 0 + + + + f6 + 32 + 12 + 0 + 0 + 0 + + + + f7 + 11 + 4 + 0 + 0 + 0 + + + + f8 + 10 + 8 + 0 + 0 + 0 + + + + f9 + 20 + 4 + 0 + 0 + 0 + + + + f10 + 21 + 4 + 0 + 0 + 0 + + + + f11 + 22 + 8 + 0 + 0 + 0 + + + +
+ + hashidxtinyvar + Hash Index + t1
+ f1 + f6 + hashidxsmallvar + Hash Index + t1
+ f2 + f6 + hashidxvarint + Hash Index + t1
+ f6 + f3 + hashidxvarbig + Hash Index + t1
+ f6 + f4 + hashidxcharvar + Hash Index + t1
+ f5 + f6 + hashidxvardate + Hash Index + t1
+ f6 + f9 + hashidxvartime + Hash Index + t1
+ f6 + f10 +
+Statement Executed diff --git a/test/sql/Datatype/exp.test010.ksh b/test/sql/Datatype/exp.test010.ksh new file mode 100644 index 00000000..75515a1d --- /dev/null +++ b/test/sql/Datatype/exp.test010.ksh @@ -0,0 +1,71 @@ +echo create table t1(f1 varchar(20),f2 varchar(30)); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + CSQL1 Lakshya1 + CSQL2 Lakshya2 + CSQL3 Lakshya3 + CSQL4 Lakshya4 + CSQL5 Lakshya5 + +echo select * from t1 where f1='CSQL4' or f1='CSQL2'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + CSQL2 Lakshya2 + CSQL4 Lakshya4 + +echo update t1 set f2='LAKSHYA' where f1='CSQL2' or f1='CSQL4'; +Statement Executed: Rows Affected = 2 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + CSQL1 Lakshya1 + CSQL2 LAKSHYA + CSQL3 Lakshya3 + CSQL4 LAKSHYA + CSQL5 Lakshya5 + +echo delete from t1 where f1 in ('CSQL1','CSQL3','CSQL5'); +Statement Executed: Rows Affected = 3 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + CSQL2 LAKSHYA + CSQL4 LAKSHYA + + + + t1 + + f1 + 32 + 20 + 0 + 0 + 0 + + + + f2 + 32 + 32 + 0 + 0 + 0 + + + +
+ + +Statement Executed diff --git a/test/sql/Datatype/test001.ksh b/test/sql/Datatype/test001.ksh new file mode 100755 index 00000000..380e10fb --- /dev/null +++ b/test/sql/Datatype/test001.ksh @@ -0,0 +1,47 @@ +#!/bin/ksh +# Default value testing with varchar. +# Create table t1( f1 int, f2 varchar(15) default 'CSQL'); +# Insert 5 records into t1 having null values in f1 for some of the records. +# insert into t1 values(2,NULL); This will put NULL in f2 field. +# update t1 set f2=NULL where f2='Lakshya3'; this will put null in f2 field where f2='Lakshya3' +# Retrieve records based on varchar field. +# +CREATEFILE=${PWD}/sql/Datatype/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Datatype +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_default.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_default.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/Datatype/test002.ksh b/test/sql/Datatype/test002.ksh new file mode 100755 index 00000000..2785a3d0 --- /dev/null +++ b/test/sql/Datatype/test002.ksh @@ -0,0 +1,61 @@ +#!/bin/ksh +# NOT NULL Constraint test on varchar +# Create table t1( f1 int, f2 varchar(15) NOT NULL); +# Insert 5 records into t1 having null values in f1 for some of the records. +# Null value should not be inserted into varchar field. +# Update Records set NULL value to varchar field. It should not be allowed +# Retrieve records based on varchar field. +# +CREATEFILE=${PWD}/sql/Datatype/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Datatype +fi + +echo "echo Create table t1( f1 int, f2 varchar(15) NOT NULL);" >${REL_PATH}/varchar_NOTNULL.sql +echo "Create table t1( f1 int, f2 varchar(15) NOT NULL);" >>${REL_PATH}/varchar_NOTNULL.sql +echo "insert into t1 values(1,'Lakshya1');" >>${REL_PATH}/varchar_NOTNULL.sql +echo "insert into t1 values(2,NULL);" >>${REL_PATH}/varchar_NOTNULL.sql +echo "insert into t1 values(3,'Lakshya3');" >>${REL_PATH}/varchar_NOTNULL.sql +echo "insert into t1 values(4,NULL);" >>${REL_PATH}/varchar_NOTNULL.sql +echo "insert into t1 values(5,'Lakshya5');" >>${REL_PATH}/varchar_NOTNULL.sql +echo "echo select * from t1;" >>${REL_PATH}/varchar_NOTNULL.sql +echo "select * from t1;" >>${REL_PATH}/varchar_NOTNULL.sql +echo "echo update t1 set f2=NULL where f1<=3;" >>${REL_PATH}/varchar_NOTNULL.sql +echo "update t1 set f2=NULL where f1<=3;" >>${REL_PATH}/varchar_NOTNULL.sql +echo "echo select * from t1;" >>${REL_PATH}/varchar_NOTNULL.sql +echo "select * from t1;" >>${REL_PATH}/varchar_NOTNULL.sql + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_NOTNULL.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_NOTNULL.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/varchar_NOTNULL.sql ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/varchar_NOTNULL.sql ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/Datatype/test003.ksh b/test/sql/Datatype/test003.ksh new file mode 100755 index 00000000..35102a64 --- /dev/null +++ b/test/sql/Datatype/test003.ksh @@ -0,0 +1,49 @@ +#!/bin/ksh +# Autoincreament should not work on Varchar. +# Create table t1( f1 int, f2 varchar(15) AUTO_INCREMENT); +# This statement execution should be failed. +# +CREATEFILE=${PWD}/sql/Datatype/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Datatype +fi + +echo "echo Create table t1( f1 int, f2 varchar(15) AUTO_INCREMENT);" >${REL_PATH}/varchar_autoincrement.sql +echo "Create table t1( f1 int, f2 varchar(15) AUTO_INCREMENT);" >>${REL_PATH}/varchar_autoincrement.sql +echo "echo show tables;" >>${REL_PATH}/varchar_autoincrement.sql +echo "show tables;" >>${REL_PATH}/varchar_autoincrement.sql + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_autoincrement.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_autoincrement.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/varchar_autoincrement.sql ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/varchar_autoincrement.sql ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/Datatype/test004.ksh b/test/sql/Datatype/test004.ksh new file mode 100755 index 00000000..4187686b --- /dev/null +++ b/test/sql/Datatype/test004.ksh @@ -0,0 +1,78 @@ +#!/bin/ksh +# Primary key and Foreign Key +# Create table t1 (f1 varchar(10), f2 int, primary key(f1)); +# Create table t2 (f1 varchar(10), f2 bigint, foreign key(f1) references t1(f1)); +# t1.f1 should not allow NULL Value, Duplicate value. +# Through update statement try to update f1 field of t1. It should be failed due to primary key +# t2.f1 should allow only values which are in t1.f1. +# Delete records from t1 table which has the dependancy in t2 table. It should be failed due to parent child dependancy. +# +CREATEFILE=${PWD}/sql/Datatype/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Datatype +fi + +echo "echo Create table t1 (f1 varchar(10), f2 int, primary key(f1));" >${REL_PATH}/varchar_pkek_fkey.sql +echo "Create table t1 (f1 varchar(10), f2 int, primary key(f1));" >>${REL_PATH}/varchar_pkek_fkey.sql +echo "echo Create table t2 (f1 varchar(10), f2 bigint, foreign key(f1) references t1(f1));" >>${REL_PATH}/varchar_pkek_fkey.sql +echo "Create table t2 (f1 varchar(10), f2 bigint, foreign key(f1) references t1(f1));" >>${REL_PATH}/varchar_pkek_fkey.sql +echo "insert into t1 values('CSQL1',1);" >>${REL_PATH}/varchar_pkek_fkey.sql +echo "insert into t1 values('CSQL2',2);" >>${REL_PATH}/varchar_pkek_fkey.sql +echo "echo insert into t1 values(NULL,3);" >>${REL_PATH}/varchar_pkek_fkey.sql +echo "insert into t1 values(NULL,3);" >>${REL_PATH}/varchar_pkek_fkey.sql +echo "echo insert into t1 values('CSQL2',4);" >>${REL_PATH}/varchar_pkek_fkey.sql +echo "insert into t1 values('CSQL2',4);" >>${REL_PATH}/varchar_pkek_fkey.sql +echo "echo select * from t1;" >>${REL_PATH}/varchar_pkek_fkey.sql +echo "select * from t1;" >>${REL_PATH}/varchar_pkek_fkey.sql +echo "echo update t1 set f1='CSQL1' where f1='CSQL2';" >>${REL_PATH}/varchar_pkek_fkey.sql +echo "update t1 set f1='CSQL1' where f1='CSQL2';" >>${REL_PATH}/varchar_pkek_fkey.sql +echo "echo select * from t1;" >>${REL_PATH}/varchar_pkek_fkey.sql +echo "select * from t1;" >>${REL_PATH}/varchar_pkek_fkey.sql +echo "insert into t2 values('CSQL1',10);" >>${REL_PATH}/varchar_pkek_fkey.sql +echo "insert into t2 values('CSQL2',20);" >>${REL_PATH}/varchar_pkek_fkey.sql +echo "echo insert into t2 values('CSQL3',30);" >>${REL_PATH}/varchar_pkek_fkey.sql +echo "insert into t2 values('CSQL3',30);" >>${REL_PATH}/varchar_pkek_fkey.sql +echo "echo select * from t2;" >>${REL_PATH}/varchar_pkek_fkey.sql +echo "select * from t2;" >>${REL_PATH}/varchar_pkek_fkey.sql +echo "echo delete from t1 where f1='CSQL1';" >>${REL_PATH}/varchar_pkek_fkey.sql +echo "delete from t1 where f1='CSQL1';" >>${REL_PATH}/varchar_pkek_fkey.sql +echo "echo select * from t1;" >>${REL_PATH}/varchar_pkek_fkey.sql +echo "select * from t1;" >>${REL_PATH}/varchar_pkek_fkey.sql +echo "echo select * from t2;" >>${REL_PATH}/varchar_pkek_fkey.sql +echo "select * from t2;" >>${REL_PATH}/varchar_pkek_fkey.sql + +echo "drop table t2;" >${REL_PATH}/drop.sql +echo "drop table t1;" >>${REL_PATH}/drop.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_pkek_fkey.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_pkek_fkey.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop.sql + rm -f ${REL_PATH}/varchar_pkek_fkey.sql ${REL_PATH}/drop.sql + exit 1; + fi +fi + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/varchar_pkek_fkey.sql ${REL_PATH}/drop.sql +exit 0; diff --git a/test/sql/Datatype/test005.ksh b/test/sql/Datatype/test005.ksh new file mode 100755 index 00000000..a25cca5b --- /dev/null +++ b/test/sql/Datatype/test005.ksh @@ -0,0 +1,49 @@ +#!/bin/ksh +# Hash Index, Unique Hash Index +# create table t1 (f1 varchar(10), f2 smallint); +# create table t2 (f1 varchar(10), f2 smallint); +# create index idx1 on t1(f1)hash; +# create index idx2 on t2(f1)hash unique; +# insert records into both the tables. +# t2.f1 field should not allow duplicate records. +# +CREATEFILE=${PWD}/sql/Datatype/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Datatype +fi + +echo "drop table t1;" >${REL_PATH}/drop.sql +echo "drop table t2;" >>${REL_PATH}/drop.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_hash.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_hash.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop.sql + rm -f ${REL_PATH}/drop.sql + exit 1; + fi +fi + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/drop.sql +exit 0; diff --git a/test/sql/Datatype/test006.ksh b/test/sql/Datatype/test006.ksh new file mode 100755 index 00000000..a6458066 --- /dev/null +++ b/test/sql/Datatype/test006.ksh @@ -0,0 +1,49 @@ +#!/bin/ksh +# Tree Index, Unique Tree Index +# create table t1 (f1 varchar(10), f2 smallint); +# create table t2 (f1 varchar(10), f2 smallint); +# create index idx1 on t1(f1)tree; +# create index idx2 on t2(f1)tree unique; +# insert records into both the tables. +# t2.f1 field should not allow duplicate records. +# +CREATEFILE=${PWD}/sql/Datatype/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Datatype +fi + +echo "drop table t1;" >${REL_PATH}/drop.sql +echo "drop table t2;" >>${REL_PATH}/drop.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_tree.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_tree.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop.sql + rm -f ${REL_PATH}/drop.sql + exit 1; + fi +fi + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/drop.sql +exit 0; diff --git a/test/sql/Datatype/test007.ksh b/test/sql/Datatype/test007.ksh new file mode 100755 index 00000000..b8a5ae1a --- /dev/null +++ b/test/sql/Datatype/test007.ksh @@ -0,0 +1,54 @@ +#!/bin/ksh +# Alter table test. +# Create table t1(f1 varchar(10), f2 bigint); +# alter table t1 rename column f1 to F1. +# rename table t1 to T1. +# +CREATEFILE=${PWD}/sql/Datatype/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Datatype +fi + +echo "echo Create table t1(f1 varchar(10), f2 bigint);" >${REL_PATH}/varchar_alter.sql +echo "Create table t1(f1 varchar(10), f2 bigint);" >>${REL_PATH}/varchar_alter.sql +echo "echo alter table t1 rename column f1 to F1;" >>${REL_PATH}/varchar_alter.sql +echo "alter table t1 rename column f1 to F1;" >>${REL_PATH}/varchar_alter.sql +echo "echo rename table t1 to T1;" >>${REL_PATH}/varchar_alter.sql +echo "rename table t1 to T1;" >>${REL_PATH}/varchar_alter.sql +echo "echo show tables;" >>${REL_PATH}/varchar_alter.sql +echo "show tables;" >>${REL_PATH}/varchar_alter.sql + +echo "drop table T1;" >${REL_PATH}/dropT1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropT1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_alter.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_alter.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropT1.sql + rm -f ${REL_PATH}/varchar_alter.sql ${REL_PATH}/dropT1.sql + exit 1; + fi +fi + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropT1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/varchar_alter.sql ${REL_PATH}/dropT1.sql +exit 0; diff --git a/test/sql/Datatype/test008.ksh b/test/sql/Datatype/test008.ksh new file mode 100755 index 00000000..5a1a2db0 --- /dev/null +++ b/test/sql/Datatype/test008.ksh @@ -0,0 +1,53 @@ +#!/bin/ksh +# Copystatement test. +# Create table t1(f1 int, f2 varchar(10), f3 char(10), f4 varchar(10)); +# Create table t2 as select f2,f1,f4 from t1; +# Run catalog tool for check the indexes are made properly or not. +# +CREATEFILE=${PWD}/sql/Datatype/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Datatype +fi + +echo "echo Create table t1(f1 int, f2 varchar(10), f3 char(10), f4 varchar(10));" >${REL_PATH}/varchar_copystmt.sql +echo "Create table t1(f1 int, f2 varchar(10), f3 char(10), f4 varchar(10));" >>${REL_PATH}/varchar_copystmt.sql +echo "echo Create table t2 as select f2,f1,f4 from t1;" >>${REL_PATH}/varchar_copystmt.sql +echo "Create table t2 as select f2,f1,f4 from t1;" >>${REL_PATH}/varchar_copystmt.sql +echo "echo show tables;" >>${REL_PATH}/varchar_copystmt.sql +echo "show tables;" >>${REL_PATH}/varchar_copystmt.sql + +echo "drop table t1;" >${REL_PATH}/drop.sql +echo "drop table t2;" >>${REL_PATH}/drop.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_copystmt.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_copystmt.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop.sql + rm -f ${REL_PATH}/varchar_copystmt.sql ${REL_PATH}/drop.sql + exit 1; + fi +fi + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/varchar_copystmt.sql ${REL_PATH}/drop.sql +exit 0; diff --git a/test/sql/Datatype/test009.ksh b/test/sql/Datatype/test009.ksh new file mode 100755 index 00000000..2988d5ce --- /dev/null +++ b/test/sql/Datatype/test009.ksh @@ -0,0 +1,54 @@ +#!/bin/ksh +# Composite key(HASH) on varchar with other types. +# Create table t1(f1 tinyint, f2 smallint, f3 int, f4 bigint, f5 char(10), f6 varchar(10), f7 float, f8 double,f9 Date, f10 Time, f11 Timestamp); +# create index hashidxtinyvar on t1(f1, f6); +# create index hashidxsmallvar on t1(f2, f6); +# create index hashidxvarint on t1(f6, f3); +# create index hashidxvarbig on t1(f6, f4); +# create index hashidxcharvar on t1(f5, f6); +# create index hashidxvardate on t1(f6, f9); +# create index hashidxvartime on t1(f6, f10); +# create index hashidxvarfloat on t1(f6, f7); should be fail. +# create index hashidxvardouble on t1(f6, f8); should be fail. +# create index hashidxvartimestamp on t1(f6, f11); should be fail. +# Run catalog tool for check the indexes are made properly or not. +# +CREATEFILE=${PWD}/sql/Datatype/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Datatype +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_compindex.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_compindex.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/Datatype/test010.ksh b/test/sql/Datatype/test010.ksh new file mode 100755 index 00000000..3417fa04 --- /dev/null +++ b/test/sql/Datatype/test010.ksh @@ -0,0 +1,62 @@ +#!/bin/ksh +# Testing VARCHAR Datatype without index +# All DML testing +# +CREATEFILE=${PWD}/sql/Datatype/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Datatype +fi + +echo "echo create table t1(f1 varchar(20),f2 varchar(30));" >${REL_PATH}/varchar.sql +echo "create table t1(f1 varchar(20),f2 varchar(30));" >>${REL_PATH}/varchar.sql +echo "insert into t1 values('CSQL1','Lakshya1');" >>${REL_PATH}/varchar.sql +echo "insert into t1 values('CSQL2','Lakshya2');" >>${REL_PATH}/varchar.sql +echo "insert into t1 values('CSQL3','Lakshya3');" >>${REL_PATH}/varchar.sql +echo "insert into t1 values('CSQL4','Lakshya4');" >>${REL_PATH}/varchar.sql +echo "insert into t1 values('CSQL5','Lakshya5');" >>${REL_PATH}/varchar.sql +echo "echo select * from t1;" >>${REL_PATH}/varchar.sql +echo "select * from t1;" >>${REL_PATH}/varchar.sql +echo "echo select * from t1 where f1='CSQL4' or f1='CSQL2';" >>${REL_PATH}/varchar.sql +echo "select * from t1 where f1='CSQL4' or f1='CSQL2';" >>${REL_PATH}/varchar.sql +echo "echo update t1 set f2='LAKSHYA' where f1='CSQL2' or f1='CSQL4';" >>${REL_PATH}/varchar.sql +echo "update t1 set f2='LAKSHYA' where f1='CSQL2' or f1='CSQL4';" >>${REL_PATH}/varchar.sql +echo "echo select * from t1;" >>${REL_PATH}/varchar.sql +echo "select * from t1;" >>${REL_PATH}/varchar.sql +echo "echo delete from t1 where f1 in ('CSQL1','CSQL3','CSQL5');" >>${REL_PATH}/varchar.sql +echo "delete from t1 where f1 in ('CSQL1','CSQL3','CSQL5');" >>${REL_PATH}/varchar.sql +echo "echo select * from t1;" >>${REL_PATH}/varchar.sql +echo "select * from t1;" >>${REL_PATH}/varchar.sql + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/varchar.sql ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +rm -f ${REL_PATH}/varchar.sql ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/Datatype/varchar_compindex.sql b/test/sql/Datatype/varchar_compindex.sql new file mode 100644 index 00000000..81f4b559 --- /dev/null +++ b/test/sql/Datatype/varchar_compindex.sql @@ -0,0 +1,23 @@ +echo Create table t1(f1 tinyint, f2 smallint, f3 int, f4 bigint, f5 char(10), f6 varchar(10), f7 float, f8 double,f9 Date, f10 Time, f11 Timestamp); +Create table t1(f1 tinyint, f2 smallint, f3 int, f4 bigint, f5 char(10), f6 varchar(10), f7 float, f8 double,f9 Date, f10 Time, f11 Timestamp); +echo create index hashidxtinyvar on t1(f1, f6); +create index hashidxtinyvar on t1(f1, f6); +echo create index hashidxsmallvar on t1(f2, f6); +create index hashidxsmallvar on t1(f2, f6); +echo create index hashidxvarint on t1(f6, f3); +create index hashidxvarint on t1(f6, f3); +echo create index hashidxvarbig on t1(f6, f4); +create index hashidxvarbig on t1(f6, f4); +echo create index hashidxcharvar on t1(f5, f6); +create index hashidxcharvar on t1(f5, f6); +echo create index hashidxvardate on t1(f6, f9); +create index hashidxvardate on t1(f6, f9); +echo create index hashidxvartime on t1(f6, f10); +create index hashidxvartime on t1(f6, f10); +echo create index hashidxvarfloat on t1(f6, f7); +create index hashidxvarfloat on t1(f6, f7); +echo create index hashidxvardouble on t1(f6, f8); +create index hashidxvardouble on t1(f6, f8); +echo create index hashidxvartimestamp on t1(f6, f11); +create index hashidxvartimestamp on t1(f6, f11); + diff --git a/test/sql/Datatype/varchar_default.sql b/test/sql/Datatype/varchar_default.sql new file mode 100644 index 00000000..e534e464 --- /dev/null +++ b/test/sql/Datatype/varchar_default.sql @@ -0,0 +1,22 @@ +echo Create table t1(f1 int, f2 varchar(15) default 'CSQL'); +Create table t1( f1 int, f2 varchar(15) default 'CSQL'); +echo insert into t1 values(1,'Lakshya1'); +insert into t1 values(1,'Lakshya1'); +echo insert into t1 values(2,NULL); +insert into t1 values(2,NULL); +echo insert into t1 values(3,'Lakshya3'); +insert into t1 values(3,'Lakshya3'); +echo insert into t1 values(4,NULL); +insert into t1 values(4,NULL); +echo insert into t1(f1) values(5); +insert into t1(f1) values(5); +echo select * from t1; +select * from t1; +echo select * from t1 where f2='CSQL'; +select * from t1 where f2='CSQL'; +echo update t1 set f2=NULL where f2='Lakshya3'; +update t1 set f2=NULL where f2='Lakshya3'; +echo select * from t1; +select * from t1; +echo select * from t1 where f2 IS NULL; +select * from t1 where f2 IS NULL; diff --git a/test/sql/Datatype/varchar_hash.sql b/test/sql/Datatype/varchar_hash.sql new file mode 100644 index 00000000..2ccab05b --- /dev/null +++ b/test/sql/Datatype/varchar_hash.sql @@ -0,0 +1,15 @@ +echo create table t1 (f1 varchar(10), f2 smallint); +create table t1 (f1 varchar(10), f2 smallint); +echo create table t2 (f1 varchar(10), f2 smallint); +create table t2 (f1 varchar(10), f2 smallint); +echo create index idx1 on t1(f1) hash; +create index idx1 on t1(f1) hash; +echo create index idx2 on t2(f1) hash unique; +create index idx2 on t2(f1) hash unique; +insert into t2 values('Lakshya1',10); +echo insert into t2 values('Lakshya1',20); +insert into t2 values('Lakshya1',20); +echo select * from t1; +select * from t1; +echo select * from t2; +select * from t2; diff --git a/test/sql/Datatype/varchar_tree.sql b/test/sql/Datatype/varchar_tree.sql new file mode 100644 index 00000000..59bb40c1 --- /dev/null +++ b/test/sql/Datatype/varchar_tree.sql @@ -0,0 +1,15 @@ +echo create table t1 (f1 varchar(10), f2 smallint); +create table t1 (f1 varchar(10), f2 smallint); +echo create table t2 (f1 varchar(10), f2 smallint); +create table t2 (f1 varchar(10), f2 smallint); +echo create index idx1 on t1(f1) tree; +create index idx1 on t1(f1) tree; +echo create index idx2 on t2(f1) tree unique; +create index idx2 on t2(f1) tree unique; +insert into t2 values('Lakshya1',10); +echo insert into t2 values('Lakshya1',20); +insert into t2 values('Lakshya1',20); +echo select * from t1; +select * from t1; +echo select * from t2; +select * from t2; diff --git a/test/sql/Distinct/alldatatype.sql b/test/sql/Distinct/alldatatype.sql new file mode 100644 index 00000000..f7499d6b --- /dev/null +++ b/test/sql/Distinct/alldatatype.sql @@ -0,0 +1,18 @@ +create table t1(f0 tinyint, f1 smallint,f2 int,f3 bigint,f4 char(10),f5 float,f6 double,f7 date,f8 time,f9 timestamp); +insert into t1 values(1, 10,100 ,1000, 'Bijay',1000,100000,'2009-03-01','11:59:59','2009-03-01 11:59:59'); +insert into t1 values(2, 11,110 ,1100, 'Jitendr',2000,200000,'2009-03-02','11:59:58','2009-03-02 11:59:59'); +insert into t1 values(3, 12,120 ,1000, 'Nihar',3000,300000,'2009-03-03','11:59:57','2009-03-03 11:59:59'); +insert into t1 values(4, 13,130 ,1100, 'Kishor',4000,400000,'2009-03-04','11:59:59','2009-03-04 11:59:59'); +insert into t1 values(5, 14,100 ,1000, 'Praba',5000,500000,'2009-03-01','11:59:58','2009-03-01 11:59:59'); +insert into t1 values(6, 15,110 ,1100, 'Sanjit',6000,600000,'2009-03-02','11:59:57','2009-03-02 11:59:59'); +insert into t1 values(7, 16,120 ,1000, 'Sanjay',7000,700000,'2009-03-03','11:59:59','2009-03-03 11:59:59'); +insert into t1 values(1, 17,130 ,1100, 'Arindam',8000,800000,'2009-03-04','11:59:58','2009-03-04 11:59:59'); +insert into t1 values(2, 10,100 ,1000, 'Bijay',9000,900000,'2009-03-01','11:59:57','2009-03-01 11:59:59'); +insert into t1 values(3, 11,110 ,1100, 'Jitendr',1000,100000,'2009-03-02','11:59:58','2009-03-02 11:59:59'); +insert into t1 values(4, 12,120 ,1000, 'Nihar',2000,200000,'2009-03-03','11:59:57','2009-03-03 11:59:59'); +insert into t1 values(5, 13,130 ,1100, 'Kishor',3000,300000,'2009-03-05','11:59:56','2009-03-05 11:59:59'); +insert into t1 values(6, 14,100 ,1000, 'Praba',4000,400000,'2009-03-01','11:59:55','2009-03-04 11:59:59'); +insert into t1 values(7, 15,110 ,1100, 'Sanjit',5000,500000,'2009-03-02','11:59:56','2009-03-01 11:59:59'); +insert into t1 values(1, 16,120 ,1000, 'Sanjay',6000,600000,'2009-03-03','11:59:55','2009-03-03 11:59:59'); +insert into t1 values(2, 17,130 ,1100, 'Arindam',7000,700000,'2009-03-01','11:59:59','2009-03-01 11:59:59'); +select * from t1; diff --git a/test/sql/Distinct/alldatatype_t1_t2_t3.sql b/test/sql/Distinct/alldatatype_t1_t2_t3.sql new file mode 100644 index 00000000..fd04b53c --- /dev/null +++ b/test/sql/Distinct/alldatatype_t1_t2_t3.sql @@ -0,0 +1,24 @@ +create table t1(f1 smallint,f2 int,f3 bigint,f4 char(10),f5 float,f6 double,f7 date,f8 time,f9 timestamp); +insert into t1 values(10,100 ,1000, 'Bijay',1000,100000,'2009-03-01','11:59:59','2009-03-01 11:59:59'); +insert into t1 values(11,110 ,1100, 'Jitendr',2000,200000,'2009-03-02','11:59:58','2009-03-02 11:59:59'); +insert into t1 values(12,120 ,1000, 'Nihar',3000,300000,'2009-03-03','11:59:57','2009-03-03 11:59:59'); +insert into t1 values(13,130 ,1500, 'Kishor',4000,400000,'2009-03-04','11:59:59','2009-03-04 11:59:59'); +insert into t1 values(14,100 ,1000, 'Praba',5000,500000,'2009-03-01','11:59:58','2009-03-01 11:59:59'); +create table t2(f1 smallint,f2 int,f3 bigint,f4 char(10),f5 float,f6 double,f7 date,f8 time,f9 timestamp); +insert into t2 values(13,130 ,1500, 'Kishor',4000,400000,'2009-03-04','11:59:59','2009-03-04 11:59:59'); +insert into t2 values(16,120 ,1000, 'Sanjay',6500,700000,'2009-03-03','11:59:59','2009-03-03 11:59:59'); +insert into t2 values(10,100 ,1000, 'Bijay',1000,100000,'2009-03-01','11:59:59','2009-03-01 11:59:59'); +insert into t2 values(17,130 ,1100, 'Arindam',8000,800000,'2009-03-04','11:59:58','2009-03-04 11:59:59'); +insert into t2 values(11,110 ,1100, 'Jitendr',2000,200000,'2009-03-02','11:59:58','2009-03-02 11:59:59'); +create table t3(f1 smallint,f2 int,f3 bigint,f4 char(10),f5 float,f6 double,f7 date,f8 time,f9 timestamp); +insert into t3 values(12,120 ,1000, 'Nihar',3000,300000,'2009-03-03','11:59:57','2009-03-03 11:59:59'); +insert into t3 values(14,100 ,1000, 'Praba',4000,400000,'2009-03-01','11:59:55','2009-03-04 11:59:59'); +insert into t3 values(13,130 ,1500, 'Kishor',4000,400000,'2009-03-04','11:59:59','2009-03-04 11:59:59'); +insert into t3 values(11,110 ,1100, 'Jitendr',2000,200000,'2009-03-02','11:59:58','2009-03-02 11:59:59'); +insert into t3 values(16,120 ,1000, 'Sanjay',6000,600000,'2009-03-03','11:59:55','2009-03-03 11:59:59'); +echo select * from t1; +select * from t1; +echo select * from t2; +select * from t2; +echo select * from t3; +select * from t3; diff --git a/test/sql/Distinct/alldatatype_with_null.sql b/test/sql/Distinct/alldatatype_with_null.sql new file mode 100644 index 00000000..5a640624 --- /dev/null +++ b/test/sql/Distinct/alldatatype_with_null.sql @@ -0,0 +1,18 @@ +create table t1(f0 tinyint, f1 smallint,f2 int,f3 bigint,f4 char(10),f5 float,f6 double,f7 date,f8 time,f9 timestamp); +insert into t1 values(1, 10 ,100 ,1000, 'Bijay' ,1000,100000,'2009-03-01','11:59:59','2009-03-01 11:59:59'); +insert into t1 values(NULL,11 ,110 ,1100, 'Jitendr',NULL,200000,'2009-03-02', NULL ,'2009-03-02 11:59:59'); +insert into t1 values(3, 12 ,120 ,1000, NULL ,3000,NULL , NULL ,'11:59:57','2009-03-03 11:59:59'); +insert into t1 values(4, NULL ,NULL ,1100, 'Kishor',4000,400000,'2009-03-04','11:59:59','2009-03-04 11:59:59'); +insert into t1 values(5, 14 ,100 ,1000, 'Praba',5000,500000,'2009-03-01', NULL ,'2009-03-01 11:59:59'); +insert into t1 values(6, 15 ,110 ,NULL, 'Sanjit',6000,600000,'2009-03-02','11:59:57','2009-03-02 11:59:59'); +insert into t1 values(7, 16 ,120 ,1000, 'Sanjay',7000,700000, NULL ,'11:59:59','2009-03-03 11:59:59'); +insert into t1 values(1, 17, NULL ,1100, 'Arindam',8000,800000,'2009-03-04', NULL ,'2009-03-04 11:59:59'); +insert into t1 values(NULL,10 ,100 ,NULL, 'Bijay',9000,900000,'2009-03-01','11:59:57','2009-03-01 11:59:59'); +insert into t1 values(3, 11 ,110 ,1100, 'Jitendr',1000,100000, NULL , NULL ,'2009-03-02 11:59:59'); +insert into t1 values(4, 12 ,120 ,1000, NULL ,NULL,200000, NULL ,'11:59:57','2009-03-03 11:59:59'); +insert into t1 values(5, NULL ,NULL ,NULL, NULL ,3000,NULL ,'2009-03-05','11:59:56','2009-03-05 11:59:59'); +insert into t1 values(6, 14 ,100 ,1000, 'Praba',4000,400000,'2009-03-01','11:59:55','2009-03-04 11:59:59'); +insert into t1 values(7, 15 ,110 ,1100, 'Sanjit',5000,500000,'2009-03-02','11:59:56','2009-03-01 11:59:59'); +insert into t1 values(NULL,NULL,120 ,1000, 'Sanjay',NULL,NULL , NULL , NULL ,'2009-03-03 11:59:59'); +insert into t1 values(NULL,17 ,130 ,1100, 'Arindam',7000,700000,'2009-03-01','11:59:59','2009-03-01 11:59:59'); +select * from t1; diff --git a/test/sql/Distinct/distinct1.sql b/test/sql/Distinct/distinct1.sql new file mode 100644 index 00000000..af07f368 --- /dev/null +++ b/test/sql/Distinct/distinct1.sql @@ -0,0 +1,21 @@ +create table t1(f1 int,f2 int,f3 int,f4 char(10)); +insert into t1 values(98,1,10,'AAA'); +insert into t1 values(99,2,20,'BBB'); +insert into t1 values(100,2,10,'CCC'); +insert into t1 values(101,3,10,'AAA'); +insert into t1 values(99,2,20,'BBB'); + +echo select * from t1; +select * from t1; + +echo select distinct * from t1 ; +select distinct * from t1 ; + +echo select distinct f2 from t1 ; +select distinct f2 from t1 ; + +echo select distinct f4 from t1 ; +select distinct f4 from t1 ; + +echo select distinct f2, f4 from t1 ; +select distinct f2, f4 from t1 ; diff --git a/test/sql/Distinct/distinct_alltypes.sql b/test/sql/Distinct/distinct_alltypes.sql new file mode 100644 index 00000000..aa715beb --- /dev/null +++ b/test/sql/Distinct/distinct_alltypes.sql @@ -0,0 +1,34 @@ +echo select distinct f0 from t1; +select distinct f0 from t1; +echo select distinct f1 from t1; +select distinct f1 from t1; +echo select distinct f2 from t1; +select distinct f2 from t1; +echo select distinct f3 from t1; +select distinct f3 from t1; +echo select distinct f4 from t1; +select distinct f4 from t1; +echo select distinct f5 from t1; +select distinct f5 from t1; +echo select distinct f6 from t1; +select distinct f6 from t1; +echo select distinct f7 from t1; +select distinct f7 from t1; +echo select distinct f8 from t1; +select distinct f8 from t1; +echo select distinct f9 from t1; +select distinct f9 from t1; +echo select distinct f1,f2,f3 from t1; +select distinct f1,f2,f3 from t1; +echo select distinct f0,f1,f2,f3 from t1; +select distinct f0,f1,f2,f3 from t1; +echo select distinct f2,f3 from t1; +select distinct f2,f3 from t1; +echo select distinct f2,f3,f4,f5 from t1; +select distinct f2,f3,f4,f5 from t1; +echo select distinct f2,f3,f4,f5,f6 from t1; +select distinct f2,f3,f4,f5,f6 from t1; +echo select distinct f4,f6,f2,f5,f3,f7,f8 from t1; +select distinct f4,f6,f2,f5,f3,f7,f8 from t1; +echo select distinct f2,f3,f4,f5,f8,f7,f9,f6 from t1; +select distinct f2,f3,f4,f5,f8,f7,f9,f6 from t1; diff --git a/test/sql/Distinct/distinct_alltypes_innerjoin.sql b/test/sql/Distinct/distinct_alltypes_innerjoin.sql new file mode 100644 index 00000000..e3fec2af --- /dev/null +++ b/test/sql/Distinct/distinct_alltypes_innerjoin.sql @@ -0,0 +1,56 @@ +echo select distinct t1.f1, t2.f1 from t1 inner join t2 on t1.f1 = t2.f1 ; +select distinct t1.f1, t2.f1 from t1 inner join t2 on t1.f1 = t2.f1 ; +echo select distinct t1.f2, t2.f2 from t1 inner join t2 on t1.f2 = t2.f2 ; +select distinct t1.f2, t2.f2 from t1 inner join t2 on t1.f2 = t2.f2 ; +echo select distinct t1.f3, t2.f3 from t1 inner join t2 on t1.f3 = t2.f3 ; +select distinct t1.f3, t2.f3 from t1 inner join t2 on t1.f3 = t2.f3 ; +echo select distinct t1.f4, t2.f4 from t1 inner join t2 on t1.f4 = t2.f4 ; +select distinct t1.f4, t2.f4 from t1 inner join t2 on t1.f4 = t2.f4 ; +echo select distinct t1.f5, t2.f5 from t1 inner join t2 on t1.f5 = t2.f5 ; +select distinct t1.f5, t2.f5 from t1 inner join t2 on t1.f5 = t2.f5 ; +echo select distinct t1.f6, t2.f6 from t1 inner join t2 on t1.f6 = t2.f6 ; +select distinct t1.f6, t2.f6 from t1 inner join t2 on t1.f6 = t2.f6 ; +echo select distinct t1.f7, t2.f7 from t1 inner join t2 on t1.f7 = t2.f7 ; +select distinct t1.f7, t2.f7 from t1 inner join t2 on t1.f7 = t2.f7 ; +echo select distinct t1.f8, t2.f8 from t1 inner join t2 on t1.f8 = t2.f8 ; +select distinct t1.f8, t2.f8 from t1 inner join t2 on t1.f8 = t2.f8 ; +echo select distinct t1.f9, t2.f9 from t1 inner join t2 on t1.f9 = t2.f9 ; +select distinct t1.f9, t2.f9 from t1 inner join t2 on t1.f9 = t2.f9 ; + +echo select distinct t1.f1, t1.f2 from t1 inner join t2 on t1.f1 = t2.f1 ; +select distinct t1.f1, t1.f2 from t1 inner join t2 on t1.f1 = t2.f1 ; +echo select distinct t1.f1, t1.f2 from t1 inner join t2 on t1.f2 = t2.f2 ; +select distinct t1.f1, t1.f2 from t1 inner join t2 on t1.f2 = t2.f2 ; +echo select distinct t1.f1, t1.f3 from t1 inner join t2 on t1.f3 = t2.f3 ; +select distinct t1.f1, t1.f3 from t1 inner join t2 on t1.f3 = t2.f3 ; +echo select distinct t1.f1, t1.f4 from t1 inner join t2 on t1.f4 = t2.f4 ; +select distinct t1.f1, t1.f4 from t1 inner join t2 on t1.f4 = t2.f4 ; +echo select distinct t1.f1, t1.f5 from t1 inner join t2 on t1.f5 = t2.f5 ; +select distinct t1.f1, t1.f5 from t1 inner join t2 on t1.f5 = t2.f5 ; +echo select distinct t1.f1, t1.f6 from t1 inner join t2 on t1.f6 = t2.f6 ; +select distinct t1.f1, t1.f6 from t1 inner join t2 on t1.f6 = t2.f6 ; +echo select distinct t1.f1, t1.f7 from t1 inner join t2 on t1.f7 = t2.f7 ; +select distinct t1.f1, t1.f7 from t1 inner join t2 on t1.f7 = t2.f7 ; +echo select distinct t1.f1, t1.f8 from t1 inner join t2 on t1.f8 = t2.f8 ; +select distinct t1.f1, t1.f8 from t1 inner join t2 on t1.f8 = t2.f8 ; +echo select distinct t1.f1, t1.f9 from t1 inner join t2 on t1.f9 = t2.f9 ; +select distinct t1.f1, t1.f9 from t1 inner join t2 on t1.f9 = t2.f9 ; + +echo select distinct t1.f1, t1.f2, t2.f1, t2.f2 from t1 inner join t2 on t1.f1 = t2.f1 ; +select distinct t1.f1, t1.f2, t2.f1, t2.f2 from t1 inner join t2 on t1.f1 = t2.f1 ; +echo select distinct t1.f1, t1.f2, t2.f1, t2.f2 from t1 inner join t2 on t1.f2 = t2.f2 ; +select distinct t1.f1, t1.f2, t2.f1, t2.f2 from t1 inner join t2 on t1.f2 = t2.f2 ; +echo select distinct t1.f1, t1.f3, t2.f1, t2.f3 from t1 inner join t2 on t1.f3 = t2.f3 ; +select distinct t1.f1, t1.f3, t2.f1, t2.f3 from t1 inner join t2 on t1.f3 = t2.f3 ; +echo select distinct t1.f1, t1.f4, t2.f1, t2.f4 from t1 inner join t2 on t1.f4 = t2.f4 ; +select distinct t1.f1, t1.f4, t2.f1, t2.f4 from t1 inner join t2 on t1.f4 = t2.f4 ; +echo select distinct t1.f1, t1.f5, t2.f1, t2.f5 from t1 inner join t2 on t1.f5 = t2.f5 ; +select distinct t1.f1, t1.f5, t2.f1, t2.f5 from t1 inner join t2 on t1.f5 = t2.f5 ; +echo select distinct t1.f1, t1.f6, t2.f1, t2.f6 from t1 inner join t2 on t1.f6 = t2.f6 ; +select distinct t1.f1, t1.f6, t2.f1, t2.f6 from t1 inner join t2 on t1.f6 = t2.f6 ; +echo select distinct t1.f1, t1.f7, t2.f1, t2.f7 from t1 inner join t2 on t1.f7 = t2.f7 ; +select distinct t1.f1, t1.f7, t2.f1, t2.f7 from t1 inner join t2 on t1.f7 = t2.f7 ; +echo select distinct t1.f1, t1.f8, t2.f1, t2.f8 from t1 inner join t2 on t1.f8 = t2.f8 ; +select distinct t1.f1, t1.f8, t2.f1, t2.f8 from t1 inner join t2 on t1.f8 = t2.f8 ; +echo select distinct t1.f1, t1.f9, t2.f1, t2.f9 from t1 inner join t2 on t1.f9 = t2.f9 ; +select distinct t1.f1, t1.f9, t2.f1, t2.f9 from t1 inner join t2 on t1.f9 = t2.f9 ; diff --git a/test/sql/Distinct/distinct_alltypes_leftjoin.sql b/test/sql/Distinct/distinct_alltypes_leftjoin.sql new file mode 100644 index 00000000..8ccf7357 --- /dev/null +++ b/test/sql/Distinct/distinct_alltypes_leftjoin.sql @@ -0,0 +1,56 @@ +echo select distinct t1.f1, t2.f1 from t1 left join t2 on t1.f1 = t2.f1 ; +select distinct t1.f1, t2.f1 from t1 left join t2 on t1.f1 = t2.f1 ; +echo select distinct t1.f2, t2.f2 from t1 left join t2 on t1.f2 = t2.f2 ; +select distinct t1.f2, t2.f2 from t1 left join t2 on t1.f2 = t2.f2 ; +echo select distinct t1.f3, t2.f3 from t1 left join t2 on t1.f3 = t2.f3 ; +select distinct t1.f3, t2.f3 from t1 left join t2 on t1.f3 = t2.f3 ; +echo select distinct t1.f4, t2.f4 from t1 left join t2 on t1.f4 = t2.f4 ; +select distinct t1.f4, t2.f4 from t1 left join t2 on t1.f4 = t2.f4 ; +echo select distinct t1.f5, t2.f5 from t1 left join t2 on t1.f5 = t2.f5 ; +select distinct t1.f5, t2.f5 from t1 left join t2 on t1.f5 = t2.f5 ; +echo select distinct t1.f6, t2.f6 from t1 left join t2 on t1.f6 = t2.f6 ; +select distinct t1.f6, t2.f6 from t1 left join t2 on t1.f6 = t2.f6 ; +echo select distinct t1.f7, t2.f7 from t1 left join t2 on t1.f7 = t2.f7 ; +select distinct t1.f7, t2.f7 from t1 left join t2 on t1.f7 = t2.f7 ; +echo select distinct t1.f8, t2.f8 from t1 left join t2 on t1.f8 = t2.f8 ; +select distinct t1.f8, t2.f8 from t1 left join t2 on t1.f8 = t2.f8 ; +echo select distinct t1.f9, t2.f9 from t1 left join t2 on t1.f9 = t2.f9 ; +select distinct t1.f9, t2.f9 from t1 left join t2 on t1.f9 = t2.f9 ; + +echo select distinct t1.f1, t1.f2 from t1 left join t2 on t1.f1 = t2.f1 ; +select distinct t1.f1, t1.f2 from t1 left join t2 on t1.f1 = t2.f1 ; +echo select distinct t1.f1, t1.f2 from t1 left join t2 on t1.f2 = t2.f2 ; +select distinct t1.f1, t1.f2 from t1 left join t2 on t1.f2 = t2.f2 ; +echo select distinct t1.f1, t1.f3 from t1 left join t2 on t1.f3 = t2.f3 ; +select distinct t1.f1, t1.f3 from t1 left join t2 on t1.f3 = t2.f3 ; +echo select distinct t1.f1, t1.f4 from t1 left join t2 on t1.f4 = t2.f4 ; +select distinct t1.f1, t1.f4 from t1 left join t2 on t1.f4 = t2.f4 ; +echo select distinct t1.f1, t1.f5 from t1 left join t2 on t1.f5 = t2.f5 ; +select distinct t1.f1, t1.f5 from t1 left join t2 on t1.f5 = t2.f5 ; +echo select distinct t1.f1, t1.f6 from t1 left join t2 on t1.f6 = t2.f6 ; +select distinct t1.f1, t1.f6 from t1 left join t2 on t1.f6 = t2.f6 ; +echo select distinct t1.f1, t1.f7 from t1 left join t2 on t1.f7 = t2.f7 ; +select distinct t1.f1, t1.f7 from t1 left join t2 on t1.f7 = t2.f7 ; +echo select distinct t1.f1, t1.f8 from t1 left join t2 on t1.f8 = t2.f8 ; +select distinct t1.f1, t1.f8 from t1 left join t2 on t1.f8 = t2.f8 ; +echo select distinct t1.f1, t1.f9 from t1 left join t2 on t1.f9 = t2.f9 ; +select distinct t1.f1, t1.f9 from t1 left join t2 on t1.f9 = t2.f9 ; + +echo select distinct t1.f1, t1.f2, t2.f1, t2.f2 from t1 left join t2 on t1.f1 = t2.f1 ; +select distinct t1.f1, t1.f2, t2.f1, t2.f2 from t1 left join t2 on t1.f1 = t2.f1 ; +echo select distinct t1.f1, t1.f2, t2.f1, t2.f2 from t1 left join t2 on t1.f2 = t2.f2 ; +select distinct t1.f1, t1.f2, t2.f1, t2.f2 from t1 left join t2 on t1.f2 = t2.f2 ; +echo select distinct t1.f1, t1.f3, t2.f1, t2.f3 from t1 left join t2 on t1.f3 = t2.f3 ; +select distinct t1.f1, t1.f3, t2.f1, t2.f3 from t1 left join t2 on t1.f3 = t2.f3 ; +echo select distinct t1.f1, t1.f4, t2.f1, t2.f4 from t1 left join t2 on t1.f4 = t2.f4 ; +select distinct t1.f1, t1.f4, t2.f1, t2.f4 from t1 left join t2 on t1.f4 = t2.f4 ; +echo select distinct t1.f1, t1.f5, t2.f1, t2.f5 from t1 left join t2 on t1.f5 = t2.f5 ; +select distinct t1.f1, t1.f5, t2.f1, t2.f5 from t1 left join t2 on t1.f5 = t2.f5 ; +echo select distinct t1.f1, t1.f6, t2.f1, t2.f6 from t1 left join t2 on t1.f6 = t2.f6 ; +select distinct t1.f1, t1.f6, t2.f1, t2.f6 from t1 left join t2 on t1.f6 = t2.f6 ; +echo select distinct t1.f1, t1.f7, t2.f1, t2.f7 from t1 left join t2 on t1.f7 = t2.f7 ; +select distinct t1.f1, t1.f7, t2.f1, t2.f7 from t1 left join t2 on t1.f7 = t2.f7 ; +echo select distinct t1.f1, t1.f8, t2.f1, t2.f8 from t1 left join t2 on t1.f8 = t2.f8 ; +select distinct t1.f1, t1.f8, t2.f1, t2.f8 from t1 left join t2 on t1.f8 = t2.f8 ; +echo select distinct t1.f1, t1.f9, t2.f1, t2.f9 from t1 left join t2 on t1.f9 = t2.f9 ; +select distinct t1.f1, t1.f9, t2.f1, t2.f9 from t1 left join t2 on t1.f9 = t2.f9 ; diff --git a/test/sql/Distinct/drop_t1_t2_t3.sql b/test/sql/Distinct/drop_t1_t2_t3.sql new file mode 100644 index 00000000..3e9ecdb1 --- /dev/null +++ b/test/sql/Distinct/drop_t1_t2_t3.sql @@ -0,0 +1,3 @@ +drop table t1; +drop table t2; +drop table t3; diff --git a/test/sql/Distinct/dropt1.sql b/test/sql/Distinct/dropt1.sql new file mode 100644 index 00000000..2d707d46 --- /dev/null +++ b/test/sql/Distinct/dropt1.sql @@ -0,0 +1,2 @@ +drop table t1; + diff --git a/test/sql/Distinct/exp.test001.ksh b/test/sql/Distinct/exp.test001.ksh new file mode 100644 index 00000000..57d82acd --- /dev/null +++ b/test/sql/Distinct/exp.test001.ksh @@ -0,0 +1,51 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 +--------------------------------------------------------- + 98 1 10 AAA + 99 2 20 BBB + 100 2 10 CCC + 101 3 10 AAA + 99 2 20 BBB + +echo select distinct * from t1 ; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 +--------------------------------------------------------- + 98 1 10 AAA + 99 2 20 BBB + 100 2 10 CCC + 101 3 10 AAA + +echo select distinct f2 from t1 ; +--------------------------------------------------------- + f2 +--------------------------------------------------------- + 1 + 2 + 3 + +echo select distinct f4 from t1 ; +--------------------------------------------------------- + f4 +--------------------------------------------------------- + AAA + BBB + CCC + +echo select distinct f2, f4 from t1 ; +--------------------------------------------------------- + f2 f4 +--------------------------------------------------------- + 1 AAA + 2 BBB + 2 CCC + 3 AAA + +Statement Executed diff --git a/test/sql/Distinct/exp.test002.ksh b/test/sql/Distinct/exp.test002.ksh new file mode 100644 index 00000000..6f14d305 --- /dev/null +++ b/test/sql/Distinct/exp.test002.ksh @@ -0,0 +1,277 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +--------------------------------------------------------- + t1.f0 t1.f1 t1.f2 t1.f3 t1.f4 t1.f5 t1.f6 t1.f7 t1.f8 t1.f9 +--------------------------------------------------------- + 1 10 100 1000 Bijay 1000.000000 100000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + 2 11 110 1100 Jitendr 2000.000000 200000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 3 12 120 1000 Nihar 3000.000000 300000.000000 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 4 13 130 1100 Kishor 4000.000000 400000.000000 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 + 5 14 100 1000 Praba 5000.000000 500000.000000 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 + 6 15 110 1100 Sanjit 6000.000000 600000.000000 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 + 7 16 120 1000 Sanjay 7000.000000 700000.000000 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 + 1 17 130 1100 Arindam 8000.000000 800000.000000 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 + 2 10 100 1000 Bijay 9000.000000 900000.000000 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 + 3 11 110 1100 Jitendr 1000.000000 100000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 4 12 120 1000 Nihar 2000.000000 200000.000000 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 5 13 130 1100 Kishor 3000.000000 300000.000000 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 + 6 14 100 1000 Praba 4000.000000 400000.000000 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 + 7 15 110 1100 Sanjit 5000.000000 500000.000000 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 + 1 16 120 1000 Sanjay 6000.000000 600000.000000 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 + 2 17 130 1100 Arindam 7000.000000 700000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + +echo select distinct f0 from t1; +--------------------------------------------------------- + f0 +--------------------------------------------------------- + 1 + 2 + 3 + 4 + 5 + 6 + 7 + +echo select distinct f1 from t1; +--------------------------------------------------------- + f1 +--------------------------------------------------------- + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + +echo select distinct f2 from t1; +--------------------------------------------------------- + f2 +--------------------------------------------------------- + 100 + 110 + 120 + 130 + +echo select distinct f3 from t1; +--------------------------------------------------------- + f3 +--------------------------------------------------------- + 1000 + 1100 + +echo select distinct f4 from t1; +--------------------------------------------------------- + f4 +--------------------------------------------------------- + Bijay + Jitendr + Nihar + Kishor + Praba + Sanjit + Sanjay + Arindam + +echo select distinct f5 from t1; +--------------------------------------------------------- + f5 +--------------------------------------------------------- + 1000.000000 + 2000.000000 + 3000.000000 + 4000.000000 + 5000.000000 + 6000.000000 + 7000.000000 + 8000.000000 + 9000.000000 + +echo select distinct f6 from t1; +--------------------------------------------------------- + f6 +--------------------------------------------------------- + 100000.000000 + 200000.000000 + 300000.000000 + 400000.000000 + 500000.000000 + 600000.000000 + 700000.000000 + 800000.000000 + 900000.000000 + +echo select distinct f7 from t1; +--------------------------------------------------------- + f7 +--------------------------------------------------------- + 2009/3/1 + 2009/3/2 + 2009/3/3 + 2009/3/4 + 2009/3/5 + +echo select distinct f8 from t1; +--------------------------------------------------------- + f8 +--------------------------------------------------------- + 11:59:59.0 + 11:59:58.0 + 11:59:57.0 + 11:59:56.0 + 11:59:55.0 + +echo select distinct f9 from t1; +--------------------------------------------------------- + f9 +--------------------------------------------------------- + 2009/3/1 11:59:59.0 + 2009/3/2 11:59:59.0 + 2009/3/3 11:59:59.0 + 2009/3/4 11:59:59.0 + 2009/3/5 11:59:59.0 + +echo select distinct f1,f2,f3 from t1; +--------------------------------------------------------- + f1 f2 f3 +--------------------------------------------------------- + 10 100 1000 + 11 110 1100 + 12 120 1000 + 13 130 1100 + 14 100 1000 + 15 110 1100 + 16 120 1000 + 17 130 1100 + +echo select distinct f0,f1,f2,f3 from t1; +--------------------------------------------------------- + f0 f1 f2 f3 +--------------------------------------------------------- + 1 10 100 1000 + 2 11 110 1100 + 3 12 120 1000 + 4 13 130 1100 + 5 14 100 1000 + 6 15 110 1100 + 7 16 120 1000 + 1 17 130 1100 + 2 10 100 1000 + 3 11 110 1100 + 4 12 120 1000 + 5 13 130 1100 + 6 14 100 1000 + 7 15 110 1100 + 1 16 120 1000 + 2 17 130 1100 + +echo select distinct f2,f3 from t1; +--------------------------------------------------------- + f2 f3 +--------------------------------------------------------- + 100 1000 + 110 1100 + 120 1000 + 130 1100 + +echo select distinct f2,f3,f4,f5 from t1; +--------------------------------------------------------- + f2 f3 f4 f5 +--------------------------------------------------------- + 100 1000 Bijay 1000.000000 + 110 1100 Jitendr 2000.000000 + 120 1000 Nihar 3000.000000 + 130 1100 Kishor 4000.000000 + 100 1000 Praba 5000.000000 + 110 1100 Sanjit 6000.000000 + 120 1000 Sanjay 7000.000000 + 130 1100 Arindam 8000.000000 + 100 1000 Bijay 9000.000000 + 110 1100 Jitendr 1000.000000 + 120 1000 Nihar 2000.000000 + 130 1100 Kishor 3000.000000 + 100 1000 Praba 4000.000000 + 110 1100 Sanjit 5000.000000 + 120 1000 Sanjay 6000.000000 + 130 1100 Arindam 7000.000000 + +echo select distinct f2,f3,f4,f5,f6 from t1; +--------------------------------------------------------- + f2 f3 f4 f5 f6 +--------------------------------------------------------- + 100 1000 Bijay 1000.000000 100000.000000 + 110 1100 Jitendr 2000.000000 200000.000000 + 120 1000 Nihar 3000.000000 300000.000000 + 130 1100 Kishor 4000.000000 400000.000000 + 100 1000 Praba 5000.000000 500000.000000 + 110 1100 Sanjit 6000.000000 600000.000000 + 120 1000 Sanjay 7000.000000 700000.000000 + 130 1100 Arindam 8000.000000 800000.000000 + 100 1000 Bijay 9000.000000 900000.000000 + 110 1100 Jitendr 1000.000000 100000.000000 + 120 1000 Nihar 2000.000000 200000.000000 + 130 1100 Kishor 3000.000000 300000.000000 + 100 1000 Praba 4000.000000 400000.000000 + 110 1100 Sanjit 5000.000000 500000.000000 + 120 1000 Sanjay 6000.000000 600000.000000 + 130 1100 Arindam 7000.000000 700000.000000 + +echo select distinct f4,f6,f2,f5,f3,f7,f8 from t1; +--------------------------------------------------------- + f4 f6 f2 f5 f3 f7 f8 +--------------------------------------------------------- + Bijay 100000.000000 100 1000.000000 1000 2009/3/1 11:59:59.0 + Jitendr 200000.000000 110 2000.000000 1100 2009/3/2 11:59:58.0 + Nihar 300000.000000 120 3000.000000 1000 2009/3/3 11:59:57.0 + Kishor 400000.000000 130 4000.000000 1100 2009/3/4 11:59:59.0 + Praba 500000.000000 100 5000.000000 1000 2009/3/1 11:59:58.0 + Sanjit 600000.000000 110 6000.000000 1100 2009/3/2 11:59:57.0 + Sanjay 700000.000000 120 7000.000000 1000 2009/3/3 11:59:59.0 + Arindam 800000.000000 130 8000.000000 1100 2009/3/4 11:59:58.0 + Bijay 900000.000000 100 9000.000000 1000 2009/3/1 11:59:57.0 + Jitendr 100000.000000 110 1000.000000 1100 2009/3/2 11:59:58.0 + Nihar 200000.000000 120 2000.000000 1000 2009/3/3 11:59:57.0 + Kishor 300000.000000 130 3000.000000 1100 2009/3/5 11:59:56.0 + Praba 400000.000000 100 4000.000000 1000 2009/3/1 11:59:55.0 + Sanjit 500000.000000 110 5000.000000 1100 2009/3/2 11:59:56.0 + Sanjay 600000.000000 120 6000.000000 1000 2009/3/3 11:59:55.0 + Arindam 700000.000000 130 7000.000000 1100 2009/3/1 11:59:59.0 + +echo select distinct f2,f3,f4,f5,f8,f7,f9,f6 from t1; +--------------------------------------------------------- + f2 f3 f4 f5 f8 f7 f9 f6 +--------------------------------------------------------- + 100 1000 Bijay 1000.000000 11:59:59.0 2009/3/1 2009/3/1 11:59:59.0 100000.000000 + 110 1100 Jitendr 2000.000000 11:59:58.0 2009/3/2 2009/3/2 11:59:59.0 200000.000000 + 120 1000 Nihar 3000.000000 11:59:57.0 2009/3/3 2009/3/3 11:59:59.0 300000.000000 + 130 1100 Kishor 4000.000000 11:59:59.0 2009/3/4 2009/3/4 11:59:59.0 400000.000000 + 100 1000 Praba 5000.000000 11:59:58.0 2009/3/1 2009/3/1 11:59:59.0 500000.000000 + 110 1100 Sanjit 6000.000000 11:59:57.0 2009/3/2 2009/3/2 11:59:59.0 600000.000000 + 120 1000 Sanjay 7000.000000 11:59:59.0 2009/3/3 2009/3/3 11:59:59.0 700000.000000 + 130 1100 Arindam 8000.000000 11:59:58.0 2009/3/4 2009/3/4 11:59:59.0 800000.000000 + 100 1000 Bijay 9000.000000 11:59:57.0 2009/3/1 2009/3/1 11:59:59.0 900000.000000 + 110 1100 Jitendr 1000.000000 11:59:58.0 2009/3/2 2009/3/2 11:59:59.0 100000.000000 + 120 1000 Nihar 2000.000000 11:59:57.0 2009/3/3 2009/3/3 11:59:59.0 200000.000000 + 130 1100 Kishor 3000.000000 11:59:56.0 2009/3/5 2009/3/5 11:59:59.0 300000.000000 + 100 1000 Praba 4000.000000 11:59:55.0 2009/3/1 2009/3/4 11:59:59.0 400000.000000 + 110 1100 Sanjit 5000.000000 11:59:56.0 2009/3/2 2009/3/1 11:59:59.0 500000.000000 + 120 1000 Sanjay 6000.000000 11:59:55.0 2009/3/3 2009/3/3 11:59:59.0 600000.000000 + 130 1100 Arindam 7000.000000 11:59:59.0 2009/3/1 2009/3/1 11:59:59.0 700000.000000 + +Statement Executed diff --git a/test/sql/Distinct/exp.test003.ksh b/test/sql/Distinct/exp.test003.ksh new file mode 100644 index 00000000..e1eadf1a --- /dev/null +++ b/test/sql/Distinct/exp.test003.ksh @@ -0,0 +1,288 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +--------------------------------------------------------- + t1.f0 t1.f1 t1.f2 t1.f3 t1.f4 t1.f5 t1.f6 t1.f7 t1.f8 t1.f9 +--------------------------------------------------------- + 1 10 100 1000 Bijay 1000.000000 100000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + NULL 11 110 1100 Jitendr NULL 200000.000000 2009/3/2 NULL 2009/3/2 11:59:59.0 + 3 12 120 1000 NULL 3000.000000 NULL NULL 11:59:57.0 2009/3/3 11:59:59.0 + 4 NULL NULL 1100 Kishor 4000.000000 400000.000000 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 + 5 14 100 1000 Praba 5000.000000 500000.000000 2009/3/1 NULL 2009/3/1 11:59:59.0 + 6 15 110 NULL Sanjit 6000.000000 600000.000000 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 + 7 16 120 1000 Sanjay 7000.000000 700000.000000 NULL 11:59:59.0 2009/3/3 11:59:59.0 + 1 17 NULL 1100 Arindam 8000.000000 800000.000000 2009/3/4 NULL 2009/3/4 11:59:59.0 + NULL 10 100 NULL Bijay 9000.000000 900000.000000 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 + 3 11 110 1100 Jitendr 1000.000000 100000.000000 NULL NULL 2009/3/2 11:59:59.0 + 4 12 120 1000 NULL NULL 200000.000000 NULL 11:59:57.0 2009/3/3 11:59:59.0 + 5 NULL NULL NULL NULL 3000.000000 NULL 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 + 6 14 100 1000 Praba 4000.000000 400000.000000 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 + 7 15 110 1100 Sanjit 5000.000000 500000.000000 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 + NULL NULL 120 1000 Sanjay NULL NULL NULL NULL 2009/3/3 11:59:59.0 + NULL 17 130 1100 Arindam 7000.000000 700000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + +echo select distinct f0 from t1; +--------------------------------------------------------- + f0 +--------------------------------------------------------- + 1 + NULL + 3 + 4 + 5 + 6 + 7 + +echo select distinct f1 from t1; +--------------------------------------------------------- + f1 +--------------------------------------------------------- + 10 + 11 + 12 + NULL + 14 + 15 + 16 + 17 + +echo select distinct f2 from t1; +--------------------------------------------------------- + f2 +--------------------------------------------------------- + 100 + 110 + 120 + NULL + 130 + +echo select distinct f3 from t1; +--------------------------------------------------------- + f3 +--------------------------------------------------------- + 1000 + 1100 + NULL + +echo select distinct f4 from t1; +--------------------------------------------------------- + f4 +--------------------------------------------------------- + Bijay + Jitendr + NULL + Kishor + Praba + Sanjit + Sanjay + Arindam + +echo select distinct f5 from t1; +--------------------------------------------------------- + f5 +--------------------------------------------------------- + 1000.000000 + NULL + 3000.000000 + 4000.000000 + 5000.000000 + 6000.000000 + 7000.000000 + 8000.000000 + 9000.000000 + +echo select distinct f6 from t1; +--------------------------------------------------------- + f6 +--------------------------------------------------------- + 100000.000000 + 200000.000000 + NULL + 400000.000000 + 500000.000000 + 600000.000000 + 700000.000000 + 800000.000000 + 900000.000000 + +echo select distinct f7 from t1; +--------------------------------------------------------- + f7 +--------------------------------------------------------- + 2009/3/1 + 2009/3/2 + NULL + 2009/3/4 + 2009/3/5 + +echo select distinct f8 from t1; +--------------------------------------------------------- + f8 +--------------------------------------------------------- + 11:59:59.0 + NULL + 11:59:57.0 + 11:59:56.0 + 11:59:55.0 + +echo select distinct f9 from t1; +--------------------------------------------------------- + f9 +--------------------------------------------------------- + 2009/3/1 11:59:59.0 + 2009/3/2 11:59:59.0 + 2009/3/3 11:59:59.0 + 2009/3/4 11:59:59.0 + 2009/3/5 11:59:59.0 + +echo select distinct f1,f2,f3 from t1; +--------------------------------------------------------- + f1 f2 f3 +--------------------------------------------------------- + 10 100 1000 + 11 110 1100 + 12 120 1000 + NULL NULL 1100 + 14 100 1000 + 15 110 NULL + 16 120 1000 + 17 NULL 1100 + 10 100 NULL + NULL NULL NULL + 15 110 1100 + NULL 120 1000 + 17 130 1100 + +echo select distinct f0,f1,f2,f3 from t1; +--------------------------------------------------------- + f0 f1 f2 f3 +--------------------------------------------------------- + 1 10 100 1000 + NULL 11 110 1100 + 3 12 120 1000 + 4 NULL NULL 1100 + 5 14 100 1000 + 6 15 110 NULL + 7 16 120 1000 + 1 17 NULL 1100 + NULL 10 100 NULL + 3 11 110 1100 + 4 12 120 1000 + 5 NULL NULL NULL + 6 14 100 1000 + 7 15 110 1100 + NULL NULL 120 1000 + NULL 17 130 1100 + +echo select distinct f2,f3 from t1; +--------------------------------------------------------- + f2 f3 +--------------------------------------------------------- + 100 1000 + 110 1100 + 120 1000 + NULL 1100 + 110 NULL + 100 NULL + NULL NULL + 130 1100 + +echo select distinct f2,f3,f4,f5 from t1; +--------------------------------------------------------- + f2 f3 f4 f5 +--------------------------------------------------------- + 100 1000 Bijay 1000.000000 + 110 1100 Jitendr NULL + 120 1000 NULL 3000.000000 + NULL 1100 Kishor 4000.000000 + 100 1000 Praba 5000.000000 + 110 NULL Sanjit 6000.000000 + 120 1000 Sanjay 7000.000000 + NULL 1100 Arindam 8000.000000 + 100 NULL Bijay 9000.000000 + 110 1100 Jitendr 1000.000000 + 120 1000 NULL NULL + NULL NULL NULL 3000.000000 + 100 1000 Praba 4000.000000 + 110 1100 Sanjit 5000.000000 + 120 1000 Sanjay NULL + 130 1100 Arindam 7000.000000 + +echo select distinct f2,f3,f4,f5,f6 from t1; +--------------------------------------------------------- + f2 f3 f4 f5 f6 +--------------------------------------------------------- + 100 1000 Bijay 1000.000000 100000.000000 + 110 1100 Jitendr NULL 200000.000000 + 120 1000 NULL 3000.000000 NULL + NULL 1100 Kishor 4000.000000 400000.000000 + 100 1000 Praba 5000.000000 500000.000000 + 110 NULL Sanjit 6000.000000 600000.000000 + 120 1000 Sanjay 7000.000000 700000.000000 + NULL 1100 Arindam 8000.000000 800000.000000 + 100 NULL Bijay 9000.000000 900000.000000 + 110 1100 Jitendr 1000.000000 100000.000000 + 120 1000 NULL NULL 200000.000000 + NULL NULL NULL 3000.000000 NULL + 100 1000 Praba 4000.000000 400000.000000 + 110 1100 Sanjit 5000.000000 500000.000000 + 120 1000 Sanjay NULL NULL + 130 1100 Arindam 7000.000000 700000.000000 + +echo select distinct f4,f6,f2,f5,f3,f7,f8 from t1; +--------------------------------------------------------- + f4 f6 f2 f5 f3 f7 f8 +--------------------------------------------------------- + Bijay 100000.000000 100 1000.000000 1000 2009/3/1 11:59:59.0 + Jitendr 200000.000000 110 NULL 1100 2009/3/2 NULL + NULL NULL 120 3000.000000 1000 NULL 11:59:57.0 + Kishor 400000.000000 NULL 4000.000000 1100 2009/3/4 11:59:59.0 + Praba 500000.000000 100 5000.000000 1000 2009/3/1 NULL + Sanjit 600000.000000 110 6000.000000 NULL 2009/3/2 11:59:57.0 + Sanjay 700000.000000 120 7000.000000 1000 NULL 11:59:59.0 + Arindam 800000.000000 NULL 8000.000000 1100 2009/3/4 NULL + Bijay 900000.000000 100 9000.000000 NULL 2009/3/1 11:59:57.0 + Jitendr 100000.000000 110 1000.000000 1100 NULL NULL + NULL 200000.000000 120 NULL 1000 NULL 11:59:57.0 + NULL NULL NULL 3000.000000 NULL 2009/3/5 11:59:56.0 + Praba 400000.000000 100 4000.000000 1000 2009/3/1 11:59:55.0 + Sanjit 500000.000000 110 5000.000000 1100 2009/3/2 11:59:56.0 + Sanjay NULL 120 NULL 1000 NULL NULL + Arindam 700000.000000 130 7000.000000 1100 2009/3/1 11:59:59.0 + +echo select distinct f2,f3,f4,f5,f8,f7,f9,f6 from t1; +--------------------------------------------------------- + f2 f3 f4 f5 f8 f7 f9 f6 +--------------------------------------------------------- + 100 1000 Bijay 1000.000000 11:59:59.0 2009/3/1 2009/3/1 11:59:59.0 100000.000000 + 110 1100 Jitendr NULL NULL 2009/3/2 2009/3/2 11:59:59.0 200000.000000 + 120 1000 NULL 3000.000000 11:59:57.0 NULL 2009/3/3 11:59:59.0 NULL + NULL 1100 Kishor 4000.000000 11:59:59.0 2009/3/4 2009/3/4 11:59:59.0 400000.000000 + 100 1000 Praba 5000.000000 NULL 2009/3/1 2009/3/1 11:59:59.0 500000.000000 + 110 NULL Sanjit 6000.000000 11:59:57.0 2009/3/2 2009/3/2 11:59:59.0 600000.000000 + 120 1000 Sanjay 7000.000000 11:59:59.0 NULL 2009/3/3 11:59:59.0 700000.000000 + NULL 1100 Arindam 8000.000000 NULL 2009/3/4 2009/3/4 11:59:59.0 800000.000000 + 100 NULL Bijay 9000.000000 11:59:57.0 2009/3/1 2009/3/1 11:59:59.0 900000.000000 + 110 1100 Jitendr 1000.000000 NULL NULL 2009/3/2 11:59:59.0 100000.000000 + 120 1000 NULL NULL 11:59:57.0 NULL 2009/3/3 11:59:59.0 200000.000000 + NULL NULL NULL 3000.000000 11:59:56.0 2009/3/5 2009/3/5 11:59:59.0 NULL + 100 1000 Praba 4000.000000 11:59:55.0 2009/3/1 2009/3/4 11:59:59.0 400000.000000 + 110 1100 Sanjit 5000.000000 11:59:56.0 2009/3/2 2009/3/1 11:59:59.0 500000.000000 + 120 1000 Sanjay NULL NULL NULL 2009/3/3 11:59:59.0 NULL + 130 1100 Arindam 7000.000000 11:59:59.0 2009/3/1 2009/3/1 11:59:59.0 700000.000000 + +Statement Executed diff --git a/test/sql/Distinct/exp.test004.ksh b/test/sql/Distinct/exp.test004.ksh new file mode 100644 index 00000000..dcddebbd --- /dev/null +++ b/test/sql/Distinct/exp.test004.ksh @@ -0,0 +1,300 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 t1.f5 t1.f6 t1.f7 t1.f8 t1.f9 +--------------------------------------------------------- + 10 100 1000 Bijay 1000.000000 100000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + 11 110 1100 Jitendr 2000.000000 200000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 12 120 1000 Nihar 3000.000000 300000.000000 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 1500 Kishor 4000.000000 400000.000000 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 + 14 100 1000 Praba 5000.000000 500000.000000 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 + +echo select * from t2; +--------------------------------------------------------- + t2.f1 t2.f2 t2.f3 t2.f4 t2.f5 t2.f6 t2.f7 t2.f8 t2.f9 +--------------------------------------------------------- + 13 130 1500 Kishor 4000.000000 400000.000000 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 + 16 120 1000 Sanjay 6500.000000 700000.000000 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 + 10 100 1000 Bijay 1000.000000 100000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + 17 130 1100 Arindam 8000.000000 800000.000000 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 + 11 110 1100 Jitendr 2000.000000 200000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + +echo select * from t3; +--------------------------------------------------------- + t3.f1 t3.f2 t3.f3 t3.f4 t3.f5 t3.f6 t3.f7 t3.f8 t3.f9 +--------------------------------------------------------- + 12 120 1000 Nihar 3000.000000 300000.000000 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 14 100 1000 Praba 4000.000000 400000.000000 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 + 13 130 1500 Kishor 4000.000000 400000.000000 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 + 11 110 1100 Jitendr 2000.000000 200000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 16 120 1000 Sanjay 6000.000000 600000.000000 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 + +echo select distinct t1.f1, t2.f1 from t1 inner join t2 on t1.f1 = t2.f1 ; +--------------------------------------------------------- + t1.f1 t2.f1 +--------------------------------------------------------- + 10 10 + 11 11 + 13 13 + +echo select distinct t1.f2, t2.f2 from t1 inner join t2 on t1.f2 = t2.f2 ; +--------------------------------------------------------- + t1.f2 t2.f2 +--------------------------------------------------------- + 100 100 + 110 110 + 120 120 + 130 130 + +echo select distinct t1.f3, t2.f3 from t1 inner join t2 on t1.f3 = t2.f3 ; +--------------------------------------------------------- + t1.f3 t2.f3 +--------------------------------------------------------- + 1000 1000 + 1100 1100 + 1500 1500 + +echo select distinct t1.f4, t2.f4 from t1 inner join t2 on t1.f4 = t2.f4 ; +--------------------------------------------------------- + t1.f4 t2.f4 +--------------------------------------------------------- + Bijay Bijay + Jitendr Jitendr + Kishor Kishor + +echo select distinct t1.f5, t2.f5 from t1 inner join t2 on t1.f5 = t2.f5 ; +--------------------------------------------------------- + t1.f5 t2.f5 +--------------------------------------------------------- + 1000.000000 1000.000000 + 2000.000000 2000.000000 + 4000.000000 4000.000000 + +echo select distinct t1.f6, t2.f6 from t1 inner join t2 on t1.f6 = t2.f6 ; +--------------------------------------------------------- + t1.f6 t2.f6 +--------------------------------------------------------- + 100000.000000 100000.000000 + 200000.000000 200000.000000 + 400000.000000 400000.000000 + +echo select distinct t1.f7, t2.f7 from t1 inner join t2 on t1.f7 = t2.f7 ; +--------------------------------------------------------- + t1.f7 t2.f7 +--------------------------------------------------------- + 2009/3/1 2009/3/1 + 2009/3/2 2009/3/2 + 2009/3/3 2009/3/3 + 2009/3/4 2009/3/4 + +echo select distinct t1.f8, t2.f8 from t1 inner join t2 on t1.f8 = t2.f8 ; +--------------------------------------------------------- + t1.f8 t2.f8 +--------------------------------------------------------- + 11:59:59.0 11:59:59.0 + 11:59:58.0 11:59:58.0 + +echo select distinct t1.f9, t2.f9 from t1 inner join t2 on t1.f9 = t2.f9 ; +--------------------------------------------------------- + t1.f9 t2.f9 +--------------------------------------------------------- + 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + 2009/3/2 11:59:59.0 2009/3/2 11:59:59.0 + 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 + 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 + +echo select distinct t1.f1, t1.f2 from t1 inner join t2 on t1.f1 = t2.f1 ; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 10 100 + 11 110 + 13 130 + +echo select distinct t1.f1, t1.f2 from t1 inner join t2 on t1.f2 = t2.f2 ; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 10 100 + 11 110 + 12 120 + 13 130 + 14 100 + +echo select distinct t1.f1, t1.f3 from t1 inner join t2 on t1.f3 = t2.f3 ; +--------------------------------------------------------- + t1.f1 t1.f3 +--------------------------------------------------------- + 10 1000 + 11 1100 + 12 1000 + 13 1500 + 14 1000 + +echo select distinct t1.f1, t1.f4 from t1 inner join t2 on t1.f4 = t2.f4 ; +--------------------------------------------------------- + t1.f1 t1.f4 +--------------------------------------------------------- + 10 Bijay + 11 Jitendr + 13 Kishor + +echo select distinct t1.f1, t1.f5 from t1 inner join t2 on t1.f5 = t2.f5 ; +--------------------------------------------------------- + t1.f1 t1.f5 +--------------------------------------------------------- + 10 1000.000000 + 11 2000.000000 + 13 4000.000000 + +echo select distinct t1.f1, t1.f6 from t1 inner join t2 on t1.f6 = t2.f6 ; +--------------------------------------------------------- + t1.f1 t1.f6 +--------------------------------------------------------- + 10 100000.000000 + 11 200000.000000 + 13 400000.000000 + +echo select distinct t1.f1, t1.f7 from t1 inner join t2 on t1.f7 = t2.f7 ; +--------------------------------------------------------- + t1.f1 t1.f7 +--------------------------------------------------------- + 10 2009/3/1 + 11 2009/3/2 + 12 2009/3/3 + 13 2009/3/4 + 14 2009/3/1 + +echo select distinct t1.f1, t1.f8 from t1 inner join t2 on t1.f8 = t2.f8 ; +--------------------------------------------------------- + t1.f1 t1.f8 +--------------------------------------------------------- + 10 11:59:59.0 + 11 11:59:58.0 + 13 11:59:59.0 + 14 11:59:58.0 + +echo select distinct t1.f1, t1.f9 from t1 inner join t2 on t1.f9 = t2.f9 ; +--------------------------------------------------------- + t1.f1 t1.f9 +--------------------------------------------------------- + 10 2009/3/1 11:59:59.0 + 11 2009/3/2 11:59:59.0 + 12 2009/3/3 11:59:59.0 + 13 2009/3/4 11:59:59.0 + 14 2009/3/1 11:59:59.0 + +echo select distinct t1.f1, t1.f2, t2.f1, t2.f2 from t1 inner join t2 on t1.f1 = t2.f1 ; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 10 100 10 100 + 11 110 11 110 + 13 130 13 130 + +echo select distinct t1.f1, t1.f2, t2.f1, t2.f2 from t1 inner join t2 on t1.f2 = t2.f2 ; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 10 100 10 100 + 11 110 11 110 + 12 120 16 120 + 13 130 13 130 + 13 130 17 130 + 14 100 10 100 + +echo select distinct t1.f1, t1.f3, t2.f1, t2.f3 from t1 inner join t2 on t1.f3 = t2.f3 ; +--------------------------------------------------------- + t1.f1 t1.f3 t2.f1 t2.f3 +--------------------------------------------------------- + 10 1000 16 1000 + 10 1000 10 1000 + 11 1100 17 1100 + 11 1100 11 1100 + 12 1000 16 1000 + 12 1000 10 1000 + 13 1500 13 1500 + 14 1000 16 1000 + 14 1000 10 1000 + +echo select distinct t1.f1, t1.f4, t2.f1, t2.f4 from t1 inner join t2 on t1.f4 = t2.f4 ; +--------------------------------------------------------- + t1.f1 t1.f4 t2.f1 t2.f4 +--------------------------------------------------------- + 10 Bijay 10 Bijay + 11 Jitendr 11 Jitendr + 13 Kishor 13 Kishor + +echo select distinct t1.f1, t1.f5, t2.f1, t2.f5 from t1 inner join t2 on t1.f5 = t2.f5 ; +--------------------------------------------------------- + t1.f1 t1.f5 t2.f1 t2.f5 +--------------------------------------------------------- + 10 1000.000000 10 1000.000000 + 11 2000.000000 11 2000.000000 + 13 4000.000000 13 4000.000000 + +echo select distinct t1.f1, t1.f6, t2.f1, t2.f6 from t1 inner join t2 on t1.f6 = t2.f6 ; +--------------------------------------------------------- + t1.f1 t1.f6 t2.f1 t2.f6 +--------------------------------------------------------- + 10 100000.000000 10 100000.000000 + 11 200000.000000 11 200000.000000 + 13 400000.000000 13 400000.000000 + +echo select distinct t1.f1, t1.f7, t2.f1, t2.f7 from t1 inner join t2 on t1.f7 = t2.f7 ; +--------------------------------------------------------- + t1.f1 t1.f7 t2.f1 t2.f7 +--------------------------------------------------------- + 10 2009/3/1 10 2009/3/1 + 11 2009/3/2 11 2009/3/2 + 12 2009/3/3 16 2009/3/3 + 13 2009/3/4 13 2009/3/4 + 13 2009/3/4 17 2009/3/4 + 14 2009/3/1 10 2009/3/1 + +echo select distinct t1.f1, t1.f8, t2.f1, t2.f8 from t1 inner join t2 on t1.f8 = t2.f8 ; +--------------------------------------------------------- + t1.f1 t1.f8 t2.f1 t2.f8 +--------------------------------------------------------- + 10 11:59:59.0 13 11:59:59.0 + 10 11:59:59.0 16 11:59:59.0 + 10 11:59:59.0 10 11:59:59.0 + 11 11:59:58.0 17 11:59:58.0 + 11 11:59:58.0 11 11:59:58.0 + 13 11:59:59.0 13 11:59:59.0 + 13 11:59:59.0 16 11:59:59.0 + 13 11:59:59.0 10 11:59:59.0 + 14 11:59:58.0 17 11:59:58.0 + 14 11:59:58.0 11 11:59:58.0 + +echo select distinct t1.f1, t1.f9, t2.f1, t2.f9 from t1 inner join t2 on t1.f9 = t2.f9 ; +--------------------------------------------------------- + t1.f1 t1.f9 t2.f1 t2.f9 +--------------------------------------------------------- + 10 2009/3/1 11:59:59.0 10 2009/3/1 11:59:59.0 + 11 2009/3/2 11:59:59.0 11 2009/3/2 11:59:59.0 + 12 2009/3/3 11:59:59.0 16 2009/3/3 11:59:59.0 + 13 2009/3/4 11:59:59.0 13 2009/3/4 11:59:59.0 + 13 2009/3/4 11:59:59.0 17 2009/3/4 11:59:59.0 + 14 2009/3/1 11:59:59.0 10 2009/3/1 11:59:59.0 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Distinct/exp.test005.ksh b/test/sql/Distinct/exp.test005.ksh new file mode 100644 index 00000000..c1c9d6dc --- /dev/null +++ b/test/sql/Distinct/exp.test005.ksh @@ -0,0 +1,327 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 t1.f5 t1.f6 t1.f7 t1.f8 t1.f9 +--------------------------------------------------------- + 10 100 1000 Bijay 1000.000000 100000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + 11 110 1100 Jitendr 2000.000000 200000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 12 120 1000 Nihar 3000.000000 300000.000000 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 1500 Kishor 4000.000000 400000.000000 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 + 14 100 1000 Praba 5000.000000 500000.000000 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 + +echo select * from t2; +--------------------------------------------------------- + t2.f1 t2.f2 t2.f3 t2.f4 t2.f5 t2.f6 t2.f7 t2.f8 t2.f9 +--------------------------------------------------------- + 13 130 1500 Kishor 4000.000000 400000.000000 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 + 16 120 1000 Sanjay 6500.000000 700000.000000 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 + 10 100 1000 Bijay 1000.000000 100000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + 17 130 1100 Arindam 8000.000000 800000.000000 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 + 11 110 1100 Jitendr 2000.000000 200000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + +echo select * from t3; +--------------------------------------------------------- + t3.f1 t3.f2 t3.f3 t3.f4 t3.f5 t3.f6 t3.f7 t3.f8 t3.f9 +--------------------------------------------------------- + 12 120 1000 Nihar 3000.000000 300000.000000 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 14 100 1000 Praba 4000.000000 400000.000000 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 + 13 130 1500 Kishor 4000.000000 400000.000000 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 + 11 110 1100 Jitendr 2000.000000 200000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 16 120 1000 Sanjay 6000.000000 600000.000000 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 + +echo select distinct t1.f1, t2.f1 from t1 left join t2 on t1.f1 = t2.f1 ; +--------------------------------------------------------- + t1.f1 t2.f1 +--------------------------------------------------------- + 10 10 + 11 11 + 12 NULL + 13 13 + 14 NULL + +echo select distinct t1.f2, t2.f2 from t1 left join t2 on t1.f2 = t2.f2 ; +--------------------------------------------------------- + t1.f2 t2.f2 +--------------------------------------------------------- + 100 100 + 110 110 + 120 120 + 130 130 + +echo select distinct t1.f3, t2.f3 from t1 left join t2 on t1.f3 = t2.f3 ; +--------------------------------------------------------- + t1.f3 t2.f3 +--------------------------------------------------------- + 1000 1000 + 1100 1100 + 1500 1500 + +echo select distinct t1.f4, t2.f4 from t1 left join t2 on t1.f4 = t2.f4 ; +--------------------------------------------------------- + t1.f4 t2.f4 +--------------------------------------------------------- + Bijay Bijay + Jitendr Jitendr + Nihar NULL + Kishor Kishor + Praba NULL + +echo select distinct t1.f5, t2.f5 from t1 left join t2 on t1.f5 = t2.f5 ; +--------------------------------------------------------- + t1.f5 t2.f5 +--------------------------------------------------------- + 1000.000000 1000.000000 + 2000.000000 2000.000000 + 3000.000000 NULL + 4000.000000 4000.000000 + 5000.000000 NULL + +echo select distinct t1.f6, t2.f6 from t1 left join t2 on t1.f6 = t2.f6 ; +--------------------------------------------------------- + t1.f6 t2.f6 +--------------------------------------------------------- + 100000.000000 100000.000000 + 200000.000000 200000.000000 + 300000.000000 NULL + 400000.000000 400000.000000 + 500000.000000 NULL + +echo select distinct t1.f7, t2.f7 from t1 left join t2 on t1.f7 = t2.f7 ; +--------------------------------------------------------- + t1.f7 t2.f7 +--------------------------------------------------------- + 2009/3/1 2009/3/1 + 2009/3/2 2009/3/2 + 2009/3/3 2009/3/3 + 2009/3/4 2009/3/4 + +echo select distinct t1.f8, t2.f8 from t1 left join t2 on t1.f8 = t2.f8 ; +--------------------------------------------------------- + t1.f8 t2.f8 +--------------------------------------------------------- + 11:59:59.0 11:59:59.0 + 11:59:58.0 11:59:58.0 + 11:59:57.0 NULL + +echo select distinct t1.f9, t2.f9 from t1 left join t2 on t1.f9 = t2.f9 ; +--------------------------------------------------------- + t1.f9 t2.f9 +--------------------------------------------------------- + 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + 2009/3/2 11:59:59.0 2009/3/2 11:59:59.0 + 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 + 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 + +echo select distinct t1.f1, t1.f2 from t1 left join t2 on t1.f1 = t2.f1 ; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 10 100 + 11 110 + 12 120 + 13 130 + 14 100 + +echo select distinct t1.f1, t1.f2 from t1 left join t2 on t1.f2 = t2.f2 ; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 10 100 + 11 110 + 12 120 + 13 130 + 14 100 + +echo select distinct t1.f1, t1.f3 from t1 left join t2 on t1.f3 = t2.f3 ; +--------------------------------------------------------- + t1.f1 t1.f3 +--------------------------------------------------------- + 10 1000 + 11 1100 + 12 1000 + 13 1500 + 14 1000 + +echo select distinct t1.f1, t1.f4 from t1 left join t2 on t1.f4 = t2.f4 ; +--------------------------------------------------------- + t1.f1 t1.f4 +--------------------------------------------------------- + 10 Bijay + 11 Jitendr + 12 Nihar + 13 Kishor + 14 Praba + +echo select distinct t1.f1, t1.f5 from t1 left join t2 on t1.f5 = t2.f5 ; +--------------------------------------------------------- + t1.f1 t1.f5 +--------------------------------------------------------- + 10 1000.000000 + 11 2000.000000 + 12 3000.000000 + 13 4000.000000 + 14 5000.000000 + +echo select distinct t1.f1, t1.f6 from t1 left join t2 on t1.f6 = t2.f6 ; +--------------------------------------------------------- + t1.f1 t1.f6 +--------------------------------------------------------- + 10 100000.000000 + 11 200000.000000 + 12 300000.000000 + 13 400000.000000 + 14 500000.000000 + +echo select distinct t1.f1, t1.f7 from t1 left join t2 on t1.f7 = t2.f7 ; +--------------------------------------------------------- + t1.f1 t1.f7 +--------------------------------------------------------- + 10 2009/3/1 + 11 2009/3/2 + 12 2009/3/3 + 13 2009/3/4 + 14 2009/3/1 + +echo select distinct t1.f1, t1.f8 from t1 left join t2 on t1.f8 = t2.f8 ; +--------------------------------------------------------- + t1.f1 t1.f8 +--------------------------------------------------------- + 10 11:59:59.0 + 11 11:59:58.0 + 12 11:59:57.0 + 13 11:59:59.0 + 14 11:59:58.0 + +echo select distinct t1.f1, t1.f9 from t1 left join t2 on t1.f9 = t2.f9 ; +--------------------------------------------------------- + t1.f1 t1.f9 +--------------------------------------------------------- + 10 2009/3/1 11:59:59.0 + 11 2009/3/2 11:59:59.0 + 12 2009/3/3 11:59:59.0 + 13 2009/3/4 11:59:59.0 + 14 2009/3/1 11:59:59.0 + +echo select distinct t1.f1, t1.f2, t2.f1, t2.f2 from t1 left join t2 on t1.f1 = t2.f1 ; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 10 100 10 100 + 11 110 11 110 + 12 120 NULL NULL + 13 130 13 130 + 14 100 NULL NULL + +echo select distinct t1.f1, t1.f2, t2.f1, t2.f2 from t1 left join t2 on t1.f2 = t2.f2 ; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 10 100 10 100 + 11 110 11 110 + 12 120 16 120 + 13 130 13 130 + 13 130 17 130 + 14 100 10 100 + +echo select distinct t1.f1, t1.f3, t2.f1, t2.f3 from t1 left join t2 on t1.f3 = t2.f3 ; +--------------------------------------------------------- + t1.f1 t1.f3 t2.f1 t2.f3 +--------------------------------------------------------- + 10 1000 16 1000 + 10 1000 10 1000 + 11 1100 17 1100 + 11 1100 11 1100 + 12 1000 16 1000 + 12 1000 10 1000 + 13 1500 13 1500 + 14 1000 16 1000 + 14 1000 10 1000 + +echo select distinct t1.f1, t1.f4, t2.f1, t2.f4 from t1 left join t2 on t1.f4 = t2.f4 ; +--------------------------------------------------------- + t1.f1 t1.f4 t2.f1 t2.f4 +--------------------------------------------------------- + 10 Bijay 10 Bijay + 11 Jitendr 11 Jitendr + 12 Nihar NULL NULL + 13 Kishor 13 Kishor + 14 Praba NULL NULL + +echo select distinct t1.f1, t1.f5, t2.f1, t2.f5 from t1 left join t2 on t1.f5 = t2.f5 ; +--------------------------------------------------------- + t1.f1 t1.f5 t2.f1 t2.f5 +--------------------------------------------------------- + 10 1000.000000 10 1000.000000 + 11 2000.000000 11 2000.000000 + 12 3000.000000 NULL NULL + 13 4000.000000 13 4000.000000 + 14 5000.000000 NULL NULL + +echo select distinct t1.f1, t1.f6, t2.f1, t2.f6 from t1 left join t2 on t1.f6 = t2.f6 ; +--------------------------------------------------------- + t1.f1 t1.f6 t2.f1 t2.f6 +--------------------------------------------------------- + 10 100000.000000 10 100000.000000 + 11 200000.000000 11 200000.000000 + 12 300000.000000 NULL NULL + 13 400000.000000 13 400000.000000 + 14 500000.000000 NULL NULL + +echo select distinct t1.f1, t1.f7, t2.f1, t2.f7 from t1 left join t2 on t1.f7 = t2.f7 ; +--------------------------------------------------------- + t1.f1 t1.f7 t2.f1 t2.f7 +--------------------------------------------------------- + 10 2009/3/1 10 2009/3/1 + 11 2009/3/2 11 2009/3/2 + 12 2009/3/3 16 2009/3/3 + 13 2009/3/4 13 2009/3/4 + 13 2009/3/4 17 2009/3/4 + 14 2009/3/1 10 2009/3/1 + +echo select distinct t1.f1, t1.f8, t2.f1, t2.f8 from t1 left join t2 on t1.f8 = t2.f8 ; +--------------------------------------------------------- + t1.f1 t1.f8 t2.f1 t2.f8 +--------------------------------------------------------- + 10 11:59:59.0 13 11:59:59.0 + 10 11:59:59.0 16 11:59:59.0 + 10 11:59:59.0 10 11:59:59.0 + 11 11:59:58.0 17 11:59:58.0 + 11 11:59:58.0 11 11:59:58.0 + 12 11:59:57.0 NULL NULL + 13 11:59:59.0 13 11:59:59.0 + 13 11:59:59.0 16 11:59:59.0 + 13 11:59:59.0 10 11:59:59.0 + 14 11:59:58.0 17 11:59:58.0 + 14 11:59:58.0 11 11:59:58.0 + +echo select distinct t1.f1, t1.f9, t2.f1, t2.f9 from t1 left join t2 on t1.f9 = t2.f9 ; +--------------------------------------------------------- + t1.f1 t1.f9 t2.f1 t2.f9 +--------------------------------------------------------- + 10 2009/3/1 11:59:59.0 10 2009/3/1 11:59:59.0 + 11 2009/3/2 11:59:59.0 11 2009/3/2 11:59:59.0 + 12 2009/3/3 11:59:59.0 16 2009/3/3 11:59:59.0 + 13 2009/3/4 11:59:59.0 13 2009/3/4 11:59:59.0 + 13 2009/3/4 11:59:59.0 17 2009/3/4 11:59:59.0 + 14 2009/3/1 11:59:59.0 10 2009/3/1 11:59:59.0 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Distinct/test001.ksh b/test/sql/Distinct/test001.ksh new file mode 100755 index 00000000..b59c5c63 --- /dev/null +++ b/test/sql/Distinct/test001.ksh @@ -0,0 +1,24 @@ +#!/bin/ksh +# Testing DISTINCT Clause +# +CREATEFILE=${PWD}/sql/Distinct/dropt1.sql +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Distinct +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/distinct1.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Distinct/test002.ksh b/test/sql/Distinct/test002.ksh new file mode 100755 index 00000000..2991beb2 --- /dev/null +++ b/test/sql/Distinct/test002.ksh @@ -0,0 +1,31 @@ +#!/bin/ksh +# Testing DISTINCT Clause on all datatypes. +# +CREATEFILE=${PWD}/sql/Distinct/dropt1.sql +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Distinct +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/alldatatype.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/distinct_alltypes.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Distinct/test003.ksh b/test/sql/Distinct/test003.ksh new file mode 100755 index 00000000..56479793 --- /dev/null +++ b/test/sql/Distinct/test003.ksh @@ -0,0 +1,31 @@ +#!/bin/ksh +# Testing DISTINCT Clause on all datatypes and NULL values. +# +CREATEFILE=${PWD}/sql/Distinct/dropt1.sql +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Distinct +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/alldatatype_with_null.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/distinct_alltypes.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Distinct/test004.ksh b/test/sql/Distinct/test004.ksh new file mode 100755 index 00000000..0d099db1 --- /dev/null +++ b/test/sql/Distinct/test004.ksh @@ -0,0 +1,31 @@ +#!/bin/ksh +# Testing DISTINCT by applying inner Join on two tables with all datatypes . +# +CREATEFILE=${PWD}/sql/Distinct/drop_t1_t2_t3.sql +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Distinct +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/alldatatype_t1_t2_t3.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/distinct_alltypes_innerjoin.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Distinct/test005.ksh b/test/sql/Distinct/test005.ksh new file mode 100755 index 00000000..8bd20057 --- /dev/null +++ b/test/sql/Distinct/test005.ksh @@ -0,0 +1,31 @@ +#!/bin/ksh +# Testing DISTINCT by applying left Join on two tables with all datatypes . +# +CREATEFILE=${PWD}/sql/Distinct/drop_t1_t2_t3.sql +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Distinct +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/alldatatype_t1_t2_t3.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/distinct_alltypes_leftjoin.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Join/alldatatype.sql b/test/sql/Join/alldatatype.sql new file mode 100644 index 00000000..c18024b7 --- /dev/null +++ b/test/sql/Join/alldatatype.sql @@ -0,0 +1,24 @@ +create table t1(f1 smallint,f2 int,f3 bigint,f4 char(10),f5 float,f6 double,f7 date,f8 time,f9 timestamp); +insert into t1 values(10,100 ,1000, 'Bijay',1000,100000,'2009-03-01','11:59:59','2009-03-01 11:59:59'); +insert into t1 values(11,110 ,1100, 'Jitendr',2000,200000,'2009-03-02','11:59:58','2009-03-02 11:59:59'); +insert into t1 values(12,120 ,1000, 'Nihar',3000,300000,'2009-03-03','11:59:57','2009-03-03 11:59:59'); +insert into t1 values(13,130 ,1500, 'Kishor',4000,400000,'2009-03-04','11:59:59','2009-03-04 11:59:59'); +insert into t1 values(14,100 ,1000, 'Praba',5000,500000,'2009-03-01','11:59:58','2009-03-01 11:59:59'); +create table t2(f1 smallint,f2 int,f3 bigint,f4 char(10),f5 float,f6 double,f7 date,f8 time,f9 timestamp); +insert into t2 values(13,110 ,1100, 'Sanjit',6000,600000,'2009-03-02','11:59:57','2009-03-02 11:59:59'); +insert into t2 values(16,120 ,1000, 'Sanjay',6500,700000,'2009-03-03','11:59:59','2009-03-03 11:59:59'); +insert into t2 values(17,130 ,1100, 'Arindam',8000,800000,'2009-03-04','11:59:58','2009-03-04 11:59:59'); +insert into t2 values(10,100 ,1000, 'Bijay',9000,900000,'2009-03-01','11:59:57','2009-03-01 11:59:59'); +insert into t2 values(11,110 ,1100, 'Jitendr',1000,100000,'2009-03-02','11:59:58','2009-03-02 11:59:59'); +create table t3(f1 smallint,f2 int,f3 bigint,f4 char(10),f5 float,f6 double,f7 date,f8 time,f9 timestamp); +insert into t3 values(12,120 ,1000, 'Nihar',2000,200000,'2009-03-03','11:59:56','2009-03-03 11:59:59'); +insert into t3 values(13,130 ,1100, 'Kishor',3000,300000,'2009-03-05','11:59:56','2009-03-05 11:59:59'); +insert into t3 values(14,100 ,1000, 'Praba',4000,400000,'2009-03-01','11:59:55','2009-03-04 11:59:59'); +insert into t3 values(15,110 ,1100, 'Sanjit',5000,500000,'2009-03-02','11:59:56','2009-03-01 11:59:59'); +insert into t3 values(16,120 ,1000, 'Sanjay',6000,600000,'2009-03-03','11:59:55','2009-03-03 11:59:59'); +echo select * from t1; +select * from t1; +echo select * from t2; +select * from t2; +echo select * from t3; +select * from t3; diff --git a/test/sql/Join/composite1.sql b/test/sql/Join/composite1.sql new file mode 100644 index 00000000..4b07fa55 --- /dev/null +++ b/test/sql/Join/composite1.sql @@ -0,0 +1,6 @@ +echo create table t1(f1 int,f2 int); +create table t1(f1 int,f2 int); +echo create index idx1 on t1(f1,f2) hash; +create index idx1 on t1(f1,f2) hash; +echo create table t2(f1 int,f2 int); +create table t2(f1 int,f2 int); diff --git a/test/sql/Join/composite10.sql b/test/sql/Join/composite10.sql new file mode 100644 index 00000000..0c201d12 --- /dev/null +++ b/test/sql/Join/composite10.sql @@ -0,0 +1,8 @@ +echo create table t1(f1 int,f2 int); +create table t1(f1 int,f2 int); +echo create index idx1 on t1(f1) tree; +create index idx1 on t1(f1) tree; +echo create table t2(f1 int,f2 int); +create table t2(f1 int,f2 int); +echo create index idx2 on t2(f2,f1) hash; +create index idx2 on t2(f2,f1) hash; diff --git a/test/sql/Join/composite11.sql b/test/sql/Join/composite11.sql new file mode 100644 index 00000000..3f14a98a --- /dev/null +++ b/test/sql/Join/composite11.sql @@ -0,0 +1,8 @@ +echo create table t1(f1 int,f2 int); +create table t1(f1 int,f2 int); +echo create index idx1 on t1(f2) tree; +create index idx1 on t1(f2) tree; +echo create table t2(f1 int,f2 int); +create table t2(f1 int,f2 int); +echo create index idx2 on t1(f2,f1) hash; +create index idx2 on t1(f2,f1) hash; diff --git a/test/sql/Join/composite12.sql b/test/sql/Join/composite12.sql new file mode 100644 index 00000000..e13b9099 --- /dev/null +++ b/test/sql/Join/composite12.sql @@ -0,0 +1,10 @@ +echo create table t1(f1 int,f2 int); +create table t1(f1 int,f2 int); +echo create index idx1 on t1(f2) tree; +create index idx1 on t1(f2) tree; +echo create index idx2 on t1(f1) tree; +create index idx2 on t1(f1) tree; +echo create table t2(f1 int,f2 int); +create table t2(f1 int,f2 int); +echo create index idx3 on t1(f2,f1) hash; +create index idx3 on t1(f2,f1) hash; diff --git a/test/sql/Join/composite2.sql b/test/sql/Join/composite2.sql new file mode 100644 index 00000000..2d1ed18e --- /dev/null +++ b/test/sql/Join/composite2.sql @@ -0,0 +1,6 @@ +echo create table t1(f1 int,f2 int); +create table t1(f1 int,f2 int); +echo create table t2(f1 int,f2 int); +create table t2(f1 int,f2 int); +echo create index idx2 on t2(f1,f2) hash; +create index idx2 on t2(f1,f2) hash; diff --git a/test/sql/Join/composite3.sql b/test/sql/Join/composite3.sql new file mode 100644 index 00000000..15e04486 --- /dev/null +++ b/test/sql/Join/composite3.sql @@ -0,0 +1,6 @@ +echo create table t1(f1 int,f2 int); +create table t1(f1 int,f2 int); +echo create index idx1 on t1(f2,f1) hash; +create index idx1 on t1(f2,f1) hash; +echo create table t2(f1 int,f2 int); +create table t2(f1 int,f2 int); diff --git a/test/sql/Join/composite4.sql b/test/sql/Join/composite4.sql new file mode 100644 index 00000000..53635307 --- /dev/null +++ b/test/sql/Join/composite4.sql @@ -0,0 +1,6 @@ +echo create table t1(f1 int,f2 int); +create table t1(f1 int,f2 int); +echo create table t2(f1 int,f2 int); +create table t2(f1 int,f2 int); +echo create index idx2 on t2(f2,f1) hash; +create index idx2 on t2(f2,f1) hash; diff --git a/test/sql/Join/composite5.sql b/test/sql/Join/composite5.sql new file mode 100644 index 00000000..4d404f71 --- /dev/null +++ b/test/sql/Join/composite5.sql @@ -0,0 +1,8 @@ +echo create table t1(f1 int,f2 int); +create table t1(f1 int,f2 int); +echo create index idx1 on t1(f1,f2) hash; +create index idx1 on t1(f1,f2) hash; +echo create table t2(f1 int,f2 int); +create table t2(f1 int,f2 int); +echo create index idx2 on t2(f2,f1) hash; +create index idx2 on t2(f2,f1) hash; diff --git a/test/sql/Join/composite6.sql b/test/sql/Join/composite6.sql new file mode 100644 index 00000000..02c41bff --- /dev/null +++ b/test/sql/Join/composite6.sql @@ -0,0 +1,8 @@ +echo create table t1(f1 int,f2 int); +create table t1(f1 int,f2 int); +echo create index idx1 on t1(f2,f1) hash; +create index idx1 on t1(f2,f1) hash; +echo create table t2(f1 int,f2 int); +create table t2(f1 int,f2 int); +echo create index idx2 on t2(f1,f2) hash; +create index idx2 on t2(f1,f2) hash; diff --git a/test/sql/Join/composite7.sql b/test/sql/Join/composite7.sql new file mode 100644 index 00000000..9a1004f3 --- /dev/null +++ b/test/sql/Join/composite7.sql @@ -0,0 +1,8 @@ +echo create table t1(f1 int,f2 int); +create table t1(f1 int,f2 int); +echo create index idx1 on t1(f1,f2) hash; +create index idx1 on t1(f1,f2) hash; +echo create table t2(f1 int,f2 int); +create table t2(f1 int,f2 int); +echo create index idx2 on t2(f1) tree; +create index idx2 on t2(f1) tree; diff --git a/test/sql/Join/composite8.sql b/test/sql/Join/composite8.sql new file mode 100644 index 00000000..c662cbb6 --- /dev/null +++ b/test/sql/Join/composite8.sql @@ -0,0 +1,8 @@ +echo create table t1(f1 int,f2 int); +create table t1(f1 int,f2 int); +echo create index idx1 on t1(f1,f2) hash; +create index idx1 on t1(f1,f2) hash; +echo create table t2(f1 int,f2 int); +create table t2(f1 int,f2 int); +echo create index idx2 on t1(f2) tree; +create index idx2 on t1(f2) tree; diff --git a/test/sql/Join/composite9.sql b/test/sql/Join/composite9.sql new file mode 100644 index 00000000..4c864715 --- /dev/null +++ b/test/sql/Join/composite9.sql @@ -0,0 +1,10 @@ +echo create table t1(f1 int,f2 int); +create table t1(f1 int,f2 int); +echo create index idx1 on t1(f1,f2) hash; +create index idx1 on t1(f1,f2) hash; +echo create table t2(f1 int,f2 int); +create table t2(f1 int,f2 int); +echo create index idx2 on t2(f1) tree; +create index idx2 on t2(f1) tree; +echo create index idx3 on t2(f2) tree; +create index idx3 on t2(f2) tree; diff --git a/test/sql/Join/createt1.sql b/test/sql/Join/createt1.sql new file mode 100644 index 00000000..1b4461ab --- /dev/null +++ b/test/sql/Join/createt1.sql @@ -0,0 +1,6 @@ +create table t1(f1 int,f2 int,primary key(f1)); +insert into t1 values(1,10); +insert into t1 values(2,20); +insert into t1 values(3,30); +insert into t1 values(4,40); + diff --git a/test/sql/Join/createt1t2.sql b/test/sql/Join/createt1t2.sql new file mode 100644 index 00000000..96233a4c --- /dev/null +++ b/test/sql/Join/createt1t2.sql @@ -0,0 +1,14 @@ +create table t1(f1 int,f2 int,f3 int,primary key(f1)); +insert into t1 values(98,13,108); +insert into t1 values(99,14,109); +insert into t1 values(100,15,109); +insert into t1 values(101,16,110); +insert into t1 values(102,17,111); +insert into t1 values(103,18,112); +create table t2(f1 int,f2 int,f3 int,primary key(f1)); +insert into t2 values(98,13,108); +insert into t2 values(99,14,109); +insert into t2 values(100,15,109); +insert into t2 values(101,16,110); +insert into t2 values(102,17,111); +insert into t2 values(103,18,112); diff --git a/test/sql/Join/createt1t2t3.sql b/test/sql/Join/createt1t2t3.sql new file mode 100644 index 00000000..5aff90dd --- /dev/null +++ b/test/sql/Join/createt1t2t3.sql @@ -0,0 +1,12 @@ +create table t1(f1 int,f2 int,f3 int,primary key(f1)); +insert into t1 values(98,13,108); +insert into t1 values(99,14,109); +insert into t1 values(100,15,109); +create table t2(f1 int,f2 int,f3 int,primary key(f1)); +insert into t2 values(98,13,108); +insert into t2 values(99,14,109); +insert into t2 values(100,15,109); +create table t3(f1 int,f2 int,f3 int,primary key(f1)); +insert into t3 values(98,13,108); +insert into t3 values(100,109,109); +insert into t3 values(102,17,111); diff --git a/test/sql/Join/createt1t2t3t4t5.sql b/test/sql/Join/createt1t2t3t4t5.sql new file mode 100644 index 00000000..d9ab1049 --- /dev/null +++ b/test/sql/Join/createt1t2t3t4t5.sql @@ -0,0 +1,27 @@ +create table t1(f1 int,f2 int,f3 int,primary key(f1)); +insert into t1 values(98,13,108); +insert into t1 values(99,14,109); +insert into t1 values(100,15,109); +insert into t1 values(101,16,110); +insert into t1 values(102,17,111); +insert into t1 values(103,18,112); +create table t2(f1 int,f2 int,f3 int,primary key(f1)); +insert into t2 values(98,13,108); +insert into t2 values(99,14,109); +insert into t2 values(100,15,109); +insert into t2 values(101,16,110); +insert into t2 values(102,17,111); +insert into t2 values(103,18,112); +create table t3(f1 int,f2 int,f3 int,primary key(f1)); +insert into t3 values(98,13,108); +insert into t3 values(99,14,109); +insert into t3 values(100,15,109); +insert into t3 values(101,16,110); +insert into t3 values(102,17,111); +insert into t3 values(103,18,112); +create table t4(f1 int,f2 int); +insert into t4 values(1,10); +insert into t4 values(2,20); +create table t5(f1 int,f2 int); +insert into t5 values(3,30); +insert into t5 values(4,40); diff --git a/test/sql/Join/crosjoin_t1_t2_t3.sql b/test/sql/Join/crosjoin_t1_t2_t3.sql new file mode 100644 index 00000000..5dff472f --- /dev/null +++ b/test/sql/Join/crosjoin_t1_t2_t3.sql @@ -0,0 +1,6 @@ +echo select * from t1,t2,t3; +select * from t1,t2,t3; +echo select * from t2,t1,t3; +select * from t2,t1,t3; +echo select * from t3,t1,t2; +select * from t3,t1,t2; diff --git a/test/sql/Join/drop_emp_dept.sql b/test/sql/Join/drop_emp_dept.sql new file mode 100644 index 00000000..3fdf55d0 --- /dev/null +++ b/test/sql/Join/drop_emp_dept.sql @@ -0,0 +1,4 @@ +echo drop table emp; +drop table emp; +echo drop table dept; +drop table dept; diff --git a/test/sql/Join/drop_t1_t2.sql b/test/sql/Join/drop_t1_t2.sql new file mode 100644 index 00000000..9c354ab0 --- /dev/null +++ b/test/sql/Join/drop_t1_t2.sql @@ -0,0 +1,2 @@ +drop table t1; +drop table t2; diff --git a/test/sql/Join/drop_t1_t2_t3.sql b/test/sql/Join/drop_t1_t2_t3.sql new file mode 100644 index 00000000..3e9ecdb1 --- /dev/null +++ b/test/sql/Join/drop_t1_t2_t3.sql @@ -0,0 +1,3 @@ +drop table t1; +drop table t2; +drop table t3; diff --git a/test/sql/Join/dropt1.sql b/test/sql/Join/dropt1.sql new file mode 100644 index 00000000..853c1ad6 --- /dev/null +++ b/test/sql/Join/dropt1.sql @@ -0,0 +1 @@ +drop table t1; diff --git a/test/sql/Join/dropt11.sql b/test/sql/Join/dropt11.sql new file mode 100644 index 00000000..34a16d31 --- /dev/null +++ b/test/sql/Join/dropt11.sql @@ -0,0 +1 @@ +drop table t11; diff --git a/test/sql/Join/dropt11t12.sql b/test/sql/Join/dropt11t12.sql new file mode 100644 index 00000000..de61bb49 --- /dev/null +++ b/test/sql/Join/dropt11t12.sql @@ -0,0 +1,2 @@ +drop table t11; +drop table t12; diff --git a/test/sql/Join/dropt11t12t13.sql b/test/sql/Join/dropt11t12t13.sql new file mode 100644 index 00000000..b86985db --- /dev/null +++ b/test/sql/Join/dropt11t12t13.sql @@ -0,0 +1,4 @@ +drop table t11; +drop table t12; +drop table t13; +\ diff --git a/test/sql/Join/dropt11t13.sql b/test/sql/Join/dropt11t13.sql new file mode 100644 index 00000000..af455023 --- /dev/null +++ b/test/sql/Join/dropt11t13.sql @@ -0,0 +1,2 @@ +drop table t11; +drop table t13; diff --git a/test/sql/Join/dropt1t2.sql b/test/sql/Join/dropt1t2.sql new file mode 100644 index 00000000..9c354ab0 --- /dev/null +++ b/test/sql/Join/dropt1t2.sql @@ -0,0 +1,2 @@ +drop table t1; +drop table t2; diff --git a/test/sql/Join/dropt1t2t3.sql b/test/sql/Join/dropt1t2t3.sql new file mode 100644 index 00000000..3e9ecdb1 --- /dev/null +++ b/test/sql/Join/dropt1t2t3.sql @@ -0,0 +1,3 @@ +drop table t1; +drop table t2; +drop table t3; diff --git a/test/sql/Join/dropt1t2t3t4t5.sql b/test/sql/Join/dropt1t2t3t4t5.sql new file mode 100644 index 00000000..a7c61193 --- /dev/null +++ b/test/sql/Join/dropt1t2t3t4t5.sql @@ -0,0 +1,5 @@ +drop table t1; +drop table t2; +drop table t3; +drop table t4; +drop table t5; diff --git a/test/sql/Join/equijoin1_with_and_t1_t2_t3.sql b/test/sql/Join/equijoin1_with_and_t1_t2_t3.sql new file mode 100644 index 00000000..ce4943e1 --- /dev/null +++ b/test/sql/Join/equijoin1_with_and_t1_t2_t3.sql @@ -0,0 +1,6 @@ +echo select * from t1,t2,t3 where t1.f1 = t2.f1 and t3.f1=100; +select * from t1,t2,t3 where t1.f1 = t2.f1 and t3.f1=100; +echo select * from t2,t1,t3 where t1.f1 = t2.f1 and t3.f1=100; +select * from t2,t1,t3 where t1.f1 = t2.f1 and t3.f1=100; +echo select * from t3,t1,t2 where t1.f1 = t2.f1 and t3.f1=100; +select * from t3,t1,t2 where t1.f1 = t2.f1 and t3.f1=100; diff --git a/test/sql/Join/equijoin2_with_and_t1_t2_t3.sql b/test/sql/Join/equijoin2_with_and_t1_t2_t3.sql new file mode 100644 index 00000000..4ef78410 --- /dev/null +++ b/test/sql/Join/equijoin2_with_and_t1_t2_t3.sql @@ -0,0 +1,6 @@ +echo select * from t1,t2,t3 where t1.f1 = t2.f1 and t2.f1=100; +select * from t1,t2,t3 where t1.f1 = t2.f1 and t2.f1=100; +echo select * from t2,t1,t3 where t1.f1 = t2.f1 and t2.f1=100; +select * from t2,t1,t3 where t1.f1 = t2.f1 and t2.f1=100; +echo select * from t3,t1,t2 where t1.f1 = t2.f1 and t2.f1=100; +select * from t3,t1,t2 where t1.f1 = t2.f1 and t2.f1=100; diff --git a/test/sql/Join/equijoin3_with_and_t1_t2_t3.sql b/test/sql/Join/equijoin3_with_and_t1_t2_t3.sql new file mode 100644 index 00000000..d9c90f03 --- /dev/null +++ b/test/sql/Join/equijoin3_with_and_t1_t2_t3.sql @@ -0,0 +1,6 @@ +echo select * from t1,t2,t3 where t1.f1 = t2.f1 and t2.f1 = t3.f1; +select * from t1,t2,t3 where t1.f1 = t2.f1 and t2.f1 = t3.f1; +echo select * from t2,t1,t3 where t1.f1 = t2.f1 and t2.f1 = t3.f1; +select * from t2,t1,t3 where t1.f1 = t2.f1 and t2.f1 = t3.f1; +echo select * from t3,t1,t2 where t1.f1 = t2.f1 and t2.f1 = t3.f1; +select * from t3,t1,t2 where t1.f1 = t2.f1 and t2.f1 = t3.f1; diff --git a/test/sql/Join/equijoin4_with_and_t1_t2_t3.sql b/test/sql/Join/equijoin4_with_and_t1_t2_t3.sql new file mode 100644 index 00000000..c911c1be --- /dev/null +++ b/test/sql/Join/equijoin4_with_and_t1_t2_t3.sql @@ -0,0 +1,6 @@ +echo select * from t1,t2,t3 where t1.f1 = t2.f1 and t2.f1 = t3.f1 and t3.f1 = 100; +select * from t1,t2,t3 where t1.f1 = t2.f1 and t2.f1 = t3.f1 and t3.f1 = 100; +echo select * from t2,t1,t3 where t1.f1 = t2.f1 and t2.f1 = t3.f1 and t3.f1 = 100; +select * from t2,t1,t3 where t1.f1 = t2.f1 and t2.f1 = t3.f1 and t3.f1 = 100; +echo select * from t3,t1,t2 where t1.f1 = t2.f1 and t2.f1 = t3.f1 and t3.f1 = 100; +select * from t3,t1,t2 where t1.f1 = t2.f1 and t2.f1 = t3.f1 and t3.f1 = 100; diff --git a/test/sql/Join/equijoin_t1_t2_t3.sql b/test/sql/Join/equijoin_t1_t2_t3.sql new file mode 100644 index 00000000..4ffc94d1 --- /dev/null +++ b/test/sql/Join/equijoin_t1_t2_t3.sql @@ -0,0 +1,6 @@ +echo select * from t1,t2,t3 where t1.f1 = t2.f1; +select * from t1,t2,t3 where t1.f1 = t2.f1; +echo select * from t2,t1,t3 where t1.f1 = t2.f1; +select * from t2,t1,t3 where t1.f1 = t2.f1; +echo select * from t3,t1,t2 where t1.f1 = t2.f1; +select * from t3,t1,t2 where t1.f1 = t2.f1; diff --git a/test/sql/Join/exp.test001.ksh b/test/sql/Join/exp.test001.ksh new file mode 100644 index 00000000..55343d2e --- /dev/null +++ b/test/sql/Join/exp.test001.ksh @@ -0,0 +1,15 @@ +echo select t1.f1 from t1; +--------------------------------------------------------- + t1.f1 +--------------------------------------------------------- + 1 + 2 + 3 + 4 + +echo select t1.f30 from t1; +Statement prepare failed with error -19 +echo select * from t1,t55 ; +Statement prepare failed with error -5 +echo select t100.f1 from t1; +Statement prepare failed with error -19 diff --git a/test/sql/Join/exp.test002.ksh b/test/sql/Join/exp.test002.ksh new file mode 100644 index 00000000..d455bcaa --- /dev/null +++ b/test/sql/Join/exp.test002.ksh @@ -0,0 +1,37 @@ +echo select * from t1,t2 where t1.f1>100 or t2.f1<100; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t2.f1 t2.f2 t2.f3 +--------------------------------------------------------- + 98 13 108 98 13 108 + 98 13 108 99 14 109 + 99 14 109 98 13 108 + 99 14 109 99 14 109 + 100 15 109 98 13 108 + 100 15 109 99 14 109 + 101 16 110 98 13 108 + 101 16 110 99 14 109 + 101 16 110 100 15 109 + 101 16 110 101 16 110 + 101 16 110 102 17 111 + 101 16 110 103 18 112 + 102 17 111 98 13 108 + 102 17 111 99 14 109 + 102 17 111 100 15 109 + 102 17 111 101 16 110 + 102 17 111 102 17 111 + 102 17 111 103 18 112 + 103 18 112 98 13 108 + 103 18 112 99 14 109 + 103 18 112 100 15 109 + 103 18 112 101 16 110 + 103 18 112 102 17 111 + 103 18 112 103 18 112 + +echo select * from t1,t2 where t1.f1 = t2.f1 and t1.f1 >100; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t2.f1 t2.f2 t2.f3 +--------------------------------------------------------- + 101 16 110 101 16 110 + 102 17 111 102 17 111 + 103 18 112 103 18 112 + diff --git a/test/sql/Join/exp.test003.ksh b/test/sql/Join/exp.test003.ksh new file mode 100644 index 00000000..dedba937 --- /dev/null +++ b/test/sql/Join/exp.test003.ksh @@ -0,0 +1,892 @@ +echo select * from t1,t2,t3,t4,t5; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t2.f1 t2.f2 t2.f3 t3.f1 t3.f2 t3.f3 t4.f1 t4.f2 t5.f1 t5.f2 +--------------------------------------------------------- + 98 13 108 98 13 108 98 13 108 1 10 3 30 + 98 13 108 98 13 108 98 13 108 1 10 4 40 + 98 13 108 98 13 108 98 13 108 2 20 3 30 + 98 13 108 98 13 108 98 13 108 2 20 4 40 + 98 13 108 98 13 108 99 14 109 1 10 3 30 + 98 13 108 98 13 108 99 14 109 1 10 4 40 + 98 13 108 98 13 108 99 14 109 2 20 3 30 + 98 13 108 98 13 108 99 14 109 2 20 4 40 + 98 13 108 98 13 108 100 15 109 1 10 3 30 + 98 13 108 98 13 108 100 15 109 1 10 4 40 + 98 13 108 98 13 108 100 15 109 2 20 3 30 + 98 13 108 98 13 108 100 15 109 2 20 4 40 + 98 13 108 98 13 108 101 16 110 1 10 3 30 + 98 13 108 98 13 108 101 16 110 1 10 4 40 + 98 13 108 98 13 108 101 16 110 2 20 3 30 + 98 13 108 98 13 108 101 16 110 2 20 4 40 + 98 13 108 98 13 108 102 17 111 1 10 3 30 + 98 13 108 98 13 108 102 17 111 1 10 4 40 + 98 13 108 98 13 108 102 17 111 2 20 3 30 + 98 13 108 98 13 108 102 17 111 2 20 4 40 + 98 13 108 98 13 108 103 18 112 1 10 3 30 + 98 13 108 98 13 108 103 18 112 1 10 4 40 + 98 13 108 98 13 108 103 18 112 2 20 3 30 + 98 13 108 98 13 108 103 18 112 2 20 4 40 + 98 13 108 99 14 109 98 13 108 1 10 3 30 + 98 13 108 99 14 109 98 13 108 1 10 4 40 + 98 13 108 99 14 109 98 13 108 2 20 3 30 + 98 13 108 99 14 109 98 13 108 2 20 4 40 + 98 13 108 99 14 109 99 14 109 1 10 3 30 + 98 13 108 99 14 109 99 14 109 1 10 4 40 + 98 13 108 99 14 109 99 14 109 2 20 3 30 + 98 13 108 99 14 109 99 14 109 2 20 4 40 + 98 13 108 99 14 109 100 15 109 1 10 3 30 + 98 13 108 99 14 109 100 15 109 1 10 4 40 + 98 13 108 99 14 109 100 15 109 2 20 3 30 + 98 13 108 99 14 109 100 15 109 2 20 4 40 + 98 13 108 99 14 109 101 16 110 1 10 3 30 + 98 13 108 99 14 109 101 16 110 1 10 4 40 + 98 13 108 99 14 109 101 16 110 2 20 3 30 + 98 13 108 99 14 109 101 16 110 2 20 4 40 + 98 13 108 99 14 109 102 17 111 1 10 3 30 + 98 13 108 99 14 109 102 17 111 1 10 4 40 + 98 13 108 99 14 109 102 17 111 2 20 3 30 + 98 13 108 99 14 109 102 17 111 2 20 4 40 + 98 13 108 99 14 109 103 18 112 1 10 3 30 + 98 13 108 99 14 109 103 18 112 1 10 4 40 + 98 13 108 99 14 109 103 18 112 2 20 3 30 + 98 13 108 99 14 109 103 18 112 2 20 4 40 + 98 13 108 100 15 109 98 13 108 1 10 3 30 + 98 13 108 100 15 109 98 13 108 1 10 4 40 + 98 13 108 100 15 109 98 13 108 2 20 3 30 + 98 13 108 100 15 109 98 13 108 2 20 4 40 + 98 13 108 100 15 109 99 14 109 1 10 3 30 + 98 13 108 100 15 109 99 14 109 1 10 4 40 + 98 13 108 100 15 109 99 14 109 2 20 3 30 + 98 13 108 100 15 109 99 14 109 2 20 4 40 + 98 13 108 100 15 109 100 15 109 1 10 3 30 + 98 13 108 100 15 109 100 15 109 1 10 4 40 + 98 13 108 100 15 109 100 15 109 2 20 3 30 + 98 13 108 100 15 109 100 15 109 2 20 4 40 + 98 13 108 100 15 109 101 16 110 1 10 3 30 + 98 13 108 100 15 109 101 16 110 1 10 4 40 + 98 13 108 100 15 109 101 16 110 2 20 3 30 + 98 13 108 100 15 109 101 16 110 2 20 4 40 + 98 13 108 100 15 109 102 17 111 1 10 3 30 + 98 13 108 100 15 109 102 17 111 1 10 4 40 + 98 13 108 100 15 109 102 17 111 2 20 3 30 + 98 13 108 100 15 109 102 17 111 2 20 4 40 + 98 13 108 100 15 109 103 18 112 1 10 3 30 + 98 13 108 100 15 109 103 18 112 1 10 4 40 + 98 13 108 100 15 109 103 18 112 2 20 3 30 + 98 13 108 100 15 109 103 18 112 2 20 4 40 + 98 13 108 101 16 110 98 13 108 1 10 3 30 + 98 13 108 101 16 110 98 13 108 1 10 4 40 + 98 13 108 101 16 110 98 13 108 2 20 3 30 + 98 13 108 101 16 110 98 13 108 2 20 4 40 + 98 13 108 101 16 110 99 14 109 1 10 3 30 + 98 13 108 101 16 110 99 14 109 1 10 4 40 + 98 13 108 101 16 110 99 14 109 2 20 3 30 + 98 13 108 101 16 110 99 14 109 2 20 4 40 + 98 13 108 101 16 110 100 15 109 1 10 3 30 + 98 13 108 101 16 110 100 15 109 1 10 4 40 + 98 13 108 101 16 110 100 15 109 2 20 3 30 + 98 13 108 101 16 110 100 15 109 2 20 4 40 + 98 13 108 101 16 110 101 16 110 1 10 3 30 + 98 13 108 101 16 110 101 16 110 1 10 4 40 + 98 13 108 101 16 110 101 16 110 2 20 3 30 + 98 13 108 101 16 110 101 16 110 2 20 4 40 + 98 13 108 101 16 110 102 17 111 1 10 3 30 + 98 13 108 101 16 110 102 17 111 1 10 4 40 + 98 13 108 101 16 110 102 17 111 2 20 3 30 + 98 13 108 101 16 110 102 17 111 2 20 4 40 + 98 13 108 101 16 110 103 18 112 1 10 3 30 + 98 13 108 101 16 110 103 18 112 1 10 4 40 + 98 13 108 101 16 110 103 18 112 2 20 3 30 + 98 13 108 101 16 110 103 18 112 2 20 4 40 + 98 13 108 102 17 111 98 13 108 1 10 3 30 + 98 13 108 102 17 111 98 13 108 1 10 4 40 + 98 13 108 102 17 111 98 13 108 2 20 3 30 + 98 13 108 102 17 111 98 13 108 2 20 4 40 + 98 13 108 102 17 111 99 14 109 1 10 3 30 + 98 13 108 102 17 111 99 14 109 1 10 4 40 + 98 13 108 102 17 111 99 14 109 2 20 3 30 + 98 13 108 102 17 111 99 14 109 2 20 4 40 + 98 13 108 102 17 111 100 15 109 1 10 3 30 + 98 13 108 102 17 111 100 15 109 1 10 4 40 + 98 13 108 102 17 111 100 15 109 2 20 3 30 + 98 13 108 102 17 111 100 15 109 2 20 4 40 + 98 13 108 102 17 111 101 16 110 1 10 3 30 + 98 13 108 102 17 111 101 16 110 1 10 4 40 + 98 13 108 102 17 111 101 16 110 2 20 3 30 + 98 13 108 102 17 111 101 16 110 2 20 4 40 + 98 13 108 102 17 111 102 17 111 1 10 3 30 + 98 13 108 102 17 111 102 17 111 1 10 4 40 + 98 13 108 102 17 111 102 17 111 2 20 3 30 + 98 13 108 102 17 111 102 17 111 2 20 4 40 + 98 13 108 102 17 111 103 18 112 1 10 3 30 + 98 13 108 102 17 111 103 18 112 1 10 4 40 + 98 13 108 102 17 111 103 18 112 2 20 3 30 + 98 13 108 102 17 111 103 18 112 2 20 4 40 + 98 13 108 103 18 112 98 13 108 1 10 3 30 + 98 13 108 103 18 112 98 13 108 1 10 4 40 + 98 13 108 103 18 112 98 13 108 2 20 3 30 + 98 13 108 103 18 112 98 13 108 2 20 4 40 + 98 13 108 103 18 112 99 14 109 1 10 3 30 + 98 13 108 103 18 112 99 14 109 1 10 4 40 + 98 13 108 103 18 112 99 14 109 2 20 3 30 + 98 13 108 103 18 112 99 14 109 2 20 4 40 + 98 13 108 103 18 112 100 15 109 1 10 3 30 + 98 13 108 103 18 112 100 15 109 1 10 4 40 + 98 13 108 103 18 112 100 15 109 2 20 3 30 + 98 13 108 103 18 112 100 15 109 2 20 4 40 + 98 13 108 103 18 112 101 16 110 1 10 3 30 + 98 13 108 103 18 112 101 16 110 1 10 4 40 + 98 13 108 103 18 112 101 16 110 2 20 3 30 + 98 13 108 103 18 112 101 16 110 2 20 4 40 + 98 13 108 103 18 112 102 17 111 1 10 3 30 + 98 13 108 103 18 112 102 17 111 1 10 4 40 + 98 13 108 103 18 112 102 17 111 2 20 3 30 + 98 13 108 103 18 112 102 17 111 2 20 4 40 + 98 13 108 103 18 112 103 18 112 1 10 3 30 + 98 13 108 103 18 112 103 18 112 1 10 4 40 + 98 13 108 103 18 112 103 18 112 2 20 3 30 + 98 13 108 103 18 112 103 18 112 2 20 4 40 + 99 14 109 98 13 108 98 13 108 1 10 3 30 + 99 14 109 98 13 108 98 13 108 1 10 4 40 + 99 14 109 98 13 108 98 13 108 2 20 3 30 + 99 14 109 98 13 108 98 13 108 2 20 4 40 + 99 14 109 98 13 108 99 14 109 1 10 3 30 + 99 14 109 98 13 108 99 14 109 1 10 4 40 + 99 14 109 98 13 108 99 14 109 2 20 3 30 + 99 14 109 98 13 108 99 14 109 2 20 4 40 + 99 14 109 98 13 108 100 15 109 1 10 3 30 + 99 14 109 98 13 108 100 15 109 1 10 4 40 + 99 14 109 98 13 108 100 15 109 2 20 3 30 + 99 14 109 98 13 108 100 15 109 2 20 4 40 + 99 14 109 98 13 108 101 16 110 1 10 3 30 + 99 14 109 98 13 108 101 16 110 1 10 4 40 + 99 14 109 98 13 108 101 16 110 2 20 3 30 + 99 14 109 98 13 108 101 16 110 2 20 4 40 + 99 14 109 98 13 108 102 17 111 1 10 3 30 + 99 14 109 98 13 108 102 17 111 1 10 4 40 + 99 14 109 98 13 108 102 17 111 2 20 3 30 + 99 14 109 98 13 108 102 17 111 2 20 4 40 + 99 14 109 98 13 108 103 18 112 1 10 3 30 + 99 14 109 98 13 108 103 18 112 1 10 4 40 + 99 14 109 98 13 108 103 18 112 2 20 3 30 + 99 14 109 98 13 108 103 18 112 2 20 4 40 + 99 14 109 99 14 109 98 13 108 1 10 3 30 + 99 14 109 99 14 109 98 13 108 1 10 4 40 + 99 14 109 99 14 109 98 13 108 2 20 3 30 + 99 14 109 99 14 109 98 13 108 2 20 4 40 + 99 14 109 99 14 109 99 14 109 1 10 3 30 + 99 14 109 99 14 109 99 14 109 1 10 4 40 + 99 14 109 99 14 109 99 14 109 2 20 3 30 + 99 14 109 99 14 109 99 14 109 2 20 4 40 + 99 14 109 99 14 109 100 15 109 1 10 3 30 + 99 14 109 99 14 109 100 15 109 1 10 4 40 + 99 14 109 99 14 109 100 15 109 2 20 3 30 + 99 14 109 99 14 109 100 15 109 2 20 4 40 + 99 14 109 99 14 109 101 16 110 1 10 3 30 + 99 14 109 99 14 109 101 16 110 1 10 4 40 + 99 14 109 99 14 109 101 16 110 2 20 3 30 + 99 14 109 99 14 109 101 16 110 2 20 4 40 + 99 14 109 99 14 109 102 17 111 1 10 3 30 + 99 14 109 99 14 109 102 17 111 1 10 4 40 + 99 14 109 99 14 109 102 17 111 2 20 3 30 + 99 14 109 99 14 109 102 17 111 2 20 4 40 + 99 14 109 99 14 109 103 18 112 1 10 3 30 + 99 14 109 99 14 109 103 18 112 1 10 4 40 + 99 14 109 99 14 109 103 18 112 2 20 3 30 + 99 14 109 99 14 109 103 18 112 2 20 4 40 + 99 14 109 100 15 109 98 13 108 1 10 3 30 + 99 14 109 100 15 109 98 13 108 1 10 4 40 + 99 14 109 100 15 109 98 13 108 2 20 3 30 + 99 14 109 100 15 109 98 13 108 2 20 4 40 + 99 14 109 100 15 109 99 14 109 1 10 3 30 + 99 14 109 100 15 109 99 14 109 1 10 4 40 + 99 14 109 100 15 109 99 14 109 2 20 3 30 + 99 14 109 100 15 109 99 14 109 2 20 4 40 + 99 14 109 100 15 109 100 15 109 1 10 3 30 + 99 14 109 100 15 109 100 15 109 1 10 4 40 + 99 14 109 100 15 109 100 15 109 2 20 3 30 + 99 14 109 100 15 109 100 15 109 2 20 4 40 + 99 14 109 100 15 109 101 16 110 1 10 3 30 + 99 14 109 100 15 109 101 16 110 1 10 4 40 + 99 14 109 100 15 109 101 16 110 2 20 3 30 + 99 14 109 100 15 109 101 16 110 2 20 4 40 + 99 14 109 100 15 109 102 17 111 1 10 3 30 + 99 14 109 100 15 109 102 17 111 1 10 4 40 + 99 14 109 100 15 109 102 17 111 2 20 3 30 + 99 14 109 100 15 109 102 17 111 2 20 4 40 + 99 14 109 100 15 109 103 18 112 1 10 3 30 + 99 14 109 100 15 109 103 18 112 1 10 4 40 + 99 14 109 100 15 109 103 18 112 2 20 3 30 + 99 14 109 100 15 109 103 18 112 2 20 4 40 + 99 14 109 101 16 110 98 13 108 1 10 3 30 + 99 14 109 101 16 110 98 13 108 1 10 4 40 + 99 14 109 101 16 110 98 13 108 2 20 3 30 + 99 14 109 101 16 110 98 13 108 2 20 4 40 + 99 14 109 101 16 110 99 14 109 1 10 3 30 + 99 14 109 101 16 110 99 14 109 1 10 4 40 + 99 14 109 101 16 110 99 14 109 2 20 3 30 + 99 14 109 101 16 110 99 14 109 2 20 4 40 + 99 14 109 101 16 110 100 15 109 1 10 3 30 + 99 14 109 101 16 110 100 15 109 1 10 4 40 + 99 14 109 101 16 110 100 15 109 2 20 3 30 + 99 14 109 101 16 110 100 15 109 2 20 4 40 + 99 14 109 101 16 110 101 16 110 1 10 3 30 + 99 14 109 101 16 110 101 16 110 1 10 4 40 + 99 14 109 101 16 110 101 16 110 2 20 3 30 + 99 14 109 101 16 110 101 16 110 2 20 4 40 + 99 14 109 101 16 110 102 17 111 1 10 3 30 + 99 14 109 101 16 110 102 17 111 1 10 4 40 + 99 14 109 101 16 110 102 17 111 2 20 3 30 + 99 14 109 101 16 110 102 17 111 2 20 4 40 + 99 14 109 101 16 110 103 18 112 1 10 3 30 + 99 14 109 101 16 110 103 18 112 1 10 4 40 + 99 14 109 101 16 110 103 18 112 2 20 3 30 + 99 14 109 101 16 110 103 18 112 2 20 4 40 + 99 14 109 102 17 111 98 13 108 1 10 3 30 + 99 14 109 102 17 111 98 13 108 1 10 4 40 + 99 14 109 102 17 111 98 13 108 2 20 3 30 + 99 14 109 102 17 111 98 13 108 2 20 4 40 + 99 14 109 102 17 111 99 14 109 1 10 3 30 + 99 14 109 102 17 111 99 14 109 1 10 4 40 + 99 14 109 102 17 111 99 14 109 2 20 3 30 + 99 14 109 102 17 111 99 14 109 2 20 4 40 + 99 14 109 102 17 111 100 15 109 1 10 3 30 + 99 14 109 102 17 111 100 15 109 1 10 4 40 + 99 14 109 102 17 111 100 15 109 2 20 3 30 + 99 14 109 102 17 111 100 15 109 2 20 4 40 + 99 14 109 102 17 111 101 16 110 1 10 3 30 + 99 14 109 102 17 111 101 16 110 1 10 4 40 + 99 14 109 102 17 111 101 16 110 2 20 3 30 + 99 14 109 102 17 111 101 16 110 2 20 4 40 + 99 14 109 102 17 111 102 17 111 1 10 3 30 + 99 14 109 102 17 111 102 17 111 1 10 4 40 + 99 14 109 102 17 111 102 17 111 2 20 3 30 + 99 14 109 102 17 111 102 17 111 2 20 4 40 + 99 14 109 102 17 111 103 18 112 1 10 3 30 + 99 14 109 102 17 111 103 18 112 1 10 4 40 + 99 14 109 102 17 111 103 18 112 2 20 3 30 + 99 14 109 102 17 111 103 18 112 2 20 4 40 + 99 14 109 103 18 112 98 13 108 1 10 3 30 + 99 14 109 103 18 112 98 13 108 1 10 4 40 + 99 14 109 103 18 112 98 13 108 2 20 3 30 + 99 14 109 103 18 112 98 13 108 2 20 4 40 + 99 14 109 103 18 112 99 14 109 1 10 3 30 + 99 14 109 103 18 112 99 14 109 1 10 4 40 + 99 14 109 103 18 112 99 14 109 2 20 3 30 + 99 14 109 103 18 112 99 14 109 2 20 4 40 + 99 14 109 103 18 112 100 15 109 1 10 3 30 + 99 14 109 103 18 112 100 15 109 1 10 4 40 + 99 14 109 103 18 112 100 15 109 2 20 3 30 + 99 14 109 103 18 112 100 15 109 2 20 4 40 + 99 14 109 103 18 112 101 16 110 1 10 3 30 + 99 14 109 103 18 112 101 16 110 1 10 4 40 + 99 14 109 103 18 112 101 16 110 2 20 3 30 + 99 14 109 103 18 112 101 16 110 2 20 4 40 + 99 14 109 103 18 112 102 17 111 1 10 3 30 + 99 14 109 103 18 112 102 17 111 1 10 4 40 + 99 14 109 103 18 112 102 17 111 2 20 3 30 + 99 14 109 103 18 112 102 17 111 2 20 4 40 + 99 14 109 103 18 112 103 18 112 1 10 3 30 + 99 14 109 103 18 112 103 18 112 1 10 4 40 + 99 14 109 103 18 112 103 18 112 2 20 3 30 + 99 14 109 103 18 112 103 18 112 2 20 4 40 + 100 15 109 98 13 108 98 13 108 1 10 3 30 + 100 15 109 98 13 108 98 13 108 1 10 4 40 + 100 15 109 98 13 108 98 13 108 2 20 3 30 + 100 15 109 98 13 108 98 13 108 2 20 4 40 + 100 15 109 98 13 108 99 14 109 1 10 3 30 + 100 15 109 98 13 108 99 14 109 1 10 4 40 + 100 15 109 98 13 108 99 14 109 2 20 3 30 + 100 15 109 98 13 108 99 14 109 2 20 4 40 + 100 15 109 98 13 108 100 15 109 1 10 3 30 + 100 15 109 98 13 108 100 15 109 1 10 4 40 + 100 15 109 98 13 108 100 15 109 2 20 3 30 + 100 15 109 98 13 108 100 15 109 2 20 4 40 + 100 15 109 98 13 108 101 16 110 1 10 3 30 + 100 15 109 98 13 108 101 16 110 1 10 4 40 + 100 15 109 98 13 108 101 16 110 2 20 3 30 + 100 15 109 98 13 108 101 16 110 2 20 4 40 + 100 15 109 98 13 108 102 17 111 1 10 3 30 + 100 15 109 98 13 108 102 17 111 1 10 4 40 + 100 15 109 98 13 108 102 17 111 2 20 3 30 + 100 15 109 98 13 108 102 17 111 2 20 4 40 + 100 15 109 98 13 108 103 18 112 1 10 3 30 + 100 15 109 98 13 108 103 18 112 1 10 4 40 + 100 15 109 98 13 108 103 18 112 2 20 3 30 + 100 15 109 98 13 108 103 18 112 2 20 4 40 + 100 15 109 99 14 109 98 13 108 1 10 3 30 + 100 15 109 99 14 109 98 13 108 1 10 4 40 + 100 15 109 99 14 109 98 13 108 2 20 3 30 + 100 15 109 99 14 109 98 13 108 2 20 4 40 + 100 15 109 99 14 109 99 14 109 1 10 3 30 + 100 15 109 99 14 109 99 14 109 1 10 4 40 + 100 15 109 99 14 109 99 14 109 2 20 3 30 + 100 15 109 99 14 109 99 14 109 2 20 4 40 + 100 15 109 99 14 109 100 15 109 1 10 3 30 + 100 15 109 99 14 109 100 15 109 1 10 4 40 + 100 15 109 99 14 109 100 15 109 2 20 3 30 + 100 15 109 99 14 109 100 15 109 2 20 4 40 + 100 15 109 99 14 109 101 16 110 1 10 3 30 + 100 15 109 99 14 109 101 16 110 1 10 4 40 + 100 15 109 99 14 109 101 16 110 2 20 3 30 + 100 15 109 99 14 109 101 16 110 2 20 4 40 + 100 15 109 99 14 109 102 17 111 1 10 3 30 + 100 15 109 99 14 109 102 17 111 1 10 4 40 + 100 15 109 99 14 109 102 17 111 2 20 3 30 + 100 15 109 99 14 109 102 17 111 2 20 4 40 + 100 15 109 99 14 109 103 18 112 1 10 3 30 + 100 15 109 99 14 109 103 18 112 1 10 4 40 + 100 15 109 99 14 109 103 18 112 2 20 3 30 + 100 15 109 99 14 109 103 18 112 2 20 4 40 + 100 15 109 100 15 109 98 13 108 1 10 3 30 + 100 15 109 100 15 109 98 13 108 1 10 4 40 + 100 15 109 100 15 109 98 13 108 2 20 3 30 + 100 15 109 100 15 109 98 13 108 2 20 4 40 + 100 15 109 100 15 109 99 14 109 1 10 3 30 + 100 15 109 100 15 109 99 14 109 1 10 4 40 + 100 15 109 100 15 109 99 14 109 2 20 3 30 + 100 15 109 100 15 109 99 14 109 2 20 4 40 + 100 15 109 100 15 109 100 15 109 1 10 3 30 + 100 15 109 100 15 109 100 15 109 1 10 4 40 + 100 15 109 100 15 109 100 15 109 2 20 3 30 + 100 15 109 100 15 109 100 15 109 2 20 4 40 + 100 15 109 100 15 109 101 16 110 1 10 3 30 + 100 15 109 100 15 109 101 16 110 1 10 4 40 + 100 15 109 100 15 109 101 16 110 2 20 3 30 + 100 15 109 100 15 109 101 16 110 2 20 4 40 + 100 15 109 100 15 109 102 17 111 1 10 3 30 + 100 15 109 100 15 109 102 17 111 1 10 4 40 + 100 15 109 100 15 109 102 17 111 2 20 3 30 + 100 15 109 100 15 109 102 17 111 2 20 4 40 + 100 15 109 100 15 109 103 18 112 1 10 3 30 + 100 15 109 100 15 109 103 18 112 1 10 4 40 + 100 15 109 100 15 109 103 18 112 2 20 3 30 + 100 15 109 100 15 109 103 18 112 2 20 4 40 + 100 15 109 101 16 110 98 13 108 1 10 3 30 + 100 15 109 101 16 110 98 13 108 1 10 4 40 + 100 15 109 101 16 110 98 13 108 2 20 3 30 + 100 15 109 101 16 110 98 13 108 2 20 4 40 + 100 15 109 101 16 110 99 14 109 1 10 3 30 + 100 15 109 101 16 110 99 14 109 1 10 4 40 + 100 15 109 101 16 110 99 14 109 2 20 3 30 + 100 15 109 101 16 110 99 14 109 2 20 4 40 + 100 15 109 101 16 110 100 15 109 1 10 3 30 + 100 15 109 101 16 110 100 15 109 1 10 4 40 + 100 15 109 101 16 110 100 15 109 2 20 3 30 + 100 15 109 101 16 110 100 15 109 2 20 4 40 + 100 15 109 101 16 110 101 16 110 1 10 3 30 + 100 15 109 101 16 110 101 16 110 1 10 4 40 + 100 15 109 101 16 110 101 16 110 2 20 3 30 + 100 15 109 101 16 110 101 16 110 2 20 4 40 + 100 15 109 101 16 110 102 17 111 1 10 3 30 + 100 15 109 101 16 110 102 17 111 1 10 4 40 + 100 15 109 101 16 110 102 17 111 2 20 3 30 + 100 15 109 101 16 110 102 17 111 2 20 4 40 + 100 15 109 101 16 110 103 18 112 1 10 3 30 + 100 15 109 101 16 110 103 18 112 1 10 4 40 + 100 15 109 101 16 110 103 18 112 2 20 3 30 + 100 15 109 101 16 110 103 18 112 2 20 4 40 + 100 15 109 102 17 111 98 13 108 1 10 3 30 + 100 15 109 102 17 111 98 13 108 1 10 4 40 + 100 15 109 102 17 111 98 13 108 2 20 3 30 + 100 15 109 102 17 111 98 13 108 2 20 4 40 + 100 15 109 102 17 111 99 14 109 1 10 3 30 + 100 15 109 102 17 111 99 14 109 1 10 4 40 + 100 15 109 102 17 111 99 14 109 2 20 3 30 + 100 15 109 102 17 111 99 14 109 2 20 4 40 + 100 15 109 102 17 111 100 15 109 1 10 3 30 + 100 15 109 102 17 111 100 15 109 1 10 4 40 + 100 15 109 102 17 111 100 15 109 2 20 3 30 + 100 15 109 102 17 111 100 15 109 2 20 4 40 + 100 15 109 102 17 111 101 16 110 1 10 3 30 + 100 15 109 102 17 111 101 16 110 1 10 4 40 + 100 15 109 102 17 111 101 16 110 2 20 3 30 + 100 15 109 102 17 111 101 16 110 2 20 4 40 + 100 15 109 102 17 111 102 17 111 1 10 3 30 + 100 15 109 102 17 111 102 17 111 1 10 4 40 + 100 15 109 102 17 111 102 17 111 2 20 3 30 + 100 15 109 102 17 111 102 17 111 2 20 4 40 + 100 15 109 102 17 111 103 18 112 1 10 3 30 + 100 15 109 102 17 111 103 18 112 1 10 4 40 + 100 15 109 102 17 111 103 18 112 2 20 3 30 + 100 15 109 102 17 111 103 18 112 2 20 4 40 + 100 15 109 103 18 112 98 13 108 1 10 3 30 + 100 15 109 103 18 112 98 13 108 1 10 4 40 + 100 15 109 103 18 112 98 13 108 2 20 3 30 + 100 15 109 103 18 112 98 13 108 2 20 4 40 + 100 15 109 103 18 112 99 14 109 1 10 3 30 + 100 15 109 103 18 112 99 14 109 1 10 4 40 + 100 15 109 103 18 112 99 14 109 2 20 3 30 + 100 15 109 103 18 112 99 14 109 2 20 4 40 + 100 15 109 103 18 112 100 15 109 1 10 3 30 + 100 15 109 103 18 112 100 15 109 1 10 4 40 + 100 15 109 103 18 112 100 15 109 2 20 3 30 + 100 15 109 103 18 112 100 15 109 2 20 4 40 + 100 15 109 103 18 112 101 16 110 1 10 3 30 + 100 15 109 103 18 112 101 16 110 1 10 4 40 + 100 15 109 103 18 112 101 16 110 2 20 3 30 + 100 15 109 103 18 112 101 16 110 2 20 4 40 + 100 15 109 103 18 112 102 17 111 1 10 3 30 + 100 15 109 103 18 112 102 17 111 1 10 4 40 + 100 15 109 103 18 112 102 17 111 2 20 3 30 + 100 15 109 103 18 112 102 17 111 2 20 4 40 + 100 15 109 103 18 112 103 18 112 1 10 3 30 + 100 15 109 103 18 112 103 18 112 1 10 4 40 + 100 15 109 103 18 112 103 18 112 2 20 3 30 + 100 15 109 103 18 112 103 18 112 2 20 4 40 + 101 16 110 98 13 108 98 13 108 1 10 3 30 + 101 16 110 98 13 108 98 13 108 1 10 4 40 + 101 16 110 98 13 108 98 13 108 2 20 3 30 + 101 16 110 98 13 108 98 13 108 2 20 4 40 + 101 16 110 98 13 108 99 14 109 1 10 3 30 + 101 16 110 98 13 108 99 14 109 1 10 4 40 + 101 16 110 98 13 108 99 14 109 2 20 3 30 + 101 16 110 98 13 108 99 14 109 2 20 4 40 + 101 16 110 98 13 108 100 15 109 1 10 3 30 + 101 16 110 98 13 108 100 15 109 1 10 4 40 + 101 16 110 98 13 108 100 15 109 2 20 3 30 + 101 16 110 98 13 108 100 15 109 2 20 4 40 + 101 16 110 98 13 108 101 16 110 1 10 3 30 + 101 16 110 98 13 108 101 16 110 1 10 4 40 + 101 16 110 98 13 108 101 16 110 2 20 3 30 + 101 16 110 98 13 108 101 16 110 2 20 4 40 + 101 16 110 98 13 108 102 17 111 1 10 3 30 + 101 16 110 98 13 108 102 17 111 1 10 4 40 + 101 16 110 98 13 108 102 17 111 2 20 3 30 + 101 16 110 98 13 108 102 17 111 2 20 4 40 + 101 16 110 98 13 108 103 18 112 1 10 3 30 + 101 16 110 98 13 108 103 18 112 1 10 4 40 + 101 16 110 98 13 108 103 18 112 2 20 3 30 + 101 16 110 98 13 108 103 18 112 2 20 4 40 + 101 16 110 99 14 109 98 13 108 1 10 3 30 + 101 16 110 99 14 109 98 13 108 1 10 4 40 + 101 16 110 99 14 109 98 13 108 2 20 3 30 + 101 16 110 99 14 109 98 13 108 2 20 4 40 + 101 16 110 99 14 109 99 14 109 1 10 3 30 + 101 16 110 99 14 109 99 14 109 1 10 4 40 + 101 16 110 99 14 109 99 14 109 2 20 3 30 + 101 16 110 99 14 109 99 14 109 2 20 4 40 + 101 16 110 99 14 109 100 15 109 1 10 3 30 + 101 16 110 99 14 109 100 15 109 1 10 4 40 + 101 16 110 99 14 109 100 15 109 2 20 3 30 + 101 16 110 99 14 109 100 15 109 2 20 4 40 + 101 16 110 99 14 109 101 16 110 1 10 3 30 + 101 16 110 99 14 109 101 16 110 1 10 4 40 + 101 16 110 99 14 109 101 16 110 2 20 3 30 + 101 16 110 99 14 109 101 16 110 2 20 4 40 + 101 16 110 99 14 109 102 17 111 1 10 3 30 + 101 16 110 99 14 109 102 17 111 1 10 4 40 + 101 16 110 99 14 109 102 17 111 2 20 3 30 + 101 16 110 99 14 109 102 17 111 2 20 4 40 + 101 16 110 99 14 109 103 18 112 1 10 3 30 + 101 16 110 99 14 109 103 18 112 1 10 4 40 + 101 16 110 99 14 109 103 18 112 2 20 3 30 + 101 16 110 99 14 109 103 18 112 2 20 4 40 + 101 16 110 100 15 109 98 13 108 1 10 3 30 + 101 16 110 100 15 109 98 13 108 1 10 4 40 + 101 16 110 100 15 109 98 13 108 2 20 3 30 + 101 16 110 100 15 109 98 13 108 2 20 4 40 + 101 16 110 100 15 109 99 14 109 1 10 3 30 + 101 16 110 100 15 109 99 14 109 1 10 4 40 + 101 16 110 100 15 109 99 14 109 2 20 3 30 + 101 16 110 100 15 109 99 14 109 2 20 4 40 + 101 16 110 100 15 109 100 15 109 1 10 3 30 + 101 16 110 100 15 109 100 15 109 1 10 4 40 + 101 16 110 100 15 109 100 15 109 2 20 3 30 + 101 16 110 100 15 109 100 15 109 2 20 4 40 + 101 16 110 100 15 109 101 16 110 1 10 3 30 + 101 16 110 100 15 109 101 16 110 1 10 4 40 + 101 16 110 100 15 109 101 16 110 2 20 3 30 + 101 16 110 100 15 109 101 16 110 2 20 4 40 + 101 16 110 100 15 109 102 17 111 1 10 3 30 + 101 16 110 100 15 109 102 17 111 1 10 4 40 + 101 16 110 100 15 109 102 17 111 2 20 3 30 + 101 16 110 100 15 109 102 17 111 2 20 4 40 + 101 16 110 100 15 109 103 18 112 1 10 3 30 + 101 16 110 100 15 109 103 18 112 1 10 4 40 + 101 16 110 100 15 109 103 18 112 2 20 3 30 + 101 16 110 100 15 109 103 18 112 2 20 4 40 + 101 16 110 101 16 110 98 13 108 1 10 3 30 + 101 16 110 101 16 110 98 13 108 1 10 4 40 + 101 16 110 101 16 110 98 13 108 2 20 3 30 + 101 16 110 101 16 110 98 13 108 2 20 4 40 + 101 16 110 101 16 110 99 14 109 1 10 3 30 + 101 16 110 101 16 110 99 14 109 1 10 4 40 + 101 16 110 101 16 110 99 14 109 2 20 3 30 + 101 16 110 101 16 110 99 14 109 2 20 4 40 + 101 16 110 101 16 110 100 15 109 1 10 3 30 + 101 16 110 101 16 110 100 15 109 1 10 4 40 + 101 16 110 101 16 110 100 15 109 2 20 3 30 + 101 16 110 101 16 110 100 15 109 2 20 4 40 + 101 16 110 101 16 110 101 16 110 1 10 3 30 + 101 16 110 101 16 110 101 16 110 1 10 4 40 + 101 16 110 101 16 110 101 16 110 2 20 3 30 + 101 16 110 101 16 110 101 16 110 2 20 4 40 + 101 16 110 101 16 110 102 17 111 1 10 3 30 + 101 16 110 101 16 110 102 17 111 1 10 4 40 + 101 16 110 101 16 110 102 17 111 2 20 3 30 + 101 16 110 101 16 110 102 17 111 2 20 4 40 + 101 16 110 101 16 110 103 18 112 1 10 3 30 + 101 16 110 101 16 110 103 18 112 1 10 4 40 + 101 16 110 101 16 110 103 18 112 2 20 3 30 + 101 16 110 101 16 110 103 18 112 2 20 4 40 + 101 16 110 102 17 111 98 13 108 1 10 3 30 + 101 16 110 102 17 111 98 13 108 1 10 4 40 + 101 16 110 102 17 111 98 13 108 2 20 3 30 + 101 16 110 102 17 111 98 13 108 2 20 4 40 + 101 16 110 102 17 111 99 14 109 1 10 3 30 + 101 16 110 102 17 111 99 14 109 1 10 4 40 + 101 16 110 102 17 111 99 14 109 2 20 3 30 + 101 16 110 102 17 111 99 14 109 2 20 4 40 + 101 16 110 102 17 111 100 15 109 1 10 3 30 + 101 16 110 102 17 111 100 15 109 1 10 4 40 + 101 16 110 102 17 111 100 15 109 2 20 3 30 + 101 16 110 102 17 111 100 15 109 2 20 4 40 + 101 16 110 102 17 111 101 16 110 1 10 3 30 + 101 16 110 102 17 111 101 16 110 1 10 4 40 + 101 16 110 102 17 111 101 16 110 2 20 3 30 + 101 16 110 102 17 111 101 16 110 2 20 4 40 + 101 16 110 102 17 111 102 17 111 1 10 3 30 + 101 16 110 102 17 111 102 17 111 1 10 4 40 + 101 16 110 102 17 111 102 17 111 2 20 3 30 + 101 16 110 102 17 111 102 17 111 2 20 4 40 + 101 16 110 102 17 111 103 18 112 1 10 3 30 + 101 16 110 102 17 111 103 18 112 1 10 4 40 + 101 16 110 102 17 111 103 18 112 2 20 3 30 + 101 16 110 102 17 111 103 18 112 2 20 4 40 + 101 16 110 103 18 112 98 13 108 1 10 3 30 + 101 16 110 103 18 112 98 13 108 1 10 4 40 + 101 16 110 103 18 112 98 13 108 2 20 3 30 + 101 16 110 103 18 112 98 13 108 2 20 4 40 + 101 16 110 103 18 112 99 14 109 1 10 3 30 + 101 16 110 103 18 112 99 14 109 1 10 4 40 + 101 16 110 103 18 112 99 14 109 2 20 3 30 + 101 16 110 103 18 112 99 14 109 2 20 4 40 + 101 16 110 103 18 112 100 15 109 1 10 3 30 + 101 16 110 103 18 112 100 15 109 1 10 4 40 + 101 16 110 103 18 112 100 15 109 2 20 3 30 + 101 16 110 103 18 112 100 15 109 2 20 4 40 + 101 16 110 103 18 112 101 16 110 1 10 3 30 + 101 16 110 103 18 112 101 16 110 1 10 4 40 + 101 16 110 103 18 112 101 16 110 2 20 3 30 + 101 16 110 103 18 112 101 16 110 2 20 4 40 + 101 16 110 103 18 112 102 17 111 1 10 3 30 + 101 16 110 103 18 112 102 17 111 1 10 4 40 + 101 16 110 103 18 112 102 17 111 2 20 3 30 + 101 16 110 103 18 112 102 17 111 2 20 4 40 + 101 16 110 103 18 112 103 18 112 1 10 3 30 + 101 16 110 103 18 112 103 18 112 1 10 4 40 + 101 16 110 103 18 112 103 18 112 2 20 3 30 + 101 16 110 103 18 112 103 18 112 2 20 4 40 + 102 17 111 98 13 108 98 13 108 1 10 3 30 + 102 17 111 98 13 108 98 13 108 1 10 4 40 + 102 17 111 98 13 108 98 13 108 2 20 3 30 + 102 17 111 98 13 108 98 13 108 2 20 4 40 + 102 17 111 98 13 108 99 14 109 1 10 3 30 + 102 17 111 98 13 108 99 14 109 1 10 4 40 + 102 17 111 98 13 108 99 14 109 2 20 3 30 + 102 17 111 98 13 108 99 14 109 2 20 4 40 + 102 17 111 98 13 108 100 15 109 1 10 3 30 + 102 17 111 98 13 108 100 15 109 1 10 4 40 + 102 17 111 98 13 108 100 15 109 2 20 3 30 + 102 17 111 98 13 108 100 15 109 2 20 4 40 + 102 17 111 98 13 108 101 16 110 1 10 3 30 + 102 17 111 98 13 108 101 16 110 1 10 4 40 + 102 17 111 98 13 108 101 16 110 2 20 3 30 + 102 17 111 98 13 108 101 16 110 2 20 4 40 + 102 17 111 98 13 108 102 17 111 1 10 3 30 + 102 17 111 98 13 108 102 17 111 1 10 4 40 + 102 17 111 98 13 108 102 17 111 2 20 3 30 + 102 17 111 98 13 108 102 17 111 2 20 4 40 + 102 17 111 98 13 108 103 18 112 1 10 3 30 + 102 17 111 98 13 108 103 18 112 1 10 4 40 + 102 17 111 98 13 108 103 18 112 2 20 3 30 + 102 17 111 98 13 108 103 18 112 2 20 4 40 + 102 17 111 99 14 109 98 13 108 1 10 3 30 + 102 17 111 99 14 109 98 13 108 1 10 4 40 + 102 17 111 99 14 109 98 13 108 2 20 3 30 + 102 17 111 99 14 109 98 13 108 2 20 4 40 + 102 17 111 99 14 109 99 14 109 1 10 3 30 + 102 17 111 99 14 109 99 14 109 1 10 4 40 + 102 17 111 99 14 109 99 14 109 2 20 3 30 + 102 17 111 99 14 109 99 14 109 2 20 4 40 + 102 17 111 99 14 109 100 15 109 1 10 3 30 + 102 17 111 99 14 109 100 15 109 1 10 4 40 + 102 17 111 99 14 109 100 15 109 2 20 3 30 + 102 17 111 99 14 109 100 15 109 2 20 4 40 + 102 17 111 99 14 109 101 16 110 1 10 3 30 + 102 17 111 99 14 109 101 16 110 1 10 4 40 + 102 17 111 99 14 109 101 16 110 2 20 3 30 + 102 17 111 99 14 109 101 16 110 2 20 4 40 + 102 17 111 99 14 109 102 17 111 1 10 3 30 + 102 17 111 99 14 109 102 17 111 1 10 4 40 + 102 17 111 99 14 109 102 17 111 2 20 3 30 + 102 17 111 99 14 109 102 17 111 2 20 4 40 + 102 17 111 99 14 109 103 18 112 1 10 3 30 + 102 17 111 99 14 109 103 18 112 1 10 4 40 + 102 17 111 99 14 109 103 18 112 2 20 3 30 + 102 17 111 99 14 109 103 18 112 2 20 4 40 + 102 17 111 100 15 109 98 13 108 1 10 3 30 + 102 17 111 100 15 109 98 13 108 1 10 4 40 + 102 17 111 100 15 109 98 13 108 2 20 3 30 + 102 17 111 100 15 109 98 13 108 2 20 4 40 + 102 17 111 100 15 109 99 14 109 1 10 3 30 + 102 17 111 100 15 109 99 14 109 1 10 4 40 + 102 17 111 100 15 109 99 14 109 2 20 3 30 + 102 17 111 100 15 109 99 14 109 2 20 4 40 + 102 17 111 100 15 109 100 15 109 1 10 3 30 + 102 17 111 100 15 109 100 15 109 1 10 4 40 + 102 17 111 100 15 109 100 15 109 2 20 3 30 + 102 17 111 100 15 109 100 15 109 2 20 4 40 + 102 17 111 100 15 109 101 16 110 1 10 3 30 + 102 17 111 100 15 109 101 16 110 1 10 4 40 + 102 17 111 100 15 109 101 16 110 2 20 3 30 + 102 17 111 100 15 109 101 16 110 2 20 4 40 + 102 17 111 100 15 109 102 17 111 1 10 3 30 + 102 17 111 100 15 109 102 17 111 1 10 4 40 + 102 17 111 100 15 109 102 17 111 2 20 3 30 + 102 17 111 100 15 109 102 17 111 2 20 4 40 + 102 17 111 100 15 109 103 18 112 1 10 3 30 + 102 17 111 100 15 109 103 18 112 1 10 4 40 + 102 17 111 100 15 109 103 18 112 2 20 3 30 + 102 17 111 100 15 109 103 18 112 2 20 4 40 + 102 17 111 101 16 110 98 13 108 1 10 3 30 + 102 17 111 101 16 110 98 13 108 1 10 4 40 + 102 17 111 101 16 110 98 13 108 2 20 3 30 + 102 17 111 101 16 110 98 13 108 2 20 4 40 + 102 17 111 101 16 110 99 14 109 1 10 3 30 + 102 17 111 101 16 110 99 14 109 1 10 4 40 + 102 17 111 101 16 110 99 14 109 2 20 3 30 + 102 17 111 101 16 110 99 14 109 2 20 4 40 + 102 17 111 101 16 110 100 15 109 1 10 3 30 + 102 17 111 101 16 110 100 15 109 1 10 4 40 + 102 17 111 101 16 110 100 15 109 2 20 3 30 + 102 17 111 101 16 110 100 15 109 2 20 4 40 + 102 17 111 101 16 110 101 16 110 1 10 3 30 + 102 17 111 101 16 110 101 16 110 1 10 4 40 + 102 17 111 101 16 110 101 16 110 2 20 3 30 + 102 17 111 101 16 110 101 16 110 2 20 4 40 + 102 17 111 101 16 110 102 17 111 1 10 3 30 + 102 17 111 101 16 110 102 17 111 1 10 4 40 + 102 17 111 101 16 110 102 17 111 2 20 3 30 + 102 17 111 101 16 110 102 17 111 2 20 4 40 + 102 17 111 101 16 110 103 18 112 1 10 3 30 + 102 17 111 101 16 110 103 18 112 1 10 4 40 + 102 17 111 101 16 110 103 18 112 2 20 3 30 + 102 17 111 101 16 110 103 18 112 2 20 4 40 + 102 17 111 102 17 111 98 13 108 1 10 3 30 + 102 17 111 102 17 111 98 13 108 1 10 4 40 + 102 17 111 102 17 111 98 13 108 2 20 3 30 + 102 17 111 102 17 111 98 13 108 2 20 4 40 + 102 17 111 102 17 111 99 14 109 1 10 3 30 + 102 17 111 102 17 111 99 14 109 1 10 4 40 + 102 17 111 102 17 111 99 14 109 2 20 3 30 + 102 17 111 102 17 111 99 14 109 2 20 4 40 + 102 17 111 102 17 111 100 15 109 1 10 3 30 + 102 17 111 102 17 111 100 15 109 1 10 4 40 + 102 17 111 102 17 111 100 15 109 2 20 3 30 + 102 17 111 102 17 111 100 15 109 2 20 4 40 + 102 17 111 102 17 111 101 16 110 1 10 3 30 + 102 17 111 102 17 111 101 16 110 1 10 4 40 + 102 17 111 102 17 111 101 16 110 2 20 3 30 + 102 17 111 102 17 111 101 16 110 2 20 4 40 + 102 17 111 102 17 111 102 17 111 1 10 3 30 + 102 17 111 102 17 111 102 17 111 1 10 4 40 + 102 17 111 102 17 111 102 17 111 2 20 3 30 + 102 17 111 102 17 111 102 17 111 2 20 4 40 + 102 17 111 102 17 111 103 18 112 1 10 3 30 + 102 17 111 102 17 111 103 18 112 1 10 4 40 + 102 17 111 102 17 111 103 18 112 2 20 3 30 + 102 17 111 102 17 111 103 18 112 2 20 4 40 + 102 17 111 103 18 112 98 13 108 1 10 3 30 + 102 17 111 103 18 112 98 13 108 1 10 4 40 + 102 17 111 103 18 112 98 13 108 2 20 3 30 + 102 17 111 103 18 112 98 13 108 2 20 4 40 + 102 17 111 103 18 112 99 14 109 1 10 3 30 + 102 17 111 103 18 112 99 14 109 1 10 4 40 + 102 17 111 103 18 112 99 14 109 2 20 3 30 + 102 17 111 103 18 112 99 14 109 2 20 4 40 + 102 17 111 103 18 112 100 15 109 1 10 3 30 + 102 17 111 103 18 112 100 15 109 1 10 4 40 + 102 17 111 103 18 112 100 15 109 2 20 3 30 + 102 17 111 103 18 112 100 15 109 2 20 4 40 + 102 17 111 103 18 112 101 16 110 1 10 3 30 + 102 17 111 103 18 112 101 16 110 1 10 4 40 + 102 17 111 103 18 112 101 16 110 2 20 3 30 + 102 17 111 103 18 112 101 16 110 2 20 4 40 + 102 17 111 103 18 112 102 17 111 1 10 3 30 + 102 17 111 103 18 112 102 17 111 1 10 4 40 + 102 17 111 103 18 112 102 17 111 2 20 3 30 + 102 17 111 103 18 112 102 17 111 2 20 4 40 + 102 17 111 103 18 112 103 18 112 1 10 3 30 + 102 17 111 103 18 112 103 18 112 1 10 4 40 + 102 17 111 103 18 112 103 18 112 2 20 3 30 + 102 17 111 103 18 112 103 18 112 2 20 4 40 + 103 18 112 98 13 108 98 13 108 1 10 3 30 + 103 18 112 98 13 108 98 13 108 1 10 4 40 + 103 18 112 98 13 108 98 13 108 2 20 3 30 + 103 18 112 98 13 108 98 13 108 2 20 4 40 + 103 18 112 98 13 108 99 14 109 1 10 3 30 + 103 18 112 98 13 108 99 14 109 1 10 4 40 + 103 18 112 98 13 108 99 14 109 2 20 3 30 + 103 18 112 98 13 108 99 14 109 2 20 4 40 + 103 18 112 98 13 108 100 15 109 1 10 3 30 + 103 18 112 98 13 108 100 15 109 1 10 4 40 + 103 18 112 98 13 108 100 15 109 2 20 3 30 + 103 18 112 98 13 108 100 15 109 2 20 4 40 + 103 18 112 98 13 108 101 16 110 1 10 3 30 + 103 18 112 98 13 108 101 16 110 1 10 4 40 + 103 18 112 98 13 108 101 16 110 2 20 3 30 + 103 18 112 98 13 108 101 16 110 2 20 4 40 + 103 18 112 98 13 108 102 17 111 1 10 3 30 + 103 18 112 98 13 108 102 17 111 1 10 4 40 + 103 18 112 98 13 108 102 17 111 2 20 3 30 + 103 18 112 98 13 108 102 17 111 2 20 4 40 + 103 18 112 98 13 108 103 18 112 1 10 3 30 + 103 18 112 98 13 108 103 18 112 1 10 4 40 + 103 18 112 98 13 108 103 18 112 2 20 3 30 + 103 18 112 98 13 108 103 18 112 2 20 4 40 + 103 18 112 99 14 109 98 13 108 1 10 3 30 + 103 18 112 99 14 109 98 13 108 1 10 4 40 + 103 18 112 99 14 109 98 13 108 2 20 3 30 + 103 18 112 99 14 109 98 13 108 2 20 4 40 + 103 18 112 99 14 109 99 14 109 1 10 3 30 + 103 18 112 99 14 109 99 14 109 1 10 4 40 + 103 18 112 99 14 109 99 14 109 2 20 3 30 + 103 18 112 99 14 109 99 14 109 2 20 4 40 + 103 18 112 99 14 109 100 15 109 1 10 3 30 + 103 18 112 99 14 109 100 15 109 1 10 4 40 + 103 18 112 99 14 109 100 15 109 2 20 3 30 + 103 18 112 99 14 109 100 15 109 2 20 4 40 + 103 18 112 99 14 109 101 16 110 1 10 3 30 + 103 18 112 99 14 109 101 16 110 1 10 4 40 + 103 18 112 99 14 109 101 16 110 2 20 3 30 + 103 18 112 99 14 109 101 16 110 2 20 4 40 + 103 18 112 99 14 109 102 17 111 1 10 3 30 + 103 18 112 99 14 109 102 17 111 1 10 4 40 + 103 18 112 99 14 109 102 17 111 2 20 3 30 + 103 18 112 99 14 109 102 17 111 2 20 4 40 + 103 18 112 99 14 109 103 18 112 1 10 3 30 + 103 18 112 99 14 109 103 18 112 1 10 4 40 + 103 18 112 99 14 109 103 18 112 2 20 3 30 + 103 18 112 99 14 109 103 18 112 2 20 4 40 + 103 18 112 100 15 109 98 13 108 1 10 3 30 + 103 18 112 100 15 109 98 13 108 1 10 4 40 + 103 18 112 100 15 109 98 13 108 2 20 3 30 + 103 18 112 100 15 109 98 13 108 2 20 4 40 + 103 18 112 100 15 109 99 14 109 1 10 3 30 + 103 18 112 100 15 109 99 14 109 1 10 4 40 + 103 18 112 100 15 109 99 14 109 2 20 3 30 + 103 18 112 100 15 109 99 14 109 2 20 4 40 + 103 18 112 100 15 109 100 15 109 1 10 3 30 + 103 18 112 100 15 109 100 15 109 1 10 4 40 + 103 18 112 100 15 109 100 15 109 2 20 3 30 + 103 18 112 100 15 109 100 15 109 2 20 4 40 + 103 18 112 100 15 109 101 16 110 1 10 3 30 + 103 18 112 100 15 109 101 16 110 1 10 4 40 + 103 18 112 100 15 109 101 16 110 2 20 3 30 + 103 18 112 100 15 109 101 16 110 2 20 4 40 + 103 18 112 100 15 109 102 17 111 1 10 3 30 + 103 18 112 100 15 109 102 17 111 1 10 4 40 + 103 18 112 100 15 109 102 17 111 2 20 3 30 + 103 18 112 100 15 109 102 17 111 2 20 4 40 + 103 18 112 100 15 109 103 18 112 1 10 3 30 + 103 18 112 100 15 109 103 18 112 1 10 4 40 + 103 18 112 100 15 109 103 18 112 2 20 3 30 + 103 18 112 100 15 109 103 18 112 2 20 4 40 + 103 18 112 101 16 110 98 13 108 1 10 3 30 + 103 18 112 101 16 110 98 13 108 1 10 4 40 + 103 18 112 101 16 110 98 13 108 2 20 3 30 + 103 18 112 101 16 110 98 13 108 2 20 4 40 + 103 18 112 101 16 110 99 14 109 1 10 3 30 + 103 18 112 101 16 110 99 14 109 1 10 4 40 + 103 18 112 101 16 110 99 14 109 2 20 3 30 + 103 18 112 101 16 110 99 14 109 2 20 4 40 + 103 18 112 101 16 110 100 15 109 1 10 3 30 + 103 18 112 101 16 110 100 15 109 1 10 4 40 + 103 18 112 101 16 110 100 15 109 2 20 3 30 + 103 18 112 101 16 110 100 15 109 2 20 4 40 + 103 18 112 101 16 110 101 16 110 1 10 3 30 + 103 18 112 101 16 110 101 16 110 1 10 4 40 + 103 18 112 101 16 110 101 16 110 2 20 3 30 + 103 18 112 101 16 110 101 16 110 2 20 4 40 + 103 18 112 101 16 110 102 17 111 1 10 3 30 + 103 18 112 101 16 110 102 17 111 1 10 4 40 + 103 18 112 101 16 110 102 17 111 2 20 3 30 + 103 18 112 101 16 110 102 17 111 2 20 4 40 + 103 18 112 101 16 110 103 18 112 1 10 3 30 + 103 18 112 101 16 110 103 18 112 1 10 4 40 + 103 18 112 101 16 110 103 18 112 2 20 3 30 + 103 18 112 101 16 110 103 18 112 2 20 4 40 + 103 18 112 102 17 111 98 13 108 1 10 3 30 + 103 18 112 102 17 111 98 13 108 1 10 4 40 + 103 18 112 102 17 111 98 13 108 2 20 3 30 + 103 18 112 102 17 111 98 13 108 2 20 4 40 + 103 18 112 102 17 111 99 14 109 1 10 3 30 + 103 18 112 102 17 111 99 14 109 1 10 4 40 + 103 18 112 102 17 111 99 14 109 2 20 3 30 + 103 18 112 102 17 111 99 14 109 2 20 4 40 + 103 18 112 102 17 111 100 15 109 1 10 3 30 + 103 18 112 102 17 111 100 15 109 1 10 4 40 + 103 18 112 102 17 111 100 15 109 2 20 3 30 + 103 18 112 102 17 111 100 15 109 2 20 4 40 + 103 18 112 102 17 111 101 16 110 1 10 3 30 + 103 18 112 102 17 111 101 16 110 1 10 4 40 + 103 18 112 102 17 111 101 16 110 2 20 3 30 + 103 18 112 102 17 111 101 16 110 2 20 4 40 + 103 18 112 102 17 111 102 17 111 1 10 3 30 + 103 18 112 102 17 111 102 17 111 1 10 4 40 + 103 18 112 102 17 111 102 17 111 2 20 3 30 + 103 18 112 102 17 111 102 17 111 2 20 4 40 + 103 18 112 102 17 111 103 18 112 1 10 3 30 + 103 18 112 102 17 111 103 18 112 1 10 4 40 + 103 18 112 102 17 111 103 18 112 2 20 3 30 + 103 18 112 102 17 111 103 18 112 2 20 4 40 + 103 18 112 103 18 112 98 13 108 1 10 3 30 + 103 18 112 103 18 112 98 13 108 1 10 4 40 + 103 18 112 103 18 112 98 13 108 2 20 3 30 + 103 18 112 103 18 112 98 13 108 2 20 4 40 + 103 18 112 103 18 112 99 14 109 1 10 3 30 + 103 18 112 103 18 112 99 14 109 1 10 4 40 + 103 18 112 103 18 112 99 14 109 2 20 3 30 + 103 18 112 103 18 112 99 14 109 2 20 4 40 + 103 18 112 103 18 112 100 15 109 1 10 3 30 + 103 18 112 103 18 112 100 15 109 1 10 4 40 + 103 18 112 103 18 112 100 15 109 2 20 3 30 + 103 18 112 103 18 112 100 15 109 2 20 4 40 + 103 18 112 103 18 112 101 16 110 1 10 3 30 + 103 18 112 103 18 112 101 16 110 1 10 4 40 + 103 18 112 103 18 112 101 16 110 2 20 3 30 + 103 18 112 103 18 112 101 16 110 2 20 4 40 + 103 18 112 103 18 112 102 17 111 1 10 3 30 + 103 18 112 103 18 112 102 17 111 1 10 4 40 + 103 18 112 103 18 112 102 17 111 2 20 3 30 + 103 18 112 103 18 112 102 17 111 2 20 4 40 + 103 18 112 103 18 112 103 18 112 1 10 3 30 + 103 18 112 103 18 112 103 18 112 1 10 4 40 + 103 18 112 103 18 112 103 18 112 2 20 3 30 + 103 18 112 103 18 112 103 18 112 2 20 4 40 + +echo select * from t1,t2 where t1.f1>100; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t2.f1 t2.f2 t2.f3 +--------------------------------------------------------- + 101 16 110 98 13 108 + 101 16 110 99 14 109 + 101 16 110 100 15 109 + 101 16 110 101 16 110 + 101 16 110 102 17 111 + 101 16 110 103 18 112 + 102 17 111 98 13 108 + 102 17 111 99 14 109 + 102 17 111 100 15 109 + 102 17 111 101 16 110 + 102 17 111 102 17 111 + 102 17 111 103 18 112 + 103 18 112 98 13 108 + 103 18 112 99 14 109 + 103 18 112 100 15 109 + 103 18 112 101 16 110 + 103 18 112 102 17 111 + 103 18 112 103 18 112 + diff --git a/test/sql/Join/exp.test004.ksh b/test/sql/Join/exp.test004.ksh new file mode 100644 index 00000000..2b516ef0 --- /dev/null +++ b/test/sql/Join/exp.test004.ksh @@ -0,0 +1,25 @@ +echo select * from t1,t2,t3 where t1.f2=t2.f2 and t1.f3=t3.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t2.f1 t2.f2 t2.f3 t3.f1 t3.f2 t3.f3 +--------------------------------------------------------- + 99 14 109 99 14 109 100 109 109 + 100 15 109 100 15 109 100 109 109 + +echo select * from t1,t2,t3 where t1.f2=t2.f2 or t1.f3=t3.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t2.f1 t2.f2 t2.f3 t3.f1 t3.f2 t3.f3 +--------------------------------------------------------- + 98 13 108 98 13 108 98 13 108 + 98 13 108 98 13 108 100 109 109 + 98 13 108 98 13 108 102 17 111 + 99 14 109 98 13 108 100 109 109 + 99 14 109 99 14 109 98 13 108 + 99 14 109 99 14 109 100 109 109 + 99 14 109 99 14 109 102 17 111 + 99 14 109 100 15 109 100 109 109 + 100 15 109 98 13 108 100 109 109 + 100 15 109 99 14 109 100 109 109 + 100 15 109 100 15 109 98 13 108 + 100 15 109 100 15 109 100 109 109 + 100 15 109 100 15 109 102 17 111 + diff --git a/test/sql/Join/exp.test005.ksh b/test/sql/Join/exp.test005.ksh new file mode 100644 index 00000000..f8ffd113 --- /dev/null +++ b/test/sql/Join/exp.test005.ksh @@ -0,0 +1,21 @@ +echo select t1.f1,t2.f1,t3.f1 from t1,t2,t3 where t1.f2=t2.f2 or t1.f1 > 100; +--------------------------------------------------------- + t1.f1 t2.f1 t3.f1 +--------------------------------------------------------- + 98 98 98 + 98 98 100 + 98 98 102 + 99 99 98 + 99 99 100 + 99 99 102 + 100 100 98 + 100 100 100 + 100 100 102 + +echo select t1.f1, t2.f1, t3.f1 from t1,t2,t3 where t1.f2= t2.f2 and t1.f3 = t3.f2; +--------------------------------------------------------- + t1.f1 t2.f1 t3.f1 +--------------------------------------------------------- + 99 99 100 + 100 100 100 + diff --git a/test/sql/Join/exp.test006.ksh b/test/sql/Join/exp.test006.ksh new file mode 100644 index 00000000..44ae7f70 --- /dev/null +++ b/test/sql/Join/exp.test006.ksh @@ -0,0 +1,2 @@ +echo select * from t1,t2 where t1.f1=t2.f100; +Statement prepare failed with error -19 diff --git a/test/sql/Join/exp.test007.ksh b/test/sql/Join/exp.test007.ksh new file mode 100644 index 00000000..c7b5038a --- /dev/null +++ b/test/sql/Join/exp.test007.ksh @@ -0,0 +1,14 @@ +echo select * from t11 where t11.f1=2; +--------------------------------------------------------- + t11.f1 t11.f2 t11.f3 t11.f4 t11.f5 +--------------------------------------------------------- + 2 Y sales 6000 20 + +echo select * from t11 where t11.f1=t11.f1; +--------------------------------------------------------- + t11.f1 t11.f2 t11.f3 t11.f4 t11.f5 +--------------------------------------------------------- + 1 X IT 5000 10 + 2 Y sales 6000 20 + 3 Z IT 7000 10 + diff --git a/test/sql/Join/exp.test008.ksh b/test/sql/Join/exp.test008.ksh new file mode 100644 index 00000000..1839117c --- /dev/null +++ b/test/sql/Join/exp.test008.ksh @@ -0,0 +1,42 @@ +echo select * from t11,t12 where t11.f5=t12.f1; +--------------------------------------------------------- + t11.f1 t11.f2 t11.f3 t11.f4 t11.f5 t12.f1 t12.f2 t12.f3 +--------------------------------------------------------- + 1 X IT 5000 10 10 IT BBSR + 2 Y sales 6000 20 20 HR CTC + 3 Z IT 7000 10 10 IT BBSR + +echo select * from t11,t12 where t11.f5 > t12.f1; +--------------------------------------------------------- + t11.f1 t11.f2 t11.f3 t11.f4 t11.f5 t12.f1 t12.f2 t12.f3 +--------------------------------------------------------- + 2 Y sales 6000 20 10 IT BBSR + +echo select * from t11,t12 where t12.f1 <= t11.f5; +--------------------------------------------------------- + t11.f1 t11.f2 t11.f3 t11.f4 t11.f5 t12.f1 t12.f2 t12.f3 +--------------------------------------------------------- + 1 X IT 5000 10 10 IT BBSR + 2 Y sales 6000 20 10 IT BBSR + 2 Y sales 6000 20 20 HR CTC + 3 Z IT 7000 10 10 IT BBSR + +echo select * from t11,t12 where t12.f1 != t11.f5; +--------------------------------------------------------- + t11.f1 t11.f2 t11.f3 t11.f4 t11.f5 t12.f1 t12.f2 t12.f3 +--------------------------------------------------------- + 1 X IT 5000 10 20 HR CTC + 1 X IT 5000 10 30 R&D DELHI + 2 Y sales 6000 20 10 IT BBSR + 2 Y sales 6000 20 30 R&D DELHI + 3 Z IT 7000 10 20 HR CTC + 3 Z IT 7000 10 30 R&D DELHI + +echo select * from t11,t12 where t12.f1 > 20; +--------------------------------------------------------- + t11.f1 t11.f2 t11.f3 t11.f4 t11.f5 t12.f1 t12.f2 t12.f3 +--------------------------------------------------------- + 1 X IT 5000 10 30 R&D DELHI + 2 Y sales 6000 20 30 R&D DELHI + 3 Z IT 7000 10 30 R&D DELHI + diff --git a/test/sql/Join/exp.test009.ksh b/test/sql/Join/exp.test009.ksh new file mode 100644 index 00000000..f6a6af08 --- /dev/null +++ b/test/sql/Join/exp.test009.ksh @@ -0,0 +1,27 @@ +echo select t11.f5, t13.f8 from t11,t13 where t11.f5=t13.f8; +--------------------------------------------------------- + t11.f5 t13.f8 +--------------------------------------------------------- + 20 20 + +echo select t11.f1,t11.f5,t13.f8 from t11,t13 where t11.f5=t13.f8; +--------------------------------------------------------- + t11.f1 t11.f5 t13.f8 +--------------------------------------------------------- + 2 20 20 + +echo select * from t11,t13 where t13.f8 > t11.f5; +--------------------------------------------------------- + t11.f1 t11.f2 t11.f3 t11.f4 t11.f5 t13.f7 t13.f8 +--------------------------------------------------------- + 1 X IT 5000 10 2 20 + 1 X IT 5000 10 1 50 + 2 Y sales 6000 20 1 50 + 3 Z IT 7000 10 2 20 + 3 Z IT 7000 10 1 50 + +echo select t11.f1,t11.f5,t13.f8 from t11,t13 where t13.f8 < t11.f5; +--------------------------------------------------------- + t11.f1 t11.f5 t13.f8 +--------------------------------------------------------- + diff --git a/test/sql/Join/exp.test010.ksh b/test/sql/Join/exp.test010.ksh new file mode 100644 index 00000000..9d9b9419 --- /dev/null +++ b/test/sql/Join/exp.test010.ksh @@ -0,0 +1,19 @@ +echo select * from t11,t12,t13 where t12.f1=t13.f8 and t13.f7=t11.f1; +--------------------------------------------------------- + t11.f1 t11.f2 t11.f3 t11.f4 t11.f5 t12.f1 t12.f2 t12.f3 t13.f7 t13.f8 +--------------------------------------------------------- + 2 Y sales 6000 20 20 HR CTC 2 20 + +echo select * from t11,t12,t13 where t12.f1=t13.f8 or t13.f7=t11.f1; +--------------------------------------------------------- + t11.f1 t11.f2 t11.f3 t11.f4 t11.f5 t12.f1 t12.f2 t12.f3 t13.f7 t13.f8 +--------------------------------------------------------- + 1 X IT 5000 10 10 IT BBSR 1 50 + 1 X IT 5000 10 20 HR CTC 2 20 + 1 X IT 5000 10 20 HR CTC 1 50 + 1 X IT 5000 10 30 R&D DELHI 1 50 + 2 Y sales 6000 20 10 IT BBSR 2 20 + 2 Y sales 6000 20 20 HR CTC 2 20 + 2 Y sales 6000 20 30 R&D DELHI 2 20 + 3 Z IT 7000 10 20 HR CTC 2 20 + diff --git a/test/sql/Join/exp.test011.ksh b/test/sql/Join/exp.test011.ksh new file mode 100644 index 00000000..1433a356 --- /dev/null +++ b/test/sql/Join/exp.test011.ksh @@ -0,0 +1,13 @@ +echo select t11.f1,t12.f7 from t12,t11; +Statement prepare failed with error -19 +echo select t11.f1,t12.f7 from t13,t11; +--------------------------------------------------------- + t11.f1 t13.f7 +--------------------------------------------------------- + 1 2 + 2 2 + 3 2 + 1 1 + 2 1 + 3 1 + diff --git a/test/sql/Join/exp.test012.ksh b/test/sql/Join/exp.test012.ksh new file mode 100644 index 00000000..0c9bfbe6 --- /dev/null +++ b/test/sql/Join/exp.test012.ksh @@ -0,0 +1,102 @@ +echo create table emp(eno int,mgrno int,sal float,deptno int); +Statement Executed +echo insert into emp values(1,3,5000,10); +Statement Executed: Rows Affected = 1 +echo insert into emp values(2,4,4000,20); +Statement Executed: Rows Affected = 1 +echo insert into emp values(3,NULL,8000,10); +Statement Executed: Rows Affected = 1 +echo create table dept(deptno int,dname char(10),lid int); +Statement Executed +echo insert into dept values(10,'IT',100); +Statement Executed: Rows Affected = 1 +echo insert into dept values(20,'HR',300); +Statement Executed: Rows Affected = 1 +echo create table loc(lid int,state char(10)); +Statement Executed +echo insert into loc values(100,'Orissa'); +Statement Executed: Rows Affected = 1 +echo insert into loc values(200,'Cal'); +Statement Executed: Rows Affected = 1 +echo insert into loc values(300,'Calif'); +Statement Executed: Rows Affected = 1 +echo select * from emp; +--------------------------------------------------------- + emp.eno emp.mgrno emp.sal emp.deptno +--------------------------------------------------------- + 1 3 5000.000000 10 + 2 4 4000.000000 20 + 3 NULL 8000.000000 10 + +echo select * from dept; +--------------------------------------------------------- + dept.deptno dept.dname dept.lid +--------------------------------------------------------- + 10 IT 100 + 20 HR 300 + +echo select * from loc; +--------------------------------------------------------- + loc.lid loc.state +--------------------------------------------------------- + 100 Orissa + 200 Cal + 300 Calif + +echo select * from emp,dept,loc; +--------------------------------------------------------- + emp.eno emp.mgrno emp.sal emp.deptno dept.deptno dept.dname dept.lid loc.lid loc.state +--------------------------------------------------------- + 1 3 5000.000000 10 10 IT 100 100 Orissa + 1 3 5000.000000 10 10 IT 100 200 Cal + 1 3 5000.000000 10 10 IT 100 300 Calif + 1 3 5000.000000 10 20 HR 300 100 Orissa + 1 3 5000.000000 10 20 HR 300 200 Cal + 1 3 5000.000000 10 20 HR 300 300 Calif + 2 4 4000.000000 20 10 IT 100 100 Orissa + 2 4 4000.000000 20 10 IT 100 200 Cal + 2 4 4000.000000 20 10 IT 100 300 Calif + 2 4 4000.000000 20 20 HR 300 100 Orissa + 2 4 4000.000000 20 20 HR 300 200 Cal + 2 4 4000.000000 20 20 HR 300 300 Calif + 3 NULL 8000.000000 10 10 IT 100 100 Orissa + 3 NULL 8000.000000 10 10 IT 100 200 Cal + 3 NULL 8000.000000 10 10 IT 100 300 Calif + 3 NULL 8000.000000 10 20 HR 300 100 Orissa + 3 NULL 8000.000000 10 20 HR 300 200 Cal + 3 NULL 8000.000000 10 20 HR 300 300 Calif + +echo select * from emp,dept,loc where emp.deptno!=dept.deptno AND dept.lid!=loc.lid; +--------------------------------------------------------- + emp.eno emp.mgrno emp.sal emp.deptno dept.deptno dept.dname dept.lid loc.lid loc.state +--------------------------------------------------------- + 1 3 5000.000000 10 20 HR 300 100 Orissa + 1 3 5000.000000 10 20 HR 300 200 Cal + 2 4 4000.000000 20 10 IT 100 200 Cal + 2 4 4000.000000 20 10 IT 100 300 Calif + 3 NULL 8000.000000 10 20 HR 300 100 Orissa + 3 NULL 8000.000000 10 20 HR 300 200 Cal + +echo select * from emp,dept,loc where NOT(emp.deptno!=dept.deptno AND dept.lid!=loc.lid); +--------------------------------------------------------- + emp.eno emp.mgrno emp.sal emp.deptno dept.deptno dept.dname dept.lid loc.lid loc.state +--------------------------------------------------------- + 1 3 5000.000000 10 10 IT 100 100 Orissa + 1 3 5000.000000 10 10 IT 100 200 Cal + 1 3 5000.000000 10 10 IT 100 300 Calif + 1 3 5000.000000 10 20 HR 300 300 Calif + 2 4 4000.000000 20 10 IT 100 100 Orissa + 2 4 4000.000000 20 20 HR 300 100 Orissa + 2 4 4000.000000 20 20 HR 300 200 Cal + 2 4 4000.000000 20 20 HR 300 300 Calif + 3 NULL 8000.000000 10 10 IT 100 100 Orissa + 3 NULL 8000.000000 10 10 IT 100 200 Cal + 3 NULL 8000.000000 10 10 IT 100 300 Calif + 3 NULL 8000.000000 10 20 HR 300 300 Calif + +echo drop table emp; +Statement Executed +echo drop table dept; +Statement Executed +echo drop table loc; +Statement Executed diff --git a/test/sql/Join/exp.test013.ksh b/test/sql/Join/exp.test013.ksh new file mode 100644 index 00000000..8e004356 --- /dev/null +++ b/test/sql/Join/exp.test013.ksh @@ -0,0 +1,87 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from emp; +--------------------------------------------------------- + emp.eno emp.dno +--------------------------------------------------------- + 1 10 + 2 20 + 4 40 + +echo select * from dept; +--------------------------------------------------------- + dept.deptno dept.dname +--------------------------------------------------------- + 20 Sales + 30 IT + 40 Mkt + 50 HR + +echo select * from emp,dept; +--------------------------------------------------------- + emp.eno emp.dno dept.deptno dept.dname +--------------------------------------------------------- + 1 10 20 Sales + 1 10 30 IT + 1 10 40 Mkt + 1 10 50 HR + 2 20 20 Sales + 2 20 30 IT + 2 20 40 Mkt + 2 20 50 HR + 4 40 20 Sales + 4 40 30 IT + 4 40 40 Mkt + 4 40 50 HR + +echo select * from emp,dept where emp.dno in(20,30); +--------------------------------------------------------- + emp.eno emp.dno dept.deptno dept.dname +--------------------------------------------------------- + 2 20 20 Sales + 2 20 30 IT + 2 20 40 Mkt + 2 20 50 HR + +echo select * from emp,dept where dept.deptno in(20,30); +--------------------------------------------------------- + emp.eno emp.dno dept.deptno dept.dname +--------------------------------------------------------- + 1 10 20 Sales + 1 10 30 IT + 2 20 20 Sales + 2 20 30 IT + 4 40 20 Sales + 4 40 30 IT + +echo select * from emp,dept where emp.dno in(20,30) and dept.deptno in(20,30); +--------------------------------------------------------- + emp.eno emp.dno dept.deptno dept.dname +--------------------------------------------------------- + 2 20 20 Sales + 2 20 30 IT + +echo select * from emp,dept where emp.dno in(20,30) or dept.deptno in(20,30); +--------------------------------------------------------- + emp.eno emp.dno dept.deptno dept.dname +--------------------------------------------------------- + 1 10 20 Sales + 1 10 30 IT + 2 20 20 Sales + 2 20 30 IT + 2 20 40 Mkt + 2 20 50 HR + 4 40 20 Sales + 4 40 30 IT + +echo drop table emp; +Statement Executed +echo drop table dept; +Statement Executed diff --git a/test/sql/Join/exp.test014.ksh b/test/sql/Join/exp.test014.ksh new file mode 100644 index 00000000..22adc003 --- /dev/null +++ b/test/sql/Join/exp.test014.ksh @@ -0,0 +1,82 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from emp; +--------------------------------------------------------- + emp.eno emp.dno +--------------------------------------------------------- + 1 10 + 2 20 + 4 40 + +echo select * from dept; +--------------------------------------------------------- + dept.deptno dept.dname +--------------------------------------------------------- + 20 Sales + 30 IT + 40 Mkt + 50 HR + +echo select * from emp,dept; +--------------------------------------------------------- + emp.eno emp.dno dept.deptno dept.dname +--------------------------------------------------------- + 1 10 20 Sales + 1 10 30 IT + 1 10 40 Mkt + 1 10 50 HR + 2 20 20 Sales + 2 20 30 IT + 2 20 40 Mkt + 2 20 50 HR + 4 40 20 Sales + 4 40 30 IT + 4 40 40 Mkt + 4 40 50 HR + +echo select * from emp,dept where emp.dno between 10 and 30; +--------------------------------------------------------- + emp.eno emp.dno dept.deptno dept.dname +--------------------------------------------------------- + 1 10 20 Sales + 1 10 30 IT + 1 10 40 Mkt + 1 10 50 HR + 2 20 20 Sales + 2 20 30 IT + 2 20 40 Mkt + 2 20 50 HR + +echo select * from emp,dept where dept.deptno between 20 and 40; +--------------------------------------------------------- + emp.eno emp.dno dept.deptno dept.dname +--------------------------------------------------------- + 1 10 20 Sales + 1 10 30 IT + 1 10 40 Mkt + 2 20 20 Sales + 2 20 30 IT + 2 20 40 Mkt + 4 40 20 Sales + 4 40 30 IT + 4 40 40 Mkt + +echo select * from emp,dept where emp.dno between 15 and 30 and dept.deptno between 20 and 40; +--------------------------------------------------------- + emp.eno emp.dno dept.deptno dept.dname +--------------------------------------------------------- + 2 20 20 Sales + 2 20 30 IT + 2 20 40 Mkt + +echo drop table emp; +Statement Executed +echo drop table dept; +Statement Executed diff --git a/test/sql/Join/exp.test015.ksh b/test/sql/Join/exp.test015.ksh new file mode 100644 index 00000000..26c7b1b4 --- /dev/null +++ b/test/sql/Join/exp.test015.ksh @@ -0,0 +1,76 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from emp,dept; +--------------------------------------------------------- + emp.eno emp.ename emp.dno dept.deptno dept.dname +--------------------------------------------------------- + 1 Nihar 10 20 Sales + 1 Nihar 10 40 Mkt + 1 Nihar 10 35 HR + 2 Kishore 20 20 Sales + 2 Kishore 20 40 Mkt + 2 Kishore 20 35 HR + 3 Jiten 30 20 Sales + 3 Jiten 30 40 Mkt + 3 Jiten 30 35 HR + 4 Bijay 40 20 Sales + 4 Bijay 40 40 Mkt + 4 Bijay 40 35 HR + 5 Kailash 50 20 Sales + 5 Kailash 50 40 Mkt + 5 Kailash 50 35 HR + +echo select * from emp,dept where emp.ename LIKE 'K%'; +--------------------------------------------------------- + emp.eno emp.ename emp.dno dept.deptno dept.dname +--------------------------------------------------------- + 2 Kishore 20 20 Sales + 2 Kishore 20 40 Mkt + 2 Kishore 20 35 HR + 5 Kailash 50 20 Sales + 5 Kailash 50 40 Mkt + 5 Kailash 50 35 HR + +echo select * from emp,dept where dept.dname LIKE 'S%'; +--------------------------------------------------------- + emp.eno emp.ename emp.dno dept.deptno dept.dname +--------------------------------------------------------- + 1 Nihar 10 20 Sales + 2 Kishore 20 20 Sales + 3 Jiten 30 20 Sales + 4 Bijay 40 20 Sales + 5 Kailash 50 20 Sales + +echo select * from emp,dept where emp.ename LIKE 'K%' and dept.dname LIKE 'S%'; +--------------------------------------------------------- + emp.eno emp.ename emp.dno dept.deptno dept.dname +--------------------------------------------------------- + 2 Kishore 20 20 Sales + 5 Kailash 50 20 Sales + +echo select * from emp,dept where emp.ename LIKE 'K%' or dept.dname LIKE 'S%'; +--------------------------------------------------------- + emp.eno emp.ename emp.dno dept.deptno dept.dname +--------------------------------------------------------- + 1 Nihar 10 20 Sales + 2 Kishore 20 20 Sales + 2 Kishore 20 40 Mkt + 2 Kishore 20 35 HR + 3 Jiten 30 20 Sales + 4 Bijay 40 20 Sales + 5 Kailash 50 20 Sales + 5 Kailash 50 40 Mkt + 5 Kailash 50 35 HR + +echo drop table emp; +Statement Executed +echo drop table dept; +Statement Executed diff --git a/test/sql/Join/exp.test016.ksh b/test/sql/Join/exp.test016.ksh new file mode 100644 index 00000000..98430475 --- /dev/null +++ b/test/sql/Join/exp.test016.ksh @@ -0,0 +1,60 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +--------------------------------------------------------- + emp.eno emp.ename emp.dno +--------------------------------------------------------- + 1 Nihar 10 + 2 Papu 20 + 3 Sima 30 + 4 Nama 40 + 5 Pinu 50 + +--------------------------------------------------------- + dept.deptno dept.dname dept.lid +--------------------------------------------------------- + 20 IT 101 + 40 Sales 102 + 60 Mkt 103 + 30 Store 104 + +--------------------------------------------------------- + emp.eno emp.ename emp.dno dept.deptno dept.dname dept.lid +--------------------------------------------------------- + 1 Nihar 10 20 IT 101 + 1 Nihar 10 40 Sales 102 + 1 Nihar 10 60 Mkt 103 + 1 Nihar 10 30 Store 104 + 2 Papu 20 20 IT 101 + 2 Papu 20 40 Sales 102 + 2 Papu 20 60 Mkt 103 + 2 Papu 20 30 Store 104 + 3 Sima 30 20 IT 101 + 3 Sima 30 40 Sales 102 + 3 Sima 30 60 Mkt 103 + 3 Sima 30 30 Store 104 + 4 Nama 40 20 IT 101 + 4 Nama 40 40 Sales 102 + 4 Nama 40 60 Mkt 103 + 4 Nama 40 30 Store 104 + 5 Pinu 50 20 IT 101 + 5 Pinu 50 40 Sales 102 + 5 Pinu 50 60 Mkt 103 + 5 Pinu 50 30 Store 104 + +echo select * from emp where emp.deptno in (20,30,40); +Statement prepare failed with error -19 +echo select * from emp,dept where emp.deptno in (20,30,40); +Statement prepare failed with error -19 +echo drop table emp; +Statement Executed +echo drop table dept; +Statement Executed diff --git a/test/sql/Join/exp.test017.ksh b/test/sql/Join/exp.test017.ksh new file mode 100644 index 00000000..48e2fe16 --- /dev/null +++ b/test/sql/Join/exp.test017.ksh @@ -0,0 +1,60 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +--------------------------------------------------------- + emp.eno emp.ename emp.dno +--------------------------------------------------------- + 1 Nihar 10 + 2 Papu 20 + 3 Sima 30 + 4 Nama 40 + 5 Pinu 50 + +--------------------------------------------------------- + dept.deptno dept.dname dept.lid +--------------------------------------------------------- + 20 IT 101 + 40 Sales 102 + 60 Mkt 103 + 30 Store 104 + +--------------------------------------------------------- + emp.eno emp.ename emp.dno dept.deptno dept.dname dept.lid +--------------------------------------------------------- + 1 Nihar 10 20 IT 101 + 1 Nihar 10 40 Sales 102 + 1 Nihar 10 60 Mkt 103 + 1 Nihar 10 30 Store 104 + 2 Papu 20 20 IT 101 + 2 Papu 20 40 Sales 102 + 2 Papu 20 60 Mkt 103 + 2 Papu 20 30 Store 104 + 3 Sima 30 20 IT 101 + 3 Sima 30 40 Sales 102 + 3 Sima 30 60 Mkt 103 + 3 Sima 30 30 Store 104 + 4 Nama 40 20 IT 101 + 4 Nama 40 40 Sales 102 + 4 Nama 40 60 Mkt 103 + 4 Nama 40 30 Store 104 + 5 Pinu 50 20 IT 101 + 5 Pinu 50 40 Sales 102 + 5 Pinu 50 60 Mkt 103 + 5 Pinu 50 30 Store 104 + +echo select * from emp where emp.deptno between 20 and 40; +Statement prepare failed with error -19 +echo select * from emp,dept where emp.deptno between 20 and 40; +Statement prepare failed with error -19 +echo drop table emp; +Statement Executed +echo drop table dept; +Statement Executed diff --git a/test/sql/Join/exp.test018.ksh b/test/sql/Join/exp.test018.ksh new file mode 100644 index 00000000..00efc8e7 --- /dev/null +++ b/test/sql/Join/exp.test018.ksh @@ -0,0 +1,60 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +--------------------------------------------------------- + emp.eno emp.ename emp.dno +--------------------------------------------------------- + 1 Nihar 10 + 2 Papu 20 + 3 Sima 30 + 4 Nama 40 + 5 Pinu 50 + +--------------------------------------------------------- + dept.deptno dept.dname dept.lid +--------------------------------------------------------- + 20 IT 101 + 40 Sales 102 + 60 Mkt 103 + 30 Store 104 + +--------------------------------------------------------- + emp.eno emp.ename emp.dno dept.deptno dept.dname dept.lid +--------------------------------------------------------- + 1 Nihar 10 20 IT 101 + 1 Nihar 10 40 Sales 102 + 1 Nihar 10 60 Mkt 103 + 1 Nihar 10 30 Store 104 + 2 Papu 20 20 IT 101 + 2 Papu 20 40 Sales 102 + 2 Papu 20 60 Mkt 103 + 2 Papu 20 30 Store 104 + 3 Sima 30 20 IT 101 + 3 Sima 30 40 Sales 102 + 3 Sima 30 60 Mkt 103 + 3 Sima 30 30 Store 104 + 4 Nama 40 20 IT 101 + 4 Nama 40 40 Sales 102 + 4 Nama 40 60 Mkt 103 + 4 Nama 40 30 Store 104 + 5 Pinu 50 20 IT 101 + 5 Pinu 50 40 Sales 102 + 5 Pinu 50 60 Mkt 103 + 5 Pinu 50 30 Store 104 + +echo select * from emp where emp.dname like 'S%'; +Statement prepare failed with error -19 +echo select * from emp,dept where emp.dname like 'S%'; +Statement prepare failed with error -19 +echo drop table emp; +Statement Executed +echo drop table dept; +Statement Executed diff --git a/test/sql/Join/exp.test019.ksh b/test/sql/Join/exp.test019.ksh new file mode 100644 index 00000000..9574120e --- /dev/null +++ b/test/sql/Join/exp.test019.ksh @@ -0,0 +1,129 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(100,101); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(303,300); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2 where t1.f1 = t2.f1 and t1.f1 = t2.f1; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 101 110 + 303 333 303 300 + 505 555 505 100 + +echo select * from t1,t2 where t1.f1 = t2.f1 and t2.f2 > 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 101 110 + 303 333 303 300 + +echo select * from t1,t2 where t1.f1 = t2.f1 or t1.f2 > t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 101 110 + 303 333 505 100 + 303 333 100 101 + 303 333 303 300 + 303 333 101 110 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +echo select * from t1,t2 where t1.f1 = t2.f1 or t2.f2 > 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 100 101 + 101 100 404 444 + 101 100 303 300 + 101 100 101 110 + 303 333 100 101 + 303 333 404 444 + 303 333 303 300 + 303 333 101 110 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +echo select * from t1,t2 where not ( t1.f1 = t2.f1 and t1.f1 = t2.f1 ); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + 101 100 100 101 + 101 100 404 444 + 101 100 303 300 + 303 333 505 100 + 303 333 100 101 + 303 333 404 444 + 303 333 101 110 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +echo select * from t1,t2 where ( not t1.f1 = t2.f1 ); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + 101 100 100 101 + 101 100 404 444 + 101 100 303 300 + 303 333 505 100 + 303 333 100 101 + 303 333 404 444 + 303 333 101 110 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +echo select * from t1,t2 where t1.f1 = t2.f1 and t1.f2 = 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 101 110 + +echo select * from t1,t2 where t1.f1 > t2.f1 and t2.f2 = 110; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 101 110 + 505 555 101 110 + +echo select * from t1,t2 where t1.f1 > t2.f1 and t2.f2 > 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 100 101 + 303 333 100 101 + 303 333 101 110 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test020.ksh b/test/sql/Join/exp.test020.ksh new file mode 100644 index 00000000..febf1ab6 --- /dev/null +++ b/test/sql/Join/exp.test020.ksh @@ -0,0 +1,133 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(100,101); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(303,300); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +Statement Executed +Statement Executed +Statement Executed +Statement Executed +echo select * from t1,t2 where t1.f1 = t2.f1 and t1.f1 = t2.f1; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 101 110 + 303 333 303 300 + 505 555 505 100 + +echo select * from t1,t2 where t1.f1 = t2.f1 and t2.f2 > 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 101 110 + 303 333 303 300 + +echo select * from t1,t2 where t1.f1 = t2.f1 or t1.f2 > t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 101 110 + 303 333 505 100 + 303 333 100 101 + 303 333 303 300 + 303 333 101 110 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +echo select * from t1,t2 where t1.f1 = t2.f1 or t2.f2 > 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 100 101 + 101 100 404 444 + 101 100 303 300 + 101 100 101 110 + 303 333 100 101 + 303 333 404 444 + 303 333 303 300 + 303 333 101 110 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +echo select * from t1,t2 where not ( t1.f1 = t2.f1 and t1.f1 = t2.f1 ); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + 101 100 100 101 + 101 100 404 444 + 101 100 303 300 + 303 333 505 100 + 303 333 100 101 + 303 333 404 444 + 303 333 101 110 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +echo select * from t1,t2 where ( not t1.f1 = t2.f1 ); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + 101 100 100 101 + 101 100 404 444 + 101 100 303 300 + 303 333 505 100 + 303 333 100 101 + 303 333 404 444 + 303 333 101 110 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +echo select * from t1,t2 where t1.f1 = t2.f1 and t1.f2 = 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 101 110 + +echo select * from t1,t2 where t1.f1 > t2.f1 and t2.f2 = 110; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 101 110 + 505 555 101 110 + +echo select * from t1,t2 where t1.f1 > t2.f1 and t2.f2 > 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 100 101 + 303 333 100 101 + 303 333 101 110 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test021.ksh b/test/sql/Join/exp.test021.ksh new file mode 100644 index 00000000..d7b58512 --- /dev/null +++ b/test/sql/Join/exp.test021.ksh @@ -0,0 +1,133 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(100,101); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(303,300); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +Statement Executed +Statement Executed +Statement Executed +Statement Executed +echo select * from t1,t2 where t1.f1 = t2.f1 and t1.f1 = t2.f1; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 101 110 + 303 333 303 300 + 505 555 505 100 + +echo select * from t1,t2 where t1.f1 = t2.f1 and t2.f2 > 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 101 110 + 303 333 303 300 + +echo select * from t1,t2 where t1.f1 = t2.f1 or t1.f2 > t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 101 110 + 303 333 505 100 + 303 333 100 101 + 303 333 303 300 + 303 333 101 110 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +echo select * from t1,t2 where t1.f1 = t2.f1 or t2.f2 > 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 100 101 + 101 100 404 444 + 101 100 303 300 + 101 100 101 110 + 303 333 100 101 + 303 333 404 444 + 303 333 303 300 + 303 333 101 110 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +echo select * from t1,t2 where not ( t1.f1 = t2.f1 and t1.f1 = t2.f1 ); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + 101 100 100 101 + 101 100 404 444 + 101 100 303 300 + 303 333 505 100 + 303 333 100 101 + 303 333 404 444 + 303 333 101 110 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +echo select * from t1,t2 where ( not t1.f1 = t2.f1 ); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + 101 100 100 101 + 101 100 404 444 + 101 100 303 300 + 303 333 505 100 + 303 333 100 101 + 303 333 404 444 + 303 333 101 110 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +echo select * from t1,t2 where t1.f1 = t2.f1 and t1.f2 = 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 101 110 + +echo select * from t1,t2 where t1.f1 > t2.f1 and t2.f2 = 110; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 101 110 + 505 555 101 110 + +echo select * from t1,t2 where t1.f1 > t2.f1 and t2.f2 > 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 100 101 + 303 333 100 101 + 303 333 101 110 + 505 555 100 101 + 505 555 101 110 + 505 555 303 300 + 505 555 404 444 + +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test022.ksh b/test/sql/Join/exp.test022.ksh new file mode 100644 index 00000000..d7b58512 --- /dev/null +++ b/test/sql/Join/exp.test022.ksh @@ -0,0 +1,133 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(100,101); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(303,300); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +Statement Executed +Statement Executed +Statement Executed +Statement Executed +echo select * from t1,t2 where t1.f1 = t2.f1 and t1.f1 = t2.f1; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 101 110 + 303 333 303 300 + 505 555 505 100 + +echo select * from t1,t2 where t1.f1 = t2.f1 and t2.f2 > 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 101 110 + 303 333 303 300 + +echo select * from t1,t2 where t1.f1 = t2.f1 or t1.f2 > t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 101 110 + 303 333 505 100 + 303 333 100 101 + 303 333 303 300 + 303 333 101 110 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +echo select * from t1,t2 where t1.f1 = t2.f1 or t2.f2 > 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 100 101 + 101 100 404 444 + 101 100 303 300 + 101 100 101 110 + 303 333 100 101 + 303 333 404 444 + 303 333 303 300 + 303 333 101 110 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +echo select * from t1,t2 where not ( t1.f1 = t2.f1 and t1.f1 = t2.f1 ); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + 101 100 100 101 + 101 100 404 444 + 101 100 303 300 + 303 333 505 100 + 303 333 100 101 + 303 333 404 444 + 303 333 101 110 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +echo select * from t1,t2 where ( not t1.f1 = t2.f1 ); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + 101 100 100 101 + 101 100 404 444 + 101 100 303 300 + 303 333 505 100 + 303 333 100 101 + 303 333 404 444 + 303 333 101 110 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +echo select * from t1,t2 where t1.f1 = t2.f1 and t1.f2 = 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 101 110 + +echo select * from t1,t2 where t1.f1 > t2.f1 and t2.f2 = 110; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 101 110 + 505 555 101 110 + +echo select * from t1,t2 where t1.f1 > t2.f1 and t2.f2 > 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 100 101 + 303 333 100 101 + 303 333 101 110 + 505 555 100 101 + 505 555 101 110 + 505 555 303 300 + 505 555 404 444 + +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test023.ksh b/test/sql/Join/exp.test023.ksh new file mode 100644 index 00000000..febf1ab6 --- /dev/null +++ b/test/sql/Join/exp.test023.ksh @@ -0,0 +1,133 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(100,101); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(303,300); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +Statement Executed +Statement Executed +Statement Executed +Statement Executed +echo select * from t1,t2 where t1.f1 = t2.f1 and t1.f1 = t2.f1; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 101 110 + 303 333 303 300 + 505 555 505 100 + +echo select * from t1,t2 where t1.f1 = t2.f1 and t2.f2 > 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 101 110 + 303 333 303 300 + +echo select * from t1,t2 where t1.f1 = t2.f1 or t1.f2 > t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 101 110 + 303 333 505 100 + 303 333 100 101 + 303 333 303 300 + 303 333 101 110 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +echo select * from t1,t2 where t1.f1 = t2.f1 or t2.f2 > 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 100 101 + 101 100 404 444 + 101 100 303 300 + 101 100 101 110 + 303 333 100 101 + 303 333 404 444 + 303 333 303 300 + 303 333 101 110 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +echo select * from t1,t2 where not ( t1.f1 = t2.f1 and t1.f1 = t2.f1 ); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + 101 100 100 101 + 101 100 404 444 + 101 100 303 300 + 303 333 505 100 + 303 333 100 101 + 303 333 404 444 + 303 333 101 110 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +echo select * from t1,t2 where ( not t1.f1 = t2.f1 ); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + 101 100 100 101 + 101 100 404 444 + 101 100 303 300 + 303 333 505 100 + 303 333 100 101 + 303 333 404 444 + 303 333 101 110 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +echo select * from t1,t2 where t1.f1 = t2.f1 and t1.f2 = 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 101 110 + +echo select * from t1,t2 where t1.f1 > t2.f1 and t2.f2 = 110; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 101 110 + 505 555 101 110 + +echo select * from t1,t2 where t1.f1 > t2.f1 and t2.f2 > 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 100 101 + 303 333 100 101 + 303 333 101 110 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test024.ksh b/test/sql/Join/exp.test024.ksh new file mode 100644 index 00000000..d002a59c --- /dev/null +++ b/test/sql/Join/exp.test024.ksh @@ -0,0 +1,131 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(100,101); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(303,300); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +Statement Executed +Statement Executed +echo select * from t1,t2 where t1.f1 = t2.f1 and t1.f1 = t2.f1; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 101 110 + 303 333 303 300 + 505 555 505 100 + +echo select * from t1,t2 where t1.f1 = t2.f1 and t2.f2 > 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 101 110 + 303 333 303 300 + +echo select * from t1,t2 where t1.f1 = t2.f1 or t1.f2 > t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 101 110 + 303 333 505 100 + 303 333 100 101 + 303 333 303 300 + 303 333 101 110 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +echo select * from t1,t2 where t1.f1 = t2.f1 or t2.f2 > 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 100 101 + 101 100 404 444 + 101 100 303 300 + 101 100 101 110 + 303 333 100 101 + 303 333 404 444 + 303 333 303 300 + 303 333 101 110 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +echo select * from t1,t2 where not ( t1.f1 = t2.f1 and t1.f1 = t2.f1 ); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + 101 100 100 101 + 101 100 404 444 + 101 100 303 300 + 303 333 505 100 + 303 333 100 101 + 303 333 404 444 + 303 333 101 110 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +echo select * from t1,t2 where ( not t1.f1 = t2.f1 ); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + 101 100 100 101 + 101 100 404 444 + 101 100 303 300 + 303 333 505 100 + 303 333 100 101 + 303 333 404 444 + 303 333 101 110 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +echo select * from t1,t2 where t1.f1 = t2.f1 and t1.f2 = 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 101 110 + +echo select * from t1,t2 where t1.f1 > t2.f1 and t2.f2 = 110; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 101 110 + 505 555 101 110 + +echo select * from t1,t2 where t1.f1 > t2.f1 and t2.f2 > 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 100 101 + 303 333 100 101 + 303 333 101 110 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test025.ksh b/test/sql/Join/exp.test025.ksh new file mode 100644 index 00000000..5da086b9 --- /dev/null +++ b/test/sql/Join/exp.test025.ksh @@ -0,0 +1,131 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(100,101); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(303,300); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +Statement Executed +Statement Executed +echo select * from t1,t2 where t1.f1 = t2.f1 and t1.f1 = t2.f1; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 101 110 + 303 333 303 300 + 505 555 505 100 + +echo select * from t1,t2 where t1.f1 = t2.f1 and t2.f2 > 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 101 110 + 303 333 303 300 + +echo select * from t1,t2 where t1.f1 = t2.f1 or t1.f2 > t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 101 110 + 303 333 505 100 + 303 333 100 101 + 303 333 303 300 + 303 333 101 110 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +echo select * from t1,t2 where t1.f1 = t2.f1 or t2.f2 > 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 100 101 + 101 100 404 444 + 101 100 303 300 + 101 100 101 110 + 303 333 100 101 + 303 333 404 444 + 303 333 303 300 + 303 333 101 110 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +echo select * from t1,t2 where not ( t1.f1 = t2.f1 and t1.f1 = t2.f1 ); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + 101 100 100 101 + 101 100 404 444 + 101 100 303 300 + 303 333 505 100 + 303 333 100 101 + 303 333 404 444 + 303 333 101 110 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +echo select * from t1,t2 where ( not t1.f1 = t2.f1 ); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + 101 100 100 101 + 101 100 404 444 + 101 100 303 300 + 303 333 505 100 + 303 333 100 101 + 303 333 404 444 + 303 333 101 110 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +echo select * from t1,t2 where t1.f1 = t2.f1 and t1.f2 = 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 101 110 + +echo select * from t1,t2 where t1.f1 > t2.f1 and t2.f2 = 110; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 101 110 + 505 555 101 110 + +echo select * from t1,t2 where t1.f1 > t2.f1 and t2.f2 > 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 100 101 + 303 333 100 101 + 303 333 101 110 + 505 555 100 101 + 505 555 101 110 + 505 555 303 300 + 505 555 404 444 + +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test026.ksh b/test/sql/Join/exp.test026.ksh new file mode 100644 index 00000000..d7b58512 --- /dev/null +++ b/test/sql/Join/exp.test026.ksh @@ -0,0 +1,133 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(100,101); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(303,300); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +Statement Executed +Statement Executed +Statement Executed +Statement Executed +echo select * from t1,t2 where t1.f1 = t2.f1 and t1.f1 = t2.f1; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 101 110 + 303 333 303 300 + 505 555 505 100 + +echo select * from t1,t2 where t1.f1 = t2.f1 and t2.f2 > 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 101 110 + 303 333 303 300 + +echo select * from t1,t2 where t1.f1 = t2.f1 or t1.f2 > t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 101 110 + 303 333 505 100 + 303 333 100 101 + 303 333 303 300 + 303 333 101 110 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +echo select * from t1,t2 where t1.f1 = t2.f1 or t2.f2 > 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 100 101 + 101 100 404 444 + 101 100 303 300 + 101 100 101 110 + 303 333 100 101 + 303 333 404 444 + 303 333 303 300 + 303 333 101 110 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +echo select * from t1,t2 where not ( t1.f1 = t2.f1 and t1.f1 = t2.f1 ); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + 101 100 100 101 + 101 100 404 444 + 101 100 303 300 + 303 333 505 100 + 303 333 100 101 + 303 333 404 444 + 303 333 101 110 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +echo select * from t1,t2 where ( not t1.f1 = t2.f1 ); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + 101 100 100 101 + 101 100 404 444 + 101 100 303 300 + 303 333 505 100 + 303 333 100 101 + 303 333 404 444 + 303 333 101 110 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +echo select * from t1,t2 where t1.f1 = t2.f1 and t1.f2 = 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 101 110 + +echo select * from t1,t2 where t1.f1 > t2.f1 and t2.f2 = 110; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 101 110 + 505 555 101 110 + +echo select * from t1,t2 where t1.f1 > t2.f1 and t2.f2 > 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 100 101 + 303 333 100 101 + 303 333 101 110 + 505 555 100 101 + 505 555 101 110 + 505 555 303 300 + 505 555 404 444 + +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test027.ksh b/test/sql/Join/exp.test027.ksh new file mode 100644 index 00000000..febf1ab6 --- /dev/null +++ b/test/sql/Join/exp.test027.ksh @@ -0,0 +1,133 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(100,101); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(303,300); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +Statement Executed +Statement Executed +Statement Executed +Statement Executed +echo select * from t1,t2 where t1.f1 = t2.f1 and t1.f1 = t2.f1; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 101 110 + 303 333 303 300 + 505 555 505 100 + +echo select * from t1,t2 where t1.f1 = t2.f1 and t2.f2 > 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 101 110 + 303 333 303 300 + +echo select * from t1,t2 where t1.f1 = t2.f1 or t1.f2 > t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 101 110 + 303 333 505 100 + 303 333 100 101 + 303 333 303 300 + 303 333 101 110 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +echo select * from t1,t2 where t1.f1 = t2.f1 or t2.f2 > 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 100 101 + 101 100 404 444 + 101 100 303 300 + 101 100 101 110 + 303 333 100 101 + 303 333 404 444 + 303 333 303 300 + 303 333 101 110 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +echo select * from t1,t2 where not ( t1.f1 = t2.f1 and t1.f1 = t2.f1 ); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + 101 100 100 101 + 101 100 404 444 + 101 100 303 300 + 303 333 505 100 + 303 333 100 101 + 303 333 404 444 + 303 333 101 110 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +echo select * from t1,t2 where ( not t1.f1 = t2.f1 ); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + 101 100 100 101 + 101 100 404 444 + 101 100 303 300 + 303 333 505 100 + 303 333 100 101 + 303 333 404 444 + 303 333 101 110 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +echo select * from t1,t2 where t1.f1 = t2.f1 and t1.f2 = 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 101 110 + +echo select * from t1,t2 where t1.f1 > t2.f1 and t2.f2 = 110; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 101 110 + 505 555 101 110 + +echo select * from t1,t2 where t1.f1 > t2.f1 and t2.f2 > 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 100 101 + 303 333 100 101 + 303 333 101 110 + 505 555 100 101 + 505 555 404 444 + 505 555 303 300 + 505 555 101 110 + +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test028.ksh b/test/sql/Join/exp.test028.ksh new file mode 100644 index 00000000..17f8e46b --- /dev/null +++ b/test/sql/Join/exp.test028.ksh @@ -0,0 +1,123 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 505 100 303 333 + 100 100 505 100 101 110 + 100 100 505 100 100 200 + 100 100 404 444 303 333 + 100 100 404 444 101 110 + 100 100 404 444 100 200 + 100 100 100 110 303 333 + 100 100 100 110 101 110 + 100 100 100 110 100 200 + 303 333 505 100 303 333 + 303 333 505 100 101 110 + 303 333 505 100 100 200 + 303 333 404 444 303 333 + 303 333 404 444 101 110 + 303 333 404 444 100 200 + 303 333 100 110 303 333 + 303 333 100 110 101 110 + 303 333 100 110 100 200 + 505 555 505 100 303 333 + 505 555 505 100 101 110 + 505 555 505 100 100 200 + 505 555 404 444 303 333 + 505 555 404 444 101 110 + 505 555 404 444 100 200 + 505 555 100 110 303 333 + 505 555 100 110 101 110 + 505 555 100 110 100 200 + +echo select * from t2,t1,t3; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 505 100 100 100 303 333 + 505 100 100 100 101 110 + 505 100 100 100 100 200 + 505 100 303 333 303 333 + 505 100 303 333 101 110 + 505 100 303 333 100 200 + 505 100 505 555 303 333 + 505 100 505 555 101 110 + 505 100 505 555 100 200 + 404 444 100 100 303 333 + 404 444 100 100 101 110 + 404 444 100 100 100 200 + 404 444 303 333 303 333 + 404 444 303 333 101 110 + 404 444 303 333 100 200 + 404 444 505 555 303 333 + 404 444 505 555 101 110 + 404 444 505 555 100 200 + 100 110 100 100 303 333 + 100 110 100 100 101 110 + 100 110 100 100 100 200 + 100 110 303 333 303 333 + 100 110 303 333 101 110 + 100 110 303 333 100 200 + 100 110 505 555 303 333 + 100 110 505 555 101 110 + 100 110 505 555 100 200 + +echo select * from t3,t1,t2; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 100 100 505 100 + 303 333 100 100 404 444 + 303 333 100 100 100 110 + 303 333 303 333 505 100 + 303 333 303 333 404 444 + 303 333 303 333 100 110 + 303 333 505 555 505 100 + 303 333 505 555 404 444 + 303 333 505 555 100 110 + 101 110 100 100 505 100 + 101 110 100 100 404 444 + 101 110 100 100 100 110 + 101 110 303 333 505 100 + 101 110 303 333 404 444 + 101 110 303 333 100 110 + 101 110 505 555 505 100 + 101 110 505 555 404 444 + 101 110 505 555 100 110 + 100 200 100 100 505 100 + 100 200 100 100 404 444 + 100 200 100 100 100 110 + 100 200 303 333 505 100 + 100 200 303 333 404 444 + 100 200 303 333 100 110 + 100 200 505 555 505 100 + 100 200 505 555 404 444 + 100 200 505 555 100 110 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test029.ksh b/test/sql/Join/exp.test029.ksh new file mode 100644 index 00000000..4d365fe8 --- /dev/null +++ b/test/sql/Join/exp.test029.ksh @@ -0,0 +1,60 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3 where t1.f1 = t2.f1; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 100 110 303 333 + 100 100 100 110 101 110 + 100 100 100 110 100 200 + 505 555 505 100 303 333 + 505 555 505 100 101 110 + 505 555 505 100 100 200 + +echo select * from t2,t1,t3 where t1.f1 = t2.f1; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 505 100 505 555 303 333 + 505 100 505 555 101 110 + 505 100 505 555 100 200 + 100 110 100 100 303 333 + 100 110 100 100 101 110 + 100 110 100 100 100 200 + +echo select * from t3,t1,t2 where t1.f1 = t2.f1; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 100 100 100 110 + 303 333 505 555 505 100 + 101 110 100 100 100 110 + 101 110 505 555 505 100 + 100 200 100 100 100 110 + 100 200 505 555 505 100 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test030.ksh b/test/sql/Join/exp.test030.ksh new file mode 100644 index 00000000..1b4a49fd --- /dev/null +++ b/test/sql/Join/exp.test030.ksh @@ -0,0 +1,48 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3 where t1.f1 = t2.f1 and t3.f1=100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 100 110 100 200 + 505 555 505 100 100 200 + +echo select * from t2,t1,t3 where t1.f1 = t2.f1 and t3.f1=100; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 505 100 505 555 100 200 + 100 110 100 100 100 200 + +echo select * from t3,t1,t2 where t1.f1 = t2.f1 and t3.f1=100; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 100 200 100 100 100 110 + 100 200 505 555 505 100 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test031.ksh b/test/sql/Join/exp.test031.ksh new file mode 100644 index 00000000..bd1e6028 --- /dev/null +++ b/test/sql/Join/exp.test031.ksh @@ -0,0 +1,51 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3 where t1.f1 = t2.f1 and t2.f1=100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 100 110 303 333 + 100 100 100 110 101 110 + 100 100 100 110 100 200 + +echo select * from t2,t1,t3 where t1.f1 = t2.f1 and t2.f1=100; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 110 100 100 303 333 + 100 110 100 100 101 110 + 100 110 100 100 100 200 + +echo select * from t3,t1,t2 where t1.f1 = t2.f1 and t2.f1=100; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 100 100 100 110 + 101 110 100 100 100 110 + 100 200 100 100 100 110 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test032.ksh b/test/sql/Join/exp.test032.ksh new file mode 100644 index 00000000..30b9fdc2 --- /dev/null +++ b/test/sql/Join/exp.test032.ksh @@ -0,0 +1,45 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3 where t1.f1 = t2.f1 and t2.f1 = t3.f1; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 100 110 100 200 + +echo select * from t2,t1,t3 where t1.f1 = t2.f1 and t2.f1 = t3.f1; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 110 100 100 100 200 + +echo select * from t3,t1,t2 where t1.f1 = t2.f1 and t2.f1 = t3.f1; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 100 200 100 100 100 110 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test033.ksh b/test/sql/Join/exp.test033.ksh new file mode 100644 index 00000000..b3d97275 --- /dev/null +++ b/test/sql/Join/exp.test033.ksh @@ -0,0 +1,45 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3 where t1.f1 = t2.f1 and t2.f1 = t3.f1 and t3.f1 = 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 100 110 100 200 + +echo select * from t2,t1,t3 where t1.f1 = t2.f1 and t2.f1 = t3.f1 and t3.f1 = 100; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 110 100 100 100 200 + +echo select * from t3,t1,t2 where t1.f1 = t2.f1 and t2.f1 = t3.f1 and t3.f1 = 100; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 100 200 100 100 100 110 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test034.ksh b/test/sql/Join/exp.test034.ksh new file mode 100644 index 00000000..8998aad4 --- /dev/null +++ b/test/sql/Join/exp.test034.ksh @@ -0,0 +1,129 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo create index idx1 on t1(f1) hash; +Statement Executed +echo create index idx2 on t2(f1) hash; +Statement Executed +echo create index idx3 on t3(f1) hash; +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 505 100 303 333 + 100 100 505 100 101 110 + 100 100 505 100 100 200 + 100 100 404 444 303 333 + 100 100 404 444 101 110 + 100 100 404 444 100 200 + 100 100 100 110 303 333 + 100 100 100 110 101 110 + 100 100 100 110 100 200 + 303 333 505 100 303 333 + 303 333 505 100 101 110 + 303 333 505 100 100 200 + 303 333 404 444 303 333 + 303 333 404 444 101 110 + 303 333 404 444 100 200 + 303 333 100 110 303 333 + 303 333 100 110 101 110 + 303 333 100 110 100 200 + 505 555 505 100 303 333 + 505 555 505 100 101 110 + 505 555 505 100 100 200 + 505 555 404 444 303 333 + 505 555 404 444 101 110 + 505 555 404 444 100 200 + 505 555 100 110 303 333 + 505 555 100 110 101 110 + 505 555 100 110 100 200 + +echo select * from t2,t1,t3; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 505 100 100 100 303 333 + 505 100 100 100 101 110 + 505 100 100 100 100 200 + 505 100 303 333 303 333 + 505 100 303 333 101 110 + 505 100 303 333 100 200 + 505 100 505 555 303 333 + 505 100 505 555 101 110 + 505 100 505 555 100 200 + 404 444 100 100 303 333 + 404 444 100 100 101 110 + 404 444 100 100 100 200 + 404 444 303 333 303 333 + 404 444 303 333 101 110 + 404 444 303 333 100 200 + 404 444 505 555 303 333 + 404 444 505 555 101 110 + 404 444 505 555 100 200 + 100 110 100 100 303 333 + 100 110 100 100 101 110 + 100 110 100 100 100 200 + 100 110 303 333 303 333 + 100 110 303 333 101 110 + 100 110 303 333 100 200 + 100 110 505 555 303 333 + 100 110 505 555 101 110 + 100 110 505 555 100 200 + +echo select * from t3,t1,t2; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 100 100 505 100 + 303 333 100 100 404 444 + 303 333 100 100 100 110 + 303 333 303 333 505 100 + 303 333 303 333 404 444 + 303 333 303 333 100 110 + 303 333 505 555 505 100 + 303 333 505 555 404 444 + 303 333 505 555 100 110 + 101 110 100 100 505 100 + 101 110 100 100 404 444 + 101 110 100 100 100 110 + 101 110 303 333 505 100 + 101 110 303 333 404 444 + 101 110 303 333 100 110 + 101 110 505 555 505 100 + 101 110 505 555 404 444 + 101 110 505 555 100 110 + 100 200 100 100 505 100 + 100 200 100 100 404 444 + 100 200 100 100 100 110 + 100 200 303 333 505 100 + 100 200 303 333 404 444 + 100 200 303 333 100 110 + 100 200 505 555 505 100 + 100 200 505 555 404 444 + 100 200 505 555 100 110 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test035.ksh b/test/sql/Join/exp.test035.ksh new file mode 100644 index 00000000..9fc219eb --- /dev/null +++ b/test/sql/Join/exp.test035.ksh @@ -0,0 +1,66 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo create index idx1 on t1(f1) hash; +Statement Executed +echo create index idx2 on t2(f1) hash; +Statement Executed +echo create index idx3 on t3(f1) hash; +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3 where t1.f1 = t2.f1; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 100 110 303 333 + 100 100 100 110 101 110 + 100 100 100 110 100 200 + 505 555 505 100 303 333 + 505 555 505 100 101 110 + 505 555 505 100 100 200 + +echo select * from t2,t1,t3 where t1.f1 = t2.f1; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 505 100 505 555 303 333 + 505 100 505 555 101 110 + 505 100 505 555 100 200 + 100 110 100 100 303 333 + 100 110 100 100 101 110 + 100 110 100 100 100 200 + +echo select * from t3,t1,t2 where t1.f1 = t2.f1; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 100 100 100 110 + 303 333 505 555 505 100 + 101 110 100 100 100 110 + 101 110 505 555 505 100 + 100 200 100 100 100 110 + 100 200 505 555 505 100 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test036.ksh b/test/sql/Join/exp.test036.ksh new file mode 100644 index 00000000..d5919f0c --- /dev/null +++ b/test/sql/Join/exp.test036.ksh @@ -0,0 +1,54 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo create index idx1 on t1(f1) hash; +Statement Executed +echo create index idx2 on t2(f1) hash; +Statement Executed +echo create index idx3 on t3(f1) hash; +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3 where t1.f1 = t2.f1 and t3.f1=100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 100 110 100 200 + 505 555 505 100 100 200 + +echo select * from t2,t1,t3 where t1.f1 = t2.f1 and t3.f1=100; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 505 100 505 555 100 200 + 100 110 100 100 100 200 + +echo select * from t3,t1,t2 where t1.f1 = t2.f1 and t3.f1=100; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 100 200 100 100 100 110 + 100 200 505 555 505 100 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test037.ksh b/test/sql/Join/exp.test037.ksh new file mode 100644 index 00000000..fac6daaf --- /dev/null +++ b/test/sql/Join/exp.test037.ksh @@ -0,0 +1,57 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo create index idx1 on t1(f1) hash; +Statement Executed +echo create index idx2 on t2(f1) hash; +Statement Executed +echo create index idx3 on t3(f1) hash; +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3 where t1.f1 = t2.f1 and t2.f1=100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 100 110 303 333 + 100 100 100 110 101 110 + 100 100 100 110 100 200 + +echo select * from t2,t1,t3 where t1.f1 = t2.f1 and t2.f1=100; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 110 100 100 303 333 + 100 110 100 100 101 110 + 100 110 100 100 100 200 + +echo select * from t3,t1,t2 where t1.f1 = t2.f1 and t2.f1=100; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 100 100 100 110 + 101 110 100 100 100 110 + 100 200 100 100 100 110 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test038.ksh b/test/sql/Join/exp.test038.ksh new file mode 100644 index 00000000..30095b89 --- /dev/null +++ b/test/sql/Join/exp.test038.ksh @@ -0,0 +1,51 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo create index idx1 on t1(f1) hash; +Statement Executed +echo create index idx2 on t2(f1) hash; +Statement Executed +echo create index idx3 on t3(f1) hash; +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3 where t1.f1 = t2.f1 and t2.f1 = t3.f1; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 100 110 100 200 + +echo select * from t2,t1,t3 where t1.f1 = t2.f1 and t2.f1 = t3.f1; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 110 100 100 100 200 + +echo select * from t3,t1,t2 where t1.f1 = t2.f1 and t2.f1 = t3.f1; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 100 200 100 100 100 110 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test039.ksh b/test/sql/Join/exp.test039.ksh new file mode 100644 index 00000000..a77c4ac6 --- /dev/null +++ b/test/sql/Join/exp.test039.ksh @@ -0,0 +1,51 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo create index idx1 on t1(f1) hash; +Statement Executed +echo create index idx2 on t2(f1) hash; +Statement Executed +echo create index idx3 on t3(f1) hash; +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3 where t1.f1 = t2.f1 and t2.f1 = t3.f1 and t3.f1 = 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 100 110 100 200 + +echo select * from t2,t1,t3 where t1.f1 = t2.f1 and t2.f1 = t3.f1 and t3.f1 = 100; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 110 100 100 100 200 + +echo select * from t3,t1,t2 where t1.f1 = t2.f1 and t2.f1 = t3.f1 and t3.f1 = 100; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 100 200 100 100 100 110 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test040.ksh b/test/sql/Join/exp.test040.ksh new file mode 100644 index 00000000..1e567539 --- /dev/null +++ b/test/sql/Join/exp.test040.ksh @@ -0,0 +1,129 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo create index idx1 on t1(f1) tree; +Statement Executed +echo create index idx2 on t2(f1) tree; +Statement Executed +echo create index idx3 on t3(f1) tree; +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 505 100 303 333 + 100 100 505 100 101 110 + 100 100 505 100 100 200 + 100 100 404 444 303 333 + 100 100 404 444 101 110 + 100 100 404 444 100 200 + 100 100 100 110 303 333 + 100 100 100 110 101 110 + 100 100 100 110 100 200 + 303 333 505 100 303 333 + 303 333 505 100 101 110 + 303 333 505 100 100 200 + 303 333 404 444 303 333 + 303 333 404 444 101 110 + 303 333 404 444 100 200 + 303 333 100 110 303 333 + 303 333 100 110 101 110 + 303 333 100 110 100 200 + 505 555 505 100 303 333 + 505 555 505 100 101 110 + 505 555 505 100 100 200 + 505 555 404 444 303 333 + 505 555 404 444 101 110 + 505 555 404 444 100 200 + 505 555 100 110 303 333 + 505 555 100 110 101 110 + 505 555 100 110 100 200 + +echo select * from t2,t1,t3; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 505 100 100 100 303 333 + 505 100 100 100 101 110 + 505 100 100 100 100 200 + 505 100 303 333 303 333 + 505 100 303 333 101 110 + 505 100 303 333 100 200 + 505 100 505 555 303 333 + 505 100 505 555 101 110 + 505 100 505 555 100 200 + 404 444 100 100 303 333 + 404 444 100 100 101 110 + 404 444 100 100 100 200 + 404 444 303 333 303 333 + 404 444 303 333 101 110 + 404 444 303 333 100 200 + 404 444 505 555 303 333 + 404 444 505 555 101 110 + 404 444 505 555 100 200 + 100 110 100 100 303 333 + 100 110 100 100 101 110 + 100 110 100 100 100 200 + 100 110 303 333 303 333 + 100 110 303 333 101 110 + 100 110 303 333 100 200 + 100 110 505 555 303 333 + 100 110 505 555 101 110 + 100 110 505 555 100 200 + +echo select * from t3,t1,t2; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 100 100 505 100 + 303 333 100 100 404 444 + 303 333 100 100 100 110 + 303 333 303 333 505 100 + 303 333 303 333 404 444 + 303 333 303 333 100 110 + 303 333 505 555 505 100 + 303 333 505 555 404 444 + 303 333 505 555 100 110 + 101 110 100 100 505 100 + 101 110 100 100 404 444 + 101 110 100 100 100 110 + 101 110 303 333 505 100 + 101 110 303 333 404 444 + 101 110 303 333 100 110 + 101 110 505 555 505 100 + 101 110 505 555 404 444 + 101 110 505 555 100 110 + 100 200 100 100 505 100 + 100 200 100 100 404 444 + 100 200 100 100 100 110 + 100 200 303 333 505 100 + 100 200 303 333 404 444 + 100 200 303 333 100 110 + 100 200 505 555 505 100 + 100 200 505 555 404 444 + 100 200 505 555 100 110 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test041.ksh b/test/sql/Join/exp.test041.ksh new file mode 100644 index 00000000..fe193e5f --- /dev/null +++ b/test/sql/Join/exp.test041.ksh @@ -0,0 +1,66 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo create index idx1 on t1(f1) tree; +Statement Executed +echo create index idx2 on t2(f1) tree; +Statement Executed +echo create index idx3 on t3(f1) tree; +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3 where t1.f1 = t2.f1; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 100 110 303 333 + 100 100 100 110 101 110 + 100 100 100 110 100 200 + 505 555 505 100 303 333 + 505 555 505 100 101 110 + 505 555 505 100 100 200 + +echo select * from t2,t1,t3 where t1.f1 = t2.f1; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 505 100 505 555 303 333 + 505 100 505 555 101 110 + 505 100 505 555 100 200 + 100 110 100 100 303 333 + 100 110 100 100 101 110 + 100 110 100 100 100 200 + +echo select * from t3,t1,t2 where t1.f1 = t2.f1; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 100 100 100 110 + 303 333 505 555 505 100 + 101 110 100 100 100 110 + 101 110 505 555 505 100 + 100 200 100 100 100 110 + 100 200 505 555 505 100 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test042.ksh b/test/sql/Join/exp.test042.ksh new file mode 100644 index 00000000..ba952d5c --- /dev/null +++ b/test/sql/Join/exp.test042.ksh @@ -0,0 +1,54 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo create index idx1 on t1(f1) tree; +Statement Executed +echo create index idx2 on t2(f1) tree; +Statement Executed +echo create index idx3 on t3(f1) tree; +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3 where t1.f1 = t2.f1 and t3.f1=100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 100 110 100 200 + 505 555 505 100 100 200 + +echo select * from t2,t1,t3 where t1.f1 = t2.f1 and t3.f1=100; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 505 100 505 555 100 200 + 100 110 100 100 100 200 + +echo select * from t3,t1,t2 where t1.f1 = t2.f1 and t3.f1=100; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 100 200 100 100 100 110 + 100 200 505 555 505 100 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test043.ksh b/test/sql/Join/exp.test043.ksh new file mode 100644 index 00000000..615ecc16 --- /dev/null +++ b/test/sql/Join/exp.test043.ksh @@ -0,0 +1,57 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo create index idx1 on t1(f1) tree; +Statement Executed +echo create index idx2 on t2(f1) tree; +Statement Executed +echo create index idx3 on t3(f1) tree; +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3 where t1.f1 = t2.f1 and t2.f1=100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 100 110 303 333 + 100 100 100 110 101 110 + 100 100 100 110 100 200 + +echo select * from t2,t1,t3 where t1.f1 = t2.f1 and t2.f1=100; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 110 100 100 303 333 + 100 110 100 100 101 110 + 100 110 100 100 100 200 + +echo select * from t3,t1,t2 where t1.f1 = t2.f1 and t2.f1=100; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 100 100 100 110 + 101 110 100 100 100 110 + 100 200 100 100 100 110 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test044.ksh b/test/sql/Join/exp.test044.ksh new file mode 100644 index 00000000..9713bc48 --- /dev/null +++ b/test/sql/Join/exp.test044.ksh @@ -0,0 +1,51 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo create index idx1 on t1(f1) tree; +Statement Executed +echo create index idx2 on t2(f1) tree; +Statement Executed +echo create index idx3 on t3(f1) tree; +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3 where t1.f1 = t2.f1 and t2.f1 = t3.f1; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 100 110 100 200 + +echo select * from t2,t1,t3 where t1.f1 = t2.f1 and t2.f1 = t3.f1; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 110 100 100 100 200 + +echo select * from t3,t1,t2 where t1.f1 = t2.f1 and t2.f1 = t3.f1; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 100 200 100 100 100 110 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test045.ksh b/test/sql/Join/exp.test045.ksh new file mode 100644 index 00000000..118005c8 --- /dev/null +++ b/test/sql/Join/exp.test045.ksh @@ -0,0 +1,51 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo create index idx1 on t1(f1) tree; +Statement Executed +echo create index idx2 on t2(f1) tree; +Statement Executed +echo create index idx3 on t3(f1) tree; +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3 where t1.f1 = t2.f1 and t2.f1 = t3.f1 and t3.f1 = 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 100 110 100 200 + +echo select * from t2,t1,t3 where t1.f1 = t2.f1 and t2.f1 = t3.f1 and t3.f1 = 100; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 110 100 100 100 200 + +echo select * from t3,t1,t2 where t1.f1 = t2.f1 and t2.f1 = t3.f1 and t3.f1 = 100; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 100 200 100 100 100 110 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test046.ksh b/test/sql/Join/exp.test046.ksh new file mode 100644 index 00000000..673d8d95 --- /dev/null +++ b/test/sql/Join/exp.test046.ksh @@ -0,0 +1,127 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo create index idx1 on t1(f1) hash; +Statement Executed +echo create index idx2 on t2(f1) tree; +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 505 100 303 333 + 100 100 505 100 101 110 + 100 100 505 100 100 200 + 100 100 404 444 303 333 + 100 100 404 444 101 110 + 100 100 404 444 100 200 + 100 100 100 110 303 333 + 100 100 100 110 101 110 + 100 100 100 110 100 200 + 303 333 505 100 303 333 + 303 333 505 100 101 110 + 303 333 505 100 100 200 + 303 333 404 444 303 333 + 303 333 404 444 101 110 + 303 333 404 444 100 200 + 303 333 100 110 303 333 + 303 333 100 110 101 110 + 303 333 100 110 100 200 + 505 555 505 100 303 333 + 505 555 505 100 101 110 + 505 555 505 100 100 200 + 505 555 404 444 303 333 + 505 555 404 444 101 110 + 505 555 404 444 100 200 + 505 555 100 110 303 333 + 505 555 100 110 101 110 + 505 555 100 110 100 200 + +echo select * from t2,t1,t3; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 505 100 100 100 303 333 + 505 100 100 100 101 110 + 505 100 100 100 100 200 + 505 100 303 333 303 333 + 505 100 303 333 101 110 + 505 100 303 333 100 200 + 505 100 505 555 303 333 + 505 100 505 555 101 110 + 505 100 505 555 100 200 + 404 444 100 100 303 333 + 404 444 100 100 101 110 + 404 444 100 100 100 200 + 404 444 303 333 303 333 + 404 444 303 333 101 110 + 404 444 303 333 100 200 + 404 444 505 555 303 333 + 404 444 505 555 101 110 + 404 444 505 555 100 200 + 100 110 100 100 303 333 + 100 110 100 100 101 110 + 100 110 100 100 100 200 + 100 110 303 333 303 333 + 100 110 303 333 101 110 + 100 110 303 333 100 200 + 100 110 505 555 303 333 + 100 110 505 555 101 110 + 100 110 505 555 100 200 + +echo select * from t3,t1,t2; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 100 100 505 100 + 303 333 100 100 404 444 + 303 333 100 100 100 110 + 303 333 303 333 505 100 + 303 333 303 333 404 444 + 303 333 303 333 100 110 + 303 333 505 555 505 100 + 303 333 505 555 404 444 + 303 333 505 555 100 110 + 101 110 100 100 505 100 + 101 110 100 100 404 444 + 101 110 100 100 100 110 + 101 110 303 333 505 100 + 101 110 303 333 404 444 + 101 110 303 333 100 110 + 101 110 505 555 505 100 + 101 110 505 555 404 444 + 101 110 505 555 100 110 + 100 200 100 100 505 100 + 100 200 100 100 404 444 + 100 200 100 100 100 110 + 100 200 303 333 505 100 + 100 200 303 333 404 444 + 100 200 303 333 100 110 + 100 200 505 555 505 100 + 100 200 505 555 404 444 + 100 200 505 555 100 110 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test047.ksh b/test/sql/Join/exp.test047.ksh new file mode 100644 index 00000000..881a0401 --- /dev/null +++ b/test/sql/Join/exp.test047.ksh @@ -0,0 +1,64 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo create index idx1 on t1(f1) hash; +Statement Executed +echo create index idx2 on t2(f1) tree; +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3 where t1.f1 = t2.f1; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 100 110 303 333 + 100 100 100 110 101 110 + 100 100 100 110 100 200 + 505 555 505 100 303 333 + 505 555 505 100 101 110 + 505 555 505 100 100 200 + +echo select * from t2,t1,t3 where t1.f1 = t2.f1; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 505 100 505 555 303 333 + 505 100 505 555 101 110 + 505 100 505 555 100 200 + 100 110 100 100 303 333 + 100 110 100 100 101 110 + 100 110 100 100 100 200 + +echo select * from t3,t1,t2 where t1.f1 = t2.f1; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 100 100 100 110 + 303 333 505 555 505 100 + 101 110 100 100 100 110 + 101 110 505 555 505 100 + 100 200 100 100 100 110 + 100 200 505 555 505 100 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test048.ksh b/test/sql/Join/exp.test048.ksh new file mode 100644 index 00000000..5391a097 --- /dev/null +++ b/test/sql/Join/exp.test048.ksh @@ -0,0 +1,52 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo create index idx1 on t1(f1) hash; +Statement Executed +echo create index idx2 on t2(f1) tree; +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3 where t1.f1 = t2.f1 and t3.f1=100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 100 110 100 200 + 505 555 505 100 100 200 + +echo select * from t2,t1,t3 where t1.f1 = t2.f1 and t3.f1=100; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 505 100 505 555 100 200 + 100 110 100 100 100 200 + +echo select * from t3,t1,t2 where t1.f1 = t2.f1 and t3.f1=100; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 100 200 100 100 100 110 + 100 200 505 555 505 100 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test049.ksh b/test/sql/Join/exp.test049.ksh new file mode 100644 index 00000000..a4a76caf --- /dev/null +++ b/test/sql/Join/exp.test049.ksh @@ -0,0 +1,55 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo create index idx1 on t1(f1) hash; +Statement Executed +echo create index idx2 on t2(f1) tree; +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3 where t1.f1 = t2.f1 and t2.f1=100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 100 110 303 333 + 100 100 100 110 101 110 + 100 100 100 110 100 200 + +echo select * from t2,t1,t3 where t1.f1 = t2.f1 and t2.f1=100; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 110 100 100 303 333 + 100 110 100 100 101 110 + 100 110 100 100 100 200 + +echo select * from t3,t1,t2 where t1.f1 = t2.f1 and t2.f1=100; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 100 100 100 110 + 101 110 100 100 100 110 + 100 200 100 100 100 110 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test050.ksh b/test/sql/Join/exp.test050.ksh new file mode 100644 index 00000000..71f8aebd --- /dev/null +++ b/test/sql/Join/exp.test050.ksh @@ -0,0 +1,49 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo create index idx1 on t1(f1) hash; +Statement Executed +echo create index idx2 on t2(f1) tree; +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3 where t1.f1 = t2.f1 and t2.f1 = t3.f1; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 100 110 100 200 + +echo select * from t2,t1,t3 where t1.f1 = t2.f1 and t2.f1 = t3.f1; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 110 100 100 100 200 + +echo select * from t3,t1,t2 where t1.f1 = t2.f1 and t2.f1 = t3.f1; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 100 200 100 100 100 110 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test051.ksh b/test/sql/Join/exp.test051.ksh new file mode 100644 index 00000000..7127a4b0 --- /dev/null +++ b/test/sql/Join/exp.test051.ksh @@ -0,0 +1,49 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo create index idx1 on t1(f1) hash; +Statement Executed +echo create index idx2 on t2(f1) tree; +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3 where t1.f1 = t2.f1 and t2.f1 = t3.f1 and t3.f1 = 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 100 110 100 200 + +echo select * from t2,t1,t3 where t1.f1 = t2.f1 and t2.f1 = t3.f1 and t3.f1 = 100; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 110 100 100 100 200 + +echo select * from t3,t1,t2 where t1.f1 = t2.f1 and t2.f1 = t3.f1 and t3.f1 = 100; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 100 200 100 100 100 110 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test052.ksh b/test/sql/Join/exp.test052.ksh new file mode 100644 index 00000000..b9ddc710 --- /dev/null +++ b/test/sql/Join/exp.test052.ksh @@ -0,0 +1,127 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo create index idx1 on t1(f1) tree; +Statement Executed +echo create index idx2 on t2(f1) hash; +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 505 100 303 333 + 100 100 505 100 101 110 + 100 100 505 100 100 200 + 100 100 404 444 303 333 + 100 100 404 444 101 110 + 100 100 404 444 100 200 + 100 100 100 110 303 333 + 100 100 100 110 101 110 + 100 100 100 110 100 200 + 303 333 505 100 303 333 + 303 333 505 100 101 110 + 303 333 505 100 100 200 + 303 333 404 444 303 333 + 303 333 404 444 101 110 + 303 333 404 444 100 200 + 303 333 100 110 303 333 + 303 333 100 110 101 110 + 303 333 100 110 100 200 + 505 555 505 100 303 333 + 505 555 505 100 101 110 + 505 555 505 100 100 200 + 505 555 404 444 303 333 + 505 555 404 444 101 110 + 505 555 404 444 100 200 + 505 555 100 110 303 333 + 505 555 100 110 101 110 + 505 555 100 110 100 200 + +echo select * from t2,t1,t3; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 505 100 100 100 303 333 + 505 100 100 100 101 110 + 505 100 100 100 100 200 + 505 100 303 333 303 333 + 505 100 303 333 101 110 + 505 100 303 333 100 200 + 505 100 505 555 303 333 + 505 100 505 555 101 110 + 505 100 505 555 100 200 + 404 444 100 100 303 333 + 404 444 100 100 101 110 + 404 444 100 100 100 200 + 404 444 303 333 303 333 + 404 444 303 333 101 110 + 404 444 303 333 100 200 + 404 444 505 555 303 333 + 404 444 505 555 101 110 + 404 444 505 555 100 200 + 100 110 100 100 303 333 + 100 110 100 100 101 110 + 100 110 100 100 100 200 + 100 110 303 333 303 333 + 100 110 303 333 101 110 + 100 110 303 333 100 200 + 100 110 505 555 303 333 + 100 110 505 555 101 110 + 100 110 505 555 100 200 + +echo select * from t3,t1,t2; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 100 100 505 100 + 303 333 100 100 404 444 + 303 333 100 100 100 110 + 303 333 303 333 505 100 + 303 333 303 333 404 444 + 303 333 303 333 100 110 + 303 333 505 555 505 100 + 303 333 505 555 404 444 + 303 333 505 555 100 110 + 101 110 100 100 505 100 + 101 110 100 100 404 444 + 101 110 100 100 100 110 + 101 110 303 333 505 100 + 101 110 303 333 404 444 + 101 110 303 333 100 110 + 101 110 505 555 505 100 + 101 110 505 555 404 444 + 101 110 505 555 100 110 + 100 200 100 100 505 100 + 100 200 100 100 404 444 + 100 200 100 100 100 110 + 100 200 303 333 505 100 + 100 200 303 333 404 444 + 100 200 303 333 100 110 + 100 200 505 555 505 100 + 100 200 505 555 404 444 + 100 200 505 555 100 110 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test053.ksh b/test/sql/Join/exp.test053.ksh new file mode 100644 index 00000000..1b650a87 --- /dev/null +++ b/test/sql/Join/exp.test053.ksh @@ -0,0 +1,64 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo create index idx1 on t1(f1) tree; +Statement Executed +echo create index idx2 on t2(f1) hash; +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3 where t1.f1 = t2.f1; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 100 110 303 333 + 100 100 100 110 101 110 + 100 100 100 110 100 200 + 505 555 505 100 303 333 + 505 555 505 100 101 110 + 505 555 505 100 100 200 + +echo select * from t2,t1,t3 where t1.f1 = t2.f1; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 505 100 505 555 303 333 + 505 100 505 555 101 110 + 505 100 505 555 100 200 + 100 110 100 100 303 333 + 100 110 100 100 101 110 + 100 110 100 100 100 200 + +echo select * from t3,t1,t2 where t1.f1 = t2.f1; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 100 100 100 110 + 303 333 505 555 505 100 + 101 110 100 100 100 110 + 101 110 505 555 505 100 + 100 200 100 100 100 110 + 100 200 505 555 505 100 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test054.ksh b/test/sql/Join/exp.test054.ksh new file mode 100644 index 00000000..fa4ffdea --- /dev/null +++ b/test/sql/Join/exp.test054.ksh @@ -0,0 +1,52 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo create index idx1 on t1(f1) tree; +Statement Executed +echo create index idx2 on t2(f1) hash; +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3 where t1.f1 = t2.f1 and t3.f1=100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 100 110 100 200 + 505 555 505 100 100 200 + +echo select * from t2,t1,t3 where t1.f1 = t2.f1 and t3.f1=100; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 505 100 505 555 100 200 + 100 110 100 100 100 200 + +echo select * from t3,t1,t2 where t1.f1 = t2.f1 and t3.f1=100; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 100 200 100 100 100 110 + 100 200 505 555 505 100 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test055.ksh b/test/sql/Join/exp.test055.ksh new file mode 100644 index 00000000..eeae7558 --- /dev/null +++ b/test/sql/Join/exp.test055.ksh @@ -0,0 +1,55 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo create index idx1 on t1(f1) tree; +Statement Executed +echo create index idx2 on t2(f1) hash; +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3 where t1.f1 = t2.f1 and t2.f1=100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 100 110 303 333 + 100 100 100 110 101 110 + 100 100 100 110 100 200 + +echo select * from t2,t1,t3 where t1.f1 = t2.f1 and t2.f1=100; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 110 100 100 303 333 + 100 110 100 100 101 110 + 100 110 100 100 100 200 + +echo select * from t3,t1,t2 where t1.f1 = t2.f1 and t2.f1=100; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 100 100 100 110 + 101 110 100 100 100 110 + 100 200 100 100 100 110 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test056.ksh b/test/sql/Join/exp.test056.ksh new file mode 100644 index 00000000..0babd2d4 --- /dev/null +++ b/test/sql/Join/exp.test056.ksh @@ -0,0 +1,49 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo create index idx1 on t1(f1) tree; +Statement Executed +echo create index idx2 on t2(f1) hash; +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3 where t1.f1 = t2.f1 and t2.f1 = t3.f1; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 100 110 100 200 + +echo select * from t2,t1,t3 where t1.f1 = t2.f1 and t2.f1 = t3.f1; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 110 100 100 100 200 + +echo select * from t3,t1,t2 where t1.f1 = t2.f1 and t2.f1 = t3.f1; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 100 200 100 100 100 110 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test057.ksh b/test/sql/Join/exp.test057.ksh new file mode 100644 index 00000000..6e52c081 --- /dev/null +++ b/test/sql/Join/exp.test057.ksh @@ -0,0 +1,49 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo create index idx1 on t1(f1) tree; +Statement Executed +echo create index idx2 on t2(f1) hash; +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3 where t1.f1 = t2.f1 and t2.f1 = t3.f1 and t3.f1 = 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 100 110 100 200 + +echo select * from t2,t1,t3 where t1.f1 = t2.f1 and t2.f1 = t3.f1 and t3.f1 = 100; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 110 100 100 100 200 + +echo select * from t3,t1,t2 where t1.f1 = t2.f1 and t2.f1 = t3.f1 and t3.f1 = 100; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 100 200 100 100 100 110 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test058.ksh b/test/sql/Join/exp.test058.ksh new file mode 100644 index 00000000..53bdf87b --- /dev/null +++ b/test/sql/Join/exp.test058.ksh @@ -0,0 +1,135 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo create index idx1 on t1(f1) hash; +Statement Executed +echo create index idx2 on t2(f1) hash; +Statement Executed +echo create index idx3 on t3(f1) hash; +Statement Executed +echo create index idx4 on t1(f2) tree; +Statement Executed +echo create index idx5 on t2(f2) tree; +Statement Executed +echo create index idx6 on t3(f2) tree; +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 505 100 303 333 + 100 100 505 100 101 110 + 100 100 505 100 100 200 + 100 100 404 444 303 333 + 100 100 404 444 101 110 + 100 100 404 444 100 200 + 100 100 100 110 303 333 + 100 100 100 110 101 110 + 100 100 100 110 100 200 + 303 333 505 100 303 333 + 303 333 505 100 101 110 + 303 333 505 100 100 200 + 303 333 404 444 303 333 + 303 333 404 444 101 110 + 303 333 404 444 100 200 + 303 333 100 110 303 333 + 303 333 100 110 101 110 + 303 333 100 110 100 200 + 505 555 505 100 303 333 + 505 555 505 100 101 110 + 505 555 505 100 100 200 + 505 555 404 444 303 333 + 505 555 404 444 101 110 + 505 555 404 444 100 200 + 505 555 100 110 303 333 + 505 555 100 110 101 110 + 505 555 100 110 100 200 + +echo select * from t2,t1,t3; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 505 100 100 100 303 333 + 505 100 100 100 101 110 + 505 100 100 100 100 200 + 505 100 303 333 303 333 + 505 100 303 333 101 110 + 505 100 303 333 100 200 + 505 100 505 555 303 333 + 505 100 505 555 101 110 + 505 100 505 555 100 200 + 404 444 100 100 303 333 + 404 444 100 100 101 110 + 404 444 100 100 100 200 + 404 444 303 333 303 333 + 404 444 303 333 101 110 + 404 444 303 333 100 200 + 404 444 505 555 303 333 + 404 444 505 555 101 110 + 404 444 505 555 100 200 + 100 110 100 100 303 333 + 100 110 100 100 101 110 + 100 110 100 100 100 200 + 100 110 303 333 303 333 + 100 110 303 333 101 110 + 100 110 303 333 100 200 + 100 110 505 555 303 333 + 100 110 505 555 101 110 + 100 110 505 555 100 200 + +echo select * from t3,t1,t2; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 100 100 505 100 + 303 333 100 100 404 444 + 303 333 100 100 100 110 + 303 333 303 333 505 100 + 303 333 303 333 404 444 + 303 333 303 333 100 110 + 303 333 505 555 505 100 + 303 333 505 555 404 444 + 303 333 505 555 100 110 + 101 110 100 100 505 100 + 101 110 100 100 404 444 + 101 110 100 100 100 110 + 101 110 303 333 505 100 + 101 110 303 333 404 444 + 101 110 303 333 100 110 + 101 110 505 555 505 100 + 101 110 505 555 404 444 + 101 110 505 555 100 110 + 100 200 100 100 505 100 + 100 200 100 100 404 444 + 100 200 100 100 100 110 + 100 200 303 333 505 100 + 100 200 303 333 404 444 + 100 200 303 333 100 110 + 100 200 505 555 505 100 + 100 200 505 555 404 444 + 100 200 505 555 100 110 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test059.ksh b/test/sql/Join/exp.test059.ksh new file mode 100644 index 00000000..e182aef1 --- /dev/null +++ b/test/sql/Join/exp.test059.ksh @@ -0,0 +1,72 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo create index idx1 on t1(f1) hash; +Statement Executed +echo create index idx2 on t2(f1) hash; +Statement Executed +echo create index idx3 on t3(f1) hash; +Statement Executed +echo create index idx4 on t1(f2) tree; +Statement Executed +echo create index idx5 on t2(f2) tree; +Statement Executed +echo create index idx6 on t3(f2) tree; +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3 where t1.f1 = t2.f1; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 100 110 303 333 + 100 100 100 110 101 110 + 100 100 100 110 100 200 + 505 555 505 100 303 333 + 505 555 505 100 101 110 + 505 555 505 100 100 200 + +echo select * from t2,t1,t3 where t1.f1 = t2.f1; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 505 100 505 555 303 333 + 505 100 505 555 101 110 + 505 100 505 555 100 200 + 100 110 100 100 303 333 + 100 110 100 100 101 110 + 100 110 100 100 100 200 + +echo select * from t3,t1,t2 where t1.f1 = t2.f1; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 100 100 100 110 + 303 333 505 555 505 100 + 101 110 100 100 100 110 + 101 110 505 555 505 100 + 100 200 100 100 100 110 + 100 200 505 555 505 100 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test060.ksh b/test/sql/Join/exp.test060.ksh new file mode 100644 index 00000000..69370761 --- /dev/null +++ b/test/sql/Join/exp.test060.ksh @@ -0,0 +1,60 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo create index idx1 on t1(f1) hash; +Statement Executed +echo create index idx2 on t2(f1) hash; +Statement Executed +echo create index idx3 on t3(f1) hash; +Statement Executed +echo create index idx4 on t1(f2) tree; +Statement Executed +echo create index idx5 on t2(f2) tree; +Statement Executed +echo create index idx6 on t3(f2) tree; +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3 where t1.f1 = t2.f1 and t3.f1=100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 100 110 100 200 + 505 555 505 100 100 200 + +echo select * from t2,t1,t3 where t1.f1 = t2.f1 and t3.f1=100; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 505 100 505 555 100 200 + 100 110 100 100 100 200 + +echo select * from t3,t1,t2 where t1.f1 = t2.f1 and t3.f1=100; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 100 200 100 100 100 110 + 100 200 505 555 505 100 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test061.ksh b/test/sql/Join/exp.test061.ksh new file mode 100644 index 00000000..1734c11b --- /dev/null +++ b/test/sql/Join/exp.test061.ksh @@ -0,0 +1,63 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo create index idx1 on t1(f1) hash; +Statement Executed +echo create index idx2 on t2(f1) hash; +Statement Executed +echo create index idx3 on t3(f1) hash; +Statement Executed +echo create index idx4 on t1(f2) tree; +Statement Executed +echo create index idx5 on t2(f2) tree; +Statement Executed +echo create index idx6 on t3(f2) tree; +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3 where t1.f1 = t2.f1 and t2.f1=100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 100 110 303 333 + 100 100 100 110 101 110 + 100 100 100 110 100 200 + +echo select * from t2,t1,t3 where t1.f1 = t2.f1 and t2.f1=100; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 110 100 100 303 333 + 100 110 100 100 101 110 + 100 110 100 100 100 200 + +echo select * from t3,t1,t2 where t1.f1 = t2.f1 and t2.f1=100; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 100 100 100 110 + 101 110 100 100 100 110 + 100 200 100 100 100 110 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test062.ksh b/test/sql/Join/exp.test062.ksh new file mode 100644 index 00000000..cb45bac0 --- /dev/null +++ b/test/sql/Join/exp.test062.ksh @@ -0,0 +1,57 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo create index idx1 on t1(f1) hash; +Statement Executed +echo create index idx2 on t2(f1) hash; +Statement Executed +echo create index idx3 on t3(f1) hash; +Statement Executed +echo create index idx4 on t1(f2) tree; +Statement Executed +echo create index idx5 on t2(f2) tree; +Statement Executed +echo create index idx6 on t3(f2) tree; +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3 where t1.f1 = t2.f1 and t2.f1 = t3.f1; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 100 110 100 200 + +echo select * from t2,t1,t3 where t1.f1 = t2.f1 and t2.f1 = t3.f1; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 110 100 100 100 200 + +echo select * from t3,t1,t2 where t1.f1 = t2.f1 and t2.f1 = t3.f1; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 100 200 100 100 100 110 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test063.ksh b/test/sql/Join/exp.test063.ksh new file mode 100644 index 00000000..8222be54 --- /dev/null +++ b/test/sql/Join/exp.test063.ksh @@ -0,0 +1,57 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo create index idx1 on t1(f1) hash; +Statement Executed +echo create index idx2 on t2(f1) hash; +Statement Executed +echo create index idx3 on t3(f1) hash; +Statement Executed +echo create index idx4 on t1(f2) tree; +Statement Executed +echo create index idx5 on t2(f2) tree; +Statement Executed +echo create index idx6 on t3(f2) tree; +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3 where t1.f1 = t2.f1 and t2.f1 = t3.f1 and t3.f1 = 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 100 110 100 200 + +echo select * from t2,t1,t3 where t1.f1 = t2.f1 and t2.f1 = t3.f1 and t3.f1 = 100; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 110 100 100 100 200 + +echo select * from t3,t1,t2 where t1.f1 = t2.f1 and t2.f1 = t3.f1 and t3.f1 = 100; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 100 200 100 100 100 110 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test064.ksh b/test/sql/Join/exp.test064.ksh new file mode 100644 index 00000000..577ee7f1 --- /dev/null +++ b/test/sql/Join/exp.test064.ksh @@ -0,0 +1,135 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo create index idx1 on t1(f1) tree; +Statement Executed +echo create index idx2 on t2(f1) tree; +Statement Executed +echo create index idx3 on t3(f1) tree; +Statement Executed +echo create index idx4 on t1(f2) hash; +Statement Executed +echo create index idx5 on t2(f2) hash; +Statement Executed +echo create index idx6 on t3(f2) hash; +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 505 100 303 333 + 100 100 505 100 101 110 + 100 100 505 100 100 200 + 100 100 404 444 303 333 + 100 100 404 444 101 110 + 100 100 404 444 100 200 + 100 100 100 110 303 333 + 100 100 100 110 101 110 + 100 100 100 110 100 200 + 303 333 505 100 303 333 + 303 333 505 100 101 110 + 303 333 505 100 100 200 + 303 333 404 444 303 333 + 303 333 404 444 101 110 + 303 333 404 444 100 200 + 303 333 100 110 303 333 + 303 333 100 110 101 110 + 303 333 100 110 100 200 + 505 555 505 100 303 333 + 505 555 505 100 101 110 + 505 555 505 100 100 200 + 505 555 404 444 303 333 + 505 555 404 444 101 110 + 505 555 404 444 100 200 + 505 555 100 110 303 333 + 505 555 100 110 101 110 + 505 555 100 110 100 200 + +echo select * from t2,t1,t3; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 505 100 100 100 303 333 + 505 100 100 100 101 110 + 505 100 100 100 100 200 + 505 100 303 333 303 333 + 505 100 303 333 101 110 + 505 100 303 333 100 200 + 505 100 505 555 303 333 + 505 100 505 555 101 110 + 505 100 505 555 100 200 + 404 444 100 100 303 333 + 404 444 100 100 101 110 + 404 444 100 100 100 200 + 404 444 303 333 303 333 + 404 444 303 333 101 110 + 404 444 303 333 100 200 + 404 444 505 555 303 333 + 404 444 505 555 101 110 + 404 444 505 555 100 200 + 100 110 100 100 303 333 + 100 110 100 100 101 110 + 100 110 100 100 100 200 + 100 110 303 333 303 333 + 100 110 303 333 101 110 + 100 110 303 333 100 200 + 100 110 505 555 303 333 + 100 110 505 555 101 110 + 100 110 505 555 100 200 + +echo select * from t3,t1,t2; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 100 100 505 100 + 303 333 100 100 404 444 + 303 333 100 100 100 110 + 303 333 303 333 505 100 + 303 333 303 333 404 444 + 303 333 303 333 100 110 + 303 333 505 555 505 100 + 303 333 505 555 404 444 + 303 333 505 555 100 110 + 101 110 100 100 505 100 + 101 110 100 100 404 444 + 101 110 100 100 100 110 + 101 110 303 333 505 100 + 101 110 303 333 404 444 + 101 110 303 333 100 110 + 101 110 505 555 505 100 + 101 110 505 555 404 444 + 101 110 505 555 100 110 + 100 200 100 100 505 100 + 100 200 100 100 404 444 + 100 200 100 100 100 110 + 100 200 303 333 505 100 + 100 200 303 333 404 444 + 100 200 303 333 100 110 + 100 200 505 555 505 100 + 100 200 505 555 404 444 + 100 200 505 555 100 110 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test065.ksh b/test/sql/Join/exp.test065.ksh new file mode 100644 index 00000000..877967e1 --- /dev/null +++ b/test/sql/Join/exp.test065.ksh @@ -0,0 +1,72 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo create index idx1 on t1(f1) tree; +Statement Executed +echo create index idx2 on t2(f1) tree; +Statement Executed +echo create index idx3 on t3(f1) tree; +Statement Executed +echo create index idx4 on t1(f2) hash; +Statement Executed +echo create index idx5 on t2(f2) hash; +Statement Executed +echo create index idx6 on t3(f2) hash; +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3 where t1.f1 = t2.f1; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 100 110 303 333 + 100 100 100 110 101 110 + 100 100 100 110 100 200 + 505 555 505 100 303 333 + 505 555 505 100 101 110 + 505 555 505 100 100 200 + +echo select * from t2,t1,t3 where t1.f1 = t2.f1; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 505 100 505 555 303 333 + 505 100 505 555 101 110 + 505 100 505 555 100 200 + 100 110 100 100 303 333 + 100 110 100 100 101 110 + 100 110 100 100 100 200 + +echo select * from t3,t1,t2 where t1.f1 = t2.f1; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 100 100 100 110 + 303 333 505 555 505 100 + 101 110 100 100 100 110 + 101 110 505 555 505 100 + 100 200 100 100 100 110 + 100 200 505 555 505 100 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test066.ksh b/test/sql/Join/exp.test066.ksh new file mode 100644 index 00000000..5288b49a --- /dev/null +++ b/test/sql/Join/exp.test066.ksh @@ -0,0 +1,60 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo create index idx1 on t1(f1) tree; +Statement Executed +echo create index idx2 on t2(f1) tree; +Statement Executed +echo create index idx3 on t3(f1) tree; +Statement Executed +echo create index idx4 on t1(f2) hash; +Statement Executed +echo create index idx5 on t2(f2) hash; +Statement Executed +echo create index idx6 on t3(f2) hash; +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3 where t1.f1 = t2.f1 and t3.f1=100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 100 110 100 200 + 505 555 505 100 100 200 + +echo select * from t2,t1,t3 where t1.f1 = t2.f1 and t3.f1=100; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 505 100 505 555 100 200 + 100 110 100 100 100 200 + +echo select * from t3,t1,t2 where t1.f1 = t2.f1 and t3.f1=100; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 100 200 100 100 100 110 + 100 200 505 555 505 100 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test067.ksh b/test/sql/Join/exp.test067.ksh new file mode 100644 index 00000000..1cdec6ee --- /dev/null +++ b/test/sql/Join/exp.test067.ksh @@ -0,0 +1,63 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo create index idx1 on t1(f1) tree; +Statement Executed +echo create index idx2 on t2(f1) tree; +Statement Executed +echo create index idx3 on t3(f1) tree; +Statement Executed +echo create index idx4 on t1(f2) hash; +Statement Executed +echo create index idx5 on t2(f2) hash; +Statement Executed +echo create index idx6 on t3(f2) hash; +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3 where t1.f1 = t2.f1 and t2.f1=100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 100 110 303 333 + 100 100 100 110 101 110 + 100 100 100 110 100 200 + +echo select * from t2,t1,t3 where t1.f1 = t2.f1 and t2.f1=100; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 110 100 100 303 333 + 100 110 100 100 101 110 + 100 110 100 100 100 200 + +echo select * from t3,t1,t2 where t1.f1 = t2.f1 and t2.f1=100; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 100 100 100 110 + 101 110 100 100 100 110 + 100 200 100 100 100 110 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test068.ksh b/test/sql/Join/exp.test068.ksh new file mode 100644 index 00000000..06668d5f --- /dev/null +++ b/test/sql/Join/exp.test068.ksh @@ -0,0 +1,57 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo create index idx1 on t1(f1) tree; +Statement Executed +echo create index idx2 on t2(f1) tree; +Statement Executed +echo create index idx3 on t3(f1) tree; +Statement Executed +echo create index idx4 on t1(f2) hash; +Statement Executed +echo create index idx5 on t2(f2) hash; +Statement Executed +echo create index idx6 on t3(f2) hash; +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3 where t1.f1 = t2.f1 and t2.f1 = t3.f1; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 100 110 100 200 + +echo select * from t2,t1,t3 where t1.f1 = t2.f1 and t2.f1 = t3.f1; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 110 100 100 100 200 + +echo select * from t3,t1,t2 where t1.f1 = t2.f1 and t2.f1 = t3.f1; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 100 200 100 100 100 110 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test069.ksh b/test/sql/Join/exp.test069.ksh new file mode 100644 index 00000000..3fcaf200 --- /dev/null +++ b/test/sql/Join/exp.test069.ksh @@ -0,0 +1,57 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo create table t3(f1 int,f2 int); +Statement Executed +echo create index idx1 on t1(f1) tree; +Statement Executed +echo create index idx2 on t2(f1) tree; +Statement Executed +echo create index idx3 on t3(f1) tree; +Statement Executed +echo create index idx4 on t1(f2) hash; +Statement Executed +echo create index idx5 on t2(f2) hash; +Statement Executed +echo create index idx6 on t3(f2) hash; +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(101,110); +Statement Executed: Rows Affected = 1 +echo insert into t3 values(222,200); +Statement Executed: Rows Affected = 1 +echo select * from t1,t2,t3 where t1.f1 = t2.f1 and t2.f1 = t3.f1 and t3.f1 = 100; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 100 100 110 100 200 + +echo select * from t2,t1,t3 where t1.f1 = t2.f1 and t2.f1 = t3.f1 and t3.f1 = 100; +--------------------------------------------------------- + t2.f1 t2.f2 t1.f1 t1.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 100 110 100 100 100 200 + +echo select * from t3,t1,t2 where t1.f1 = t2.f1 and t2.f1 = t3.f1 and t3.f1 = 100; +--------------------------------------------------------- + t3.f1 t3.f2 t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 100 200 100 100 100 110 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test070.ksh b/test/sql/Join/exp.test070.ksh new file mode 100644 index 00000000..9c36771a --- /dev/null +++ b/test/sql/Join/exp.test070.ksh @@ -0,0 +1,206 @@ +echo create table t1(f1 int,f2 int); +Statement Executed +echo create index idx1 on t1(f1,f2) hash; +Statement Executed +echo create table t2(f1 int,f2 int); +Statement Executed +echo insert into t1 values(101,100); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t1 values(505,555); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(505,100); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(100,101); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(404,444); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(303,333); +Statement Executed: Rows Affected = 1 +echo insert into t2 values(101,100); +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 101 100 + 303 333 + 505 555 + +echo select * from t2; +--------------------------------------------------------- + t2.f1 t2.f2 +--------------------------------------------------------- + 505 100 + 100 101 + 404 444 + 303 333 + 101 100 + +echo select * from t1,t2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + 101 100 100 101 + 101 100 404 444 + 101 100 303 333 + 101 100 101 100 + 303 333 505 100 + 303 333 100 101 + 303 333 404 444 + 303 333 303 333 + 303 333 101 100 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 333 + 505 555 101 100 + +echo select * from t1,t2 where t1.f1=t2.f1 and t1.f2=t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 101 100 + 303 333 303 333 + +echo select * from t1,t2 where t1.f2=t2.f2 and t1.f1=t2.f1; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 101 100 + 303 333 303 333 + +echo select * from t1,t2 where t1.f1>t2.f1 and t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 100 101 + 303 333 101 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 333 + 505 555 101 100 + +echo select * from t1,t2 where t1.f2t2.f1 or t1.f2>=t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + 101 100 100 101 + 101 100 101 100 + 303 333 505 100 + 303 333 100 101 + 303 333 303 333 + 303 333 101 100 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 333 + 505 555 101 100 + +echo select * from t1,t2 where t1.f2t2.f1 or t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 100 101 + 303 333 505 100 + 303 333 100 101 + 303 333 101 100 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 333 + 505 555 101 100 + +echo select * from t1,t2 where t1.f1=t2.f1 and not(t1.f2=t2.f2); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 505 555 505 100 + +echo select * from t1,t2 where t1.f2=t2.f2 and not(t1.f1=t2.f1); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + +echo select * from t1,t2 where not(t1.f1>t2.f1) and t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 505 100 + 505 555 505 100 + +echo select * from t1,t2 where not(t1.f2t2.f1 and t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 100 101 + 303 333 101 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 333 + 505 555 101 100 + +echo select * from t1,t2 where t1.f2t2.f1 or t1.f2>=t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + 101 100 100 101 + 101 100 101 100 + 303 333 505 100 + 303 333 100 101 + 303 333 303 333 + 303 333 101 100 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 333 + 505 555 101 100 + +echo select * from t1,t2 where t1.f2t2.f1 or t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 100 101 + 303 333 505 100 + 303 333 100 101 + 303 333 101 100 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 333 + 505 555 101 100 + +echo select * from t1,t2 where t1.f1=t2.f1 and not(t1.f2=t2.f2); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 505 555 505 100 + +echo select * from t1,t2 where t1.f2=t2.f2 and not(t1.f1=t2.f1); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + +echo select * from t1,t2 where not(t1.f1>t2.f1) and t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 505 100 + 505 555 505 100 + +echo select * from t1,t2 where not(t1.f2t2.f1 and t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 100 101 + 303 333 101 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 333 + 505 555 101 100 + +echo select * from t1,t2 where t1.f2t2.f1 or t1.f2>=t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + 101 100 100 101 + 101 100 101 100 + 303 333 505 100 + 303 333 100 101 + 303 333 303 333 + 303 333 101 100 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 333 + 505 555 101 100 + +echo select * from t1,t2 where t1.f2t2.f1 or t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 100 101 + 303 333 505 100 + 303 333 100 101 + 303 333 101 100 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 333 + 505 555 101 100 + +echo select * from t1,t2 where t1.f1=t2.f1 and not(t1.f2=t2.f2); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 505 555 505 100 + +echo select * from t1,t2 where t1.f2=t2.f2 and not(t1.f1=t2.f1); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + +echo select * from t1,t2 where not(t1.f1>t2.f1) and t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 505 100 + 505 555 505 100 + +echo select * from t1,t2 where not(t1.f2t2.f1 and t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 100 101 + 303 333 101 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 333 + 505 555 101 100 + +echo select * from t1,t2 where t1.f2t2.f1 or t1.f2>=t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + 101 100 100 101 + 101 100 101 100 + 303 333 505 100 + 303 333 100 101 + 303 333 303 333 + 303 333 101 100 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 333 + 505 555 101 100 + +echo select * from t1,t2 where t1.f2t2.f1 or t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 100 101 + 303 333 505 100 + 303 333 100 101 + 303 333 101 100 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 333 + 505 555 101 100 + +echo select * from t1,t2 where t1.f1=t2.f1 and not(t1.f2=t2.f2); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 505 555 505 100 + +echo select * from t1,t2 where t1.f2=t2.f2 and not(t1.f1=t2.f1); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + +echo select * from t1,t2 where not(t1.f1>t2.f1) and t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 505 100 + 505 555 505 100 + +echo select * from t1,t2 where not(t1.f2t2.f1 and t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 100 101 + 303 333 101 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 333 + 505 555 101 100 + +echo select * from t1,t2 where t1.f2t2.f1 or t1.f2>=t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + 101 100 100 101 + 101 100 101 100 + 303 333 505 100 + 303 333 100 101 + 303 333 303 333 + 303 333 101 100 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 333 + 505 555 101 100 + +echo select * from t1,t2 where t1.f2t2.f1 or t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 100 101 + 303 333 505 100 + 303 333 100 101 + 303 333 101 100 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 333 + 505 555 101 100 + +echo select * from t1,t2 where t1.f1=t2.f1 and not(t1.f2=t2.f2); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 505 555 505 100 + +echo select * from t1,t2 where t1.f2=t2.f2 and not(t1.f1=t2.f1); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + +echo select * from t1,t2 where not(t1.f1>t2.f1) and t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 505 100 + 505 555 505 100 + +echo select * from t1,t2 where not(t1.f2t2.f1 and t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 100 101 + 303 333 101 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 333 + 505 555 101 100 + +echo select * from t1,t2 where t1.f2t2.f1 or t1.f2>=t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + 101 100 100 101 + 101 100 101 100 + 303 333 505 100 + 303 333 100 101 + 303 333 303 333 + 303 333 101 100 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 333 + 505 555 101 100 + +echo select * from t1,t2 where t1.f2t2.f1 or t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 100 101 + 303 333 505 100 + 303 333 100 101 + 303 333 101 100 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 333 + 505 555 101 100 + +echo select * from t1,t2 where t1.f1=t2.f1 and not(t1.f2=t2.f2); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 505 555 505 100 + +echo select * from t1,t2 where t1.f2=t2.f2 and not(t1.f1=t2.f1); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + +echo select * from t1,t2 where not(t1.f1>t2.f1) and t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 505 100 + 505 555 505 100 + +echo select * from t1,t2 where not(t1.f2t2.f1 and t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 100 101 + 303 333 101 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 333 + 505 555 101 100 + +echo select * from t1,t2 where t1.f2t2.f1 or t1.f2>=t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + 101 100 100 101 + 101 100 101 100 + 303 333 505 100 + 303 333 100 101 + 303 333 303 333 + 303 333 101 100 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 333 + 505 555 101 100 + +echo select * from t1,t2 where t1.f2t2.f1 or t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 100 101 + 303 333 505 100 + 303 333 100 101 + 303 333 101 100 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 333 + 505 555 101 100 + +echo select * from t1,t2 where t1.f1=t2.f1 and not(t1.f2=t2.f2); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 505 555 505 100 + +echo select * from t1,t2 where t1.f2=t2.f2 and not(t1.f1=t2.f1); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + +echo select * from t1,t2 where not(t1.f1>t2.f1) and t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 505 100 + 505 555 505 100 + +echo select * from t1,t2 where not(t1.f2t2.f1 and t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 100 101 + 303 333 101 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 333 + 505 555 101 100 + +echo select * from t1,t2 where t1.f2t2.f1 or t1.f2>=t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + 101 100 100 101 + 101 100 101 100 + 303 333 505 100 + 303 333 100 101 + 303 333 303 333 + 303 333 101 100 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 333 + 505 555 101 100 + +echo select * from t1,t2 where t1.f2t2.f1 or t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 100 101 + 303 333 505 100 + 303 333 100 101 + 303 333 101 100 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 333 + 505 555 101 100 + +echo select * from t1,t2 where t1.f1=t2.f1 and not(t1.f2=t2.f2); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 505 555 505 100 + +echo select * from t1,t2 where t1.f2=t2.f2 and not(t1.f1=t2.f1); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + +echo select * from t1,t2 where not(t1.f1>t2.f1) and t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 505 100 + 505 555 505 100 + +echo select * from t1,t2 where not(t1.f2t2.f1 and t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 100 101 + 303 333 101 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 333 + 505 555 101 100 + +echo select * from t1,t2 where t1.f2t2.f1 or t1.f2>=t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + 101 100 100 101 + 101 100 101 100 + 303 333 505 100 + 303 333 100 101 + 303 333 303 333 + 303 333 101 100 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 333 + 505 555 101 100 + +echo select * from t1,t2 where t1.f2t2.f1 or t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 100 101 + 303 333 505 100 + 303 333 100 101 + 303 333 101 100 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 333 + 505 555 101 100 + +echo select * from t1,t2 where t1.f1=t2.f1 and not(t1.f2=t2.f2); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 505 555 505 100 + +echo select * from t1,t2 where t1.f2=t2.f2 and not(t1.f1=t2.f1); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + +echo select * from t1,t2 where not(t1.f1>t2.f1) and t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 505 100 + 505 555 505 100 + +echo select * from t1,t2 where not(t1.f2t2.f1 and t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 100 101 + 303 333 101 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 333 + 505 555 101 100 + +echo select * from t1,t2 where t1.f2t2.f1 or t1.f2>=t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + 101 100 100 101 + 101 100 101 100 + 303 333 505 100 + 303 333 100 101 + 303 333 303 333 + 303 333 101 100 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 333 + 505 555 101 100 + +echo select * from t1,t2 where t1.f2t2.f1 or t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 100 101 + 303 333 505 100 + 303 333 100 101 + 303 333 101 100 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 333 + 505 555 101 100 + +echo select * from t1,t2 where t1.f1=t2.f1 and not(t1.f2=t2.f2); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 505 555 505 100 + +echo select * from t1,t2 where t1.f2=t2.f2 and not(t1.f1=t2.f1); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + +echo select * from t1,t2 where not(t1.f1>t2.f1) and t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 505 100 + 505 555 505 100 + +echo select * from t1,t2 where not(t1.f2t2.f1 and t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 100 101 + 303 333 101 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 333 + 505 555 101 100 + +echo select * from t1,t2 where t1.f2t2.f1 or t1.f2>=t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + 101 100 100 101 + 101 100 101 100 + 303 333 505 100 + 303 333 100 101 + 303 333 303 333 + 303 333 101 100 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 333 + 505 555 101 100 + +echo select * from t1,t2 where t1.f2t2.f1 or t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 100 101 + 303 333 505 100 + 303 333 100 101 + 303 333 101 100 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 333 + 505 555 101 100 + +echo select * from t1,t2 where t1.f1=t2.f1 and not(t1.f2=t2.f2); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 505 555 505 100 + +echo select * from t1,t2 where t1.f2=t2.f2 and not(t1.f1=t2.f1); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + +echo select * from t1,t2 where not(t1.f1>t2.f1) and t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 505 100 + 505 555 505 100 + +echo select * from t1,t2 where not(t1.f2t2.f1 and t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 100 101 + 303 333 101 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 333 + 505 555 101 100 + +echo select * from t1,t2 where t1.f2t2.f1 or t1.f2>=t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + 101 100 100 101 + 101 100 101 100 + 303 333 505 100 + 303 333 100 101 + 303 333 303 333 + 303 333 101 100 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 333 + 505 555 101 100 + +echo select * from t1,t2 where t1.f2t2.f1 or t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 100 101 + 303 333 505 100 + 303 333 100 101 + 303 333 101 100 + 505 555 505 100 + 505 555 100 101 + 505 555 404 444 + 505 555 303 333 + 505 555 101 100 + +echo select * from t1,t2 where t1.f1=t2.f1 and not(t1.f2=t2.f2); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 505 555 505 100 + +echo select * from t1,t2 where t1.f2=t2.f2 and not(t1.f1=t2.f1); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 101 100 505 100 + +echo select * from t1,t2 where not(t1.f1>t2.f1) and t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 303 333 505 100 + 505 555 505 100 + +echo select * from t1,t2 where not(t1.f2t2.f1 and t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 3 30 2 20 + 5 50 2 20 + 5 50 3 30 + 5 50 4 40 + +echo select * from t1,t2 where t1.f2t2.f1 or t1.f2>=t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 2 NULL 1 NULL + 3 30 1 NULL + 3 30 2 20 + 3 30 3 30 + 5 50 1 NULL + 5 50 2 20 + 5 50 3 30 + 5 50 4 40 + +echo select * from t1,t2 where t1.f2t2.f1 or t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 2 NULL 1 NULL + 3 30 1 NULL + 3 30 2 20 + 5 50 1 NULL + 5 50 2 20 + 5 50 3 30 + 5 50 4 40 + +echo select * from t1,t2 where t1.f1=t2.f1 and not(t1.f2=t2.f2); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + +echo select * from t1,t2 where t1.f2=t2.f2 and not(t1.f1=t2.f1); +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + +echo select * from t1,t2 where not(t1.f1>t2.f1) and t1.f2>t2.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + +echo select * from t1,t2 where not(t1.f2= 'K' AND t1.f4 LIKE 'N%' OR t1.f4 LIKE '%a'; +--------------------------------------------------------- + t1.f1 t1.f4 t2.f1 t2.f4 +--------------------------------------------------------- + 12 Nihar 13 Sanjit + 12 Nihar 16 Sanjay + 12 Nihar 17 Arindam + 12 Nihar 10 Bijay + 12 Nihar 11 Jitendr + 14 Praba 13 Sanjit + 14 Praba 16 Sanjay + 14 Praba 17 Arindam + 14 Praba 10 Bijay + 14 Praba 11 Jitendr + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Join/exp.test130.ksh b/test/sql/Join/exp.test130.ksh new file mode 100644 index 00000000..c2a7ad99 --- /dev/null +++ b/test/sql/Join/exp.test130.ksh @@ -0,0 +1,26 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +--------------------------------------------------------- + emp10.eno emp10.ename emp10.job emp10.mgrno +--------------------------------------------------------- + 1 ALLEN SALES 4 + 2 PITTER IT 3 + 3 JACK MKTING 1 + 4 TOM CLERK 1 + 5 HARRY MANAGER 5 + +echo SELECT emp.ename,mgr.ename FROM emp10 as emp,emp10 as mgr WHERE emp.mgrno=mgr.eno; +--------------------------------------------------------- + emp.ename mgr.ename +--------------------------------------------------------- + ALLEN TOM + PITTER JACK + JACK ALLEN + TOM ALLEN + HARRY HARRY + +Statement Executed diff --git a/test/sql/Join/exp.test131.ksh b/test/sql/Join/exp.test131.ksh new file mode 100644 index 00000000..def7c59d --- /dev/null +++ b/test/sql/Join/exp.test131.ksh @@ -0,0 +1,172 @@ +echo Create table client_master(clientno char(6), name char(20) NOT NULL, address1 char(30), address2 char(30), city char(15), pincode int, state char(15), baldue float,PRIMARY KEY(clientno)); +Statement Executed +echo Create table product_master(productno char(6), description char(15) NOT NULL,profitpercent float NOT NULL,unitmeasure char(10) NOT NULL,qtyonhand int NOT NULL,reorderlvl int NOT NULL,selprice float NOT NULL,costprice float NOT NULL, PRIMARY KEY(productno)); +Statement Executed +echo Create table salesman_master(salesmanno char(6),salesmanname char(20) NOT NULL,address1 char(30) NOT NULL,address2 char(30),city char(20),pincode char(8),state char(20),salamt float NOT NULL,tgttoget float NOT NULL,ytdsales float NOT NULL,remarks char(30),PRIMARY KEY(salesmanno)); +Statement Executed +echo Create table sales_order(orderno char(6),orderdate date,clientno char(6),delyaddr char(25),delytype char(1),billedyn char(1),salesmanno char(6),delydate date,orderstatus char(10),PRIMARY KEY(orderno),FOREIGN KEY(clientno) REFERENCES client_master(clientno),FOREIGN KEY(salesmanno) REFERENCES salesman_master(salesmanno)); +Statement Executed +echo Create table sales_order_details(orderno char(6),productno char(6),qtyordered int,qtydisp int,productrate float,FOREIGN KEY(orderno) REFERENCES sales_order(orderno),FOREIGN KEY(productno) REFERENCES product_master(productno)); +Statement Executed +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00001','Ivan Bayross','Mumbai',400054,'Maharastra',15000); +Statement Executed: Rows Affected = 1 +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00002','mamta Muzumdar','Madras',780001,'Tamil Nadu',0); +Statement Executed: Rows Affected = 1 +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00003','Chhaya Bankar','Mumbai',400057,'Maharastra',5000); +Statement Executed: Rows Affected = 1 +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00004','Ashwini Joshi','Bangalore',560001,'MKarnataka',0); +Statement Executed: Rows Affected = 1 +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00005','Hansel Colaco','Mumbai',400060,'Maharastra',2000); +Statement Executed: Rows Affected = 1 +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00006','Deepak Sharma','Mangalore',560050,'Karnatakaa',0); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P00001','T-Shirts',5,'Piece',200,50,350,250); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P03453','Shirts',6,'Piece',150,50,500,350); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P06734','Cotton Jeans',5,'Piece',100,20,60,450); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P07865','Jeans',5,'Piece',100,20,750,500); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P07868','Trousers',2,'Piece',150,50,850,550); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P07885','Pull Overs',2.5,'Piece',80,30,700,450); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P07965','Denim Shirts',4,'Piece',100,40,350,250); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P07975','Lycra Tops',5,'Piece',70,30,300,175); +Statement Executed: Rows Affected = 1 +echo insert into product_master values('P08865','Skirts',5,'Piece',75,30,450,300); +Statement Executed: Rows Affected = 1 +echo insert into salesman_master values('S00001','Aman','A/14','Worli','Mumbai',400002,'Maharastra',3000,100,50,'Good'); +Statement Executed: Rows Affected = 1 +echo insert into salesman_master values('S00002','Omkar','65','Nariman','Mumbai',400001,'maharastra',3000,200,100,'Good'); +Statement Executed: Rows Affected = 1 +echo insert into salesman_master values('S00003','Raj','P-7','Banfra','Mumbai',400032,'Maharastra',3000,200,100,'Good'); +Statement Executed: Rows Affected = 1 +echo insert into salesman_master values('S00004','Ashish','A/5','Juhu','Bombay',400044,'Maharastra',3500,200,150,'Good'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19001','2002-06-12','C00001','F','N','S00001','2002-07-20','In Process'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19002','2002-06-25','C00002','P','N','S00002','2002-06-27','Cancelled'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O46865','2002-02-18','C00003','F','Y','S00003','2002-02-20','Fulfilled'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19003','2002-04-03','C00001','F','Y','S00001','2002-04-07','Fulfilled'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O46866','2002-05-20','C00004','P','N','S00002','2002-05-22','Cancelled'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19008','2002-05-24','C00005','F','N','S00004','2002-07-26','In Process'); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19001','P00001',4,4,525); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19001','P07965',2,1,8400); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19001','P07885',2,1,5250); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19002','P00001',10,0,525); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P07868',3,3,3150); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P07885',3,1,5250); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P00001',10,10,525); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P03453',4,4,1050); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19003','P03453',2,2,1050); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19003','P06734',1,1,12000); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46866','P07965',1,0,8400); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46866','P07975',1,0,1050); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19008','P00001',10,5,525); +Statement Executed: Rows Affected = 1 +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19008','P07975',5,3,1050); +Statement Executed: Rows Affected = 1 +echo select * from client_master; +--------------------------------------------------------- + client_master.clientno client_master.name client_master.address1 client_master.address2 client_master.city client_master.pincode client_master.state client_master.baldue +--------------------------------------------------------- + C00001 Ivan Bayross NULL NULL Mumbai 400054 Maharastra 15000.000000 + C00002 mamta Muzumdar NULL NULL Madras 780001 Tamil Nadu 0.000000 + C00003 Chhaya Bankar NULL NULL Mumbai 400057 Maharastra 5000.000000 + C00004 Ashwini Joshi NULL NULL Bangalore 560001 MKarnataka 0.000000 + C00005 Hansel Colaco NULL NULL Mumbai 400060 Maharastra 2000.000000 + C00006 Deepak Sharma NULL NULL Mangalore 560050 Karnatakaa 0.000000 + +echo select * from product_master; +--------------------------------------------------------- + product_master.productno product_master.description product_master.profitpercent product_master.unitmeasure product_master.qtyonhand product_master.reorderlvl product_master.selprice product_master.costprice +--------------------------------------------------------- + P00001 T-Shirts 5.000000 Piece 200 50 350.000000 250.000000 + P03453 Shirts 6.000000 Piece 150 50 500.000000 350.000000 + P06734 Cotton Jeans 5.000000 Piece 100 20 60.000000 450.000000 + P07865 Jeans 5.000000 Piece 100 20 750.000000 500.000000 + P07868 Trousers 2.000000 Piece 150 50 850.000000 550.000000 + P07885 Pull Overs 2.500000 Piece 80 30 700.000000 450.000000 + P07965 Denim Shirts 4.000000 Piece 100 40 350.000000 250.000000 + P07975 Lycra Tops 5.000000 Piece 70 30 300.000000 175.000000 + P08865 Skirts 5.000000 Piece 75 30 450.000000 300.000000 + +echo select * from salesman_master; +--------------------------------------------------------- + salesman_master.salesmanno salesman_master.salesmanname salesman_master.address1 salesman_master.address2 salesman_master.city salesman_master.pincode salesman_master.state salesman_master.salamt salesman_master.tgttoget salesman_master.ytdsales salesman_master.remarks +--------------------------------------------------------- + S00001 Aman A/14 Worli Mumbai 400002 Maharastra 3000.000000 100.000000 50.000000 Good + S00002 Omkar 65 Nariman Mumbai 400001 maharastra 3000.000000 200.000000 100.000000 Good + S00003 Raj P-7 Banfra Mumbai 400032 Maharastra 3000.000000 200.000000 100.000000 Good + S00004 Ashish A/5 Juhu Bombay 400044 Maharastra 3500.000000 200.000000 150.000000 Good + +echo select * from sales_order; +--------------------------------------------------------- + sales_order.orderno sales_order.orderdate sales_order.clientno sales_order.delyaddr sales_order.delytype sales_order.billedyn sales_order.salesmanno sales_order.delydate sales_order.orderstatus +--------------------------------------------------------- + O19001 2002/6/12 C00001 NULL F N S00001 2002/7/20 In Process + O19002 2002/6/25 C00002 NULL P N S00002 2002/6/27 Cancelled + O46865 2002/2/18 C00003 NULL F Y S00003 2002/2/20 Fulfilled + O19003 2002/4/3 C00001 NULL F Y S00001 2002/4/7 Fulfilled + O46866 2002/5/20 C00004 NULL P N S00002 2002/5/22 Cancelled + O19008 2002/5/24 C00005 NULL F N S00004 2002/7/26 In Process + +echo select * from sales_order_details; +--------------------------------------------------------- + sales_order_details.orderno sales_order_details.productno sales_order_details.qtyordered sales_order_details.qtydisp sales_order_details.productrate +--------------------------------------------------------- + O19001 P00001 4 4 525.000000 + O19001 P07965 2 1 8400.000000 + O19001 P07885 2 1 5250.000000 + O19002 P00001 10 0 525.000000 + O46865 P07868 3 3 3150.000000 + O46865 P07885 3 1 5250.000000 + O46865 P00001 10 10 525.000000 + O46865 P03453 4 4 1050.000000 + O19003 P03453 2 2 1050.000000 + O19003 P06734 1 1 12000.000000 + O46866 P07965 1 0 8400.000000 + O46866 P07975 1 0 1050.000000 + O19008 P00001 10 5 525.000000 + O19008 P07975 5 3 1050.000000 + +echo select sales_order_details.productno,description from sales_order_details,sales_order,product_master,client_master where product_master.productno=sales_order_details.productno and sales_order.orderno=sales_order_details.orderno and client_master.clientno=sales_order.clientno and client_master.name='Ivan Bayross'; +--------------------------------------------------------- + sales_order_details.productno description +--------------------------------------------------------- + P00001 T-Shirts + P07965 Denim Shirts + P07885 Pull Overs + P03453 Shirts + P06734 Cotton Jeans + +echo drop table sales_order_details; +Statement Executed +echo drop table sales_order; +Statement Executed +echo drop table salesman_master; +Statement Executed +echo drop table product_master; +Statement Executed +echo drop table client_master; +Statement Executed diff --git a/test/sql/Join/exp1.test004.ksh b/test/sql/Join/exp1.test004.ksh new file mode 100644 index 00000000..99db5a7f --- /dev/null +++ b/test/sql/Join/exp1.test004.ksh @@ -0,0 +1,8 @@ + --------------------------- + f1 f1 f2 f2 + --------------------------- + 101 101 16 16 + 102 102 17 17 + 103 103 18 18 + + diff --git a/test/sql/Join/hash_t1f1_tree_t2f1.sql b/test/sql/Join/hash_t1f1_tree_t2f1.sql new file mode 100644 index 00000000..b9d77732 --- /dev/null +++ b/test/sql/Join/hash_t1f1_tree_t2f1.sql @@ -0,0 +1,4 @@ +echo create index idx1 on t1(f1) hash; +create index idx1 on t1(f1) hash; +echo create index idx2 on t2(f1) tree; +create index idx2 on t2(f1) tree; diff --git a/test/sql/Join/hashon_t1f1_t2f1_t3f1.sql b/test/sql/Join/hashon_t1f1_t2f1_t3f1.sql new file mode 100644 index 00000000..d49c99df --- /dev/null +++ b/test/sql/Join/hashon_t1f1_t2f1_t3f1.sql @@ -0,0 +1,7 @@ +echo create index idx1 on t1(f1) hash; +create index idx1 on t1(f1) hash; +echo create index idx2 on t2(f1) hash; +create index idx2 on t2(f1) hash; +echo create index idx3 on t3(f1) hash; +create index idx3 on t3(f1) hash; + diff --git a/test/sql/Join/hashon_t1f1_t2f1_t3f1_treeon_t1f2_t2f1_t3f1.sql b/test/sql/Join/hashon_t1f1_t2f1_t3f1_treeon_t1f2_t2f1_t3f1.sql new file mode 100644 index 00000000..2a3eb399 --- /dev/null +++ b/test/sql/Join/hashon_t1f1_t2f1_t3f1_treeon_t1f2_t2f1_t3f1.sql @@ -0,0 +1,12 @@ +echo create index idx1 on t1(f1) hash; +create index idx1 on t1(f1) hash; +echo create index idx2 on t2(f1) hash; +create index idx2 on t2(f1) hash; +echo create index idx3 on t3(f1) hash; +create index idx3 on t3(f1) hash; +echo create index idx4 on t1(f2) tree; +create index idx4 on t1(f2) tree; +echo create index idx5 on t2(f2) tree; +create index idx5 on t2(f2) tree; +echo create index idx6 on t3(f2) tree; +create index idx6 on t3(f2) tree; diff --git a/test/sql/Join/hashon_t1f2_t2f2.sql b/test/sql/Join/hashon_t1f2_t2f2.sql new file mode 100644 index 00000000..7b360ea0 --- /dev/null +++ b/test/sql/Join/hashon_t1f2_t2f2.sql @@ -0,0 +1,3 @@ +create index idx1 on t1(f2) hash; +create index idx2 on t2(f2) hash; + diff --git a/test/sql/Join/hashonboth.sql b/test/sql/Join/hashonboth.sql new file mode 100644 index 00000000..e06fd71a --- /dev/null +++ b/test/sql/Join/hashonboth.sql @@ -0,0 +1,4 @@ +create index idx1 on t1(f1) hash; +create index idx2 on t1(f2) hash; +create index idx3 on t2(f1) hash; +create index idx4 on t2(f2) hash; diff --git a/test/sql/Join/hashtree_mix1.sql b/test/sql/Join/hashtree_mix1.sql new file mode 100644 index 00000000..09ab36bd --- /dev/null +++ b/test/sql/Join/hashtree_mix1.sql @@ -0,0 +1,5 @@ +create index idx1 on t1(f2) hash; +create index idx2 on t2(f2) hash; +create index idx3 on t1(f2) tree; +create index idx4 on t2(f2) tree; + diff --git a/test/sql/Join/hashtree_mix2.sql b/test/sql/Join/hashtree_mix2.sql new file mode 100644 index 00000000..4fc6915d --- /dev/null +++ b/test/sql/Join/hashtree_mix2.sql @@ -0,0 +1,4 @@ +create index idx1 on t1(f1) hash; +create index idx2 on t2(f1) hash; +create index idx3 on t1(f1) tree; +create index idx4 on t2(f1) tree; diff --git a/test/sql/Join/hashtreeonboth.sql b/test/sql/Join/hashtreeonboth.sql new file mode 100644 index 00000000..8060027a --- /dev/null +++ b/test/sql/Join/hashtreeonboth.sql @@ -0,0 +1,4 @@ +create index idx1 on t1(f1) hash; +create index idx2 on t2(f1) hash; +create index idx3 on t1(f2) tree; +create index idx4 on t2(f2) tree; diff --git a/test/sql/Join/inner_t1_t2.sql b/test/sql/Join/inner_t1_t2.sql new file mode 100644 index 00000000..4ac2ce54 --- /dev/null +++ b/test/sql/Join/inner_t1_t2.sql @@ -0,0 +1,18 @@ +echo select t1.f1, t1.f2, t2.f1, t2.f2 from t1 inner join t2 on t1.f1 = t2.f1 ; +select t1.f1, t1.f2, t2.f1, t2.f2 from t1 inner join t2 on t1.f1 = t2.f1 ; +echo select t1.f1, t1.f2, t2.f1, t2.f2 from t1 inner join t2 on t1.f2 = t2.f2 ; +select t1.f1, t1.f2, t2.f1, t2.f2 from t1 inner join t2 on t1.f2 = t2.f2 ; +echo select t1.f1, t1.f3, t2.f1, t2.f3 from t1 inner join t2 on t1.f3 = t2.f3 ; +select t1.f1, t1.f3, t2.f1, t2.f3 from t1 inner join t2 on t1.f3 = t2.f3 ; +echo select t1.f1, t1.f4, t2.f1, t2.f4 from t1 inner join t2 on t1.f4 = t2.f4 ; +select t1.f1, t1.f4, t2.f1, t2.f4 from t1 inner join t2 on t1.f4 = t2.f4 ; +echo select t1.f1, t1.f5, t2.f1, t2.f5 from t1 inner join t2 on t1.f5 = t2.f5 ; +select t1.f1, t1.f5, t2.f1, t2.f5 from t1 inner join t2 on t1.f5 = t2.f5 ; +echo select t1.f1, t1.f6, t2.f1, t2.f6 from t1 inner join t2 on t1.f6 = t2.f6 ; +select t1.f1, t1.f6, t2.f1, t2.f6 from t1 inner join t2 on t1.f6 = t2.f6 ; +echo select t1.f1, t1.f7, t2.f1, t2.f7 from t1 inner join t2 on t1.f7 = t2.f7 ; +select t1.f1, t1.f7, t2.f1, t2.f7 from t1 inner join t2 on t1.f7 = t2.f7 ; +echo select t1.f1, t1.f8, t2.f1, t2.f8 from t1 inner join t2 on t1.f8 = t2.f8 ; +select t1.f1, t1.f8, t2.f1, t2.f8 from t1 inner join t2 on t1.f8 = t2.f8 ; +echo select t1.f1, t1.f9, t2.f1, t2.f9 from t1 inner join t2 on t1.f9 = t2.f9 ; +select t1.f1, t1.f9, t2.f1, t2.f9 from t1 inner join t2 on t1.f9 = t2.f9 ; diff --git a/test/sql/Join/inner_t1_t2_t3.sql b/test/sql/Join/inner_t1_t2_t3.sql new file mode 100644 index 00000000..1baf4bc0 --- /dev/null +++ b/test/sql/Join/inner_t1_t2_t3.sql @@ -0,0 +1,18 @@ +echo select t1.f1, t1.f2, t2.f1, t2.f2, t3.f1, t3.f2 from t1 inner join t2 on t1.f1 = t2.f1 inner join t3 on t2.f1 = t3.f1; +select t1.f1, t1.f2, t2.f1, t2.f2, t3.f1, t3.f2 from t1 inner join t2 on t1.f1 = t2.f1 inner join t3 on t2.f1 = t3.f1; +echo select t1.f1, t1.f2, t2.f1, t2.f2, t3.f1, t3.f2 from t1 inner join t2 on t1.f2 = t2.f2 inner join t3 on t2.f2 = t3.f2; +select t1.f1, t1.f2, t2.f1, t2.f2, t3.f1, t3.f2 from t1 inner join t2 on t1.f2 = t2.f2 inner join t3 on t2.f2 = t3.f2; +echo select t1.f1, t1.f3, t2.f1, t2.f3, t3.f1, t3.f3 from t1 inner join t2 on t1.f3 = t2.f3 inner join t3 on t2.f3 = t3.f3; +select t1.f1, t1.f3, t2.f1, t2.f3, t3.f1, t3.f3 from t1 inner join t2 on t1.f3 = t2.f3 inner join t3 on t2.f3 = t3.f3; +echo select t1.f1, t1.f4, t2.f1, t2.f4, t3.f1, t3.f4 from t1 inner join t2 on t1.f4 = t2.f4 inner join t3 on t2.f4 = t3.f4; +select t1.f1, t1.f4, t2.f1, t2.f4, t3.f1, t3.f4 from t1 inner join t2 on t1.f4 = t2.f4 inner join t3 on t2.f4 = t3.f4; +echo select t1.f1, t1.f5, t2.f1, t2.f5, t3.f1, t3.f5 from t1 inner join t2 on t1.f5 = t2.f5 inner join t3 on t2.f5 = t3.f5; +select t1.f1, t1.f5, t2.f1, t2.f5, t3.f1, t3.f5 from t1 inner join t2 on t1.f5 = t2.f5 inner join t3 on t2.f5 = t3.f5; +echo select t1.f1, t1.f6, t2.f1, t2.f6, t3.f1, t3.f6 from t1 inner join t2 on t1.f6 = t2.f6 inner join t3 on t2.f6 = t3.f6; +select t1.f1, t1.f6, t2.f1, t2.f6, t3.f1, t3.f6 from t1 inner join t2 on t1.f6 = t2.f6 inner join t3 on t2.f6 = t3.f6; +echo select t1.f1, t1.f7, t2.f1, t2.f7, t3.f1, t3.f7 from t1 inner join t2 on t1.f7 = t2.f7 inner join t3 on t2.f7 = t3.f7; +select t1.f1, t1.f7, t2.f1, t2.f7, t3.f1, t3.f7 from t1 inner join t2 on t1.f7 = t2.f7 inner join t3 on t2.f7 = t3.f7; +echo select t1.f1, t1.f8, t2.f1, t2.f8, t3.f1, t3.f8 from t1 inner join t2 on t1.f8 = t2.f8 inner join t3 on t2.f8 = t3.f8; +select t1.f1, t1.f8, t2.f1, t2.f8, t3.f1, t3.f8 from t1 inner join t2 on t1.f8 = t2.f8 inner join t3 on t2.f8 = t3.f8; +echo select t1.f1, t1.f9, t2.f1, t2.f9, t3.f1, t3.f9 from t1 inner join t2 on t1.f9 = t2.f9 inner join t3 on t2.f9 = t3.f9; +select t1.f1, t1.f9, t2.f1, t2.f9, t3.f1, t3.f9 from t1 inner join t2 on t1.f9 = t2.f9 inner join t3 on t2.f9 = t3.f9; diff --git a/test/sql/Join/inner_t1_t2_t3_t1.sql b/test/sql/Join/inner_t1_t2_t3_t1.sql new file mode 100644 index 00000000..74d5e68d --- /dev/null +++ b/test/sql/Join/inner_t1_t2_t3_t1.sql @@ -0,0 +1,18 @@ +echo select t1.f1, t1.f2, t2.f1, t2.f2, t3.f1, t3.f2 from t1 inner join t2 on t1.f1 = t2.f1 inner join t3 on t2.f1 = t3.f1 inner join t1 on t3.f1 = t1.f1; +select t1.f1, t1.f2, t2.f1, t2.f2, t3.f1, t3.f2 from t1 inner join t2 on t1.f1 = t2.f1 inner join t3 on t2.f1 = t3.f1 inner join t1 on t3.f1 = t1.f1; +echo select t1.f1, t1.f2, t2.f1, t2.f2, t3.f1, t3.f2 from t1 inner join t2 on t1.f2 = t2.f2 inner join t3 on t2.f2 = t3.f2 inner join t1 on t3.f1 = t1.f1; +select t1.f1, t1.f2, t2.f1, t2.f2, t3.f1, t3.f2 from t1 inner join t2 on t1.f2 = t2.f2 inner join t3 on t2.f2 = t3.f2 inner join t1 on t3.f1 = t1.f1; +echo select t1.f1, t1.f3, t2.f1, t2.f3, t3.f1, t3.f3 from t1 inner join t2 on t1.f3 = t2.f3 inner join t3 on t2.f3 = t3.f3 inner join t1 on t3.f1 = t1.f1; +select t1.f1, t1.f3, t2.f1, t2.f3, t3.f1, t3.f3 from t1 inner join t2 on t1.f3 = t2.f3 inner join t3 on t2.f3 = t3.f3 inner join t1 on t3.f1 = t1.f1; +echo select t1.f1, t1.f4, t2.f1, t2.f4, t3.f1, t3.f4 from t1 inner join t2 on t1.f4 = t2.f4 inner join t3 on t2.f4 = t3.f4 inner join t1 on t3.f1 = t1.f1; +select t1.f1, t1.f4, t2.f1, t2.f4, t3.f1, t3.f4 from t1 inner join t2 on t1.f4 = t2.f4 inner join t3 on t2.f4 = t3.f4 inner join t1 on t3.f1 = t1.f1; +echo select t1.f1, t1.f5, t2.f1, t2.f5, t3.f1, t3.f5 from t1 inner join t2 on t1.f5 = t2.f5 inner join t3 on t2.f5 = t3.f5 inner join t1 on t3.f1 = t1.f1; +select t1.f1, t1.f5, t2.f1, t2.f5, t3.f1, t3.f5 from t1 inner join t2 on t1.f5 = t2.f5 inner join t3 on t2.f5 = t3.f5 inner join t1 on t3.f1 = t1.f1; +echo select t1.f1, t1.f6, t2.f1, t2.f6, t3.f1, t3.f6 from t1 inner join t2 on t1.f6 = t2.f6 inner join t3 on t2.f6 = t3.f6 inner join t1 on t3.f1 = t1.f1; +select t1.f1, t1.f6, t2.f1, t2.f6, t3.f1, t3.f6 from t1 inner join t2 on t1.f6 = t2.f6 inner join t3 on t2.f6 = t3.f6 inner join t1 on t3.f1 = t1.f1; +echo select t1.f1, t1.f7, t2.f1, t2.f7, t3.f1, t3.f7 from t1 inner join t2 on t1.f7 = t2.f7 inner join t3 on t2.f7 = t3.f7 inner join t1 on t3.f1 = t1.f1; +select t1.f1, t1.f7, t2.f1, t2.f7, t3.f1, t3.f7 from t1 inner join t2 on t1.f7 = t2.f7 inner join t3 on t2.f7 = t3.f7 inner join t1 on t3.f1 = t1.f1; +echo select t1.f1, t1.f8, t2.f1, t2.f8, t3.f1, t3.f8 from t1 inner join t2 on t1.f8 = t2.f8 inner join t3 on t2.f8 = t3.f8 inner join t1 on t3.f1 = t1.f1; +select t1.f1, t1.f8, t2.f1, t2.f8, t3.f1, t3.f8 from t1 inner join t2 on t1.f8 = t2.f8 inner join t3 on t2.f8 = t3.f8 inner join t1 on t3.f1 = t1.f1; +echo select t1.f1, t1.f9, t2.f1, t2.f9, t3.f1, t3.f9 from t1 inner join t2 on t1.f9 = t2.f9 inner join t3 on t2.f9 = t3.f9 inner join t1 on t3.f1 = t1.f1; +select t1.f1, t1.f9, t2.f1, t2.f9, t3.f1, t3.f9 from t1 inner join t2 on t1.f9 = t2.f9 inner join t3 on t2.f9 = t3.f9 inner join t1 on t3.f1 = t1.f1; diff --git a/test/sql/Join/innerjoin_in_between_like.sql b/test/sql/Join/innerjoin_in_between_like.sql new file mode 100644 index 00000000..2bb8ea6b --- /dev/null +++ b/test/sql/Join/innerjoin_in_between_like.sql @@ -0,0 +1,6 @@ +echo SELECT t1.f1, t1.f4, t2.f1, t2.f4 FROM t1 INNER JOIN t2 ON t1.f1 IN(12,10,14) OR t1.f1=t2.f1; +SELECT t1.f1, t1.f4, t2.f1, t2.f4 FROM t1 INNER JOIN t2 ON t1.f1 IN(12,10,14) OR t1.f1=t2.f1; +echo SELECT t1.f1, t1.f4, t2.f1, t2.f4 FROM t1 INNER JOIN t2 ON t1.f1 BETWEEN 11 AND 14; +SELECT t1.f1, t1.f4, t2.f1, t2.f4 FROM t1 INNER JOIN t2 ON t1.f1 BETWEEN 11 AND 14; +echo SELECT t1.f1, t1.f4, t2.f1, t2.f4 FROM t1 INNER JOIN t2 ON t1.f4 >= 'K' AND t1.f4 LIKE 'N%' OR t1.f4 LIKE '%a'; +SELECT t1.f1, t1.f4, t2.f1, t2.f4 FROM t1 INNER JOIN t2 ON t1.f4 >= 'K' AND t1.f4 LIKE 'N%' OR t1.f4 LIKE '%a'; diff --git a/test/sql/Join/insert_t1_t2.sql b/test/sql/Join/insert_t1_t2.sql new file mode 100644 index 00000000..fbf83bb2 --- /dev/null +++ b/test/sql/Join/insert_t1_t2.sql @@ -0,0 +1,20 @@ +echo insert into t1 values(101,100); +insert into t1 values(101,100); +echo insert into t1 values(303,333); +insert into t1 values(303,333); +echo insert into t1 values(505,555); +insert into t1 values(505,555); +echo insert into t2 values(505,100); +insert into t2 values(505,100); +echo insert into t2 values(100,101); +insert into t2 values(100,101); +echo insert into t2 values(404,444); +insert into t2 values(404,444); +echo insert into t2 values(303,333); +insert into t2 values(303,333); +echo insert into t2 values(101,100); +insert into t2 values(101,100); +echo select * from t1; +select * from t1; +echo select * from t2; +select * from t2; diff --git a/test/sql/Join/insert_t1_t2_t3.sql b/test/sql/Join/insert_t1_t2_t3.sql new file mode 100644 index 00000000..562f4c70 --- /dev/null +++ b/test/sql/Join/insert_t1_t2_t3.sql @@ -0,0 +1,21 @@ +echo insert into t1 values(101,100); +insert into t1 values(100,100); +echo insert into t1 values(303,333); +insert into t1 values(303,333); +echo insert into t1 values(505,555); +insert into t1 values(505,555); + +echo insert into t2 values(505,100); +insert into t2 values(505,100); +echo insert into t2 values(404,444); +insert into t2 values(404,444); +echo insert into t2 values(101,110); +insert into t2 values(100,110); + +echo insert into t3 values(303,333); +insert into t3 values(303,333); +echo insert into t3 values(101,110); +insert into t3 values(101,110); +echo insert into t3 values(222,200); +insert into t3 values(100,200); + diff --git a/test/sql/Join/join1.sql b/test/sql/Join/join1.sql new file mode 100644 index 00000000..64031f40 --- /dev/null +++ b/test/sql/Join/join1.sql @@ -0,0 +1,11 @@ +echo select t1.f1 from t1; +select t1.f1 from t1; + +echo select t1.f30 from t1; +select t1.f30 from t1; + +echo select * from t1,t55 ; +select * from t1,t55 ; + +echo select t100.f1 from t1; +select t100.f1 from t1; diff --git a/test/sql/Join/join10.sql b/test/sql/Join/join10.sql new file mode 100644 index 00000000..9a3e1ab8 --- /dev/null +++ b/test/sql/Join/join10.sql @@ -0,0 +1,6 @@ +echo select * from t11,t12,t13 where t12.f1=t13.f8 and t13.f7=t11.f1; +select * from t11,t12,t13 where t12.f1=t13.f8 and t13.f7=t11.f1; + +echo select * from t11,t12,t13 where t12.f1=t13.f8 or t13.f7=t11.f1; +select * from t11,t12,t13 where t12.f1=t13.f8 or t13.f7=t11.f1; + diff --git a/test/sql/Join/join11.sql b/test/sql/Join/join11.sql new file mode 100644 index 00000000..aaddc97e --- /dev/null +++ b/test/sql/Join/join11.sql @@ -0,0 +1,6 @@ +echo select t11.f1,t12.f7 from t12,t11; +select t11.f1,t12.f7 from t12,t11; + +echo select t11.f1,t12.f7 from t13,t11; +select t11.f1,t13.f7 from t13,t11; + diff --git a/test/sql/Join/join2.sql b/test/sql/Join/join2.sql new file mode 100644 index 00000000..13229971 --- /dev/null +++ b/test/sql/Join/join2.sql @@ -0,0 +1,5 @@ +echo select * from t1,t2 where t1.f1>100 or t2.f1<100; +select * from t1,t2 where t1.f1>100 or t2.f1<100; + +echo select * from t1,t2 where t1.f1 = t2.f1 and t1.f1 >100; +select * from t1,t2 where t1.f1 = t2.f1 and t1.f1 >100; diff --git a/test/sql/Join/join3.sql b/test/sql/Join/join3.sql new file mode 100644 index 00000000..d59d1adb --- /dev/null +++ b/test/sql/Join/join3.sql @@ -0,0 +1,7 @@ +echo select * from t1,t2,t3,t4,t5; +select * from t1,t2,t3,t4,t5; + +echo select * from t1,t2 where t1.f1>100; +select * from t1,t2 where t1.f1>100; + + diff --git a/test/sql/Join/join31.sql b/test/sql/Join/join31.sql new file mode 100644 index 00000000..10da61ba --- /dev/null +++ b/test/sql/Join/join31.sql @@ -0,0 +1,41 @@ +echo create table emp(eno int,mgrno int,sal float,deptno int); +create table emp(eno int,mgrno int,sal float,deptno int); +echo insert into emp values(1,3,5000,10); +insert into emp values(1,3,5000,10); +echo insert into emp values(2,4,4000,20); +insert into emp values(2,4,4000,20); +echo insert into emp values(3,NULL,8000,10); +insert into emp values(3,NULL,8000,10); +echo create table dept(deptno int,dname char(10),lid int); +create table dept(deptno int,dname char(10),lid int); +echo insert into dept values(10,'IT',100); +insert into dept values(10,'IT',100); +echo insert into dept values(20,'HR',300); +insert into dept values(20,'HR',300); +echo create table loc(lid int,state char(10)); +create table loc(lid int,state char(10)); +echo insert into loc values(100,'Orissa'); +insert into loc values(100,'Orissa'); +echo insert into loc values(200,'Cal'); +insert into loc values(200,'Cal'); +echo insert into loc values(300,'Calif'); +insert into loc values(300,'Calif'); +echo select * from emp; +select * from emp; +echo select * from dept; +select * from dept; +echo select * from loc; +select * from loc; +echo select * from emp,dept,loc; +select * from emp,dept,loc; +echo select * from emp,dept,loc where emp.deptno!=dept.deptno AND dept.lid!=loc.lid; +select * from emp,dept,loc where emp.deptno!=dept.deptno AND dept.lid!=loc.lid; +echo select * from emp,dept,loc where NOT(emp.deptno!=dept.deptno AND dept.lid!=loc.lid); +select * from emp,dept,loc where NOT(emp.deptno!=dept.deptno AND dept.lid!=loc.lid); +echo drop table emp; +drop table emp; +echo drop table dept; +drop table dept; +echo drop table loc; +drop table loc; + diff --git a/test/sql/Join/join32.sql b/test/sql/Join/join32.sql new file mode 100644 index 00000000..2da72cc8 --- /dev/null +++ b/test/sql/Join/join32.sql @@ -0,0 +1,18 @@ +create table emp(eno int,dno int); +insert into emp values(1,10); +insert into emp values(2,20); +insert into emp values(4,40); + +create table dept(deptno int,dname char(10)); +insert into dept values(20,'Sales'); +insert into dept values(30,'IT'); +insert into dept values(40,'Mkt'); +insert into dept values(50,'HR'); + +echo select * from emp; +select * from emp; +echo select * from dept; +select * from dept; + + + diff --git a/test/sql/Join/join33.sql b/test/sql/Join/join33.sql new file mode 100644 index 00000000..8b42e4fa --- /dev/null +++ b/test/sql/Join/join33.sql @@ -0,0 +1,11 @@ +create table emp(eno int,ename char(10),dno int); +insert into emp values(1,'Nihar',10); +insert into emp values(2,'Kishore',20); +insert into emp values(3,'Jiten',30); +insert into emp values(4,'Bijay',40); +insert into emp values(5,'Kailash',50); +create table dept(deptno int,dname char(10)); +insert into dept values(20,'Sales'); +insert into dept values(40,'Mkt'); +insert into dept values(35,'HR'); + diff --git a/test/sql/Join/join34.sql b/test/sql/Join/join34.sql new file mode 100644 index 00000000..112da7de --- /dev/null +++ b/test/sql/Join/join34.sql @@ -0,0 +1,16 @@ +create table emp(eno int,ename char(10),dno int); +insert into emp values(1,'Nihar',10); +insert into emp values(2,'Papu',20); +insert into emp values(3,'Sima',30); +insert into emp values(4,'Nama',40); +insert into emp values(5,'Pinu',50); +create table dept(deptno int,dname char(10),lid int); +insert into dept values(20,'IT',101); +insert into dept values(40,'Sales',102); +insert into dept values(60,'Mkt',103); +insert into dept values(30,'Store',104); +select * from emp; +select * from dept; +select * from emp,dept; + ~ + diff --git a/test/sql/Join/join35.sql b/test/sql/Join/join35.sql new file mode 100644 index 00000000..5981bf6c --- /dev/null +++ b/test/sql/Join/join35.sql @@ -0,0 +1,18 @@ +echo select * from t1,t2 where t1.f1 = t2.f1 and t1.f1 = t2.f1; +select * from t1,t2 where t1.f1 = t2.f1 and t1.f1 = t2.f1; +echo select * from t1,t2 where t1.f1 = t2.f1 and t2.f2 > 100; +select * from t1,t2 where t1.f1 = t2.f1 and t2.f2 > 100; +echo select * from t1,t2 where t1.f1 = t2.f1 or t1.f2 > t2.f2; +select * from t1,t2 where t1.f1 = t2.f1 or t1.f2 > t2.f2; +echo select * from t1,t2 where t1.f1 = t2.f1 or t2.f2 > 100; +select * from t1,t2 where t1.f1 = t2.f1 or t2.f2 > 100; +echo select * from t1,t2 where not ( t1.f1 = t2.f1 and t1.f1 = t2.f1 ); +select * from t1,t2 where not ( t1.f1 = t2.f1 and t1.f1 = t2.f1 ); +echo select * from t1,t2 where ( not t1.f1 = t2.f1 ); +select * from t1,t2 where ( not t1.f1 = t2.f1 ); +echo select * from t1,t2 where t1.f1 = t2.f1 and t1.f2 = 100; +select * from t1,t2 where t1.f1 = t2.f1 and t1.f2 = 100; +echo select * from t1,t2 where t1.f1 > t2.f1 and t2.f2 = 110; +select * from t1,t2 where t1.f1 > t2.f1 and t2.f2 = 110; +echo select * from t1,t2 where t1.f1 > t2.f1 and t2.f2 > 100; +select * from t1,t2 where t1.f1 > t2.f1 and t2.f2 > 100; diff --git a/test/sql/Join/join36.sql b/test/sql/Join/join36.sql new file mode 100644 index 00000000..d5d15974 --- /dev/null +++ b/test/sql/Join/join36.sql @@ -0,0 +1,44 @@ +echo select * from t1,t2; +select * from t1,t2; + +echo select * from t1,t2 where t1.f1=t2.f1 and t1.f2=t2.f2; +select * from t1,t2 where t1.f1=t2.f1 and t1.f2=t2.f2; + +echo select * from t1,t2 where t1.f2=t2.f2 and t1.f1=t2.f1; +select * from t1,t2 where t1.f2=t2.f2 and t1.f1=t2.f1; + +echo select * from t1,t2 where t1.f1>t2.f1 and t1.f2>t2.f2; +select * from t1,t2 where t1.f1>t2.f1 and t1.f2>t2.f2; + +echo select * from t1,t2 where t1.f2t2.f1 or t1.f2>=t2.f2; +select * from t1,t2 where t1.f1>t2.f1 or t1.f2>=t2.f2; + +echo select * from t1,t2 where t1.f2t2.f1 or t1.f2>t2.f2; +select * from t1,t2 where t1.f1>t2.f1 or t1.f2>t2.f2; + +echo select * from t1,t2 where t1.f1=t2.f1 and not(t1.f2=t2.f2); +select * from t1,t2 where t1.f1=t2.f1 and not(t1.f2=t2.f2); + +echo select * from t1,t2 where t1.f2=t2.f2 and not(t1.f1=t2.f1); +select * from t1,t2 where t1.f2=t2.f2 and not(t1.f1=t2.f1); + +echo select * from t1,t2 where not(t1.f1>t2.f1) and t1.f2>t2.f2; +select * from t1,t2 where not(t1.f1>t2.f1) and t1.f2>t2.f2; + +echo select * from t1,t2 where not(t1.f2 100; +select t1.f1,t2.f1,t3.f1 from t1,t2,t3 where t1.f2=t2.f2 or t1.f1 > 100; +echo select t1.f1, t2.f1, t3.f1 from t1,t2,t3 where t1.f2= t2.f2 and t1.f3 = t3.f2; +select t1.f1, t2.f1, t3.f1 from t1,t2,t3 where t1.f2= t2.f2 and t1.f3 = t3.f2; diff --git a/test/sql/Join/join6.sql b/test/sql/Join/join6.sql new file mode 100644 index 00000000..a69384d2 --- /dev/null +++ b/test/sql/Join/join6.sql @@ -0,0 +1,2 @@ +echo select * from t1,t2 where t1.f1=t2.f100; +select * from t1,t2 where t1.f1=t2.f100; diff --git a/test/sql/Join/join7.sql b/test/sql/Join/join7.sql new file mode 100644 index 00000000..cfd53b80 --- /dev/null +++ b/test/sql/Join/join7.sql @@ -0,0 +1,5 @@ +echo select * from t11 where t11.f1=2; +select * from t11 where t11.f1=2; + +echo select * from t11 where t11.f1=t11.f1; +select * from t11 where t11.f1=t11.f1; diff --git a/test/sql/Join/join8.sql b/test/sql/Join/join8.sql new file mode 100644 index 00000000..4e56b922 --- /dev/null +++ b/test/sql/Join/join8.sql @@ -0,0 +1,15 @@ +echo select * from t11,t12 where t11.f5=t12.f1; +select * from t11,t12 where t11.f5=t12.f1; + +echo select * from t11,t12 where t11.f5 > t12.f1; +select * from t11,t12 where t11.f5 > t12.f1; + +echo select * from t11,t12 where t12.f1 <= t11.f5; +select * from t11,t12 where t12.f1 <= t11.f5; + +echo select * from t11,t12 where t12.f1 != t11.f5; +select * from t11,t12 where t12.f1 != t11.f5; + +echo select * from t11,t12 where t12.f1 > 20; +select * from t11,t12 where t12.f1 > 20; + diff --git a/test/sql/Join/join9.sql b/test/sql/Join/join9.sql new file mode 100644 index 00000000..f79ee73f --- /dev/null +++ b/test/sql/Join/join9.sql @@ -0,0 +1,11 @@ +echo select t11.f5, t13.f8 from t11,t13 where t11.f5=t13.f8; +select t11.f5, t13.f8 from t11,t13 where t11.f5=t13.f8; + +echo select t11.f1,t11.f5,t13.f8 from t11,t13 where t11.f5=t13.f8; +select t11.f1,t11.f5,t13.f8 from t11,t13 where t11.f5=t13.f8; + +echo select * from t11,t13 where t13.f8 > t11.f5; +select * from t11,t13 where t13.f8 > t11.f5; + +echo select t11.f1,t11.f5,t13.f8 from t11,t13 where t13.f8 < t11.f5; +select t11.f1,t11.f5,t13.f8 from t11,t13 where t13.f8 < t11.f5; diff --git a/test/sql/Join/join_between.sql b/test/sql/Join/join_between.sql new file mode 100644 index 00000000..980a2c26 --- /dev/null +++ b/test/sql/Join/join_between.sql @@ -0,0 +1,9 @@ +echo select * from emp,dept; +select * from emp,dept; +echo select * from emp,dept where emp.dno between 10 and 30; +select * from emp,dept where emp.dno between 10 and 30; +echo select * from emp,dept where dept.deptno between 20 and 40; +select * from emp,dept where dept.deptno between 20 and 40; +echo select * from emp,dept where emp.dno between 15 and 30 and dept.deptno between 20 and 40; +select * from emp,dept where emp.dno between 15 and 30 and dept.deptno between 20 and 40; + diff --git a/test/sql/Join/join_between_notexist.sql b/test/sql/Join/join_between_notexist.sql new file mode 100644 index 00000000..4328ee8e --- /dev/null +++ b/test/sql/Join/join_between_notexist.sql @@ -0,0 +1,4 @@ +echo select * from emp where emp.deptno between 20 and 40; +select * from emp where emp.deptno between 20 and 40; +echo select * from emp,dept where emp.deptno between 20 and 40; +select * from emp,dept where emp.deptno between 20 and 40; diff --git a/test/sql/Join/join_in.sql b/test/sql/Join/join_in.sql new file mode 100644 index 00000000..1d743f6a --- /dev/null +++ b/test/sql/Join/join_in.sql @@ -0,0 +1,12 @@ +echo select * from emp,dept; +select * from emp,dept; +echo select * from emp,dept where emp.dno in(20,30); +select * from emp,dept where emp.dno in(20,30); +echo select * from emp,dept where dept.deptno in(20,30); +select * from emp,dept where dept.deptno in(20,30); +echo select * from emp,dept where emp.dno in(20,30) and dept.deptno in(20,30); +select * from emp,dept where emp.dno in(20,30) and dept.deptno in(20,30); + +echo select * from emp,dept where emp.dno in(20,30) or dept.deptno in(20,30); + select * from emp,dept where emp.dno in(20,30) or dept.deptno in(20,30); + ~ diff --git a/test/sql/Join/join_in_notexist.sql b/test/sql/Join/join_in_notexist.sql new file mode 100644 index 00000000..327860b5 --- /dev/null +++ b/test/sql/Join/join_in_notexist.sql @@ -0,0 +1,4 @@ +echo select * from emp where emp.deptno in (20,30,40); +select * from emp where emp.deptno in (20,30,40); +echo select * from emp,dept where emp.deptno in (20,30,40); +select * from emp,dept where emp.deptno in (20,30,40); diff --git a/test/sql/Join/join_like.sql b/test/sql/Join/join_like.sql new file mode 100644 index 00000000..57dd365b --- /dev/null +++ b/test/sql/Join/join_like.sql @@ -0,0 +1,10 @@ +echo select * from emp,dept; +select * from emp,dept; +echo select * from emp,dept where emp.ename LIKE 'K%'; +select * from emp,dept where emp.ename LIKE 'K%'; +echo select * from emp,dept where dept.dname LIKE 'S%'; +select * from emp,dept where dept.dname LIKE 'S%'; +echo select * from emp,dept where emp.ename LIKE 'K%' and dept.dname LIKE 'S%'; +select * from emp,dept where emp.ename LIKE 'K%' and dept.dname LIKE 'S%'; +echo select * from emp,dept where emp.ename LIKE 'K%' or dept.dname LIKE 'S%'; +select * from emp,dept where emp.ename LIKE 'K%' or dept.dname LIKE 'S%'; diff --git a/test/sql/Join/join_like_notexist1.sql b/test/sql/Join/join_like_notexist1.sql new file mode 100644 index 00000000..0a47f392 --- /dev/null +++ b/test/sql/Join/join_like_notexist1.sql @@ -0,0 +1,2 @@ +echo select * from emp where emp.dname like 'S%'; +select * from emp where emp.dname like 'S%'; diff --git a/test/sql/Join/join_like_notexist2.sql b/test/sql/Join/join_like_notexist2.sql new file mode 100644 index 00000000..d1f7c5f3 --- /dev/null +++ b/test/sql/Join/join_like_notexist2.sql @@ -0,0 +1,2 @@ +echo select * from emp,dept where emp.dname like 'S%'; +select * from emp,dept where emp.dname like 'S%'; diff --git a/test/sql/Join/noindex_t1_t2.sql b/test/sql/Join/noindex_t1_t2.sql new file mode 100644 index 00000000..50093c50 --- /dev/null +++ b/test/sql/Join/noindex_t1_t2.sql @@ -0,0 +1,20 @@ +echo create table t1(f1 int,f2 int); +create table t1(f1 int,f2 int); +echo create table t2(f1 int,f2 int); +create table t2(f1 int,f2 int); +echo insert into t1 values(101,100); +insert into t1 values(101,100); +echo insert into t1 values(303,333); +insert into t1 values(303,333); +echo insert into t1 values(505,555); +insert into t1 values(505,555); +echo insert into t2 values(505,100); +insert into t2 values(505,100); +echo insert into t2 values(100,101); +insert into t2 values(100,101); +echo insert into t2 values(404,444); +insert into t2 values(404,444); +echo insert into t2 values(303,300); +insert into t2 values(303,300); +echo insert into t2 values(101,110); +insert into t2 values(101,110); diff --git a/test/sql/Join/noindex_t1_t2_t3.sql b/test/sql/Join/noindex_t1_t2_t3.sql new file mode 100644 index 00000000..60d733f2 --- /dev/null +++ b/test/sql/Join/noindex_t1_t2_t3.sql @@ -0,0 +1,6 @@ +echo create table t1(f1 int,f2 int); +create table t1(f1 int,f2 int); +echo create table t2(f1 int,f2 int); +create table t2(f1 int,f2 int); +echo create table t3(f1 int,f2 int); +create table t3(f1 int,f2 int); diff --git a/test/sql/Join/nulltest1.sql b/test/sql/Join/nulltest1.sql new file mode 100644 index 00000000..bce708fb --- /dev/null +++ b/test/sql/Join/nulltest1.sql @@ -0,0 +1,24 @@ +echo create table t1(f1 int,f2 int); +create table t1(f1 int,f2 int); +echo insert into t1 values(1,10); +insert into t1 values(1,10); +echo insert into t1 values(2,NULL); +insert into t1 values(2,NULL); +echo insert into t1 values(3,30); +insert into t1 values(3,30); +echo insert into t1 values(5,50); +insert into t1 values(5,50); +echo create table t2(f1 int,f2 int); +create table t2(f1 int,f2 int); +echo insert into t2 values(1,NULL); +insert into t2 values(1,NULL); +echo insert into t2 values(2,20); +insert into t2 values(2,20); +echo insert into t2 values(3,30); +insert into t2 values(3,30); +echo insert into t2 values(4,40); +insert into t2 values(4,40); +echo select * from t1; +select * from t1; +echo select * from t2; +select * from t2; diff --git a/test/sql/Join/quit.sql b/test/sql/Join/quit.sql new file mode 100644 index 00000000..0bc271ce --- /dev/null +++ b/test/sql/Join/quit.sql @@ -0,0 +1,2 @@ +quit; + diff --git a/test/sql/Join/sales_join.sql b/test/sql/Join/sales_join.sql new file mode 100644 index 00000000..c6014c77 --- /dev/null +++ b/test/sql/Join/sales_join.sql @@ -0,0 +1,2 @@ +echo select sales_order_details.productno,description from sales_order_details,sales_order,product_master,client_master where product_master.productno=sales_order_details.productno and sales_order.orderno=sales_order_details.orderno and client_master.clientno=sales_order.clientno and client_master.name='Ivan Bayross'; +select sales_order_details.productno,description from sales_order_details,sales_order,product_master,client_master where product_master.productno=sales_order_details.productno and sales_order.orderno=sales_order_details.orderno and client_master.clientno=sales_order.clientno and client_master.name='Ivan Bayross'; diff --git a/test/sql/Join/sales_table_drop.sql b/test/sql/Join/sales_table_drop.sql new file mode 100644 index 00000000..504b7c40 --- /dev/null +++ b/test/sql/Join/sales_table_drop.sql @@ -0,0 +1,10 @@ +echo drop table sales_order_details; +drop table sales_order_details; +echo drop table sales_order; +drop table sales_order; +echo drop table salesman_master; +drop table salesman_master; +echo drop table product_master; +drop table product_master; +echo drop table client_master; +drop table client_master; diff --git a/test/sql/Join/sales_tables.sql b/test/sql/Join/sales_tables.sql new file mode 100644 index 00000000..6d5eead2 --- /dev/null +++ b/test/sql/Join/sales_tables.sql @@ -0,0 +1,98 @@ +echo Create table client_master(clientno char(6), name char(20) NOT NULL, address1 char(30), address2 char(30), city char(15), pincode int, state char(15), baldue float,PRIMARY KEY(clientno)); +Create table client_master(clientno char(6), name char(20) NOT NULL, address1 char(30), address2 char(30), city char(15), pincode int, state char(15), baldue float,PRIMARY KEY(clientno)); +echo Create table product_master(productno char(6), description char(15) NOT NULL,profitpercent float NOT NULL,unitmeasure char(10) NOT NULL,qtyonhand int NOT NULL,reorderlvl int NOT NULL,selprice float NOT NULL,costprice float NOT NULL, PRIMARY KEY(productno)); +Create table product_master(productno char(6), description char(15) NOT NULL,profitpercent float NOT NULL,unitmeasure char(10) NOT NULL,qtyonhand int NOT NULL,reorderlvl int NOT NULL,selprice float NOT NULL,costprice float NOT NULL, PRIMARY KEY(productno)); +echo Create table salesman_master(salesmanno char(6),salesmanname char(20) NOT NULL,address1 char(30) NOT NULL,address2 char(30),city char(20),pincode char(8),state char(20),salamt float NOT NULL,tgttoget float NOT NULL,ytdsales float NOT NULL,remarks char(30),PRIMARY KEY(salesmanno)); +Create table salesman_master(salesmanno char(6),salesmanname char(20) NOT NULL,address1 char(30) NOT NULL,address2 char(30),city char(20),pincode char(8),state char(20),salamt float NOT NULL,tgttoget float NOT NULL,ytdsales float NOT NULL,remarks char(30),PRIMARY KEY(salesmanno)); +echo Create table sales_order(orderno char(6),orderdate date,clientno char(6),delyaddr char(25),delytype char(1),billedyn char(1),salesmanno char(6),delydate date,orderstatus char(10),PRIMARY KEY(orderno),FOREIGN KEY(clientno) REFERENCES client_master(clientno),FOREIGN KEY(salesmanno) REFERENCES salesman_master(salesmanno)); +Create table sales_order(orderno char(6),orderdate date,clientno char(6),delyaddr char(25),delytype char(1),billedyn char(1),salesmanno char(6),delydate date,orderstatus char(10),PRIMARY KEY(orderno),FOREIGN KEY(clientno) REFERENCES client_master(clientno),FOREIGN KEY(salesmanno) REFERENCES salesman_master(salesmanno)); +echo Create table sales_order_details(orderno char(6),productno char(6),qtyordered int,qtydisp int,productrate float,FOREIGN KEY(orderno) REFERENCES sales_order(orderno),FOREIGN KEY(productno) REFERENCES product_master(productno)); +Create table sales_order_details(orderno char(6),productno char(6),qtyordered int,qtydisp int,productrate float,FOREIGN KEY(orderno) REFERENCES sales_order(orderno),FOREIGN KEY(productno) REFERENCES product_master(productno)); +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00001','Ivan Bayross','Mumbai',400054,'Maharastra',15000); +insert into client_master(clientno,name,city,pincode,state,baldue) values('C00001','Ivan Bayross','Mumbai',400054,'Maharastra',15000); +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00002','mamta Muzumdar','Madras',780001,'Tamil Nadu',0); +insert into client_master(clientno,name,city,pincode,state,baldue) values('C00002','mamta Muzumdar','Madras',780001,'Tamil Nadu',0); +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00003','Chhaya Bankar','Mumbai',400057,'Maharastra',5000); +insert into client_master(clientno,name,city,pincode,state,baldue) values('C00003','Chhaya Bankar','Mumbai',400057,'Maharastra',5000); +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00004','Ashwini Joshi','Bangalore',560001,'MKarnataka',0); +insert into client_master(clientno,name,city,pincode,state,baldue) values('C00004','Ashwini Joshi','Bangalore',560001,'MKarnataka',0); +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00005','Hansel Colaco','Mumbai',400060,'Maharastra',2000); +insert into client_master(clientno,name,city,pincode,state,baldue) values('C00005','Hansel Colaco','Mumbai',400060,'Maharastra',2000); +echo insert into client_master(clientno,name,city,pincode,state,baldue) values('C00006','Deepak Sharma','Mangalore',560050,'Karnatakaa',0); +insert into client_master(clientno,name,city,pincode,state,baldue) values('C00006','Deepak Sharma','Mangalore',560050,'Karnatakaa',0); +echo insert into product_master values('P00001','T-Shirts',5,'Piece',200,50,350,250); +insert into product_master values('P00001','T-Shirts',5,'Piece',200,50,350,250); +echo insert into product_master values('P03453','Shirts',6,'Piece',150,50,500,350); +insert into product_master values('P03453','Shirts',6,'Piece',150,50,500,350); +echo insert into product_master values('P06734','Cotton Jeans',5,'Piece',100,20,60,450); +insert into product_master values('P06734','Cotton Jeans',5,'Piece',100,20,60,450); +echo insert into product_master values('P07865','Jeans',5,'Piece',100,20,750,500); +insert into product_master values('P07865','Jeans',5,'Piece',100,20,750,500); +echo insert into product_master values('P07868','Trousers',2,'Piece',150,50,850,550); +insert into product_master values('P07868','Trousers',2,'Piece',150,50,850,550); +echo insert into product_master values('P07885','Pull Overs',2.5,'Piece',80,30,700,450); +insert into product_master values('P07885','Pull Overs',2.5,'Piece',80,30,700,450); +echo insert into product_master values('P07965','Denim Shirts',4,'Piece',100,40,350,250); +insert into product_master values('P07965','Denim Shirts',4,'Piece',100,40,350,250); +echo insert into product_master values('P07975','Lycra Tops',5,'Piece',70,30,300,175); +insert into product_master values('P07975','Lycra Tops',5,'Piece',70,30,300,175); +echo insert into product_master values('P08865','Skirts',5,'Piece',75,30,450,300); +insert into product_master values('P08865','Skirts',5,'Piece',75,30,450,300); +echo insert into salesman_master values('S00001','Aman','A/14','Worli','Mumbai',400002,'Maharastra',3000,100,50,'Good'); +insert into salesman_master values('S00001','Aman','A/14','Worli','Mumbai',400002,'Maharastra',3000,100,50,'Good'); +echo insert into salesman_master values('S00002','Omkar','65','Nariman','Mumbai',400001,'maharastra',3000,200,100,'Good'); +insert into salesman_master values('S00002','Omkar','65','Nariman','Mumbai',400001,'maharastra',3000,200,100,'Good'); +echo insert into salesman_master values('S00003','Raj','P-7','Banfra','Mumbai',400032,'Maharastra',3000,200,100,'Good'); +insert into salesman_master values('S00003','Raj','P-7','Banfra','Mumbai',400032,'Maharastra',3000,200,100,'Good'); +echo insert into salesman_master values('S00004','Ashish','A/5','Juhu','Bombay',400044,'Maharastra',3500,200,150,'Good'); +insert into salesman_master values('S00004','Ashish','A/5','Juhu','Bombay',400044,'Maharastra',3500,200,150,'Good'); +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19001','2002-06-12','C00001','F','N','S00001','2002-07-20','In Process'); +insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19001','2002-06-12','C00001','F','N','S00001','2002-07-20','In Process'); +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19002','2002-06-25','C00002','P','N','S00002','2002-06-27','Cancelled'); +insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19002','2002-06-25','C00002','P','N','S00002','2002-06-27','Cancelled'); +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O46865','2002-02-18','C00003','F','Y','S00003','2002-02-20','Fulfilled'); +insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O46865','2002-02-18','C00003','F','Y','S00003','2002-02-20','Fulfilled'); +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19003','2002-04-03','C00001','F','Y','S00001','2002-04-07','Fulfilled'); +insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19003','2002-04-03','C00001','F','Y','S00001','2002-04-07','Fulfilled'); +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O46866','2002-05-20','C00004','P','N','S00002','2002-05-22','Cancelled'); +insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O46866','2002-05-20','C00004','P','N','S00002','2002-05-22','Cancelled'); +echo insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19008','2002-05-24','C00005','F','N','S00004','2002-07-26','In Process'); +insert into sales_order (orderno,orderdate,clientno,delytype,billedyn,salesmanno,delydate,orderstatus) values('O19008','2002-05-24','C00005','F','N','S00004','2002-07-26','In Process'); +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19001','P00001',4,4,525); +insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19001','P00001',4,4,525); +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19001','P07965',2,1,8400); +insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19001','P07965',2,1,8400); +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19001','P07885',2,1,5250); +insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19001','P07885',2,1,5250); +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19002','P00001',10,0,525); +insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19002','P00001',10,0,525); +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P07868',3,3,3150); +insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P07868',3,3,3150); +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P07885',3,1,5250); +insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P07885',3,1,5250); +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P00001',10,10,525); +insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P00001',10,10,525); +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P03453',4,4,1050); +insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46865','P03453',4,4,1050); +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19003','P03453',2,2,1050); +insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19003','P03453',2,2,1050); +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19003','P06734',1,1,12000); +insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19003','P06734',1,1,12000); +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46866','P07965',1,0,8400); +insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46866','P07965',1,0,8400); +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46866','P07975',1,0,1050); +insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O46866','P07975',1,0,1050); +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19008','P00001',10,5,525); +insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19008','P00001',10,5,525); +echo insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19008','P07975',5,3,1050); +insert into sales_order_details(orderno,productno,qtyordered,qtydisp,productrate) values('O19008','P07975',5,3,1050); +echo select * from client_master; +select * from client_master; +echo select * from product_master; +select * from product_master; +echo select * from salesman_master; +select * from salesman_master; +echo select * from sales_order; +select * from sales_order; +echo select * from sales_order_details; +select * from sales_order_details; diff --git a/test/sql/Join/select_t1_t2_t3.sql b/test/sql/Join/select_t1_t2_t3.sql new file mode 100644 index 00000000..2fee0ada --- /dev/null +++ b/test/sql/Join/select_t1_t2_t3.sql @@ -0,0 +1,6 @@ +echo select * from t1; +select * from t1; +echo select * from t2; +select * from t2; +echo select * from t3; +select * from t3; diff --git a/test/sql/Join/selfjoin1.sql b/test/sql/Join/selfjoin1.sql new file mode 100644 index 00000000..d168b12b --- /dev/null +++ b/test/sql/Join/selfjoin1.sql @@ -0,0 +1,9 @@ +CREATE TABLE emp10(eno int,ename char(10),job char(8),mgrno int); +INSERT INTO emp10 VALUES(1,'ALLEN','SALES',4); +INSERT INTO emp10 VALUES(2,'PITTER','IT',3); +INSERT INTO emp10 VALUES(3,'JACK','MKTING',1); +INSERT INTO emp10 VALUES(4,'TOM','CLERK',1); +INSERT INTO emp10 VALUES(5,'HARRY','MANAGERi',5); +SELECT * FROM emp10; +echo SELECT emp.ename,mgr.ename FROM emp10 as emp,emp10 as mgr WHERE emp.mgrno=mgr.eno; +SELECT emp.ename,mgr.ename FROM emp10 as emp,emp10 as mgr WHERE emp.mgrno=mgr.eno; diff --git a/test/sql/Join/tablet11.sql b/test/sql/Join/tablet11.sql new file mode 100644 index 00000000..caee7c79 --- /dev/null +++ b/test/sql/Join/tablet11.sql @@ -0,0 +1,5 @@ + create table t11(f1 int,f2 char(20),f3 char(10),f4 int,f5 int); + insert into t11 values(1,'X','IT',5000,10); + insert into t11 values(2,'Y','sales',6000,20); + insert into t11 values(3,'Z','IT',7000,10); + commit; diff --git a/test/sql/Join/tablet11t12.sql b/test/sql/Join/tablet11t12.sql new file mode 100644 index 00000000..629b1293 --- /dev/null +++ b/test/sql/Join/tablet11t12.sql @@ -0,0 +1,10 @@ +create table t11(f1 int,f2 char(20),f3 char(10),f4 int,f5 int); +insert into t11 values(1,'X','IT',5000,10); +insert into t11 values(2,'Y','sales',6000,20); +insert into t11 values(3,'Z','IT',7000,10); +commit; +create table t12(f1 int,f2 char(10),f3 char(20)); +insert into t12 values(10,'IT','BBSR'); +insert into t12 values(20,'HR','CTC'); +insert into t12 values(30,'R&D','DELHI'); +commit; diff --git a/test/sql/Join/tablet11t12t13.sql b/test/sql/Join/tablet11t12t13.sql new file mode 100644 index 00000000..6bb06733 --- /dev/null +++ b/test/sql/Join/tablet11t12t13.sql @@ -0,0 +1,15 @@ +create table t11(f1 int,f2 char(20),f3 char(10),f4 int,f5 int); +insert into t11 values(1,'X','IT',5000,10); +insert into t11 values(2,'Y','sales',6000,20); +insert into t11 values(3,'Z','IT',7000,10); +commit; +create table t12(f1 int,f2 char(10),f3 char(20)); +insert into t12 values(10,'IT','BBSR'); +insert into t12 values(20,'HR','CTC'); +insert into t12 values(30,'R&D','DELHI'); +commit; +create table t13(f7 int,f8 int); +insert into t13 values(2,20); +insert into t13 values(1,50); +commit; + diff --git a/test/sql/Join/tablet11t13.sql b/test/sql/Join/tablet11t13.sql new file mode 100644 index 00000000..364d9d62 --- /dev/null +++ b/test/sql/Join/tablet11t13.sql @@ -0,0 +1,9 @@ +create table t11(f1 int,f2 char(20),f3 char(10),f4 int,f5 int); +insert into t11 values(1,'X','IT',5000,10); +insert into t11 values(2,'Y','sales',6000,20); +insert into t11 values(3,'Z','IT',7000,10); +commit; +create table t13(f7 int,f8 int); +insert into t13 values(2,20); +insert into t13 values(1,50); +commit; diff --git a/test/sql/Join/tablet12.sql b/test/sql/Join/tablet12.sql new file mode 100644 index 00000000..ab816b1e --- /dev/null +++ b/test/sql/Join/tablet12.sql @@ -0,0 +1,6 @@ +create table t12(f1 int,f2 char(10),f3 char(20)); +insert into t12 values(10,'IT','BBSR'); +insert into t12 values(20,'HR','CTC'); +insert into t12 values(30,'R&D','DELHI'); +commit; + diff --git a/test/sql/Join/tablet13.sql b/test/sql/Join/tablet13.sql new file mode 100644 index 00000000..233af0dc --- /dev/null +++ b/test/sql/Join/tablet13.sql @@ -0,0 +1,4 @@ +create table t13(f7 int,f8 int); +insert into t13 values(2,20); +insert into t13 values(1,50); +commit; diff --git a/test/sql/Join/test001.ksh b/test/sql/Join/test001.ksh new file mode 100755 index 00000000..10cd355c --- /dev/null +++ b/test/sql/Join/test001.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# Test Case +# 1. Create t1 table with 4 records in csql database. +# select t1.f1 from t1; It should be passed +# select t1.notexist from t1;It should be failed. +# + +# AUTHOR : Jitendra Lenka + +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then +REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/createt1.sql > /dev/null 2>&1 +if [ $? -ne 0 ] +then + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join1.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql > /dev/null 2>&1 + exit 2; +fi + + + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql > /dev/null 2>&1 + exit 0; + diff --git a/test/sql/Join/test002.ksh b/test/sql/Join/test002.ksh new file mode 100755 index 00000000..969d2ea8 --- /dev/null +++ b/test/sql/Join/test002.ksh @@ -0,0 +1,33 @@ +#!/bin/ksh +# Test Case +# 4. Create t1 and t2 table with 5 records each. +# select t1.f1, t2.f1, t1.f2, t2.f2 from t1,t2 +# select * from t1,t2 where t1.f1 = t2.f1 and t1.f1 >100 + +# AUTHOR : Jitendra Lenka + +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/createt1t2.sql > /dev/null 2>&1 +if [ $? -ne 0 ] +then + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join2.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2.sql > /dev/null 2>&1 + exit 2; +fi + + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2.sql > /dev/null 2>&1 + exit 0; + diff --git a/test/sql/Join/test003.ksh b/test/sql/Join/test003.ksh new file mode 100755 index 00000000..a6fbd4f0 --- /dev/null +++ b/test/sql/Join/test003.ksh @@ -0,0 +1,32 @@ +#!/bin/ksh +# Test Case +# Create t1(6 rec),t2(6 rec),t3(6 rec),t4(2 rec),t5(2 rec) table. +# Select * from t1,t2,t3,t4,t5; +# select * from t1,t2 where t1.f1>100; + +# AUTHOR : Jitendra Lenka + +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/createt1t2t3t4t5.sql > /dev/null 2>&1 +if [ $? -ne 0 ] +then + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join3.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2t3t4t5.sql > /dev/null 2>&1 + exit 1; +fi + + + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2t3t4t5.sql > /dev/null 2>&1 + exit 0; + diff --git a/test/sql/Join/test004.ksh b/test/sql/Join/test004.ksh new file mode 100755 index 00000000..bf4af9af --- /dev/null +++ b/test/sql/Join/test004.ksh @@ -0,0 +1,35 @@ +#!/bin/ksh +# Test Case +# 5. +# Testing or, and operators in join. +# Create t1,t2,t3 table with 5 records each. +# select * from t1,t2,t3 where t1.f2= t2.f2 and t1.f3 = t3.f2. +# select * from t1,t2,t3 where t1.f2= t2.f2 or t1.f3 = t3.f2. + +# AUTHOR : Jitendra Lenka + +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] + then +REL_PATH=`pwd`/sql/Join +fi + + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/createt1t2t3.sql > /dev/null 2>&1 +if [ $? -ne 0 ] +then + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join4.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2t3.sql > /dev/null 2>&1 + exit 2; +fi + + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2t3.sql > /dev/null 2>&1 +exit 0; + diff --git a/test/sql/Join/test005.ksh b/test/sql/Join/test005.ksh new file mode 100755 index 00000000..aa26e2f0 --- /dev/null +++ b/test/sql/Join/test005.ksh @@ -0,0 +1,32 @@ +#!/bin/ksh +# Test Case +# Create t1,t2,t3 table with 5 Records in each. +# select t1.f1, t2.f1, t3.f1 from t1,t2,t3 where t1.f2= t2.f2 or t1.f1 >100. + +# AUTHOR : Jitendra Lenka + +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/createt1t2t3.sql > /dev/null 2>&1 +if [ $? -ne 0 ] + then + exit 1; + fi + + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join5.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2t3.sql > /dev/null 2>&1 + exit 1; + fi + + + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2t3.sql > /dev/null 2>&1 + exit 0; + diff --git a/test/sql/Join/test006.ksh b/test/sql/Join/test006.ksh new file mode 100755 index 00000000..01717563 --- /dev/null +++ b/test/sql/Join/test006.ksh @@ -0,0 +1,33 @@ +#!/bin/ksh +# Test Case +# Create t1,t2 table with 5 records in each. +# select * from t1,t2 where t1.f1 = t2.notexist + +# AUTHOR : Jitendra Lenka + +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/createt1t2.sql > /dev/null 2>&1 +if [ $? -ne 0 ] +then + exit 1; +fi + + + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join6.sql +if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2.sql > /dev/null 2>&1 + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2.sql > /dev/null 2>&1 +exit 0; + diff --git a/test/sql/Join/test007.ksh b/test/sql/Join/test007.ksh new file mode 100755 index 00000000..7d56fcbf --- /dev/null +++ b/test/sql/Join/test007.ksh @@ -0,0 +1,36 @@ +#!/bin/ksh +# Test Case +# Create t11 table with 5 fields, and insert 3 records in it. +# (a)select * from t11 where t1.f1=2; +# (b)select * from t11 where t1.f1=t1.f1; + +# AUTHOR : Jitendra Lenka + +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/tablet11.sql > /dev/null 2>&1 +if [ $? -ne 0 ] +then + exit 1; +fi + + + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join7.sql +if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drot11.sql > /dev/null 2>&1 + exit 2; +fi + + + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt11.sql > /dev/null 2>&1 +exit 0; + diff --git a/test/sql/Join/test008.ksh b/test/sql/Join/test008.ksh new file mode 100755 index 00000000..34de37eb --- /dev/null +++ b/test/sql/Join/test008.ksh @@ -0,0 +1,40 @@ +#!/bin/ksh +# Test Case +# Create t11 table with 5 fields & t12 table with 3 fields and insert 3 records in each. +#(a)select * from t11,t12 where t11.f5=t12.f1; +#(b)select * from t11,t12 where t11.f5 > t12.f1; +#(c) select * from t11,t12 where t12.f1 <= t11.f5; +#(d)select * from t11,t12 where t12.f1 != t11.f5; +#(e)select * from t11,t12 where t12.f1 > 20; + +# AUTHOR : Jitendra Lenka + +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/tablet11t12.sql > /dev/null 2>&1 +if [ $? -ne 0 ] +then + exit 1; +fi + + + + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join8.sql +if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt11t12.sql > /dev/null 2>&1 + exit 2; +fi + + + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt11t12.sql > /dev/null 2>&1 +exit 0; + diff --git a/test/sql/Join/test009.ksh b/test/sql/Join/test009.ksh new file mode 100755 index 00000000..ffe4e2b5 --- /dev/null +++ b/test/sql/Join/test009.ksh @@ -0,0 +1,42 @@ +#!/bin/ksh +# Test Case +#Create t11 table with 5 fields f1,f2,f3,f4,f5 +#Create t13 table with 2 fields f7,f8 +#Insert 3 records in each. +#(a)select t11.f1,t11.f2,t13.f7,t13.f8 from t11,t13 where t11.f5=t13.f8; +#(b)select f1,f3,f7,f8 from t11,t13 where t11.f5=t13.f8; +#(c)select t11.f1,t11.f2,t12.f1,t12.f2 from t11,t12,t13 where t13.f8 > t11.f5; +#(d)select f1,f3,f7,f8 from t11,t13 where t13.f8 < t11.f5; +#(e)select f1,f3,f7,f8 from t11,t13 where f5 > f8; + +# AUTHOR : Jitendra Lenka + +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/tablet11t13.sql > /dev/null 2>&1 +if [ $? -ne 0 ] +then + exit 1; +fi + + + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join9.sql +if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt11t13.sql > /dev/null 2>&1 + exit 2; +fi + + + + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt11t13.sql > /dev/null 2>&1 +exit 0; + diff --git a/test/sql/Join/test010.ksh b/test/sql/Join/test010.ksh new file mode 100755 index 00000000..419c99ee --- /dev/null +++ b/test/sql/Join/test010.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# Test Case +# Create t11 table with 5 fields(f1,f2,f3,f4,f5) +# Create t12 with 3 fields(f1,f2,f3) +# Create t13 with 2 fields(f7,f8) +# Insert 3 records in each. +# (a)select * from t11,t12,t13 where t12.f1=t13.f8 and t13.f7=t11.f1; +# (b)select * from t11,t12,t13 where t12.f1=t13.f8 or t13.f7=t11.f1; + +# AUTHOR : Jitendra Lenka + +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/tablet11t12t13.sql > /dev/null 2>&1 +if [ $? -ne 0 ] +then + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join10.sql +if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt11t12t13.sql > /dev/null 2>&1 + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt11t12t13.sql > /dev/null 2>&1 +exit 0; + diff --git a/test/sql/Join/test011.ksh b/test/sql/Join/test011.ksh new file mode 100755 index 00000000..2bb0d140 --- /dev/null +++ b/test/sql/Join/test011.ksh @@ -0,0 +1,39 @@ +#!/bin/ksh +# Test Case +# Create t11 table with 5 fields(f1,f2,f3,f4,f5) +# Create t12 with 3 fields(f1,f2,f3) +# Create t13 with 2 fields(f7,f8) +# Insert 3 records in each. +# (a)select f1,f7 from t12,t11; +# (b)select t11.f1,t12.f7 from t13,t11; + +# AUTHOR : Jitendra Lenka + +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/tablet11t12t13.sql > /dev/null 2>&1 +if [ $? -ne 0 ] +then + exit 1; +fi + + + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join11.sql +if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt11t12t13.sql > /dev/null 2>&1 + exit 2; +fi + + + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt11t12t13.sql > /dev/null 2>&1 +exit 0; + diff --git a/test/sql/Join/test012.ksh b/test/sql/Join/test012.ksh new file mode 100755 index 00000000..dff34f3e --- /dev/null +++ b/test/sql/Join/test012.ksh @@ -0,0 +1,23 @@ +#!/bin/ksh +# Test Case +#create three tables as: +#create table emp(eno int,mgrno int,sal float,deptno int); +#create table dept(deptno int,dname char(10),lid int); +#create table loc(lid int,state char(10)); +#Insert valid records into the 3 tables. Insert NULL values in some of the field +#select * from emp,dept,loc where emp.deptno!=dept.deptno AND dept.lid!=loc.lid; +#select * from emp,dept,loc where NOT(emp.deptno!=dept.deptno AND dept.lid!=loc.lid); +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join31.sql +if [ $? -ne 0 ] +then + exit 1; +fi diff --git a/test/sql/Join/test013.ksh b/test/sql/Join/test013.ksh new file mode 100755 index 00000000..03a16e02 --- /dev/null +++ b/test/sql/Join/test013.ksh @@ -0,0 +1,33 @@ +#!/bin/ksh +#Testing IN operator in Join +#create table emp(eno int,dno int); +#create table dept(deptno int,dname char(10)); +#insert some records into both the tables. +#Test the following Select statements using join and in operator and check the retrieved data are proper or not +#select * from emp,dept where emp.dno in(20,30); +#select * from emp,dept where dept.deptno in(20,30); +#select * from emp,dept where emp.dno in(20,30) and dept.deptno in(20,30); +#select * from emp,dept where emp.dno in(20,30) or dept.deptno in(20,30); +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join32.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join_in.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_emp_dept.sql +if [ $? -ne 0 ] +then + exit 1; +fi diff --git a/test/sql/Join/test014.ksh b/test/sql/Join/test014.ksh new file mode 100755 index 00000000..00024701 --- /dev/null +++ b/test/sql/Join/test014.ksh @@ -0,0 +1,33 @@ +#!/bin/ksh +#Testing BETWEEN operator in Join +#create table emp(eno int,dno int); +#create table dept(deptno int,dname char(10)); +#insert some records into both the tables. +#Test the following Select statements using join and BETWEEN operator and check the retrieved data are proper or not +#select * from emp,dept where emp.dno between 10 and 30; +#select * from emp,dept where dept.deptno between 20 and 40; +#select * from emp,dept where emp.dno between 15 and 30 and dept.deptno between 20 and 40; +#select * from emp,dept where emp.dno between 15 and 30 or dept.deptno between 20 and 40; +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join32.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join_between.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_emp_dept.sql +if [ $? -ne 0 ] +then + exit 1; +fi diff --git a/test/sql/Join/test015.ksh b/test/sql/Join/test015.ksh new file mode 100755 index 00000000..3d81f71e --- /dev/null +++ b/test/sql/Join/test015.ksh @@ -0,0 +1,33 @@ +#!/bin/ksh +#Testing LIKE operator in Join +#create table emp(eno int,ename char(10),dno int); +#create table dept(deptno int,dname char(10)); +#insert some records into both the tables. +#Test the following Select statements using join and BETWEEN operator and check the retrieved data are proper or not +#select * from emp,dept where emp.ename LIKE 'K%'; +#select * from emp,dept where dept.dname LIKE 'S%'; +#select * from emp,dept where emp.ename LIKE 'K%' and dept.dname LIKE 'S%'; +#select * from emp,dept where emp.ename LIKE 'K%' or dept.dname LIKE 'S%'; +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join33.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join_like.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_emp_dept.sql +if [ $? -ne 0 ] +then + exit 1; +fi diff --git a/test/sql/Join/test016.ksh b/test/sql/Join/test016.ksh new file mode 100755 index 00000000..132579dc --- /dev/null +++ b/test/sql/Join/test016.ksh @@ -0,0 +1,30 @@ +#!/bin/ksh +# Testing LIKE operator in Join +#create table emp(eno int,ename char(10),dno int); +#create table dept(deptno int,dname char(10),lid int); +#Insert some records into both the tables. +#Test the following Select statements using join and BETWEEN operator and check the retrieved data are proper or not +# select * from emp where emp.deptno in (20,30,40); here emp.deptno is non existing field. +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join34.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join_in_notexist.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_emp_dept.sql +if [ $? -ne 0 ] +then + exit 1; +fi diff --git a/test/sql/Join/test017.ksh b/test/sql/Join/test017.ksh new file mode 100755 index 00000000..f5d6b8cb --- /dev/null +++ b/test/sql/Join/test017.ksh @@ -0,0 +1,25 @@ +#!/bin/ksh + +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join34.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join_between_notexist.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_emp_dept.sql +if [ $? -ne 0 ] +then + exit 1; +fi diff --git a/test/sql/Join/test018.ksh b/test/sql/Join/test018.ksh new file mode 100755 index 00000000..3a9bbd72 --- /dev/null +++ b/test/sql/Join/test018.ksh @@ -0,0 +1,32 @@ +#!/bin/ksh + +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join34.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join_like_notexist1.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_emp_dept.sql + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join_like_notexist2.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_emp_dept.sql + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_emp_dept.sql +if [ $? -ne 0 ] +then + exit 1; +fi diff --git a/test/sql/Join/test019.ksh b/test/sql/Join/test019.ksh new file mode 100755 index 00000000..7ec8618a --- /dev/null +++ b/test/sql/Join/test019.ksh @@ -0,0 +1,24 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join35.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2.sql +if [ $? -ne 0 ] +then + exit 3; +fi diff --git a/test/sql/Join/test020.ksh b/test/sql/Join/test020.ksh new file mode 100755 index 00000000..2506ba3c --- /dev/null +++ b/test/sql/Join/test020.ksh @@ -0,0 +1,29 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/hashonboth.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join35.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2.sql +if [ $? -ne 0 ] +then + exit 4; +fi diff --git a/test/sql/Join/test021.ksh b/test/sql/Join/test021.ksh new file mode 100755 index 00000000..e13847cb --- /dev/null +++ b/test/sql/Join/test021.ksh @@ -0,0 +1,29 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/treeonboth.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join35.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2.sql +if [ $? -ne 0 ] +then + exit 4; +fi diff --git a/test/sql/Join/test022.ksh b/test/sql/Join/test022.ksh new file mode 100755 index 00000000..c78123b0 --- /dev/null +++ b/test/sql/Join/test022.ksh @@ -0,0 +1,29 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/hashtreeonboth.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join35.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2.sql +if [ $? -ne 0 ] +then + exit 4; +fi diff --git a/test/sql/Join/test023.ksh b/test/sql/Join/test023.ksh new file mode 100755 index 00000000..2c18b4a7 --- /dev/null +++ b/test/sql/Join/test023.ksh @@ -0,0 +1,29 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/treehashonboth.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join35.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2.sql +if [ $? -ne 0 ] +then + exit 4; +fi diff --git a/test/sql/Join/test024.ksh b/test/sql/Join/test024.ksh new file mode 100755 index 00000000..9d228121 --- /dev/null +++ b/test/sql/Join/test024.ksh @@ -0,0 +1,29 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/hashon_t1f2_t2f2.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join35.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2.sql +if [ $? -ne 0 ] +then + exit 4; +fi diff --git a/test/sql/Join/test025.ksh b/test/sql/Join/test025.ksh new file mode 100755 index 00000000..373c7db0 --- /dev/null +++ b/test/sql/Join/test025.ksh @@ -0,0 +1,29 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/treeon_t1f2_t2f2.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join35.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2.sql +if [ $? -ne 0 ] +then + exit 4; +fi diff --git a/test/sql/Join/test026.ksh b/test/sql/Join/test026.ksh new file mode 100755 index 00000000..da1f4f82 --- /dev/null +++ b/test/sql/Join/test026.ksh @@ -0,0 +1,29 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/hashtree_mix1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join35.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2.sql +if [ $? -ne 0 ] +then + exit 4; +fi diff --git a/test/sql/Join/test027.ksh b/test/sql/Join/test027.ksh new file mode 100755 index 00000000..f806df1e --- /dev/null +++ b/test/sql/Join/test027.ksh @@ -0,0 +1,29 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/hashtree_mix2.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join35.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2.sql +if [ $? -ne 0 ] +then + exit 4; +fi diff --git a/test/sql/Join/test028.ksh b/test/sql/Join/test028.ksh new file mode 100755 index 00000000..1a63b315 --- /dev/null +++ b/test/sql/Join/test028.ksh @@ -0,0 +1,29 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/crosjoin_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi diff --git a/test/sql/Join/test029.ksh b/test/sql/Join/test029.ksh new file mode 100755 index 00000000..f0db3078 --- /dev/null +++ b/test/sql/Join/test029.ksh @@ -0,0 +1,29 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/equijoin_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi diff --git a/test/sql/Join/test030.ksh b/test/sql/Join/test030.ksh new file mode 100755 index 00000000..963c1ba7 --- /dev/null +++ b/test/sql/Join/test030.ksh @@ -0,0 +1,29 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/equijoin1_with_and_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi diff --git a/test/sql/Join/test031.ksh b/test/sql/Join/test031.ksh new file mode 100755 index 00000000..2bbaaa7f --- /dev/null +++ b/test/sql/Join/test031.ksh @@ -0,0 +1,29 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/equijoin2_with_and_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi diff --git a/test/sql/Join/test032.ksh b/test/sql/Join/test032.ksh new file mode 100755 index 00000000..6eb43919 --- /dev/null +++ b/test/sql/Join/test032.ksh @@ -0,0 +1,29 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/equijoin3_with_and_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi diff --git a/test/sql/Join/test033.ksh b/test/sql/Join/test033.ksh new file mode 100755 index 00000000..a979db07 --- /dev/null +++ b/test/sql/Join/test033.ksh @@ -0,0 +1,29 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/equijoin4_with_and_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi diff --git a/test/sql/Join/test034.ksh b/test/sql/Join/test034.ksh new file mode 100755 index 00000000..7cf87a12 --- /dev/null +++ b/test/sql/Join/test034.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/hashon_t1f1_t2f1_t3f1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/crosjoin_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 5; +fi diff --git a/test/sql/Join/test035.ksh b/test/sql/Join/test035.ksh new file mode 100755 index 00000000..d8447d0d --- /dev/null +++ b/test/sql/Join/test035.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/hashon_t1f1_t2f1_t3f1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/equijoin_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 5; +fi diff --git a/test/sql/Join/test036.ksh b/test/sql/Join/test036.ksh new file mode 100755 index 00000000..79e6fc04 --- /dev/null +++ b/test/sql/Join/test036.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/hashon_t1f1_t2f1_t3f1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/equijoin1_with_and_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 5; +fi diff --git a/test/sql/Join/test037.ksh b/test/sql/Join/test037.ksh new file mode 100755 index 00000000..e64c29f0 --- /dev/null +++ b/test/sql/Join/test037.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/hashon_t1f1_t2f1_t3f1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/equijoin2_with_and_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 5; +fi diff --git a/test/sql/Join/test038.ksh b/test/sql/Join/test038.ksh new file mode 100755 index 00000000..75254386 --- /dev/null +++ b/test/sql/Join/test038.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/hashon_t1f1_t2f1_t3f1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/equijoin3_with_and_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 5; +fi diff --git a/test/sql/Join/test039.ksh b/test/sql/Join/test039.ksh new file mode 100755 index 00000000..be1c2fc4 --- /dev/null +++ b/test/sql/Join/test039.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/hashon_t1f1_t2f1_t3f1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/equijoin4_with_and_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 5; +fi diff --git a/test/sql/Join/test040.ksh b/test/sql/Join/test040.ksh new file mode 100755 index 00000000..08f9d628 --- /dev/null +++ b/test/sql/Join/test040.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/treeon_t1f1_t2f1_t3f1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/crosjoin_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 5; +fi diff --git a/test/sql/Join/test041.ksh b/test/sql/Join/test041.ksh new file mode 100755 index 00000000..b314ba45 --- /dev/null +++ b/test/sql/Join/test041.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/treeon_t1f1_t2f1_t3f1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/equijoin_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 5; +fi diff --git a/test/sql/Join/test042.ksh b/test/sql/Join/test042.ksh new file mode 100755 index 00000000..d4d5387c --- /dev/null +++ b/test/sql/Join/test042.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/treeon_t1f1_t2f1_t3f1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/equijoin1_with_and_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 5; +fi diff --git a/test/sql/Join/test043.ksh b/test/sql/Join/test043.ksh new file mode 100755 index 00000000..72bf3a76 --- /dev/null +++ b/test/sql/Join/test043.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/treeon_t1f1_t2f1_t3f1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/equijoin2_with_and_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 5; +fi diff --git a/test/sql/Join/test044.ksh b/test/sql/Join/test044.ksh new file mode 100755 index 00000000..bf42358a --- /dev/null +++ b/test/sql/Join/test044.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/treeon_t1f1_t2f1_t3f1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/equijoin3_with_and_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 5; +fi diff --git a/test/sql/Join/test045.ksh b/test/sql/Join/test045.ksh new file mode 100755 index 00000000..4a89e051 --- /dev/null +++ b/test/sql/Join/test045.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/treeon_t1f1_t2f1_t3f1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/equijoin4_with_and_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 5; +fi diff --git a/test/sql/Join/test046.ksh b/test/sql/Join/test046.ksh new file mode 100755 index 00000000..3acc1e48 --- /dev/null +++ b/test/sql/Join/test046.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/hash_t1f1_tree_t2f1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/crosjoin_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 5; +fi diff --git a/test/sql/Join/test047.ksh b/test/sql/Join/test047.ksh new file mode 100755 index 00000000..4432d7ab --- /dev/null +++ b/test/sql/Join/test047.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/hash_t1f1_tree_t2f1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/equijoin_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 5; +fi diff --git a/test/sql/Join/test048.ksh b/test/sql/Join/test048.ksh new file mode 100755 index 00000000..0fc77f10 --- /dev/null +++ b/test/sql/Join/test048.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/hash_t1f1_tree_t2f1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/equijoin1_with_and_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 5; +fi diff --git a/test/sql/Join/test049.ksh b/test/sql/Join/test049.ksh new file mode 100755 index 00000000..81634f36 --- /dev/null +++ b/test/sql/Join/test049.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/hash_t1f1_tree_t2f1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/equijoin2_with_and_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 5; +fi diff --git a/test/sql/Join/test050.ksh b/test/sql/Join/test050.ksh new file mode 100755 index 00000000..2841ed92 --- /dev/null +++ b/test/sql/Join/test050.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/hash_t1f1_tree_t2f1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/equijoin3_with_and_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 5; +fi diff --git a/test/sql/Join/test051.ksh b/test/sql/Join/test051.ksh new file mode 100755 index 00000000..763f67cb --- /dev/null +++ b/test/sql/Join/test051.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/hash_t1f1_tree_t2f1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/equijoin4_with_and_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 5; +fi diff --git a/test/sql/Join/test052.ksh b/test/sql/Join/test052.ksh new file mode 100755 index 00000000..e28dbaef --- /dev/null +++ b/test/sql/Join/test052.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/tree_t1f1_hash_t2f1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/crosjoin_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 5; +fi diff --git a/test/sql/Join/test053.ksh b/test/sql/Join/test053.ksh new file mode 100755 index 00000000..f885e53c --- /dev/null +++ b/test/sql/Join/test053.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/tree_t1f1_hash_t2f1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/equijoin_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 5; +fi diff --git a/test/sql/Join/test054.ksh b/test/sql/Join/test054.ksh new file mode 100755 index 00000000..989745c6 --- /dev/null +++ b/test/sql/Join/test054.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/tree_t1f1_hash_t2f1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/equijoin1_with_and_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 5; +fi diff --git a/test/sql/Join/test055.ksh b/test/sql/Join/test055.ksh new file mode 100755 index 00000000..88d70467 --- /dev/null +++ b/test/sql/Join/test055.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/tree_t1f1_hash_t2f1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/equijoin2_with_and_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 5; +fi diff --git a/test/sql/Join/test056.ksh b/test/sql/Join/test056.ksh new file mode 100755 index 00000000..f60d9464 --- /dev/null +++ b/test/sql/Join/test056.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/tree_t1f1_hash_t2f1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/equijoin3_with_and_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 5; +fi diff --git a/test/sql/Join/test057.ksh b/test/sql/Join/test057.ksh new file mode 100755 index 00000000..14b2cb17 --- /dev/null +++ b/test/sql/Join/test057.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/tree_t1f1_hash_t2f1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/equijoin4_with_and_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 5; +fi diff --git a/test/sql/Join/test058.ksh b/test/sql/Join/test058.ksh new file mode 100755 index 00000000..640d7c97 --- /dev/null +++ b/test/sql/Join/test058.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/hashon_t1f1_t2f1_t3f1_treeon_t1f2_t2f1_t3f1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/crosjoin_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 5; +fi diff --git a/test/sql/Join/test059.ksh b/test/sql/Join/test059.ksh new file mode 100755 index 00000000..ad134ab3 --- /dev/null +++ b/test/sql/Join/test059.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/hashon_t1f1_t2f1_t3f1_treeon_t1f2_t2f1_t3f1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/equijoin_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 5; +fi diff --git a/test/sql/Join/test060.ksh b/test/sql/Join/test060.ksh new file mode 100755 index 00000000..ab73fa8d --- /dev/null +++ b/test/sql/Join/test060.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/hashon_t1f1_t2f1_t3f1_treeon_t1f2_t2f1_t3f1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/equijoin1_with_and_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 5; +fi diff --git a/test/sql/Join/test061.ksh b/test/sql/Join/test061.ksh new file mode 100755 index 00000000..656f54f0 --- /dev/null +++ b/test/sql/Join/test061.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/hashon_t1f1_t2f1_t3f1_treeon_t1f2_t2f1_t3f1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/equijoin2_with_and_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 5; +fi diff --git a/test/sql/Join/test062.ksh b/test/sql/Join/test062.ksh new file mode 100755 index 00000000..860f0880 --- /dev/null +++ b/test/sql/Join/test062.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/hashon_t1f1_t2f1_t3f1_treeon_t1f2_t2f1_t3f1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/equijoin3_with_and_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 5; +fi diff --git a/test/sql/Join/test063.ksh b/test/sql/Join/test063.ksh new file mode 100755 index 00000000..4cb9a5e5 --- /dev/null +++ b/test/sql/Join/test063.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/hashon_t1f1_t2f1_t3f1_treeon_t1f2_t2f1_t3f1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/equijoin4_with_and_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 5; +fi diff --git a/test/sql/Join/test064.ksh b/test/sql/Join/test064.ksh new file mode 100755 index 00000000..c10cc9a9 --- /dev/null +++ b/test/sql/Join/test064.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/treeon_t1f1_t2f1_t3f1_hashon_t1f2_t2f1_t3f1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/crosjoin_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 5; +fi diff --git a/test/sql/Join/test065.ksh b/test/sql/Join/test065.ksh new file mode 100755 index 00000000..841efcd3 --- /dev/null +++ b/test/sql/Join/test065.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/treeon_t1f1_t2f1_t3f1_hashon_t1f2_t2f1_t3f1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/equijoin_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 5; +fi diff --git a/test/sql/Join/test066.ksh b/test/sql/Join/test066.ksh new file mode 100755 index 00000000..03923c6c --- /dev/null +++ b/test/sql/Join/test066.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/treeon_t1f1_t2f1_t3f1_hashon_t1f2_t2f1_t3f1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/equijoin1_with_and_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 5; +fi diff --git a/test/sql/Join/test067.ksh b/test/sql/Join/test067.ksh new file mode 100755 index 00000000..4b980888 --- /dev/null +++ b/test/sql/Join/test067.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/treeon_t1f1_t2f1_t3f1_hashon_t1f2_t2f1_t3f1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/equijoin2_with_and_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 5; +fi diff --git a/test/sql/Join/test068.ksh b/test/sql/Join/test068.ksh new file mode 100755 index 00000000..d5c3366c --- /dev/null +++ b/test/sql/Join/test068.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/treeon_t1f1_t2f1_t3f1_hashon_t1f2_t2f1_t3f1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/equijoin3_with_and_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 5; +fi diff --git a/test/sql/Join/test069.ksh b/test/sql/Join/test069.ksh new file mode 100755 index 00000000..9954ecfc --- /dev/null +++ b/test/sql/Join/test069.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/noindex_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/treeon_t1f1_t2f1_t3f1_hashon_t1f2_t2f1_t3f1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/equijoin4_with_and_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 4; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 5; +fi diff --git a/test/sql/Join/test070.ksh b/test/sql/Join/test070.ksh new file mode 100755 index 00000000..d02247e4 --- /dev/null +++ b/test/sql/Join/test070.ksh @@ -0,0 +1,29 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/composite1.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join36.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2.sql +if [ $? -ne 0 ] +then + exit 3; +fi diff --git a/test/sql/Join/test071.ksh b/test/sql/Join/test071.ksh new file mode 100755 index 00000000..9936e968 --- /dev/null +++ b/test/sql/Join/test071.ksh @@ -0,0 +1,29 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/composite2.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join36.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2.sql +if [ $? -ne 0 ] +then + exit 3; +fi diff --git a/test/sql/Join/test072.ksh b/test/sql/Join/test072.ksh new file mode 100755 index 00000000..035ed78c --- /dev/null +++ b/test/sql/Join/test072.ksh @@ -0,0 +1,29 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/composite3.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join36.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2.sql +if [ $? -ne 0 ] +then + exit 3; +fi diff --git a/test/sql/Join/test073.ksh b/test/sql/Join/test073.ksh new file mode 100755 index 00000000..599ea5ee --- /dev/null +++ b/test/sql/Join/test073.ksh @@ -0,0 +1,29 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/composite4.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join36.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2.sql +if [ $? -ne 0 ] +then + exit 3; +fi diff --git a/test/sql/Join/test074.ksh b/test/sql/Join/test074.ksh new file mode 100755 index 00000000..45227a63 --- /dev/null +++ b/test/sql/Join/test074.ksh @@ -0,0 +1,29 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/composite5.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join36.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2.sql +if [ $? -ne 0 ] +then + exit 3; +fi diff --git a/test/sql/Join/test075.ksh b/test/sql/Join/test075.ksh new file mode 100755 index 00000000..cee6c545 --- /dev/null +++ b/test/sql/Join/test075.ksh @@ -0,0 +1,29 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/composite6.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join36.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2.sql +if [ $? -ne 0 ] +then + exit 3; +fi diff --git a/test/sql/Join/test076.ksh b/test/sql/Join/test076.ksh new file mode 100755 index 00000000..d5b987ff --- /dev/null +++ b/test/sql/Join/test076.ksh @@ -0,0 +1,29 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/composite7.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join36.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2.sql +if [ $? -ne 0 ] +then + exit 3; +fi diff --git a/test/sql/Join/test077.ksh b/test/sql/Join/test077.ksh new file mode 100755 index 00000000..1653ed9e --- /dev/null +++ b/test/sql/Join/test077.ksh @@ -0,0 +1,29 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/composite8.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join36.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2.sql +if [ $? -ne 0 ] +then + exit 3; +fi diff --git a/test/sql/Join/test078.ksh b/test/sql/Join/test078.ksh new file mode 100755 index 00000000..e494020e --- /dev/null +++ b/test/sql/Join/test078.ksh @@ -0,0 +1,29 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/composite9.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join36.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2.sql +if [ $? -ne 0 ] +then + exit 3; +fi diff --git a/test/sql/Join/test079.ksh b/test/sql/Join/test079.ksh new file mode 100755 index 00000000..b73fff5a --- /dev/null +++ b/test/sql/Join/test079.ksh @@ -0,0 +1,29 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/composite10.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join36.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2.sql +if [ $? -ne 0 ] +then + exit 3; +fi diff --git a/test/sql/Join/test080.ksh b/test/sql/Join/test080.ksh new file mode 100755 index 00000000..64802479 --- /dev/null +++ b/test/sql/Join/test080.ksh @@ -0,0 +1,29 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/composite11.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join36.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2.sql +if [ $? -ne 0 ] +then + exit 3; +fi diff --git a/test/sql/Join/test081.ksh b/test/sql/Join/test081.ksh new file mode 100755 index 00000000..72b9d02b --- /dev/null +++ b/test/sql/Join/test081.ksh @@ -0,0 +1,29 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/composite12.sql +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert_t1_t2.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join36.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2.sql +if [ $? -ne 0 ] +then + exit 3; +fi diff --git a/test/sql/Join/test082.ksh b/test/sql/Join/test082.ksh new file mode 100755 index 00000000..8728e636 --- /dev/null +++ b/test/sql/Join/test082.ksh @@ -0,0 +1,23 @@ +#!/bin/ksh +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/nulltest1.sql +if [ $? -ne 0 ] +then + exit 2; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join36.sql +if [ $? -ne 0 ] +then + exit 3; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop_t1_t2.sql +if [ $? -ne 0 ] +then + exit 3; +fi diff --git a/test/sql/Join/test083.ksh b/test/sql/Join/test083.ksh new file mode 100755 index 00000000..378978e5 --- /dev/null +++ b/test/sql/Join/test083.ksh @@ -0,0 +1,31 @@ +#!/bin/ksh +# Testing Inner Join on two tables with All Datatypes. +# +CREATEFILE=${PWD}/sql/Join/dropt1t2.sql +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/alldatatype.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/inner_t1_t2.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Join/test084.ksh b/test/sql/Join/test084.ksh new file mode 100755 index 00000000..076bb424 --- /dev/null +++ b/test/sql/Join/test084.ksh @@ -0,0 +1,31 @@ +#!/bin/ksh +# Testing Inner Join on three tables with All Datatypes. +# +CREATEFILE=${PWD}/sql/Join/dropt1t2.sql +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/alldatatype.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/inner_t1_t2_t3.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Join/test085.ksh b/test/sql/Join/test085.ksh new file mode 100755 index 00000000..a503dab7 --- /dev/null +++ b/test/sql/Join/test085.ksh @@ -0,0 +1,32 @@ +#!/bin/ksh +# Testing Left Join on three tables with All Datatypes. +# select t1.f1, t1.f2, t2.f1, t2.f2, t3.f1, t3.f2 from t1 inner join t2 on t1.f1 = t2.f1 inner join t3 on t2.f1 = t3.f1 inner join t1 on t3.f1 = t1.f1; +# +CREATEFILE=${PWD}/sql/Join/dropt1t2.sql +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/alldatatype.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/inner_t1_t2_t3_t1.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Join/test086.ksh b/test/sql/Join/test086.ksh new file mode 100755 index 00000000..f03dfc1d --- /dev/null +++ b/test/sql/Join/test086.ksh @@ -0,0 +1,31 @@ +#!/bin/ksh +# Testing inner Join on two tables using IN, BETWEEN and LIKE operators with All Datatypes. +# +CREATEFILE=${PWD}/sql/Join/drop_t1_t2_t3.sql +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/alldatatype.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/innerjoin_in_between_like.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Join/test130.ksh b/test/sql/Join/test130.ksh new file mode 100755 index 00000000..b189fb60 --- /dev/null +++ b/test/sql/Join/test130.ksh @@ -0,0 +1,27 @@ +#!/bin/ksh +# Testing self join +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi +echo "drop table emp10;" > ${REL_PATH}/dropp_emp10.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/selfjoin1.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropp_emp10.sql + rm -f ${REL_PATH}/dropp_t1.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropp_emp10.sql +if [ $? -ne 0 ] +then + rm -f ${REL_PATH}/dropp_emp10.sql + exit 3; +fi +rm -f ${REL_PATH}/dropp_emp10.sql +exit 0; diff --git a/test/sql/Join/test131.ksh b/test/sql/Join/test131.ksh new file mode 100755 index 00000000..4a6cc34c --- /dev/null +++ b/test/sql/Join/test131.ksh @@ -0,0 +1,29 @@ +#!/bin/ksh +# Testing Join on 5 sales tables. +# Create 5 tables like client_master,product_master,salesman_master,sales_order,sales_order_details. +# populate the above tables with required values. +# List the products which have been sold to 'Ivan Bayross' +# +QUITFILE=${PWD}/sql/Join/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/sql/Join +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/sales_tables.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/sales_table_drop.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/sales_join.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/sales_table_drop.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/sales_table_drop.sql +exit 0; diff --git a/test/sql/Join/tree_t1f1_hash_t2f1.sql b/test/sql/Join/tree_t1f1_hash_t2f1.sql new file mode 100644 index 00000000..eebcdf56 --- /dev/null +++ b/test/sql/Join/tree_t1f1_hash_t2f1.sql @@ -0,0 +1,4 @@ +echo create index idx1 on t1(f1) tree; +create index idx1 on t1(f1) tree; +echo create index idx2 on t2(f1) hash; +create index idx2 on t2(f1) hash; diff --git a/test/sql/Join/treehashonboth.sql b/test/sql/Join/treehashonboth.sql new file mode 100644 index 00000000..90b5ca28 --- /dev/null +++ b/test/sql/Join/treehashonboth.sql @@ -0,0 +1,4 @@ +create index idx1 on t1(f1) tree; +create index idx2 on t2(f1) tree; +create index idx3 on t1(f2) hash; +create index idx4 on t2(f2) hash; diff --git a/test/sql/Join/treeon_t1f1_t2f1_t3f1.sql b/test/sql/Join/treeon_t1f1_t2f1_t3f1.sql new file mode 100644 index 00000000..0b458ca3 --- /dev/null +++ b/test/sql/Join/treeon_t1f1_t2f1_t3f1.sql @@ -0,0 +1,7 @@ +echo create index idx1 on t1(f1) tree; +create index idx1 on t1(f1) tree; +echo create index idx2 on t2(f1) tree; +create index idx2 on t2(f1) tree; +echo create index idx3 on t3(f1) tree; +create index idx3 on t3(f1) tree; + diff --git a/test/sql/Join/treeon_t1f1_t2f1_t3f1_hashon_t1f2_t2f1_t3f1.sql b/test/sql/Join/treeon_t1f1_t2f1_t3f1_hashon_t1f2_t2f1_t3f1.sql new file mode 100644 index 00000000..feac02fc --- /dev/null +++ b/test/sql/Join/treeon_t1f1_t2f1_t3f1_hashon_t1f2_t2f1_t3f1.sql @@ -0,0 +1,12 @@ +echo create index idx1 on t1(f1) tree; +create index idx1 on t1(f1) tree; +echo create index idx2 on t2(f1) tree; +create index idx2 on t2(f1) tree; +echo create index idx3 on t3(f1) tree; +create index idx3 on t3(f1) tree; +echo create index idx4 on t1(f2) hash; +create index idx4 on t1(f2) hash; +echo create index idx5 on t2(f2) hash; +create index idx5 on t2(f2) hash; +echo create index idx6 on t3(f2) hash; +create index idx6 on t3(f2) hash; diff --git a/test/sql/Join/treeon_t1f2_t2f2.sql b/test/sql/Join/treeon_t1f2_t2f2.sql new file mode 100644 index 00000000..18f9b55a --- /dev/null +++ b/test/sql/Join/treeon_t1f2_t2f2.sql @@ -0,0 +1,2 @@ +create index idx1 on t1(f2) tree; +create index idx2 on t2(f2) tree; diff --git a/test/sql/Join/treeonboth.sql b/test/sql/Join/treeonboth.sql new file mode 100644 index 00000000..2e8e3f14 --- /dev/null +++ b/test/sql/Join/treeonboth.sql @@ -0,0 +1,4 @@ +create index idx1 on t1(f1) tree; +create index idx2 on t1(f2) tree; +create index idx3 on t2(f1) tree; +create index idx4 on t2(f2) tree; diff --git a/test/sql/Limit/TODO b/test/sql/Limit/TODO new file mode 100644 index 00000000..e02695f6 --- /dev/null +++ b/test/sql/Limit/TODO @@ -0,0 +1,30 @@ +1.create a table + Insert 10 records + test limit and offset conditionally + test limit and offset field wise applying condition. + test limit and offset field wise on multiple conditions using or,and. + test limit and offset field wise on in operator. + test limit and offset field wise on between operator. + test limit and offset field wise on like operator. + +2.create three tables emp,dept and loc + Join the three tables in different combination apply limit on them. + +3. Create emp table with id int,name char(20),job char(10),salary double,doj date, deptno int,mgrno int +a) Apply self join and limit on emp. + +4. create table t1, t2 , t3 + take 5-6 field in each + Apply join on aggregate fields the apply limit on them. + +4. create table t1, t2 , t3 + take 5-6 field in each + Apply join on aggregate fields the apply limit on them. + +4. create table t1, t2 , t3 + take 5-6 field in each + Apply join on aggregate fields the apply limit on them. + +5. new case wwill be written according to Ivan Bayross page-426 no:2(d),(e) (by Nihar) + + diff --git a/test/sql/Limit/drop2.sql b/test/sql/Limit/drop2.sql new file mode 100644 index 00000000..969f0bf5 --- /dev/null +++ b/test/sql/Limit/drop2.sql @@ -0,0 +1,2 @@ +DROP TABLE t1; +DROP TABLE t2; diff --git a/test/sql/Limit/dropt1.sql b/test/sql/Limit/dropt1.sql new file mode 100644 index 00000000..2d707d46 --- /dev/null +++ b/test/sql/Limit/dropt1.sql @@ -0,0 +1,2 @@ +drop table t1; + diff --git a/test/sql/Limit/exp.test001.ksh b/test/sql/Limit/exp.test001.ksh new file mode 100644 index 00000000..3d3eb1bc --- /dev/null +++ b/test/sql/Limit/exp.test001.ksh @@ -0,0 +1,94 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 95 1 + 96 2 + 97 2 + 98 2 + 99 2 + 100 3 + 101 4 + 102 5 + 103 5 + 104 5 + +echo select * from t1 limit 1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 95 1 + +echo select * from t1 limit 3; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 95 1 + 96 2 + 97 2 + +echo select * from t1 limit 20; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 95 1 + 96 2 + 97 2 + 98 2 + 99 2 + 100 3 + 101 4 + 102 5 + 103 5 + 104 5 + +echo select * from t1 limit 1 offset 0; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 95 1 + +echo select * from t1 limit 1 offset 1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 96 2 + +echo select * from t1 limit 1 offset 5; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 100 3 + +echo select * from t1 limit 1 offset 15; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + +echo select * from t1 limit 5 offset 5; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 100 3 + 101 4 + 102 5 + 103 5 + 104 5 + +echo select * from t1 limit 15 offset 15; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + +Statement Executed diff --git a/test/sql/Limit/exp.test002.ksh b/test/sql/Limit/exp.test002.ksh new file mode 100644 index 00000000..ee4e9242 --- /dev/null +++ b/test/sql/Limit/exp.test002.ksh @@ -0,0 +1,143 @@ +echo CREATE TABLE t1(f1 int, f2 char(10), f3 date); +Statement Executed +echo CREATE TABLE t2(f1 int, f2 char(10), f3 date); +Statement Executed +echo INSERT INTO t1 VALUES(1, 'ABCD', '2009-08-01'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(3, 'BCDA', '2009-08-02'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(5, 'CDBA', '2009-08-03'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(9, 'DCBA', '2009-08-09'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(7, 'ACBD', '2009-08-07'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t2 VALUES(2, 'PQRS', '2009-08-02'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t2 VALUES(3, 'TUVW', '2009-08-03'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t2 VALUES(4, 'EFGH', '2009-08-04'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t2 VALUES(5, 'IJKL', '2009-08-07'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t2 VALUES(6, 'MNOP', '2009-08-08'); +Statement Executed: Rows Affected = 1 +echo SELECT * FROM t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 +--------------------------------------------------------- + 1 ABCD 2009/8/1 + 3 BCDA 2009/8/2 + 5 CDBA 2009/8/3 + 9 DCBA 2009/8/9 + 7 ACBD 2009/8/7 + +echo SELECT * FROM t2; +--------------------------------------------------------- + t2.f1 t2.f2 t2.f3 +--------------------------------------------------------- + 2 PQRS 2009/8/2 + 3 TUVW 2009/8/3 + 4 EFGH 2009/8/4 + 5 IJKL 2009/8/7 + 6 MNOP 2009/8/8 + +echo SELECT * FROM t1,t2; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t2.f1 t2.f2 t2.f3 +--------------------------------------------------------- + 1 ABCD 2009/8/1 2 PQRS 2009/8/2 + 1 ABCD 2009/8/1 3 TUVW 2009/8/3 + 1 ABCD 2009/8/1 4 EFGH 2009/8/4 + 1 ABCD 2009/8/1 5 IJKL 2009/8/7 + 1 ABCD 2009/8/1 6 MNOP 2009/8/8 + 3 BCDA 2009/8/2 2 PQRS 2009/8/2 + 3 BCDA 2009/8/2 3 TUVW 2009/8/3 + 3 BCDA 2009/8/2 4 EFGH 2009/8/4 + 3 BCDA 2009/8/2 5 IJKL 2009/8/7 + 3 BCDA 2009/8/2 6 MNOP 2009/8/8 + 5 CDBA 2009/8/3 2 PQRS 2009/8/2 + 5 CDBA 2009/8/3 3 TUVW 2009/8/3 + 5 CDBA 2009/8/3 4 EFGH 2009/8/4 + 5 CDBA 2009/8/3 5 IJKL 2009/8/7 + 5 CDBA 2009/8/3 6 MNOP 2009/8/8 + 9 DCBA 2009/8/9 2 PQRS 2009/8/2 + 9 DCBA 2009/8/9 3 TUVW 2009/8/3 + 9 DCBA 2009/8/9 4 EFGH 2009/8/4 + 9 DCBA 2009/8/9 5 IJKL 2009/8/7 + 9 DCBA 2009/8/9 6 MNOP 2009/8/8 + 7 ACBD 2009/8/7 2 PQRS 2009/8/2 + 7 ACBD 2009/8/7 3 TUVW 2009/8/3 + 7 ACBD 2009/8/7 4 EFGH 2009/8/4 + 7 ACBD 2009/8/7 5 IJKL 2009/8/7 + 7 ACBD 2009/8/7 6 MNOP 2009/8/8 + +echo SELECT * FROM t1,t2 LIMIT 5; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t2.f1 t2.f2 t2.f3 +--------------------------------------------------------- + 1 ABCD 2009/8/1 2 PQRS 2009/8/2 + 1 ABCD 2009/8/1 3 TUVW 2009/8/3 + 1 ABCD 2009/8/1 4 EFGH 2009/8/4 + 1 ABCD 2009/8/1 5 IJKL 2009/8/7 + 1 ABCD 2009/8/1 6 MNOP 2009/8/8 + +echo SELECT * FROM t1,t2 LIMIT 5 OFFSET 5; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t2.f1 t2.f2 t2.f3 +--------------------------------------------------------- + 3 BCDA 2009/8/2 2 PQRS 2009/8/2 + 3 BCDA 2009/8/2 3 TUVW 2009/8/3 + 3 BCDA 2009/8/2 4 EFGH 2009/8/4 + 3 BCDA 2009/8/2 5 IJKL 2009/8/7 + 3 BCDA 2009/8/2 6 MNOP 2009/8/8 + +echo SELECT t1.f1, t2.f1 FROM t1 INNER JOIN t2 ON t1.f1 = t2.f1; +--------------------------------------------------------- + t1.f1 t2.f1 +--------------------------------------------------------- + 3 3 + 5 5 + +echo SELECT t1.f1, t2.f1 FROM t1 INNER JOIN t2 ON t1.f1 = t2.f1 LIMIT 2; +--------------------------------------------------------- + t1.f1 t2.f1 +--------------------------------------------------------- + 3 3 + 5 5 + +echo SELECT t1.f1, t2.f1 FROM t1 INNER JOIN t2 ON t1.f1 = t2.f1 LIMIT 2 OFFSET 1; +--------------------------------------------------------- + t1.f1 t2.f1 +--------------------------------------------------------- + 5 5 + +echo SELECT t1.f1, t2.f1 FROM t1 LEFT JOIN t2 ON t1.f1 = t2.f1; +--------------------------------------------------------- + t1.f1 t2.f1 +--------------------------------------------------------- + 1 NULL + 3 3 + 5 5 + 9 NULL + 7 NULL + +echo SELECT t1.f1, t2.f1 FROM t1 LEFT JOIN t2 ON t1.f1 = t2.f1 LIMIT 4; +--------------------------------------------------------- + t1.f1 t2.f1 +--------------------------------------------------------- + 1 NULL + 3 3 + 5 5 + 9 NULL + +echo SELECT t1.f1, t2.f1 FROM t1 LEFT JOIN t2 ON t1.f1 = t2.f1 LIMIT 3 OFFSET 2; +--------------------------------------------------------- + t1.f1 t2.f1 +--------------------------------------------------------- + 5 5 + 9 NULL + 7 NULL + +Statement Executed +Statement Executed diff --git a/test/sql/Limit/exp.test003.ksh b/test/sql/Limit/exp.test003.ksh new file mode 100644 index 00000000..24c926ab --- /dev/null +++ b/test/sql/Limit/exp.test003.ksh @@ -0,0 +1,158 @@ +echo CREATE TABLE t1(f1 int, f2 char(10), f3 date); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo SELECT * FROM t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 +--------------------------------------------------------- + 1 ABCD 2009/8/1 + 3 BCDA 2009/8/2 + 5 CDBA 2009/8/3 + 9 DCBA 2009/8/9 + 7 ACBD 2009/8/7 + 2 PQRS 2009/8/2 + 3 TUVW 2009/8/3 + 4 EFGH 2009/8/4 + 5 IJKL 2009/8/7 + 6 MNOP 2009/8/8 + 2 MMMM 2009/8/2 + 3 NNNN 2009/8/3 + 4 OOOO 2009/8/4 + 5 PPPP 2009/8/7 + 6 QQQQ 2009/8/8 + +echo SELECT * FROM t1 ORDER BY f1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 +--------------------------------------------------------- + 1 ABCD 2009/8/1 + 2 MMMM 2009/8/2 + 2 PQRS 2009/8/2 + 3 NNNN 2009/8/3 + 3 TUVW 2009/8/3 + 3 BCDA 2009/8/2 + 4 OOOO 2009/8/4 + 4 EFGH 2009/8/4 + 5 PPPP 2009/8/7 + 5 IJKL 2009/8/7 + 5 CDBA 2009/8/3 + 6 QQQQ 2009/8/8 + 6 MNOP 2009/8/8 + 7 ACBD 2009/8/7 + 9 DCBA 2009/8/9 + +echo SELECT * FROM t1 ORDER BY f1 LIMIT 5; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 +--------------------------------------------------------- + 1 ABCD 2009/8/1 + 2 MMMM 2009/8/2 + 2 PQRS 2009/8/2 + 3 NNNN 2009/8/3 + 3 TUVW 2009/8/3 + +echo SELECT * FROM t1 ORDER BY f1 LIMIT 5 OFFSET 5; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 +--------------------------------------------------------- + 3 BCDA 2009/8/2 + 4 OOOO 2009/8/4 + 4 EFGH 2009/8/4 + 5 PPPP 2009/8/7 + 5 IJKL 2009/8/7 + +echo SELECT * FROM t1 ORDER BY f1 DESC; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 +--------------------------------------------------------- + 9 DCBA 2009/8/9 + 7 ACBD 2009/8/7 + 6 QQQQ 2009/8/8 + 6 MNOP 2009/8/8 + 5 PPPP 2009/8/7 + 5 IJKL 2009/8/7 + 5 CDBA 2009/8/3 + 4 OOOO 2009/8/4 + 4 EFGH 2009/8/4 + 3 NNNN 2009/8/3 + 3 TUVW 2009/8/3 + 3 BCDA 2009/8/2 + 2 MMMM 2009/8/2 + 2 PQRS 2009/8/2 + 1 ABCD 2009/8/1 + +echo SELECT * FROM t1 ORDER BY f1 DESC LIMIT 5; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 +--------------------------------------------------------- + 9 DCBA 2009/8/9 + 7 ACBD 2009/8/7 + 6 QQQQ 2009/8/8 + 6 MNOP 2009/8/8 + 5 PPPP 2009/8/7 + +echo SELECT * FROM t1 ORDER BY f1 DESC LIMIT 5 OFFSET 5; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 +--------------------------------------------------------- + 5 IJKL 2009/8/7 + 5 CDBA 2009/8/3 + 4 OOOO 2009/8/4 + 4 EFGH 2009/8/4 + 3 NNNN 2009/8/3 + +echo SELECT * FROM t1 ORDER BY f1 ASC, f2 DESC; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 +--------------------------------------------------------- + 1 ABCD 2009/8/1 + 2 PQRS 2009/8/2 + 2 MMMM 2009/8/2 + 3 TUVW 2009/8/3 + 3 NNNN 2009/8/3 + 3 BCDA 2009/8/2 + 4 OOOO 2009/8/4 + 4 EFGH 2009/8/4 + 5 PPPP 2009/8/7 + 5 IJKL 2009/8/7 + 5 CDBA 2009/8/3 + 6 QQQQ 2009/8/8 + 6 MNOP 2009/8/8 + 7 ACBD 2009/8/7 + 9 DCBA 2009/8/9 + +echo SELECT * FROM t1 ORDER BY f1 ASC, f2 DESC LIMIT 5; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 +--------------------------------------------------------- + 1 ABCD 2009/8/1 + 2 PQRS 2009/8/2 + 2 MMMM 2009/8/2 + 3 TUVW 2009/8/3 + 3 NNNN 2009/8/3 + +echo SELECT * FROM t1 ORDER BY f1 DESC, f2 ASC LIMIT 5 OFFSET 5; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 +--------------------------------------------------------- + 5 IJKL 2009/8/7 + 5 PPPP 2009/8/7 + 4 EFGH 2009/8/4 + 4 OOOO 2009/8/4 + 3 BCDA 2009/8/2 + +Statement Executed diff --git a/test/sql/Limit/exp.test004.ksh b/test/sql/Limit/exp.test004.ksh new file mode 100644 index 00000000..5b97f4eb --- /dev/null +++ b/test/sql/Limit/exp.test004.ksh @@ -0,0 +1,72 @@ +echo CREATE TABLE t1(f1 int, f2 char(10), f3 date, f4 BIGINT); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo SELECT * FROM t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 +--------------------------------------------------------- + 1 ABCD 2009/8/1 50 + 3 BCDA 2009/8/2 60 + 5 CDBA 2009/8/3 70 + 3 DCBA 2009/8/9 80 + 4 ACBD 2009/8/7 10 + 1 PQRS 2009/8/2 20 + 2 TUVW 2009/8/3 30 + 3 EFGH 2009/8/4 40 + 4 IJKL 2009/8/7 50 + 5 MNOP 2009/8/8 10 + 4 MMMM 2009/8/2 40 + 3 NNNN 2009/8/3 50 + 2 OOOO 2009/8/4 20 + 1 PPPP 2009/8/7 30 + 2 QQQQ 2009/8/8 50 + +echo SELECT f1,MAX(f3) FROM t1 GROUP BY f1; +--------------------------------------------------------- + f1 MAX(f3) +--------------------------------------------------------- + 1 2009/8/7 + 3 2009/8/9 + 5 2009/8/8 + 4 2009/8/7 + 2 2009/8/8 + +echo SELECT f1,COUNT(f3) FROM t1 GROUP BY f1 LIMIT 3; +--------------------------------------------------------- + f1 COUNT(f3) +--------------------------------------------------------- + 1 3 + 3 4 + 5 2 + +echo SELECT f1,MIN(f3) FROM t1 GROUP BY f1 LIMIT 3 OFFSET 2; +--------------------------------------------------------- + f1 MIN(f3) +--------------------------------------------------------- + 5 2009/8/3 + 4 2009/8/2 + 2 2009/8/3 + +echo SELECT f1,SUM(f4) FROM t1 GROUP BY f1 LIMIT 3 OFFSET 2; +--------------------------------------------------------- + f1 SUM(f4) +--------------------------------------------------------- + 5 80 + 4 100 + 2 100 + +Statement Executed diff --git a/test/sql/Limit/exp.test005.ksh b/test/sql/Limit/exp.test005.ksh new file mode 100644 index 00000000..b0beec88 --- /dev/null +++ b/test/sql/Limit/exp.test005.ksh @@ -0,0 +1,41 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +--------------------------------------------------------- + emp10.eno emp10.ename emp10.job emp10.mgrno +--------------------------------------------------------- + 1 ALLEN SALES 4 + 2 PITTER IT 3 + 3 JACK MKTING 1 + 4 TOM CLERK 1 + 5 HARRY MANAGER 5 + +echo SELECT emp.ename,mgr.ename FROM emp10 as emp,emp10 as mgr WHERE emp.mgrno=mgr.eno; +--------------------------------------------------------- + emp.ename mgr.ename +--------------------------------------------------------- + ALLEN TOM + PITTER JACK + JACK ALLEN + TOM ALLEN + HARRY HARRY + +echo SELECT emp.ename,mgr.ename FROM emp10 as emp,emp10 as mgr WHERE emp.mgrno=mgr.eno limit 3; +--------------------------------------------------------- + emp.ename mgr.ename +--------------------------------------------------------- + ALLEN TOM + PITTER JACK + JACK ALLEN + +echo SELECT emp.ename,mgr.ename FROM emp10 as emp,emp10 as mgr WHERE emp.mgrno=mgr.eno limit 2 offset 2; +--------------------------------------------------------- + emp.ename mgr.ename +--------------------------------------------------------- + JACK ALLEN + TOM ALLEN + +Statement Executed diff --git a/test/sql/Limit/groupby.sql b/test/sql/Limit/groupby.sql new file mode 100644 index 00000000..0d138075 --- /dev/null +++ b/test/sql/Limit/groupby.sql @@ -0,0 +1,27 @@ +echo CREATE TABLE t1(f1 int, f2 char(10), f3 date, f4 BIGINT); +CREATE TABLE t1(f1 int, f2 char(10), f3 date, f4 BIGINT); +INSERT INTO t1 VALUES(1, 'ABCD', '2009-08-01', 50); +INSERT INTO t1 VALUES(3, 'BCDA', '2009-08-02', 60); +INSERT INTO t1 VALUES(5, 'CDBA', '2009-08-03', 70); +INSERT INTO t1 VALUES(3, 'DCBA', '2009-08-09', 80); +INSERT INTO t1 VALUES(4, 'ACBD', '2009-08-07', 10); +INSERT INTO t1 VALUES(1, 'PQRS', '2009-08-02', 20); +INSERT INTO t1 VALUES(2, 'TUVW', '2009-08-03', 30); +INSERT INTO t1 VALUES(3, 'EFGH', '2009-08-04', 40); +INSERT INTO t1 VALUES(4, 'IJKL', '2009-08-07', 50); +INSERT INTO t1 VALUES(5, 'MNOP', '2009-08-08', 10); +INSERT INTO t1 VALUES(4, 'MMMM', '2009-08-02', 40); +INSERT INTO t1 VALUES(3, 'NNNN', '2009-08-03', 50); +INSERT INTO t1 VALUES(2, 'OOOO', '2009-08-04', 20); +INSERT INTO t1 VALUES(1, 'PPPP', '2009-08-07', 30); +INSERT INTO t1 VALUES(2, 'QQQQ', '2009-08-08', 50); +echo SELECT * FROM t1; +SELECT * FROM t1; +echo SELECT f1,MAX(f3) FROM t1 GROUP BY f1; +SELECT f1,MAX(f3) FROM t1 GROUP BY f1; +echo SELECT f1,COUNT(f3) FROM t1 GROUP BY f1 LIMIT 3; +SELECT f1,COUNT(f3) FROM t1 GROUP BY f1 LIMIT 3; +echo SELECT f1,MIN(f3) FROM t1 GROUP BY f1 LIMIT 3 OFFSET 2; +SELECT f1,MIN(f3) FROM t1 GROUP BY f1 LIMIT 3 OFFSET 2; +echo SELECT f1,SUM(f4) FROM t1 GROUP BY f1 LIMIT 3 OFFSET 2; +SELECT f1,SUM(f4) FROM t1 GROUP BY f1 LIMIT 3 OFFSET 2; diff --git a/test/sql/Limit/join.sql b/test/sql/Limit/join.sql new file mode 100644 index 00000000..b8c55824 --- /dev/null +++ b/test/sql/Limit/join.sql @@ -0,0 +1,46 @@ +echo CREATE TABLE t1(f1 int, f2 char(10), f3 date); +CREATE TABLE t1(f1 int, f2 char(10), f3 date); +echo CREATE TABLE t2(f1 int, f2 char(10), f3 date); +CREATE TABLE t2(f1 int, f2 char(10), f3 date); +echo INSERT INTO t1 VALUES(1, 'ABCD', '2009-08-01'); +INSERT INTO t1 VALUES(1, 'ABCD', '2009-08-01'); +echo INSERT INTO t1 VALUES(3, 'BCDA', '2009-08-02'); +INSERT INTO t1 VALUES(3, 'BCDA', '2009-08-02'); +echo INSERT INTO t1 VALUES(5, 'CDBA', '2009-08-03'); +INSERT INTO t1 VALUES(5, 'CDBA', '2009-08-03'); +echo INSERT INTO t1 VALUES(9, 'DCBA', '2009-08-09'); +INSERT INTO t1 VALUES(9, 'DCBA', '2009-08-09'); +echo INSERT INTO t1 VALUES(7, 'ACBD', '2009-08-07'); +INSERT INTO t1 VALUES(7, 'ACBD', '2009-08-07'); +echo INSERT INTO t2 VALUES(2, 'PQRS', '2009-08-02'); +INSERT INTO t2 VALUES(2, 'PQRS', '2009-08-02'); +echo INSERT INTO t2 VALUES(3, 'TUVW', '2009-08-03'); +INSERT INTO t2 VALUES(3, 'TUVW', '2009-08-03'); +echo INSERT INTO t2 VALUES(4, 'EFGH', '2009-08-04'); +INSERT INTO t2 VALUES(4, 'EFGH', '2009-08-04'); +echo INSERT INTO t2 VALUES(5, 'IJKL', '2009-08-07'); +INSERT INTO t2 VALUES(5, 'IJKL', '2009-08-07'); +echo INSERT INTO t2 VALUES(6, 'MNOP', '2009-08-08'); +INSERT INTO t2 VALUES(6, 'MNOP', '2009-08-08'); +echo SELECT * FROM t1; +SELECT * FROM t1; +echo SELECT * FROM t2; +SELECT * FROM t2; +echo SELECT * FROM t1,t2; +SELECT * FROM t1,t2; +echo SELECT * FROM t1,t2 LIMIT 5; +SELECT * FROM t1,t2 LIMIT 5; +echo SELECT * FROM t1,t2 LIMIT 5 OFFSET 5; +SELECT * FROM t1,t2 LIMIT 5 OFFSET 5; +echo SELECT t1.f1, t2.f1 FROM t1 INNER JOIN t2 ON t1.f1 = t2.f1; +SELECT t1.f1, t2.f1 FROM t1 INNER JOIN t2 ON t1.f1 = t2.f1; +echo SELECT t1.f1, t2.f1 FROM t1 INNER JOIN t2 ON t1.f1 = t2.f1 LIMIT 2; +SELECT t1.f1, t2.f1 FROM t1 INNER JOIN t2 ON t1.f1 = t2.f1 LIMIT 2; +echo SELECT t1.f1, t2.f1 FROM t1 INNER JOIN t2 ON t1.f1 = t2.f1 LIMIT 2 OFFSET 1; +SELECT t1.f1, t2.f1 FROM t1 INNER JOIN t2 ON t1.f1 = t2.f1 LIMIT 2 OFFSET 1; +echo SELECT t1.f1, t2.f1 FROM t1 LEFT JOIN t2 ON t1.f1 = t2.f1; +SELECT t1.f1, t2.f1 FROM t1 LEFT JOIN t2 ON t1.f1 = t2.f1; +echo SELECT t1.f1, t2.f1 FROM t1 LEFT JOIN t2 ON t1.f1 = t2.f1 LIMIT 4; +SELECT t1.f1, t2.f1 FROM t1 LEFT JOIN t2 ON t1.f1 = t2.f1 LIMIT 4; +echo SELECT t1.f1, t2.f1 FROM t1 LEFT JOIN t2 ON t1.f1 = t2.f1 LIMIT 3 OFFSET 2; +SELECT t1.f1, t2.f1 FROM t1 LEFT JOIN t2 ON t1.f1 = t2.f1 LIMIT 3 OFFSET 2; diff --git a/test/sql/Limit/limit1.sql b/test/sql/Limit/limit1.sql new file mode 100644 index 00000000..6bea7223 --- /dev/null +++ b/test/sql/Limit/limit1.sql @@ -0,0 +1,31 @@ +create table t1(f1 int,f2 int,primary key(f1)); +insert into t1 values(95,1); +insert into t1 values(96,2); +insert into t1 values(97,2); +insert into t1 values(98,2); +insert into t1 values(99,2); +insert into t1 values(100,3); +insert into t1 values(101,4); +insert into t1 values(102,5); +insert into t1 values(103,5); +insert into t1 values(104,5); +echo select * from t1; +select * from t1; +echo select * from t1 limit 1; +select * from t1 limit 1; +echo select * from t1 limit 3; +select * from t1 limit 3; +echo select * from t1 limit 20; +select * from t1 limit 20; +echo select * from t1 limit 1 offset 0; +select * from t1 limit 1 offset 0; +echo select * from t1 limit 1 offset 1; +select * from t1 limit 1 offset 1; +echo select * from t1 limit 1 offset 5; +select * from t1 limit 1 offset 5; +echo select * from t1 limit 1 offset 15; +select * from t1 limit 1 offset 15; +echo select * from t1 limit 5 offset 5; +select * from t1 limit 5 offset 5; +echo select * from t1 limit 15 offset 15; +select * from t1 limit 15 offset 15; diff --git a/test/sql/Limit/orderby.sql b/test/sql/Limit/orderby.sql new file mode 100644 index 00000000..bd1da9a7 --- /dev/null +++ b/test/sql/Limit/orderby.sql @@ -0,0 +1,37 @@ +echo CREATE TABLE t1(f1 int, f2 char(10), f3 date); +CREATE TABLE t1(f1 int, f2 char(10), f3 date); +INSERT INTO t1 VALUES(1, 'ABCD', '2009-08-01'); +INSERT INTO t1 VALUES(3, 'BCDA', '2009-08-02'); +INSERT INTO t1 VALUES(5, 'CDBA', '2009-08-03'); +INSERT INTO t1 VALUES(9, 'DCBA', '2009-08-09'); +INSERT INTO t1 VALUES(7, 'ACBD', '2009-08-07'); +INSERT INTO t1 VALUES(2, 'PQRS', '2009-08-02'); +INSERT INTO t1 VALUES(3, 'TUVW', '2009-08-03'); +INSERT INTO t1 VALUES(4, 'EFGH', '2009-08-04'); +INSERT INTO t1 VALUES(5, 'IJKL', '2009-08-07'); +INSERT INTO t1 VALUES(6, 'MNOP', '2009-08-08'); +INSERT INTO t1 VALUES(2, 'MMMM', '2009-08-02'); +INSERT INTO t1 VALUES(3, 'NNNN', '2009-08-03'); +INSERT INTO t1 VALUES(4, 'OOOO', '2009-08-04'); +INSERT INTO t1 VALUES(5, 'PPPP', '2009-08-07'); +INSERT INTO t1 VALUES(6, 'QQQQ', '2009-08-08'); +echo SELECT * FROM t1; +SELECT * FROM t1; +echo SELECT * FROM t1 ORDER BY f1; +SELECT * FROM t1 ORDER BY f1; +echo SELECT * FROM t1 ORDER BY f1 LIMIT 5; +SELECT * FROM t1 ORDER BY f1 LIMIT 5; +echo SELECT * FROM t1 ORDER BY f1 LIMIT 5 OFFSET 5; +SELECT * FROM t1 ORDER BY f1 LIMIT 5 OFFSET 5; +echo SELECT * FROM t1 ORDER BY f1 DESC; +SELECT * FROM t1 ORDER BY f1 DESC; +echo SELECT * FROM t1 ORDER BY f1 DESC LIMIT 5; +SELECT * FROM t1 ORDER BY f1 DESC LIMIT 5; +echo SELECT * FROM t1 ORDER BY f1 DESC LIMIT 5 OFFSET 5; +SELECT * FROM t1 ORDER BY f1 DESC LIMIT 5 OFFSET 5; +echo SELECT * FROM t1 ORDER BY f1 ASC, f2 DESC; +SELECT * FROM t1 ORDER BY f1 ASC, f2 DESC; +echo SELECT * FROM t1 ORDER BY f1 ASC, f2 DESC LIMIT 5; +SELECT * FROM t1 ORDER BY f1 ASC, f2 DESC LIMIT 5; +echo SELECT * FROM t1 ORDER BY f1 DESC, f2 ASC LIMIT 5 OFFSET 5; +SELECT * FROM t1 ORDER BY f1 DESC, f2 ASC LIMIT 5 OFFSET 5; diff --git a/test/sql/Limit/selfjoin1.sql b/test/sql/Limit/selfjoin1.sql new file mode 100644 index 00000000..d7688049 --- /dev/null +++ b/test/sql/Limit/selfjoin1.sql @@ -0,0 +1,14 @@ +CREATE TABLE emp10(eno int,ename char(10),job char(8),mgrno int); +INSERT INTO emp10 VALUES(1,'ALLEN','SALES',4); +INSERT INTO emp10 VALUES(2,'PITTER','IT',3); +INSERT INTO emp10 VALUES(3,'JACK','MKTING',1); +INSERT INTO emp10 VALUES(4,'TOM','CLERK',1); +INSERT INTO emp10 VALUES(5,'HARRY','MANAGERi',5); +SELECT * FROM emp10; +echo SELECT emp.ename,mgr.ename FROM emp10 as emp,emp10 as mgr WHERE emp.mgrno=mgr.eno; +SELECT emp.ename,mgr.ename FROM emp10 as emp,emp10 as mgr WHERE emp.mgrno=mgr.eno; +echo SELECT emp.ename,mgr.ename FROM emp10 as emp,emp10 as mgr WHERE emp.mgrno=mgr.eno limit 3; +SELECT emp.ename,mgr.ename FROM emp10 as emp,emp10 as mgr WHERE emp.mgrno=mgr.eno limit 3; +echo SELECT emp.ename,mgr.ename FROM emp10 as emp,emp10 as mgr WHERE emp.mgrno=mgr.eno limit 2 offset 2; +SELECT emp.ename,mgr.ename FROM emp10 as emp,emp10 as mgr WHERE emp.mgrno=mgr.eno limit 2 offset 2; + diff --git a/test/sql/Limit/test001.ksh b/test/sql/Limit/test001.ksh new file mode 100755 index 00000000..34423684 --- /dev/null +++ b/test/sql/Limit/test001.ksh @@ -0,0 +1,27 @@ +#!/bin/ksh +# Testing limit and offset +# offset tells that from which record you want to fetch +# limit tells that how many records you want to fetch from offset +# offset 0 indicates the 1st record +# +CREATEFILE=${PWD}/sql/Limit/dropt1.sql +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Limit +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/limit1.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Limit/test002.ksh b/test/sql/Limit/test002.ksh new file mode 100755 index 00000000..25b0facc --- /dev/null +++ b/test/sql/Limit/test002.ksh @@ -0,0 +1,24 @@ +#!/bin/ksh +# Testing limit and offset on Join. +# +CREATEFILE=${PWD}/sql/Limit/dropt1.sql +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Limit +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/join.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop2.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop2.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +exit 0; diff --git a/test/sql/Limit/test003.ksh b/test/sql/Limit/test003.ksh new file mode 100755 index 00000000..9da5a952 --- /dev/null +++ b/test/sql/Limit/test003.ksh @@ -0,0 +1,29 @@ +#!/bin/ksh +# Testing limit and offset on ORDER BY. +# +CREATEFILE=${PWD}/sql/Limit/dropt1.sql +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Limit +fi + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/orderby.sql 2> $0.valgr +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/orderby.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +exit 0; diff --git a/test/sql/Limit/test004.ksh b/test/sql/Limit/test004.ksh new file mode 100755 index 00000000..9acd7031 --- /dev/null +++ b/test/sql/Limit/test004.ksh @@ -0,0 +1,29 @@ +#!/bin/ksh +# Testing limit and offset on GROUP BY and HAVING. +# +CREATEFILE=${PWD}/sql/Limit/dropt1.sql +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Limit +fi + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/groupby.sql 2> $0.valgr +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/groupby.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +exit 0; diff --git a/test/sql/Limit/test005.ksh b/test/sql/Limit/test005.ksh new file mode 100755 index 00000000..8ec63347 --- /dev/null +++ b/test/sql/Limit/test005.ksh @@ -0,0 +1,27 @@ +#!/bin/ksh +# Testing limit and offset on self joined table. +# +CREATEFILE=${PWD}/sql/Limit/dropt1.sql +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Limit +fi + + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/selfjoin1.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropemp10.sql + exit 1; +fi + +echo "drop table emp10;" >${REL_PATH}/dropemp10.sql +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropemp10.sql +if [ $? -ne 0 ] +then + rm -f ${REL_PATH}/dropemp10.sql + exit 2; +fi +rm -f ${REL_PATH}/dropemp10.sql +exit 0; diff --git a/test/sql/Makefile b/test/sql/Makefile new file mode 100644 index 00000000..8b8aa8e0 --- /dev/null +++ b/test/sql/Makefile @@ -0,0 +1,18 @@ +OSNAME = $(shell uname -s) +MAKE=gmake + +all: + @for i in *; \ + do \ + if [ -d $$i ];\ + then cd $$i; $(MAKE); cd ..;\ + fi;\ + done + +clean: + @for i in *; \ + do \ + if [ -d $$i ];\ + then cd $$i; $(MAKE) clean; cd ..;\ + fi;\ + done diff --git a/test/sql/Optimizer/TODO b/test/sql/Optimizer/TODO new file mode 100644 index 00000000..e69de29b diff --git a/test/sql/Optimizer/big_composite.sql b/test/sql/Optimizer/big_composite.sql new file mode 100644 index 00000000..64314152 --- /dev/null +++ b/test/sql/Optimizer/big_composite.sql @@ -0,0 +1,27 @@ +echo create table t1(f1 bigint, f2 bigint, f3 bigint, f4 bigint); +create table t1(f1 bigint, f2 bigint, f3 bigint, f4 bigint); +echo create index hashbigf1f2f3 on t1(f2,f3,f1) hash; +create index hashbigf1f2f3 on t1(f2,f3,f1) hash; +echo explain plan select * from t1; +explain plan select * from t1; +echo explain plan select * from t1 where f1 = 2; +explain plan select * from t1 where f1 = 2; +echo explain plan select * from t1 where f1 = 2 and f2=2; +explain plan select * from t1 where f1 = 2 and f2=2; +echo explain plan select * from t1 where f1 = 2 and f2=2 and f3=2; +explain plan select * from t1 where f1 = 2 and f2=2 and f3=2; +echo explain plan select * from t1 where f1 = 2 or f2=2 or f3=2; +explain plan select * from t1 where f1 = 2 or f2=2 or f3=2; +echo explain plan select * from t1 where f1 = 2 and f2=2 or f3=2; +explain plan select * from t1 where f1 = 2 and f2=2 or f3=2; +echo explain plan select * from t1 where f1 = 2 and f2=2 and not(f3=2); +explain plan select * from t1 where f1 = 2 and f2=2 and not(f3=2); +echo explain plan select * from t1 where f1 in(1,2,3) and f2=2 and not(f3=2); +explain plan select * from t1 where f1 in(1,2,3) and f2=2 and not(f3=2); +echo explain plan select * from t1 where f1 in(1,2,3) and (f2 between 2 and 4) and not(f3=2); +explain plan select * from t1 where f1 in(1,2,3) and (f2 between 2 and 4) and not(f3=2); +echo explain plan select * from t1 where f1 in(1,2,3) or (f2 between 2 and 4) or not(f3=2); +explain plan select * from t1 where f1 in(1,2,3) or (f2 between 2 and 4) or not(f3=2); +echo explain plan select * from t1 where f1 in(1,2,3) or (f2 between 2 and 4) and not(f3=2); +explain plan select * from t1 where f1 in(1,2,3) or (f2 between 2 and 4) and not(f3=2); + diff --git a/test/sql/Optimizer/char_composite.sql b/test/sql/Optimizer/char_composite.sql new file mode 100644 index 00000000..f560b596 --- /dev/null +++ b/test/sql/Optimizer/char_composite.sql @@ -0,0 +1,27 @@ +echo create table t1(f1 char, f2 char, f3 char, f4 char); +create table t1(f1 char, f2 char, f3 char, f4 char); +echo create index hashcharf1f2f3 on t1(f2,f3,f1) hash; +create index hashcharf1f2f3 on t1(f2,f3,f1) hash; +echo explain plan select * from t1; +explain plan select * from t1; +echo explain plan select * from t1 where f1 = 'a'; +explain plan select * from t1 where f1 = 'a'; +echo explain plan select * from t1 where f1 = 'a' and f2='a'; +explain plan select * from t1 where f1 = 'a' and f2='a'; +echo explain plan select * from t1 where f1 = 'a' and f2='a' and f3='a'; +explain plan select * from t1 where f1 = 'a' and f2='a' and f3='a'; +echo explain plan select * from t1 where f1 = 'a' or f2='a' or f3='a'; +explain plan select * from t1 where f1 = 'a' or f2='a' or f3='a'; +echo explain plan select * from t1 where f1 = 'a' and f2='a' or f3='a'; +explain plan select * from t1 where f1 = 'a' and f2='a' or f3='a'; +echo explain plan select * from t1 where f1 = 'a' and f2='a' and not(f3='a'); +explain plan select * from t1 where f1 = 'a' and f2='a' and not(f3='a'); +echo explain plan select * from t1 where f1 in('a','a','a') and f2='a' and not(f3='a'); +explain plan select * from t1 where f1 in('a','a','a') and f2='a' and not(f3='a'); +echo explain plan select * from t1 where f1 in('a','b','c') and f2 like 'a%' and not(f3='d'); +explain plan select * from t1 where f1 in('a','b','c') and f2 like 'a%' and not(f3='d'); +echo explain plan select * from t1 where f1 in('b','c','a') or f2 like 'a%' or not(f3='d'); +explain plan select * from t1 where f1 in('b','c','a') or f2 like 'a%' or not(f3='d'); +echo explain plan select * from t1 where f1 in('a','c','b') or f2 like 'a%' and not(f3='d'); +explain plan select * from t1 where f1 in('a','c','b') or f2 like 'a%' and not(f3='d'); + diff --git a/test/sql/Optimizer/composite_mixdatatype.sql b/test/sql/Optimizer/composite_mixdatatype.sql new file mode 100644 index 00000000..a3c540ad --- /dev/null +++ b/test/sql/Optimizer/composite_mixdatatype.sql @@ -0,0 +1,18 @@ +echo create table t1 (f1 smallint, f2 int, f3 bigint, f4 varchar, f5 date); +create table t1 (f1 smallint, f2 int, f3 bigint, f4 varchar, f5 date); +echo create index compositehashindex on t1(f2,f3,f4,f5) hash; +create index compositehashindex on t1(f2,f3,f4,f5) hash; +echo explain plan select * from t1; +explain plan select * from t1; +echo explain plan select * from t1 where f2=1 and f3=10 and f4='abc' and f5='2001-01-01'; +explain plan select * from t1 where f2=1 and f3=10 and f4='abc' and f5='2001-01-01'; +echo explain plan select * from t1 where f2=1 and f3=10 and f4='abc' and f5='2001-01-01'; +explain plan select * from t1 where f2=1 and f3=10 and f4='abc' and f5='2001-01-01'; +echo explain plan select * from t1 where f2<=10 and f3>=10 and f4 like 'abc%' and f5 in ('2001-01-01','2001-03-03'); +explain plan select * from t1 where f2<=10 and f3>=10 and f4 like 'abc%' and f5 in ('2001-01-01','2001-03-03'); +echo explain plan select * from t1 where f2<=10 and f3>=10 and f4 like 'abc%' and f5 in ('2001-01-01','2001-03-03'); +explain plan select * from t1 where f2<=10 and f3>=10 and f4 like 'abc%' and f5 in ('2001-01-01','2001-03-03'); +echo explain plan select * from t1 where f2<=10 or f3>=10 or f4 like 'abc%' or f5 in ('2001-01-01','2001-03-03'); +explain plan select * from t1 where f2<=10 or f3>=10 or f4 like 'abc%' or f5 in ('2001-01-01','2001-03-03'); +echo explain plan select * from t1 where f2<=10 or f3>=10 or f4 like 'abc%' or f5 in ('2001-01-01','2001-03-03'); +explain plan select * from t1 where f2<=10 or f3>=10 or f4 like 'abc%' or f5 in ('2001-01-01','2001-03-03'); diff --git a/test/sql/Optimizer/createt1t2t3.sql b/test/sql/Optimizer/createt1t2t3.sql new file mode 100644 index 00000000..96fd3b36 --- /dev/null +++ b/test/sql/Optimizer/createt1t2t3.sql @@ -0,0 +1,21 @@ +create table t1(f1 int NOT NULL,f2 int,f3 int); +insert into t1 values(98,13,108); +insert into t1 values(99,14,109); +insert into t1 values(100,15,109); +insert into t1 values(101,16,110); +insert into t1 values(102,17,111); +insert into t1 values(103,18,112); +create table t2(f1 int NOT NULL,f2 int,f3 int); +insert into t2 values(98,13,108); +insert into t2 values(99,14,109); +insert into t2 values(100,15,109); +insert into t2 values(101,16,110); +insert into t2 values(102,17,111); +insert into t2 values(103,18,112); +create table t3(f1 int NOT NULL,f2 int,f3 int); +insert into t3 values(98,13,108); +insert into t3 values(99,14,109); +insert into t3 values(100,15,109); +insert into t3 values(101,16,110); +insert into t3 values(102,17,111); +insert into t3 values(103,18,112); diff --git a/test/sql/Optimizer/date_composite.sql b/test/sql/Optimizer/date_composite.sql new file mode 100644 index 00000000..63cf29dc --- /dev/null +++ b/test/sql/Optimizer/date_composite.sql @@ -0,0 +1,27 @@ +echo create table t1(f1 date, f2 date, f3 date, f4 date); +create table t1(f1 date, f2 date, f3 date, f4 date); +echo create index hashdatef1f2f3 on t1(f2,f3,f1) hash; +create index hashdatef1f2f3 on t1(f2,f3,f1) hash; +echo explain plan select * from t1; +explain plan select * from t1; +echo explain plan select * from t1 where f1 = '2003-03-03'; +explain plan select * from t1 where f1 = '2003-03-03'; +echo explain plan select * from t1 where f1 = '2003-03-03' and f2='2003-03-03'; +explain plan select * from t1 where f1 = '2003-03-03' and f2='2003-03-03'; +echo explain plan select * from t1 where f1 = '2003-03-03' and f2='2003-03-03' and f3='2003-03-03'; +explain plan select * from t1 where f1 = '2003-03-03' and f2='2003-03-03' and f3='2003-03-03'; +echo explain plan select * from t1 where f1 = '2003-03-03' or f2='2003-03-03' or f3='2003-03-03'; +explain plan select * from t1 where f1 = '2003-03-03' or f2='2003-03-03' or f3='2003-03-03'; +echo explain plan select * from t1 where f1 = '2003-03-03' and f2='2003-03-03' or f3='2003-03-03'; +explain plan select * from t1 where f1 = '2003-03-03' and f2='2003-03-03' or f3='2003-03-03'; +echo explain plan select * from t1 where f1 = '2003-03-03' and f2='2003-03-03' and not(f3='2003-03-03'); +explain plan select * from t1 where f1 = '2003-03-03' and f2='2003-03-03' and not(f3='2003-03-03'); +echo explain plan select * from t1 where f1 in('2003-03-03','2003-03-03','2003-03-03') and f2='2003-03-03' and not(f3='2003-03-03'); +explain plan select * from t1 where f1 in('2003-03-03','2003-03-03','2003-03-03') and f2='2003-03-03' and not(f3='2003-03-03'); +echo explain plan select * from t1 where f1 in('2003-03-03','2003-03-08','2003-03-12') and (f2 between '2003-03-03' and '2003-03-03') and not(f3='2003-03-03'); +explain plan select * from t1 where f1 in('2003-03-03','2003-03-08','2003-03-12') and (f2 between '2003-03-03' and '2003-03-03') and not(f3='2003-03-03'); +echo explain plan select * from t1 where f1 in('2003-03-08','2003-03-12','2003-03-03') or (f2 between '2003-03-03' and '2003-03-03') or not(f3='2003-03-03'); +explain plan select * from t1 where f1 in('2003-03-08','2003-03-12','2003-03-03') or (f2 between '2003-03-03' and '2003-03-03') or not(f3='2003-03-03'); +echo explain plan select * from t1 where f1 in('2003-03-03','2003-03-12','2003-03-08') or (f2 between '2003-03-03' and '2003-03-03') and not(f3='2003-03-03'); +explain plan select * from t1 where f1 in('2003-03-03','2003-03-12','2003-03-08') or (f2 between '2003-03-03' and '2003-03-03') and not(f3='2003-03-03'); + diff --git a/test/sql/Optimizer/drop.sql b/test/sql/Optimizer/drop.sql new file mode 100644 index 00000000..3e9ecdb1 --- /dev/null +++ b/test/sql/Optimizer/drop.sql @@ -0,0 +1,3 @@ +drop table t1; +drop table t2; +drop table t3; diff --git a/test/sql/Optimizer/exp.test001.ksh b/test/sql/Optimizer/exp.test001.ksh new file mode 100644 index 00000000..5c834766 --- /dev/null +++ b/test/sql/Optimizer/exp.test001.ksh @@ -0,0 +1,107 @@ +echo No Primary key -Test Case - 1,2,3 +echo select * from t1; + + t1 + TableScan + +echo select * from t1 where f1=10; + + t1 + TableScan + + f1 + Equals + VALUE + + +echo select * from t1 where f1>10; + + t1 + TableScan + + f1 + GreaterThan + VALUE + + +Statement Executed +echo Primary key -Test Case - 4,5,6 +echo select * from t1; + + t1 + TableScan + +echo select * from t1 where f1=10; + + t1 + HashScan + + f1 + Equals + VALUE + + +echo select * from t1 where f1>10; + + t1 + TableScan + + f1 + GreaterThan + VALUE + + +Statement Executed +echo Hash Index -Test Case - 7,8,9 +echo select * from t1; + + t1 + TableScan + +echo select * from t1 where f2=10; + + t1 + HashScan + + f2 + Equals + VALUE + + +echo select * from t1 where f2>10; + + t1 + TableScan + + f2 + GreaterThan + VALUE + + +Statement Executed +echo Tree Index -Test Case - 10,11,12 +echo select * from t1; + + t1 + TableScan + +echo select * from t1 where f3=10; + + t1 + TreeScan + + f3 + Equals + VALUE + + +echo select * from t1 where f2>10; + + t1 + TreeScan + + f3 + GreaterThan + VALUE + + diff --git a/test/sql/Optimizer/exp.test002.ksh b/test/sql/Optimizer/exp.test002.ksh new file mode 100644 index 00000000..b8933eb0 --- /dev/null +++ b/test/sql/Optimizer/exp.test002.ksh @@ -0,0 +1,156 @@ +Statement Executed +Statement Executed +echo Multiple predicates Test Cases - 1,2,3 +echo select * from t1 where f1=10 and f3=20; + + t1 + TableScan + + AND + + + f1 + Equals + VALUE + + + + + f3 + Equals + VALUE + + + + +echo select * from t1 where f2>10 and f3=20; + + t1 + TableScan + + AND + + + f1 + GreaterThan + VALUE + + + + + f3 + Equals + VALUE + + + + +echo select * from t1 where f3=20 and f1 >10; + + t1 + TableScan + + AND + + + f3 + Equals + VALUE + + + + + f1 + GreaterThan + VALUE + + + + +echo Disjunctive Queries Test case - 4,5,6,7,8 +echo select * from t1 where f1!=10; + + t1 + TableScan + + f1 + NotEquals + VALUE + + +echo select * from t1 where f2!=10; + + t1 + TableScan + + f2 + NotEquals + VALUE + + +echo select * from t1 where f1=10 or f3=20; + + t1 + TableScan + + OR + + + f1 + Equals + VALUE + + + + + f3 + Equals + VALUE + + + + +echo select * from t1 where f2>10 or f3=20; + + t1 + TableScan + + OR + + + f2 + GreaterThan + VALUE + + + + + f3 + Equals + VALUE + + + + +echo select * from t1 where f3=20 or f2 >10; + + t1 + TableScan + + OR + + + f3 + Equals + VALUE + + + + + f2 + GreaterThan + VALUE + + + + diff --git a/test/sql/Optimizer/exp.test003.ksh b/test/sql/Optimizer/exp.test003.ksh new file mode 100644 index 00000000..76e40b6f --- /dev/null +++ b/test/sql/Optimizer/exp.test003.ksh @@ -0,0 +1,189 @@ +echo create table t1(f1 tinyint, f2 smallint, f3 int, f4 bigint, f5 char(10), f6 varchar(10), f7 date, f8 time); +Statement Executed +echo create index hashtiny on t1(f1) hash; +Statement Executed +echo create index hashsmall on t1(f2) hash; +Statement Executed +echo create index hashint on t1(f3) hash; +Statement Executed +echo create index hashbig on t1(f4) hash; +Statement Executed +echo create index hashchar on t1(f5) hash; +Statement Executed +echo create index hashvarchar on t1(f6) hash; +Statement Executed +echo create index hashdate on t1(f7) hash; +Statement Executed +echo create index hashtime on t1(f8) hash; +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo explain plan select * from t1; + + t1 + TableScan + +echo explain plan select * from t1 where f1 = 2; + + t1 + HashScan + + f1 + Equals + VALUE + + +echo explain plan select * from t1 where f1 < 3; + + t1 + TableScan + + f1 + LessThan + VALUE + + +echo explain plan select * from t1 where f2 = 22; + + t1 + HashScan + + f2 + Equals + VALUE + + +echo explain plan select * from t1 where f2 > 33; + + t1 + TableScan + + f2 + GreaterThan + VALUE + + +echo explain plan select * from t1 where f3 = 333; + + t1 + HashScan + + f3 + Equals + VALUE + + +echo explain plan select * from t1 where f3 <> 333; + + t1 + TableScan + + f3 + NotEquals + VALUE + + +echo explain plan select * from t1 where f4 = 4444; + + t1 + HashScan + + f4 + Equals + VALUE + + +echo explain plan select * from t1 where f4 != 4444; + + t1 + TableScan + + f4 + NotEquals + VALUE + + +echo explain plan select * from t1 where f5 = 'CSQL3'; + + t1 + HashScan + + f5 + Equals + VALUE + + +echo explain plan select * from t1 where f5 <= 'CSQL3'; + + t1 + TableScan + + f5 + LessThanEquals + VALUE + + +echo explain plan select * from t1 where f6 = 'Lakshya3'; + + t1 + HashScan + + f6 + Equals + VALUE + + +echo explain plan select * from t1 where f6 >= 'Lakshya3'; + + t1 + TableScan + + f6 + GreaterThanEquals + VALUE + + +echo explain plan select * from t1 where f7 = '2003-11-12'; + + t1 + HashScan + + f7 + Equals + VALUE + + +echo explain plan select * from t1 where f7 > '2003-11-12'; + + t1 + TableScan + + f7 + GreaterThan + VALUE + + +echo explain plan select * from t1 where f8 = '03:21:00'; + + t1 + HashScan + + f8 + Equals + VALUE + + +echo explain plan select * from t1 where f8 < '03:21:00'; + + t1 + TableScan + + f8 + LessThan + VALUE + + +Statement Executed diff --git a/test/sql/Optimizer/exp.test004.ksh b/test/sql/Optimizer/exp.test004.ksh new file mode 100644 index 00000000..148402ae --- /dev/null +++ b/test/sql/Optimizer/exp.test004.ksh @@ -0,0 +1,189 @@ +echo create table t1(f1 tinyint, f2 smallint, f3 int, f4 bigint, f5 char(10), f6 varchar(10), f7 date, f8 time); +Statement Executed +echo create index treetiny on t1(f1) tree; +Statement Executed +echo create index treesmall on t1(f2) tree; +Statement Executed +echo create index treeint on t1(f3) tree; +Statement Executed +echo create index treebig on t1(f4) tree; +Statement Executed +echo create index treechar on t1(f5) tree; +Statement Executed +echo create index treevarchar on t1(f6) tree; +Statement Executed +echo create index treedate on t1(f7) tree; +Statement Executed +echo create index treetime on t1(f8) tree; +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo explain plan select * from t1; + + t1 + TableScan + +echo explain plan select * from t1 where f1 = 2; + + t1 + TreeScan + + f1 + Equals + VALUE + + +echo explain plan select * from t1 where f1 < 3; + + t1 + TreeScan + + f1 + LessThan + VALUE + + +echo explain plan select * from t1 where f2 = 22; + + t1 + TreeScan + + f2 + Equals + VALUE + + +echo explain plan select * from t1 where f2 > 33; + + t1 + TreeScan + + f2 + GreaterThan + VALUE + + +echo explain plan select * from t1 where f3 = 333; + + t1 + TreeScan + + f3 + Equals + VALUE + + +echo explain plan select * from t1 where f3 <> 333; + + t1 + TableScan + + f3 + NotEquals + VALUE + + +echo explain plan select * from t1 where f4 = 4444; + + t1 + TreeScan + + f4 + Equals + VALUE + + +echo explain plan select * from t1 where f4 != 4444; + + t1 + TableScan + + f4 + NotEquals + VALUE + + +echo explain plan select * from t1 where f5 = 'CSQL3'; + + t1 + TreeScan + + f5 + Equals + VALUE + + +echo explain plan select * from t1 where f5 <= 'CSQL3'; + + t1 + TreeScan + + f5 + LessThanEquals + VALUE + + +echo explain plan select * from t1 where f6 = 'Lakshya3'; + + t1 + TreeScan + + f6 + Equals + VALUE + + +echo explain plan select * from t1 where f6 >= 'Lakshya3'; + + t1 + TreeScan + + f6 + GreaterThanEquals + VALUE + + +echo explain plan select * from t1 where f7 = '2003-11-12'; + + t1 + TreeScan + + f7 + Equals + VALUE + + +echo explain plan select * from t1 where f7 > '2003-11-12'; + + t1 + TreeScan + + f7 + GreaterThan + VALUE + + +echo explain plan select * from t1 where f8 = '03:21:00'; + + t1 + TreeScan + + f8 + Equals + VALUE + + +echo explain plan select * from t1 where f8 < '03:21:00'; + + t1 + TreeScan + + f8 + LessThan + VALUE + + +Statement Executed diff --git a/test/sql/Optimizer/exp.test005.ksh b/test/sql/Optimizer/exp.test005.ksh new file mode 100644 index 00000000..bd834773 --- /dev/null +++ b/test/sql/Optimizer/exp.test005.ksh @@ -0,0 +1,336 @@ +echo create table t1(f1 tinyint, f2 smallint, f3 int, f4 bigint, f5 char(10), f6 varchar(10), f7 date, f8 time); +Statement Executed +echo create index hashtiny on t1(f1) hash; +Statement Executed +echo create index hashsmall on t1(f2) hash; +Statement Executed +echo create index hashint on t1(f3) hash; +Statement Executed +echo create index hashbig on t1(f4) hash; +Statement Executed +echo create index hashchar on t1(f5) hash; +Statement Executed +echo create index hashvarchar on t1(f6) hash; +Statement Executed +echo create index hashdate on t1(f7) hash; +Statement Executed +echo create index hashtime on t1(f8) hash; +Statement Executed +echo explain plan select * from t1; + + t1 + TableScan + +echo explain plan select * from t1 where f1 in (0,2,4); + + t1 + TableScan + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f1 + Equals + VALUE + + + + + + + f1 + Equals + VALUE + + + + +echo explain plan select * from t1 where f1 between 2 and 4; + + t1 + TableScan + + f1 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + +echo explain plan select * from t1 where f2 in (0,2,4); + + t1 + TableScan + + OR + + + OR + + + f2 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + + + + f2 + Equals + VALUE + + + + +echo explain plan select * from t1 where f2 between 2 and 4; + + t1 + TableScan + + f2 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + +echo explain plan select * from t1 where f3 in (1,2); + + t1 + TableScan + + OR + + + f3 + Equals + VALUE + + + + + f3 + Equals + VALUE + + + + +echo explain plan select * from t1 where f3 between 1 and 4; + + t1 + TableScan + + f3 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + +echo explain plan select * from t1 where f4 in (1,2); + + t1 + TableScan + + OR + + + f4 + Equals + VALUE + + + + + f4 + Equals + VALUE + + + + +echo explain plan select * from t1 where f4 between 1 and 4; + + t1 + TableScan + + f4 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + +echo explain plan select * from t1 where f5 in ('1','2'); + + t1 + TableScan + + OR + + + f5 + Equals + VALUE + + + + + f5 + Equals + VALUE + + + + +echo explain plan select * from t1 where f5 like 'N%'; + + t1 + TableScan + + f5 + Like + VALUE + + +echo explain plan select * from t1 where f5 like 'N_h'; + + t1 + TableScan + + f5 + Like + VALUE + + +echo explain plan select * from t1 where f6 in ('1','2'); + + t1 + TableScan + + OR + + + f6 + Equals + VALUE + + + + + f6 + Equals + VALUE + + + + +echo explain plan select * from t1 where f6 like 'N%'; + + t1 + TableScan + + f6 + Like + VALUE + + +echo explain plan select * from t1 where f6 like 'N_h'; + + t1 + TableScan + + f6 + Like + VALUE + + +echo explain plan select * from t1 where f7 in ('2003-11-12','2003-11-15'); + + t1 + TableScan + + OR + + + f7 + Equals + VALUE + + + + + f7 + Equals + VALUE + + + + +echo explain plan select * from t1 where f7 between '2003-11-12' and '2003-11-15'; + + t1 + TableScan + + f7 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + +echo explain plan select * from t1 where f8 in ('03:21:00','03:21:08'); + + t1 + TableScan + + OR + + + f8 + Equals + VALUE + + + + + f8 + Equals + VALUE + + + + +echo explain plan select * from t1 where f8 between '03:21:00' and '03:21:08'; + + t1 + TableScan + + f8 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + +Statement Executed diff --git a/test/sql/Optimizer/exp.test006.ksh b/test/sql/Optimizer/exp.test006.ksh new file mode 100644 index 00000000..e958e7b0 --- /dev/null +++ b/test/sql/Optimizer/exp.test006.ksh @@ -0,0 +1,444 @@ +echo create table t1(f1 tinyint, f2 smallint, f3 int, f4 bigint, f5 char(10), f6 varchar(10), f7 date, f8 time, f9 float, f10 double, f11 timestamp); +Statement Executed +echo create index treetiny on t1(f1) tree; +Statement Executed +echo create index treesmall on t1(f2) tree; +Statement Executed +echo create index treeint on t1(f3) tree; +Statement Executed +echo create index treebig on t1(f4) tree; +Statement Executed +echo create index treechar on t1(f5) tree; +Statement Executed +echo create index treevarchar on t1(f6) tree; +Statement Executed +echo create index treedate on t1(f7) tree; +Statement Executed +echo create index treetime on t1(f8) tree; +Statement Executed +echo create index treefloat on t1(f9) tree; +Statement Executed +echo create index treedouble on t1(f10) tree; +Statement Executed +echo create index treetimestamp on t1(f11) tree; +Statement Executed +echo explain plan select * from t1; + + t1 + TableScan + +echo explain plan select * from t1 where f1 in (0,2,4); + + t1 + TableScan + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f1 + Equals + VALUE + + + + + + + f1 + Equals + VALUE + + + + +echo explain plan select * from t1 where f1 between 2 and 4; + + t1 + TreeScan + + f1 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + +echo explain plan select * from t1 where f2 in (0,2,4); + + t1 + TableScan + + OR + + + OR + + + f2 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + + + + f2 + Equals + VALUE + + + + +echo explain plan select * from t1 where f2 between 2 and 4; + + t1 + TreeScan + + f2 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + +echo explain plan select * from t1 where f3 in (1,2); + + t1 + TableScan + + OR + + + f3 + Equals + VALUE + + + + + f3 + Equals + VALUE + + + + +echo explain plan select * from t1 where f3 between 1 and 4; + + t1 + TreeScan + + f3 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + +echo explain plan select * from t1 where f4 in (1,2); + + t1 + TableScan + + OR + + + f4 + Equals + VALUE + + + + + f4 + Equals + VALUE + + + + +echo explain plan select * from t1 where f4 between 1 and 4; + + t1 + TreeScan + + f4 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + +echo explain plan select * from t1 where f5 in ('1','2'); + + t1 + TableScan + + OR + + + f5 + Equals + VALUE + + + + + f5 + Equals + VALUE + + + + +echo explain plan select * from t1 where f5 like 'N%'; + + t1 + TableScan + + f5 + Like + VALUE + + +echo explain plan select * from t1 where f5 like 'N_h'; + + t1 + TableScan + + f5 + Like + VALUE + + +echo explain plan select * from t1 where f6 in ('1','2'); + + t1 + TableScan + + OR + + + f6 + Equals + VALUE + + + + + f6 + Equals + VALUE + + + + +echo explain plan select * from t1 where f6 like 'N%'; + + t1 + TableScan + + f6 + Like + VALUE + + +echo explain plan select * from t1 where f6 like 'N_h'; + + t1 + TableScan + + f6 + Like + VALUE + + +echo explain plan select * from t1 where f7 in ('2003-11-12','2003-11-15'); + + t1 + TableScan + + OR + + + f7 + Equals + VALUE + + + + + f7 + Equals + VALUE + + + + +echo explain plan select * from t1 where f7 between '2003-11-12' and '2003-11-15'; + + t1 + TreeScan + + f7 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + +echo explain plan select * from t1 where f8 in ('03:21:00','03:21:08'); + + t1 + TableScan + + OR + + + f8 + Equals + VALUE + + + + + f8 + Equals + VALUE + + + + +echo explain plan select * from t1 where f8 between '03:21:00' and '03:21:08'; + + t1 + TreeScan + + f8 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + +echo explain plan select * from t1 where f9 in ('2.7','3.7'); + + t1 + TableScan + + OR + + + f9 + Equals + VALUE + + + + + f9 + Equals + VALUE + + + + +echo explain plan select * from t1 where f9 between '2.7' and '3.7'; + + t1 + TreeScan + + f9 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + +echo explain plan select * from t1 where f10 in ('2.7','3.7'); + + t1 + TableScan + + OR + + + f10 + Equals + VALUE + + + + + f10 + Equals + VALUE + + + + +echo explain plan select * from t1 where f10 between '2.7' and '3.7'; + + t1 + TreeScan + + f10 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + +echo explain plan select * from t1 where f11 in ('2003-11-12 01:01:01','2003-11-18 01:01:01'); + + t1 + TableScan + + OR + + + f11 + Equals + VALUE + + + + + f11 + Equals + VALUE + + + + +echo explain plan select * from t1 where f11 between '2003-11-12 01:01:01' and '2003-11-18 01:01:01'; + + t1 + TreeScan + + f11 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + +Statement Executed diff --git a/test/sql/Optimizer/exp.test007.ksh b/test/sql/Optimizer/exp.test007.ksh new file mode 100644 index 00000000..192d1abb --- /dev/null +++ b/test/sql/Optimizer/exp.test007.ksh @@ -0,0 +1,552 @@ +echo create table t1(f1 tinyint, f2 smallint, f3 int, f4 bigint, f5 char(10), f6 varchar(10), f7 date, f8 time); +Statement Executed +echo create index hashtiny on t1(f1) hash; +Statement Executed +echo create index hashsmall on t1(f2) hash; +Statement Executed +echo create index hashint on t1(f3) hash; +Statement Executed +echo create index hashbig on t1(f4) hash; +Statement Executed +echo create index hashchar on t1(f5) hash; +Statement Executed +echo create index hashvarchar on t1(f6) hash; +Statement Executed +echo create index hashdate on t1(f7) hash; +Statement Executed +echo create index hashtime on t1(f8) hash; +Statement Executed +echo explain plan select * from t1; + + t1 + TableScan + +echo explain plan select * from t1 where f1 = 2 and f1 in (0,2,4) ; + + t1 + TableScan + + AND + + + f1 + Equals + VALUE + + + + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f1 + Equals + VALUE + + + + + + + f1 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f1 = 3 or (f1 between 2 and 4); + + t1 + TableScan + + OR + + + f1 + Equals + VALUE + + + + + f1 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + + + +echo explain plan select * from t1 where f2 in (0,2,4) and f2 = 2; + + t1 + TableScan + + AND + + + OR + + + OR + + + f2 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + + + + f2 + Equals + VALUE + + + + + + + f2 + Equals + VALUE + + + + +echo explain plan select * from t1 where (f2 between 2 and 4) or f2 = 2; + + t1 + TableScan + + OR + + + f2 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + + + + f2 + Equals + VALUE + + + + +echo explain plan select * from t1 where f3 = 2 or f3 in (1,2) ; + + t1 + TableScan + + OR + + + f3 + Equals + VALUE + + + + + OR + + + f3 + Equals + VALUE + + + + + f3 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f3 = 2 and f3 between 1 and 4; + + t1 + HashScan + + AND + + + f3 + Equals + VALUE + + + + + f3 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + + + +echo explain plan select * from t1 where f4 in (1,2) or f4 = 2; + + t1 + TableScan + + OR + + + OR + + + f4 + Equals + VALUE + + + + + f4 + Equals + VALUE + + + + + + + f4 + Equals + VALUE + + + + +echo explain plan select * from t1 where (f4 between 1 and 4) and f4 = 2; + + t1 + HashScan + + AND + + + f4 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + + + + f4 + Equals + VALUE + + + + +echo explain plan select * from t1 where f5 in ('1','2') and f5 = '1'; + + t1 + TableScan + + AND + + + OR + + + f5 + Equals + VALUE + + + + + f5 + Equals + VALUE + + + + + + + f5 + Equals + VALUE + + + + +echo explain plan select * from t1 where f5 like 'N%' or f5 = 'NP'; + + t1 + TableScan + + OR + + + f5 + Like + VALUE + + + + + f5 + Equals + VALUE + + + + +echo explain plan select * from t1 where f5 like 'N_h' and f6 = 'Nihar'; + + t1 + HashScan + + AND + + + f5 + Like + VALUE + + + + + f6 + Equals + VALUE + + + + +echo explain plan select * from t1 where f6 = '1' or f6 in ('1','2'); + + t1 + TableScan + + OR + + + f6 + Equals + VALUE + + + + + OR + + + f6 + Equals + VALUE + + + + + f6 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f6 = 'NP' or f6 like 'N%'; + + t1 + TableScan + + OR + + + f6 + Equals + VALUE + + + + + f6 + Like + VALUE + + + + +echo explain plan select * from t1 where f6 like 'N_h' and f6 = 'NIHAR'; + + t1 + HashScan + + AND + + + f6 + Like + VALUE + + + + + f6 + Equals + VALUE + + + + +echo explain plan select * from t1 where f7 = '2003-11-12' or f7 in ('2003-11-12','2003-11-15'); + + t1 + TableScan + + OR + + + f7 + Equals + VALUE + + + + + OR + + + f7 + Equals + VALUE + + + + + f7 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f7 = '2003-11-15' and (f7 between '2003-11-12' and '2003-11-15'); + + t1 + HashScan + + AND + + + f7 + Equals + VALUE + + + + + f7 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + + + +echo explain plan select * from t1 where f8 in ('03:21:00','03:21:08') and f8 = '03:21:08'; + + t1 + TableScan + + AND + + + OR + + + f8 + Equals + VALUE + + + + + f8 + Equals + VALUE + + + + + + + f8 + Equals + VALUE + + + + +echo explain plan select * from t1 where (f8 between '03:21:00' and '03:21:08') or f8='03:21:00'; + + t1 + TableScan + + OR + + + f8 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + + + + f8 + Equals + VALUE + + + + +Statement Executed diff --git a/test/sql/Optimizer/exp.test008.ksh b/test/sql/Optimizer/exp.test008.ksh new file mode 100644 index 00000000..e713a71e --- /dev/null +++ b/test/sql/Optimizer/exp.test008.ksh @@ -0,0 +1,441 @@ +echo create table t1(f1 tinyint, f2 tinyint, f3 tinyint, f4 tinyint); +Statement Executed +echo create index hashtinyf1f2f3 on t1(f2,f3,f1) hash; +Statement Executed +echo explain plan select * from t1; + + t1 + TableScan + +echo explain plan select * from t1 where f1 = 2; + + t1 + TableScan + + f1 + Equals + VALUE + + +echo explain plan select * from t1 where f1 = 2 and f2=2; + + t1 + TableScan + + AND + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + +echo explain plan select * from t1 where f1 = 2 and f2=2 and f3=2; + + t1 + TableScan + + AND + + + AND + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + + + + f3 + Equals + VALUE + + + + +echo explain plan select * from t1 where f1 = 2 or f2=2 or f3=2; + + t1 + TableScan + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + + + + f3 + Equals + VALUE + + + + +echo explain plan select * from t1 where f1 = 2 and f2=2 or f3=2; + + t1 + TableScan + + OR + + + AND + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + + + + f3 + Equals + VALUE + + + + +echo explain plan select * from t1 where f1 = 2 and f2=2 and not(f3=2); + + t1 + TableScan + + AND + + + AND + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + + + + NOT + + + f3 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f1 in(1,2,3) and f2=2 and not(f3=2); + + t1 + TableScan + + AND + + + AND + + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f1 + Equals + VALUE + + + + + + + f1 + Equals + VALUE + + + + + + + f2 + Equals + VALUE + + + + + + + NOT + + + f3 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f1 in(1,2,3) and (f2 between 2 and 4) and not(f3=2); + + t1 + TableScan + + AND + + + AND + + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f1 + Equals + VALUE + + + + + + + f1 + Equals + VALUE + + + + + + + f2 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + + + + + + NOT + + + f3 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f1 in(1,2,3) or (f2 between 2 and 4) or not(f3=2); + + t1 + TableScan + + OR + + + OR + + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f1 + Equals + VALUE + + + + + + + f1 + Equals + VALUE + + + + + + + f2 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + + + + + + NOT + + + f3 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f1 in(1,2,3) or (f2 between 2 and 4) and not(f3=2); + + t1 + TableScan + + OR + + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f1 + Equals + VALUE + + + + + + + f1 + Equals + VALUE + + + + + + + AND + + + f2 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + + + + NOT + + + f3 + Equals + VALUE + + + + + + + + +Statement Executed diff --git a/test/sql/Optimizer/exp.test009.ksh b/test/sql/Optimizer/exp.test009.ksh new file mode 100644 index 00000000..ce6f169b --- /dev/null +++ b/test/sql/Optimizer/exp.test009.ksh @@ -0,0 +1,441 @@ +echo create table t1(f1 smallint, f2 smallint, f3 smallint, f4 smallint); +Statement Executed +echo create index hashsmallf1f2f3 on t1(f2,f3,f1) hash; +Statement Executed +echo explain plan select * from t1; + + t1 + TableScan + +echo explain plan select * from t1 where f1 = 2; + + t1 + TableScan + + f1 + Equals + VALUE + + +echo explain plan select * from t1 where f1 = 2 and f2=2; + + t1 + TableScan + + AND + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + +echo explain plan select * from t1 where f1 = 2 and f2=2 and f3=2; + + t1 + TableScan + + AND + + + AND + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + + + + f3 + Equals + VALUE + + + + +echo explain plan select * from t1 where f1 = 2 or f2=2 or f3=2; + + t1 + TableScan + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + + + + f3 + Equals + VALUE + + + + +echo explain plan select * from t1 where f1 = 2 and f2=2 or f3=2; + + t1 + TableScan + + OR + + + AND + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + + + + f3 + Equals + VALUE + + + + +echo explain plan select * from t1 where f1 = 2 and f2=2 and not(f3=2); + + t1 + TableScan + + AND + + + AND + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + + + + NOT + + + f3 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f1 in(1,2,3) and f2=2 and not(f3=2); + + t1 + TableScan + + AND + + + AND + + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f1 + Equals + VALUE + + + + + + + f1 + Equals + VALUE + + + + + + + f2 + Equals + VALUE + + + + + + + NOT + + + f3 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f1 in(1,2,3) and (f2 between 2 and 4) and not(f3=2); + + t1 + TableScan + + AND + + + AND + + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f1 + Equals + VALUE + + + + + + + f1 + Equals + VALUE + + + + + + + f2 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + + + + + + NOT + + + f3 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f1 in(1,2,3) or (f2 between 2 and 4) or not(f3=2); + + t1 + TableScan + + OR + + + OR + + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f1 + Equals + VALUE + + + + + + + f1 + Equals + VALUE + + + + + + + f2 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + + + + + + NOT + + + f3 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f1 in(1,2,3) or (f2 between 2 and 4) and not(f3=2); + + t1 + TableScan + + OR + + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f1 + Equals + VALUE + + + + + + + f1 + Equals + VALUE + + + + + + + AND + + + f2 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + + + + NOT + + + f3 + Equals + VALUE + + + + + + + + +Statement Executed diff --git a/test/sql/Optimizer/exp.test010.ksh b/test/sql/Optimizer/exp.test010.ksh new file mode 100644 index 00000000..8e283eba --- /dev/null +++ b/test/sql/Optimizer/exp.test010.ksh @@ -0,0 +1,441 @@ +echo create table t1(f1 int, f2 int, f3 int, f4 int); +Statement Executed +echo create index hashintf1f2f3 on t1(f2,f3,f1) hash; +Statement Executed +echo explain plan select * from t1; + + t1 + TableScan + +echo explain plan select * from t1 where f1 = 2; + + t1 + TableScan + + f1 + Equals + VALUE + + +echo explain plan select * from t1 where f1 = 2 and f2=2; + + t1 + TableScan + + AND + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + +echo explain plan select * from t1 where f1 = 2 and f2=2 and f3=2; + + t1 + TableScan + + AND + + + AND + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + + + + f3 + Equals + VALUE + + + + +echo explain plan select * from t1 where f1 = 2 or f2=2 or f3=2; + + t1 + TableScan + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + + + + f3 + Equals + VALUE + + + + +echo explain plan select * from t1 where f1 = 2 and f2=2 or f3=2; + + t1 + TableScan + + OR + + + AND + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + + + + f3 + Equals + VALUE + + + + +echo explain plan select * from t1 where f1 = 2 and f2=2 and not(f3=2); + + t1 + TableScan + + AND + + + AND + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + + + + NOT + + + f3 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f1 in(1,2,3) and f2=2 and not(f3=2); + + t1 + TableScan + + AND + + + AND + + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f1 + Equals + VALUE + + + + + + + f1 + Equals + VALUE + + + + + + + f2 + Equals + VALUE + + + + + + + NOT + + + f3 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f1 in(1,2,3) and (f2 between 2 and 4) and not(f3=2); + + t1 + TableScan + + AND + + + AND + + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f1 + Equals + VALUE + + + + + + + f1 + Equals + VALUE + + + + + + + f2 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + + + + + + NOT + + + f3 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f1 in(1,2,3) or (f2 between 2 and 4) or not(f3=2); + + t1 + TableScan + + OR + + + OR + + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f1 + Equals + VALUE + + + + + + + f1 + Equals + VALUE + + + + + + + f2 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + + + + + + NOT + + + f3 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f1 in(1,2,3) or (f2 between 2 and 4) and not(f3=2); + + t1 + TableScan + + OR + + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f1 + Equals + VALUE + + + + + + + f1 + Equals + VALUE + + + + + + + AND + + + f2 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + + + + NOT + + + f3 + Equals + VALUE + + + + + + + + +Statement Executed diff --git a/test/sql/Optimizer/exp.test011.ksh b/test/sql/Optimizer/exp.test011.ksh new file mode 100644 index 00000000..578452db --- /dev/null +++ b/test/sql/Optimizer/exp.test011.ksh @@ -0,0 +1,441 @@ +echo create table t1(f1 bigint, f2 bigint, f3 bigint, f4 bigint); +Statement Executed +echo create index hashbigf1f2f3 on t1(f2,f3,f1) hash; +Statement Executed +echo explain plan select * from t1; + + t1 + TableScan + +echo explain plan select * from t1 where f1 = 2; + + t1 + TableScan + + f1 + Equals + VALUE + + +echo explain plan select * from t1 where f1 = 2 and f2=2; + + t1 + TableScan + + AND + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + +echo explain plan select * from t1 where f1 = 2 and f2=2 and f3=2; + + t1 + TableScan + + AND + + + AND + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + + + + f3 + Equals + VALUE + + + + +echo explain plan select * from t1 where f1 = 2 or f2=2 or f3=2; + + t1 + TableScan + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + + + + f3 + Equals + VALUE + + + + +echo explain plan select * from t1 where f1 = 2 and f2=2 or f3=2; + + t1 + TableScan + + OR + + + AND + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + + + + f3 + Equals + VALUE + + + + +echo explain plan select * from t1 where f1 = 2 and f2=2 and not(f3=2); + + t1 + TableScan + + AND + + + AND + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + + + + NOT + + + f3 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f1 in(1,2,3) and f2=2 and not(f3=2); + + t1 + TableScan + + AND + + + AND + + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f1 + Equals + VALUE + + + + + + + f1 + Equals + VALUE + + + + + + + f2 + Equals + VALUE + + + + + + + NOT + + + f3 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f1 in(1,2,3) and (f2 between 2 and 4) and not(f3=2); + + t1 + TableScan + + AND + + + AND + + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f1 + Equals + VALUE + + + + + + + f1 + Equals + VALUE + + + + + + + f2 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + + + + + + NOT + + + f3 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f1 in(1,2,3) or (f2 between 2 and 4) or not(f3=2); + + t1 + TableScan + + OR + + + OR + + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f1 + Equals + VALUE + + + + + + + f1 + Equals + VALUE + + + + + + + f2 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + + + + + + NOT + + + f3 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f1 in(1,2,3) or (f2 between 2 and 4) and not(f3=2); + + t1 + TableScan + + OR + + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f1 + Equals + VALUE + + + + + + + f1 + Equals + VALUE + + + + + + + AND + + + f2 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + + + + NOT + + + f3 + Equals + VALUE + + + + + + + + +Statement Executed diff --git a/test/sql/Optimizer/exp.test012.ksh b/test/sql/Optimizer/exp.test012.ksh new file mode 100644 index 00000000..8599e3a8 --- /dev/null +++ b/test/sql/Optimizer/exp.test012.ksh @@ -0,0 +1,435 @@ +echo create table t1(f1 char, f2 char, f3 char, f4 char); +Statement Executed +echo create index hashcharf1f2f3 on t1(f2,f3,f1) hash; +Statement Executed +echo explain plan select * from t1; + + t1 + TableScan + +echo explain plan select * from t1 where f1 = 'a'; + + t1 + TableScan + + f1 + Equals + VALUE + + +echo explain plan select * from t1 where f1 = 'a' and f2='a'; + + t1 + TableScan + + AND + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + +echo explain plan select * from t1 where f1 = 'a' and f2='a' and f3='a'; + + t1 + TableScan + + AND + + + AND + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + + + + f3 + Equals + VALUE + + + + +echo explain plan select * from t1 where f1 = 'a' or f2='a' or f3='a'; + + t1 + TableScan + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + + + + f3 + Equals + VALUE + + + + +echo explain plan select * from t1 where f1 = 'a' and f2='a' or f3='a'; + + t1 + TableScan + + OR + + + AND + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + + + + f3 + Equals + VALUE + + + + +echo explain plan select * from t1 where f1 = 'a' and f2='a' and not(f3='a'); + + t1 + TableScan + + AND + + + AND + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + + + + NOT + + + f3 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f1 in('a','a','a') and f2='a' and not(f3='a'); + + t1 + TableScan + + AND + + + AND + + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f1 + Equals + VALUE + + + + + + + f1 + Equals + VALUE + + + + + + + f2 + Equals + VALUE + + + + + + + NOT + + + f3 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f1 in('a','b','c') and f2 like 'a%' and not(f3='d'); + + t1 + TableScan + + AND + + + AND + + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f1 + Equals + VALUE + + + + + + + f1 + Equals + VALUE + + + + + + + f2 + Like + VALUE + + + + + + + NOT + + + f3 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f1 in('b','c','a') or f2 like 'a%' or not(f3='d'); + + t1 + TableScan + + OR + + + OR + + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f1 + Equals + VALUE + + + + + + + f1 + Equals + VALUE + + + + + + + f2 + Like + VALUE + + + + + + + NOT + + + f3 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f1 in('a','c','b') or f2 like 'a%' and not(f3='d'); + + t1 + TableScan + + OR + + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f1 + Equals + VALUE + + + + + + + f1 + Equals + VALUE + + + + + + + AND + + + f2 + Like + VALUE + + + + + NOT + + + f3 + Equals + VALUE + + + + + + + + +Statement Executed diff --git a/test/sql/Optimizer/exp.test013.ksh b/test/sql/Optimizer/exp.test013.ksh new file mode 100644 index 00000000..1b650cda --- /dev/null +++ b/test/sql/Optimizer/exp.test013.ksh @@ -0,0 +1,435 @@ +echo create table t1(f1 varchar, f2 varchar, f3 varchar, f4 varchar); +Statement Executed +echo create index hashvarcharf1f2f3 on t1(f2,f3,f1) hash; +Statement Executed +echo explain plan select * from t1; + + t1 + TableScan + +echo explain plan select * from t1 where f1 = 'a'; + + t1 + TableScan + + f1 + Equals + VALUE + + +echo explain plan select * from t1 where f1 = 'a' and f2='a'; + + t1 + TableScan + + AND + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + +echo explain plan select * from t1 where f1 = 'a' and f2='a' and f3='a'; + + t1 + TableScan + + AND + + + AND + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + + + + f3 + Equals + VALUE + + + + +echo explain plan select * from t1 where f1 = 'a' or f2='a' or f3='a'; + + t1 + TableScan + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + + + + f3 + Equals + VALUE + + + + +echo explain plan select * from t1 where f1 = 'a' and f2='a' or f3='a'; + + t1 + TableScan + + OR + + + AND + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + + + + f3 + Equals + VALUE + + + + +echo explain plan select * from t1 where f1 = 'a' and f2='a' and not(f3='a'); + + t1 + TableScan + + AND + + + AND + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + + + + NOT + + + f3 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f1 in('a','a','a') and f2='a' and not(f3='a'); + + t1 + TableScan + + AND + + + AND + + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f1 + Equals + VALUE + + + + + + + f1 + Equals + VALUE + + + + + + + f2 + Equals + VALUE + + + + + + + NOT + + + f3 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f1 in('a','b','c') and f2 like 'a%' and not(f3='d'); + + t1 + TableScan + + AND + + + AND + + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f1 + Equals + VALUE + + + + + + + f1 + Equals + VALUE + + + + + + + f2 + Like + VALUE + + + + + + + NOT + + + f3 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f1 in('b','c','a') or f2 like 'a%' or not(f3='d'); + + t1 + TableScan + + OR + + + OR + + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f1 + Equals + VALUE + + + + + + + f1 + Equals + VALUE + + + + + + + f2 + Like + VALUE + + + + + + + NOT + + + f3 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f1 in('a','c','b') or f2 like 'a%' and not(f3='d'); + + t1 + TableScan + + OR + + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f1 + Equals + VALUE + + + + + + + f1 + Equals + VALUE + + + + + + + AND + + + f2 + Like + VALUE + + + + + NOT + + + f3 + Equals + VALUE + + + + + + + + +Statement Executed diff --git a/test/sql/Optimizer/exp.test014.ksh b/test/sql/Optimizer/exp.test014.ksh new file mode 100644 index 00000000..fe3704b9 --- /dev/null +++ b/test/sql/Optimizer/exp.test014.ksh @@ -0,0 +1,441 @@ +echo create table t1(f1 date, f2 date, f3 date, f4 date); +Statement Executed +echo create index hashdatef1f2f3 on t1(f2,f3,f1) hash; +Statement Executed +echo explain plan select * from t1; + + t1 + TableScan + +echo explain plan select * from t1 where f1 = '2003-03-03'; + + t1 + TableScan + + f1 + Equals + VALUE + + +echo explain plan select * from t1 where f1 = '2003-03-03' and f2='2003-03-03'; + + t1 + TableScan + + AND + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + +echo explain plan select * from t1 where f1 = '2003-03-03' and f2='2003-03-03' and f3='2003-03-03'; + + t1 + TableScan + + AND + + + AND + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + + + + f3 + Equals + VALUE + + + + +echo explain plan select * from t1 where f1 = '2003-03-03' or f2='2003-03-03' or f3='2003-03-03'; + + t1 + TableScan + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + + + + f3 + Equals + VALUE + + + + +echo explain plan select * from t1 where f1 = '2003-03-03' and f2='2003-03-03' or f3='2003-03-03'; + + t1 + TableScan + + OR + + + AND + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + + + + f3 + Equals + VALUE + + + + +echo explain plan select * from t1 where f1 = '2003-03-03' and f2='2003-03-03' and not(f3='2003-03-03'); + + t1 + TableScan + + AND + + + AND + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + + + + NOT + + + f3 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f1 in('2003-03-03','2003-03-03','2003-03-03') and f2='2003-03-03' and not(f3='2003-03-03'); + + t1 + TableScan + + AND + + + AND + + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f1 + Equals + VALUE + + + + + + + f1 + Equals + VALUE + + + + + + + f2 + Equals + VALUE + + + + + + + NOT + + + f3 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f1 in('2003-03-03','2003-03-08','2003-03-12') and (f2 between '2003-03-03' and '2003-03-03') and not(f3='2003-03-03'); + + t1 + TableScan + + AND + + + AND + + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f1 + Equals + VALUE + + + + + + + f1 + Equals + VALUE + + + + + + + f2 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + + + + + + NOT + + + f3 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f1 in('2003-03-08','2003-03-12','2003-03-03') or (f2 between '2003-03-03' and '2003-03-03') or not(f3='2003-03-03'); + + t1 + TableScan + + OR + + + OR + + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f1 + Equals + VALUE + + + + + + + f1 + Equals + VALUE + + + + + + + f2 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + + + + + + NOT + + + f3 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f1 in('2003-03-03','2003-03-12','2003-03-08') or (f2 between '2003-03-03' and '2003-03-03') and not(f3='2003-03-03'); + + t1 + TableScan + + OR + + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f1 + Equals + VALUE + + + + + + + f1 + Equals + VALUE + + + + + + + AND + + + f2 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + + + + NOT + + + f3 + Equals + VALUE + + + + + + + + +Statement Executed diff --git a/test/sql/Optimizer/exp.test015.ksh b/test/sql/Optimizer/exp.test015.ksh new file mode 100644 index 00000000..2746102c --- /dev/null +++ b/test/sql/Optimizer/exp.test015.ksh @@ -0,0 +1,441 @@ +echo create table t1(f1 time, f2 time, f3 time, f4 time); +Statement Executed +echo create index hashtimef1f2f3 on t1(f2,f3,f1) hash; +Statement Executed +echo explain plan select * from t1; + + t1 + TableScan + +echo explain plan select * from t1 where f1 = '03:03:03'; + + t1 + TableScan + + f1 + Equals + VALUE + + +echo explain plan select * from t1 where f1 = '03:03:03' and f2='03:03:03'; + + t1 + TableScan + + AND + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + +echo explain plan select * from t1 where f1 = '03:03:03' and f2='03:03:03' and f3='03:03:03'; + + t1 + TableScan + + AND + + + AND + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + + + + f3 + Equals + VALUE + + + + +echo explain plan select * from t1 where f1 = '03:03:03' or f2='03:03:03' or f3='03:03:03'; + + t1 + TableScan + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + + + + f3 + Equals + VALUE + + + + +echo explain plan select * from t1 where f1 = '03:03:03' and f2='03:03:03' or f3='03:03:03'; + + t1 + TableScan + + OR + + + AND + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + + + + f3 + Equals + VALUE + + + + +echo explain plan select * from t1 where f1 = '03:03:03' and f2='03:03:03' and not(f3='03:03:03'); + + t1 + TableScan + + AND + + + AND + + + f1 + Equals + VALUE + + + + + f2 + Equals + VALUE + + + + + + + NOT + + + f3 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f1 in('03:03:03','03:03:03','03:03:03') and f2='03:03:03' and not(f3='03:03:03'); + + t1 + TableScan + + AND + + + AND + + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f1 + Equals + VALUE + + + + + + + f1 + Equals + VALUE + + + + + + + f2 + Equals + VALUE + + + + + + + NOT + + + f3 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f1 in('03:03:03','05:05:05','06:06:06') and (f2 between '03:03:03' and '03:03:03') and not(f3='03:03:03'); + + t1 + TableScan + + AND + + + AND + + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f1 + Equals + VALUE + + + + + + + f1 + Equals + VALUE + + + + + + + f2 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + + + + + + NOT + + + f3 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f1 in('05:05:05','06:06:06','03:03:03') or (f2 between '03:03:03' and '03:03:03') or not(f3='03:03:03'); + + t1 + TableScan + + OR + + + OR + + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f1 + Equals + VALUE + + + + + + + f1 + Equals + VALUE + + + + + + + f2 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + + + + + + NOT + + + f3 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f1 in('03:03:03','06:06:06','05:05:05') or (f2 between '03:03:03' and '03:03:03') and not(f3='03:03:03'); + + t1 + TableScan + + OR + + + OR + + + OR + + + f1 + Equals + VALUE + + + + + f1 + Equals + VALUE + + + + + + + f1 + Equals + VALUE + + + + + + + AND + + + f2 + GreaterThanEquals + VALUE + LessThanEquals + VALUE + + + + + NOT + + + f3 + Equals + VALUE + + + + + + + + +Statement Executed diff --git a/test/sql/Optimizer/exp.test016.ksh b/test/sql/Optimizer/exp.test016.ksh new file mode 100644 index 00000000..4d927fd3 --- /dev/null +++ b/test/sql/Optimizer/exp.test016.ksh @@ -0,0 +1,334 @@ +echo create table t1 (f1 smallint, f2 int, f3 bigint, f4 varchar, f5 date); +Statement Executed +echo create index compositehashindex on t1(f2,f3,f4,f5) hash; +Statement Executed +echo explain plan select * from t1; + + t1 + TableScan + +echo explain plan select * from t1 where f2=1 and f3=10 and f4='abc' and f5='2001-01-01'; + + t1 + TableScan + + AND + + + AND + + + AND + + + f2 + Equals + VALUE + + + + + f3 + Equals + VALUE + + + + + + + f4 + Equals + VALUE + + + + + + + f5 + Equals + VALUE + + + + +echo explain plan select * from t1 where f2=1 and f3=10 and f4='abc' and f5='2001-01-01'; + + t1 + TableScan + + AND + + + AND + + + AND + + + f2 + Equals + VALUE + + + + + f3 + Equals + VALUE + + + + + + + f4 + Equals + VALUE + + + + + + + f5 + Equals + VALUE + + + + +echo explain plan select * from t1 where f2<=10 and f3>=10 and f4 like 'abc%' and f5 in ('2001-01-01','2001-03-03'); + + t1 + TableScan + + AND + + + AND + + + AND + + + f2 + LessThanEquals + VALUE + + + + + f3 + GreaterThanEquals + VALUE + + + + + + + f4 + Like + VALUE + + + + + + + OR + + + f5 + Equals + VALUE + + + + + f5 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f2<=10 and f3>=10 and f4 like 'abc%' and f5 in ('2001-01-01','2001-03-03'); + + t1 + TableScan + + AND + + + AND + + + AND + + + f2 + LessThanEquals + VALUE + + + + + f3 + GreaterThanEquals + VALUE + + + + + + + f4 + Like + VALUE + + + + + + + OR + + + f5 + Equals + VALUE + + + + + f5 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f2<=10 or f3>=10 or f4 like 'abc%' or f5 in ('2001-01-01','2001-03-03'); + + t1 + TableScan + + OR + + + OR + + + OR + + + f2 + LessThanEquals + VALUE + + + + + f3 + GreaterThanEquals + VALUE + + + + + + + f4 + Like + VALUE + + + + + + + OR + + + f5 + Equals + VALUE + + + + + f5 + Equals + VALUE + + + + + + +echo explain plan select * from t1 where f2<=10 or f3>=10 or f4 like 'abc%' or f5 in ('2001-01-01','2001-03-03'); + + t1 + TableScan + + OR + + + OR + + + OR + + + f2 + LessThanEquals + VALUE + + + + + f3 + GreaterThanEquals + VALUE + + + + + + + f4 + Like + VALUE + + + + + + + OR + + + f5 + Equals + VALUE + + + + + f5 + Equals + VALUE + + + + + + +Statement Executed diff --git a/test/sql/Optimizer/exp.test017.ksh b/test/sql/Optimizer/exp.test017.ksh new file mode 100644 index 00000000..842a5bd8 --- /dev/null +++ b/test/sql/Optimizer/exp.test017.ksh @@ -0,0 +1,127 @@ +echo create table t1(f1 int, f2 int, f3 varchar(20),f4 date); +Statement Executed +echo create index idx on t1(f3,f4,f2) hash; +Statement Executed +echo explain plan select * from t1 where f2 is null; + + t1 + TableScan + + f2 + isNULL + + +echo explain plan select * from t1 where f2 is not null; + + t1 + TableScan + + f2 + isNULL + + +echo explain plan select * from t1 where f2 is null and f3 is not null; + + t1 + TableScan + + AND + + + f2 + isNULL + + + + + f3 + isNULL + + + + +echo explain plan select * from t1 where f1 is null or f2 is not null or f3 is null or f4 is not null; + + t1 + TableScan + + OR + + + OR + + + OR + + + f1 + isNULL + + + + + f2 + isNULL + + + + + + + f3 + isNULL + + + + + + + f4 + isNULL + + + + +echo explain plan select * from t1 where f1 is null and f2 is not null and f3 is null and f4 is not null; + + t1 + TableScan + + AND + + + AND + + + AND + + + f1 + isNULL + + + + + f2 + isNULL + + + + + + + f3 + isNULL + + + + + + + f4 + isNULL + + + + +Statement Executed diff --git a/test/sql/Optimizer/exp.test018.ksh b/test/sql/Optimizer/exp.test018.ksh new file mode 100644 index 00000000..e20b7afa --- /dev/null +++ b/test/sql/Optimizer/exp.test018.ksh @@ -0,0 +1,93 @@ +echo create table t1(f1 int, f2 int); +Statement Executed +echo create index hashidxt1f1 on t1(f1) hash; +Statement Executed +echo create index hashidxt1f2 on t1(f2) hash; +Statement Executed +echo create table t2(f1 int, f2 int); +Statement Executed +echo create index hashidxt2f1 on t2(f1) hash; +Statement Executed +echo create index hashidxt2f2 on t2(f2) hash; +Statement Executed +echo explain plan select * from t1,t2; + + INNER_JOIN + + + t1 + TableScan + + + + + t2 + TableScan + + + +echo explain plan select * from t1,t2 where t1.f1=t2.f1; + + INNER_JOIN + + t1.f1 + t2.f1 + Equals + + + + t1 + TableScan + + + + + t2 + TableScan + + + +echo explain plan select * from t1,t2 where t1.f1<=t2.f1; + + INNER_JOIN + + t1.f1 + t2.f1 + LessThanEquals + + + + t1 + TableScan + + + + + t2 + TableScan + + + +echo explain plan select * from t1,t2 where t1.f1!=t2.f1; + + INNER_JOIN + + t1.f1 + t2.f1 + NotEquals + + + + t1 + TableScan + + + + + t2 + TableScan + + + +Statement Executed +Statement Executed diff --git a/test/sql/Optimizer/exp.test019.ksh b/test/sql/Optimizer/exp.test019.ksh new file mode 100644 index 00000000..9d434e19 --- /dev/null +++ b/test/sql/Optimizer/exp.test019.ksh @@ -0,0 +1,93 @@ +echo create table t1(f1 int, f2 int); +Statement Executed +echo create index treeidxt1f1 on t1(f1) tree; +Statement Executed +echo create index treeidxt1f2 on t1(f2) tree; +Statement Executed +echo create table t2(f1 int, f2 int); +Statement Executed +echo create index treeidxt2f1 on t2(f1) tree; +Statement Executed +echo create index treeidxt2f2 on t2(f2) tree; +Statement Executed +echo explain plan select * from t1,t2; + + INNER_JOIN + + + t1 + TableScan + + + + + t2 + TableScan + + + +echo explain plan select * from t1,t2 where t1.f1=t2.f1; + + INNER_JOIN + + t1.f1 + t2.f1 + Equals + + + + t1 + TableScan + + + + + t2 + TableScan + + + +echo explain plan select * from t1,t2 where t1.f1<=t2.f1; + + INNER_JOIN + + t1.f1 + t2.f1 + LessThanEquals + + + + t1 + TableScan + + + + + t2 + TableScan + + + +echo explain plan select * from t1,t2 where t1.f1!=t2.f1; + + INNER_JOIN + + t1.f1 + t2.f1 + NotEquals + + + + t1 + TableScan + + + + + t2 + TableScan + + + +Statement Executed +Statement Executed diff --git a/test/sql/Optimizer/exp.test020.ksh b/test/sql/Optimizer/exp.test020.ksh new file mode 100644 index 00000000..a89565b5 --- /dev/null +++ b/test/sql/Optimizer/exp.test020.ksh @@ -0,0 +1,93 @@ +echo create table t1(f1 int, f2 int); +Statement Executed +echo create index hashidxt1f1 on t1(f1) hash; +Statement Executed +echo create index hashidxt1f2 on t1(f2) hash; +Statement Executed +echo create table t2(f1 int, f2 int); +Statement Executed +echo create index hashidxt2f1 on t2(f1) hash; +Statement Executed +echo create index hashidxt2f2 on t2(f2) hash; +Statement Executed +echo explain plan select * from t1,t2; + + INNER_JOIN + + + t1 + TableScan + + + + + t2 + TableScan + + + +echo explain plan select * from t1 left join t2 on t1.f1=t2.f1; + + LEFT_JOIN + + t1.f1 + t2.f1 + Equals + + + + t1 + TableScan + + + + + t2 + TableScan + + + +echo explain plan select * from t1 left join t2 on t1.f1<=t2.f1; + + LEFT_JOIN + + t1.f1 + t2.f1 + LessThanEquals + + + + t1 + TableScan + + + + + t2 + TableScan + + + +echo explain plan select * from t1 left join t2 on t1.f1!=t2.f1; + + LEFT_JOIN + + t1.f1 + t2.f1 + NotEquals + + + + t1 + TableScan + + + + + t2 + TableScan + + + +Statement Executed +Statement Executed diff --git a/test/sql/Optimizer/exp.test021.ksh b/test/sql/Optimizer/exp.test021.ksh new file mode 100644 index 00000000..d4016148 --- /dev/null +++ b/test/sql/Optimizer/exp.test021.ksh @@ -0,0 +1,93 @@ +echo create table t1(f1 int, f2 int); +Statement Executed +echo create index treeidxt1f1 on t1(f1) tree; +Statement Executed +echo create index treeidxt1f2 on t1(f2) tree; +Statement Executed +echo create table t2(f1 int, f2 int); +Statement Executed +echo create index treeidxt2f1 on t2(f1) tree; +Statement Executed +echo create index treeidxt2f2 on t2(f2) tree; +Statement Executed +echo explain plan select * from t1,t2; + + INNER_JOIN + + + t1 + TableScan + + + + + t2 + TableScan + + + +echo explain plan select * from t1 left join t2 on t1.f1=t2.f1; + + LEFT_JOIN + + t1.f1 + t2.f1 + Equals + + + + t1 + TableScan + + + + + t2 + TableScan + + + +echo explain plan select * from t1 left join t2 on t1.f1<=t2.f1; + + LEFT_JOIN + + t1.f1 + t2.f1 + LessThanEquals + + + + t1 + TableScan + + + + + t2 + TableScan + + + +echo explain plan select * from t1 left join t2 on t1.f1!=t2.f1; + + LEFT_JOIN + + t1.f1 + t2.f1 + NotEquals + + + + t1 + TableScan + + + + + t2 + TableScan + + + +Statement Executed +Statement Executed diff --git a/test/sql/Optimizer/exp.test022.ksh b/test/sql/Optimizer/exp.test022.ksh new file mode 100644 index 00000000..81c86104 --- /dev/null +++ b/test/sql/Optimizer/exp.test022.ksh @@ -0,0 +1,93 @@ +echo create table t1(f1 int, f2 int); +Statement Executed +echo create index hashidxt1f1 on t1(f1) hash; +Statement Executed +echo create index hashidxt1f2 on t1(f2) hash; +Statement Executed +echo create table t2(f1 int, f2 int); +Statement Executed +echo create index hashidxt2f1 on t2(f1) hash; +Statement Executed +echo create index hashidxt2f2 on t2(f2) hash; +Statement Executed +echo explain plan select * from t1,t2; + + INNER_JOIN + + + t1 + TableScan + + + + + t2 + TableScan + + + +echo explain plan select * from t1 inner join t2 on t1.f1=t2.f1; + + INNER_JOIN + + t1.f1 + t2.f1 + Equals + + + + t1 + TableScan + + + + + t2 + TableScan + + + +echo explain plan select * from t1 inner join t2 on t1.f1<=t2.f1; + + INNER_JOIN + + t1.f1 + t2.f1 + LessThanEquals + + + + t1 + TableScan + + + + + t2 + TableScan + + + +echo explain plan select * from t1 inner join t2 on t1.f1!=t2.f1; + + INNER_JOIN + + t1.f1 + t2.f1 + NotEquals + + + + t1 + TableScan + + + + + t2 + TableScan + + + +Statement Executed +Statement Executed diff --git a/test/sql/Optimizer/exp.test023.ksh b/test/sql/Optimizer/exp.test023.ksh new file mode 100644 index 00000000..f00e709c --- /dev/null +++ b/test/sql/Optimizer/exp.test023.ksh @@ -0,0 +1,93 @@ +echo create table t1(f1 int, f2 int); +Statement Executed +echo create index treeidxt1f1 on t1(f1) tree; +Statement Executed +echo create index treeidxt1f2 on t1(f2) tree; +Statement Executed +echo create table t2(f1 int, f2 int); +Statement Executed +echo create index treeidxt2f1 on t2(f1) tree; +Statement Executed +echo create index treeidxt2f2 on t2(f2) tree; +Statement Executed +echo explain plan select * from t1,t2; + + INNER_JOIN + + + t1 + TableScan + + + + + t2 + TableScan + + + +echo explain plan select * from t1 inner join t2 on t1.f1=t2.f1; + + INNER_JOIN + + t1.f1 + t2.f1 + Equals + + + + t1 + TableScan + + + + + t2 + TableScan + + + +echo explain plan select * from t1 inner join t2 on t1.f1<=t2.f1; + + INNER_JOIN + + t1.f1 + t2.f1 + LessThanEquals + + + + t1 + TableScan + + + + + t2 + TableScan + + + +echo explain plan select * from t1 inner join t2 on t1.f1!=t2.f1; + + INNER_JOIN + + t1.f1 + t2.f1 + NotEquals + + + + t1 + TableScan + + + + + t2 + TableScan + + + +Statement Executed +Statement Executed diff --git a/test/sql/Optimizer/exp.test024.ksh b/test/sql/Optimizer/exp.test024.ksh new file mode 100644 index 00000000..d1739531 --- /dev/null +++ b/test/sql/Optimizer/exp.test024.ksh @@ -0,0 +1,28 @@ +echo create table t1(f1 int, f2 int); +Statement Executed +echo create index hashidxt1f1 on t1(f1) hash; +Statement Executed +echo create index hashidxt1f2 on t1(f2) hash; +Statement Executed +echo explain plan select a.f1,b.f1 from t1 a, t1 b where a.f1=b.f1; + + INNER_JOIN + + a.f1 + b.f1 + Equals + + + + t1 + TableScan + + + + + t1 + TableScan + + + +Statement Executed diff --git a/test/sql/Optimizer/exp.test025.ksh b/test/sql/Optimizer/exp.test025.ksh new file mode 100644 index 00000000..850a997b --- /dev/null +++ b/test/sql/Optimizer/exp.test025.ksh @@ -0,0 +1,28 @@ +echo create table t1(f1 int, f2 int); +Statement Executed +echo create index treeidxt1f1 on t1(f1) tree; +Statement Executed +echo create index treeidxt1f2 on t1(f2) tree; +Statement Executed +echo explain plan select a.f1,b.f1 from t1 a, t1 b where a.f1=b.f1; + + INNER_JOIN + + a.f1 + b.f1 + Equals + + + + t1 + TableScan + + + + + t1 + TableScan + + + +Statement Executed diff --git a/test/sql/Optimizer/explainplan_isnull_isnotnull.sql b/test/sql/Optimizer/explainplan_isnull_isnotnull.sql new file mode 100644 index 00000000..ea14d818 --- /dev/null +++ b/test/sql/Optimizer/explainplan_isnull_isnotnull.sql @@ -0,0 +1,14 @@ +echo create table t1(f1 int, f2 int, f3 varchar(20),f4 date); +create table t1(f1 int, f2 int, f3 varchar(20),f4 date); +echo create index idx on t1(f3,f4,f2) hash; +create index idx on t1(f3,f4,f2) hash; +echo explain plan select * from t1 where f2 is null; +explain plan select * from t1 where f2 is null; +echo explain plan select * from t1 where f2 is not null; +explain plan select * from t1 where f2 is not null; +echo explain plan select * from t1 where f2 is null and f3 is not null; +explain plan select * from t1 where f2 is null and f3 is not null; +echo explain plan select * from t1 where f1 is null or f2 is not null or f3 is null or f4 is not null; +explain plan select * from t1 where f1 is null or f2 is not null or f3 is null or f4 is not null; +echo explain plan select * from t1 where f1 is null and f2 is not null and f3 is null and f4 is not null; +explain plan select * from t1 where f1 is null and f2 is not null and f3 is null and f4 is not null; diff --git a/test/sql/Optimizer/hash_inbetweenlike.sql b/test/sql/Optimizer/hash_inbetweenlike.sql new file mode 100644 index 00000000..76830ecf --- /dev/null +++ b/test/sql/Optimizer/hash_inbetweenlike.sql @@ -0,0 +1,56 @@ +echo create table t1(f1 tinyint, f2 smallint, f3 int, f4 bigint, f5 char(10), f6 varchar(10), f7 date, f8 time); +create table t1(f1 tinyint, f2 smallint, f3 int, f4 bigint, f5 char(10), f6 varchar(10), f7 date, f8 time); +echo create index hashtiny on t1(f1) hash; +create index hashtiny on t1(f1) hash; +echo create index hashsmall on t1(f2) hash; +create index hashsmall on t1(f2) hash; +echo create index hashint on t1(f3) hash; +create index hashint on t1(f3) hash; +echo create index hashbig on t1(f4) hash; +create index hashbig on t1(f4) hash; +echo create index hashchar on t1(f5) hash; +create index hashchar on t1(f5) hash; +echo create index hashvarchar on t1(f6) hash; +create index hashvarchar on t1(f6) hash; +echo create index hashdate on t1(f7) hash; +create index hashdate on t1(f7) hash; +echo create index hashtime on t1(f8) hash; +create index hashtime on t1(f8) hash; +echo explain plan select * from t1; +explain plan select * from t1; +echo explain plan select * from t1 where f1 in (0,2,4); +explain plan select * from t1 where f1 in (0,2,4) ; +echo explain plan select * from t1 where f1 between 2 and 4; +explain plan select * from t1 where f1 between 2 and 4; +echo explain plan select * from t1 where f2 in (0,2,4);; +explain plan select * from t1 where f2 in (0,2,4); +echo explain plan select * from t1 where f2 between 2 and 4; +explain plan select * from t1 where f2 between 2 and 4; +echo explain plan select * from t1 where f3 in (1,2); +explain plan select * from t1 where f3 in (1,2) ; +echo explain plan select * from t1 where f3 between 1 and 4; +explain plan select * from t1 where f3 between 1 and 4; +echo explain plan select * from t1 where f4 in (1,2); +explain plan select * from t1 where f4 in (1,2) ; +echo explain plan select * from t1 where f4 between 1 and 4; +explain plan select * from t1 where f4 between 1 and 4; +echo explain plan select * from t1 where f5 in ('1','2'); +explain plan select * from t1 where f5 in ('1','2') ; +echo explain plan select * from t1 where f5 like 'N%'; +explain plan select * from t1 where f5 like 'N%'; +echo explain plan select * from t1 where f5 like 'N_h'; +explain plan select * from t1 where f5 like 'N_h'; +echo explain plan select * from t1 where f6 in ('1','2'); +explain plan select * from t1 where f6 in ('1','2') ; +echo explain plan select * from t1 where f6 like 'N%'; +explain plan select * from t1 where f6 like 'N%'; +echo explain plan select * from t1 where f6 like 'N_h'; +explain plan select * from t1 where f6 like 'N_h'; +echo explain plan select * from t1 where f7 in ('2003-11-12','2003-11-15'); +explain plan select * from t1 where f7 in ('2003-11-12','2003-11-15'); +echo explain plan select * from t1 where f7 between '2003-11-12' and '2003-11-15'; +explain plan select * from t1 where f7 between '2003-11-12' and '2003-11-15'; +echo explain plan select * from t1 where f8 in ('03:21:00','03:21:08'); +explain plan select * from t1 where f8 in ('03:21:00','03:21:08'); +echo explain plan select * from t1 where f8 between '03:21:00' and '03:21:08'; +explain plan select * from t1 where f8 between '03:21:00' and '03:21:08'; diff --git a/test/sql/Optimizer/hash_multiplepredicate.sql b/test/sql/Optimizer/hash_multiplepredicate.sql new file mode 100644 index 00000000..005c5346 --- /dev/null +++ b/test/sql/Optimizer/hash_multiplepredicate.sql @@ -0,0 +1,56 @@ +echo create table t1(f1 tinyint, f2 smallint, f3 int, f4 bigint, f5 char(10), f6 varchar(10), f7 date, f8 time); +create table t1(f1 tinyint, f2 smallint, f3 int, f4 bigint, f5 char(10), f6 varchar(10), f7 date, f8 time); +echo create index hashtiny on t1(f1) hash; +create index hashtiny on t1(f1) hash; +echo create index hashsmall on t1(f2) hash; +create index hashsmall on t1(f2) hash; +echo create index hashint on t1(f3) hash; +create index hashint on t1(f3) hash; +echo create index hashbig on t1(f4) hash; +create index hashbig on t1(f4) hash; +echo create index hashchar on t1(f5) hash; +create index hashchar on t1(f5) hash; +echo create index hashvarchar on t1(f6) hash; +create index hashvarchar on t1(f6) hash; +echo create index hashdate on t1(f7) hash; +create index hashdate on t1(f7) hash; +echo create index hashtime on t1(f8) hash; +create index hashtime on t1(f8) hash; +echo explain plan select * from t1; +explain plan select * from t1; +echo explain plan select * from t1 where f1 = 2 and f1 in (0,2,4) ; +explain plan select * from t1 where f1 = 2 and f1 in (0,2,4) ; +echo explain plan select * from t1 where f1 = 3 or (f1 between 2 and 4); +explain plan select * from t1 where f1 = 3 or (f1 between 2 and 4); +echo explain plan select * from t1 where f2 in (0,2,4) and f2 = 2; +explain plan select * from t1 where f2 in (0,2,4) and f2 = 2; +echo explain plan select * from t1 where (f2 between 2 and 4) or f2 = 2; +explain plan select * from t1 where (f2 between 2 and 4) or f2 = 2; +echo explain plan select * from t1 where f3 = 2 or f3 in (1,2) ; +explain plan select * from t1 where f3 = 2 or f3 in (1,2) ; +echo explain plan select * from t1 where f3 = 2 and f3 between 1 and 4; +explain plan select * from t1 where f3 = 2 and f3 between 1 and 4; +echo explain plan select * from t1 where f4 in (1,2) or f4 = 2; +explain plan select * from t1 where f4 in (1,2) or f4 = 2; +echo explain plan select * from t1 where (f4 between 1 and 4) and f4 = 2; +explain plan select * from t1 where (f4 between 1 and 4) and f4 = 2; +echo explain plan select * from t1 where f5 in ('1','2') and f5 = '1'; +explain plan select * from t1 where f5 in ('1','2') and f5 = '1'; +echo explain plan select * from t1 where f5 like 'N%' or f5 = 'NP'; +explain plan select * from t1 where f5 like 'N%' or f5 = 'NP'; +echo explain plan select * from t1 where f5 like 'N_h' and f6 = 'Nihar'; +explain plan select * from t1 where f5 like 'N_h' and f6 = 'Nihar'; +echo explain plan select * from t1 where f6 = '1' or f6 in ('1','2'); +explain plan select * from t1 where f6 = '1' or f6 in ('1','2'); +echo explain plan select * from t1 where f6 = 'NP' or f6 like 'N%'; +explain plan select * from t1 where f6 = 'NP' or f6 like 'N%'; +echo explain plan select * from t1 where f6 like 'N_h' and f6 = 'NIHAR'; +explain plan select * from t1 where f6 like 'N_h' and f6 = 'NIHAR'; +echo explain plan select * from t1 where f7 = '2003-11-12' or f7 in ('2003-11-12','2003-11-15'); +explain plan select * from t1 where f7 = '2003-11-12' or f7 in ('2003-11-12','2003-11-15'); +echo explain plan select * from t1 where f7 = '2003-11-15' and (f7 between '2003-11-12' and '2003-11-15'); +explain plan select * from t1 where f7 = '2003-11-15' and (f7 between '2003-11-12' and '2003-11-15'); +echo explain plan select * from t1 where f8 in ('03:21:00','03:21:08') and f8 = '03:21:08'; +explain plan select * from t1 where f8 in ('03:21:00','03:21:08') and f8 = '03:21:08'; +echo explain plan select * from t1 where (f8 between '03:21:00' and '03:21:08') or f8='03:21:00'; +explain plan select * from t1 where (f8 between '03:21:00' and '03:21:08') or f8='03:21:00'; diff --git a/test/sql/Optimizer/hash_singleprrdicate.sql b/test/sql/Optimizer/hash_singleprrdicate.sql new file mode 100644 index 00000000..0e4477db --- /dev/null +++ b/test/sql/Optimizer/hash_singleprrdicate.sql @@ -0,0 +1,57 @@ +echo create table t1(f1 tinyint, f2 smallint, f3 int, f4 bigint, f5 char(10), f6 varchar(10), f7 date, f8 time); +create table t1(f1 tinyint, f2 smallint, f3 int, f4 bigint, f5 char(10), f6 varchar(10), f7 date, f8 time); +echo create index hashtiny on t1(f1) hash; +create index hashtiny on t1(f1) hash; +echo create index hashsmall on t1(f2) hash; +create index hashsmall on t1(f2) hash; +echo create index hashint on t1(f3) hash; +create index hashint on t1(f3) hash; +echo create index hashbig on t1(f4) hash; +create index hashbig on t1(f4) hash; +echo create index hashchar on t1(f5) hash; +create index hashchar on t1(f5) hash; +echo create index hashvarchar on t1(f6) hash; +create index hashvarchar on t1(f6) hash; +echo create index hashdate on t1(f7) hash; +create index hashdate on t1(f7) hash; +echo create index hashtime on t1(f8) hash; +create index hashtime on t1(f8) hash; +insert into t1 values(1,11,111,1111,'CSQL1','Lakshya1','2001-11-12','01:21:00'); +insert into t1 values(2,22,222,2222,'CSQL2','Lakshya2','2002-11-12','02:21:00'); +insert into t1 values(3,33,333,3333,'CSQL3','Lakshya3','2003-11-12','03:21:00'); +insert into t1 values(4,44,444,4444,'CSQL4','Lakshya4','2004-11-12','04:21:00'); +insert into t1 values(5,55,555,5555,'CSQL5','Lakshya5','2005-11-12','05:21:00'); +echo explain plan select * from t1; +explain plan select * from t1; +echo explain plan select * from t1 where f1 = 2; +explain plan select * from t1 where f1 = 2; +echo explain plan select * from t1 where f1 < 3; +explain plan select * from t1 where f1 < 3; +echo explain plan select * from t1 where f2 = 22; +explain plan select * from t1 where f2 = 22; +echo explain plan select * from t1 where f2 > 33; +explain plan select * from t1 where f2 > 33; +echo explain plan select * from t1 where f3 = 333; +explain plan select * from t1 where f3 = 333; +echo explain plan select * from t1 where f3 <> 333; +explain plan select * from t1 where f3 <> 333; +echo explain plan select * from t1 where f4 = 4444; +explain plan select * from t1 where f4 = 4444; +echo explain plan select * from t1 where f4 != 4444; +explain plan select * from t1 where f4 != 4444; +echo explain plan select * from t1 where f5 = 'CSQL3'; +explain plan select * from t1 where f5 = 'CSQL3'; +echo explain plan select * from t1 where f5 <= 'CSQL3'; +explain plan select * from t1 where f5 <= 'CSQL3'; +echo explain plan select * from t1 where f6 = 'Lakshya3'; +explain plan select * from t1 where f6 = 'Lakshya3'; +echo explain plan select * from t1 where f6 >= 'Lakshya3'; +explain plan select * from t1 where f6 >= 'Lakshya3'; +echo explain plan select * from t1 where f7 = '2003-11-12'; +explain plan select * from t1 where f7 = '2003-11-12'; +echo explain plan select * from t1 where f7 > '2003-11-12'; +explain plan select * from t1 where f7 > '2003-11-12'; +echo explain plan select * from t1 where f8 = '03:21:00'; +explain plan select * from t1 where f8 = '03:21:00'; +echo explain plan select * from t1 where f8 < '03:21:00'; +explain plan select * from t1 where f8 < '03:21:00'; diff --git a/test/sql/Optimizer/innerjoin_hash_int.sql b/test/sql/Optimizer/innerjoin_hash_int.sql new file mode 100644 index 00000000..435a3151 --- /dev/null +++ b/test/sql/Optimizer/innerjoin_hash_int.sql @@ -0,0 +1,20 @@ +echo create table t1(f1 int, f2 int); +create table t1(f1 int, f2 int); +echo create index hashidxt1f1 on t1(f1) hash; +create index hashidxt1f1 on t1(f1) hash; +echo create index hashidxt1f2 on t1(f2) hash; +create index hashidxt1f2 on t1(f2) hash; +echo create table t2(f1 int, f2 int); +create table t2(f1 int, f2 int); +echo create index hashidxt2f1 on t2(f1) hash; +create index hashidxt2f1 on t2(f1) hash; +echo create index hashidxt2f2 on t2(f2) hash; +create index hashidxt2f2 on t2(f2) hash; +echo explain plan select * from t1,t2; +explain plan select * from t1,t2; +echo explain plan select * from t1 inner join t2 on t1.f1=t2.f1; +explain plan select * from t1 inner join t2 on t1.f1=t2.f1; +echo explain plan select * from t1 inner join t2 on t1.f1<=t2.f1; +explain plan select * from t1 inner join t2 on t1.f1<=t2.f1; +echo explain plan select * from t1 inner join t2 on t1.f1!=t2.f1; +explain plan select * from t1 inner join t2 on t1.f1!=t2.f1; diff --git a/test/sql/Optimizer/innerjoin_tree_int.sql b/test/sql/Optimizer/innerjoin_tree_int.sql new file mode 100644 index 00000000..d0027141 --- /dev/null +++ b/test/sql/Optimizer/innerjoin_tree_int.sql @@ -0,0 +1,20 @@ +echo create table t1(f1 int, f2 int); +create table t1(f1 int, f2 int); +echo create index treeidxt1f1 on t1(f1) tree; +create index treeidxt1f1 on t1(f1) tree; +echo create index treeidxt1f2 on t1(f2) tree; +create index treeidxt1f2 on t1(f2) tree; +echo create table t2(f1 int, f2 int); +create table t2(f1 int, f2 int); +echo create index treeidxt2f1 on t2(f1) tree; +create index treeidxt2f1 on t2(f1) tree; +echo create index treeidxt2f2 on t2(f2) tree; +create index treeidxt2f2 on t2(f2) tree; +echo explain plan select * from t1,t2; +explain plan select * from t1,t2; +echo explain plan select * from t1 inner join t2 on t1.f1=t2.f1; +explain plan select * from t1 inner join t2 on t1.f1=t2.f1; +echo explain plan select * from t1 inner join t2 on t1.f1<=t2.f1; +explain plan select * from t1 inner join t2 on t1.f1<=t2.f1; +echo explain plan select * from t1 inner join t2 on t1.f1!=t2.f1; +explain plan select * from t1 inner join t2 on t1.f1!=t2.f1; diff --git a/test/sql/Optimizer/int_composite.sql b/test/sql/Optimizer/int_composite.sql new file mode 100644 index 00000000..72e86899 --- /dev/null +++ b/test/sql/Optimizer/int_composite.sql @@ -0,0 +1,27 @@ +echo create table t1(f1 int, f2 int, f3 int, f4 int); +create table t1(f1 int, f2 int, f3 int, f4 int); +echo create index hashintf1f2f3 on t1(f2,f3,f1) hash; +create index hashintf1f2f3 on t1(f2,f3,f1) hash; +echo explain plan select * from t1; +explain plan select * from t1; +echo explain plan select * from t1 where f1 = 2; +explain plan select * from t1 where f1 = 2; +echo explain plan select * from t1 where f1 = 2 and f2=2; +explain plan select * from t1 where f1 = 2 and f2=2; +echo explain plan select * from t1 where f1 = 2 and f2=2 and f3=2; +explain plan select * from t1 where f1 = 2 and f2=2 and f3=2; +echo explain plan select * from t1 where f1 = 2 or f2=2 or f3=2; +explain plan select * from t1 where f1 = 2 or f2=2 or f3=2; +echo explain plan select * from t1 where f1 = 2 and f2=2 or f3=2; +explain plan select * from t1 where f1 = 2 and f2=2 or f3=2; +echo explain plan select * from t1 where f1 = 2 and f2=2 and not(f3=2); +explain plan select * from t1 where f1 = 2 and f2=2 and not(f3=2); +echo explain plan select * from t1 where f1 in(1,2,3) and f2=2 and not(f3=2); +explain plan select * from t1 where f1 in(1,2,3) and f2=2 and not(f3=2); +echo explain plan select * from t1 where f1 in(1,2,3) and (f2 between 2 and 4) and not(f3=2); +explain plan select * from t1 where f1 in(1,2,3) and (f2 between 2 and 4) and not(f3=2); +echo explain plan select * from t1 where f1 in(1,2,3) or (f2 between 2 and 4) or not(f3=2); +explain plan select * from t1 where f1 in(1,2,3) or (f2 between 2 and 4) or not(f3=2); +echo explain plan select * from t1 where f1 in(1,2,3) or (f2 between 2 and 4) and not(f3=2); +explain plan select * from t1 where f1 in(1,2,3) or (f2 between 2 and 4) and not(f3=2); + diff --git a/test/sql/Optimizer/join_hash_int.sql b/test/sql/Optimizer/join_hash_int.sql new file mode 100644 index 00000000..e7545da6 --- /dev/null +++ b/test/sql/Optimizer/join_hash_int.sql @@ -0,0 +1,20 @@ +echo create table t1(f1 int, f2 int); +create table t1(f1 int, f2 int); +echo create index hashidxt1f1 on t1(f1) hash; +create index hashidxt1f1 on t1(f1) hash; +echo create index hashidxt1f2 on t1(f2) hash; +create index hashidxt1f2 on t1(f2) hash; +echo create table t2(f1 int, f2 int); +create table t2(f1 int, f2 int); +echo create index hashidxt2f1 on t2(f1) hash; +create index hashidxt2f1 on t2(f1) hash; +echo create index hashidxt2f2 on t2(f2) hash; +create index hashidxt2f2 on t2(f2) hash; +echo explain plan select * from t1,t2; +explain plan select * from t1,t2; +echo explain plan select * from t1,t2 where t1.f1=t2.f1; +explain plan select * from t1,t2 where t1.f1=t2.f1; +echo explain plan select * from t1,t2 where t1.f1<=t2.f1; +explain plan select * from t1,t2 where t1.f1<=t2.f1; +echo explain plan select * from t1,t2 where t1.f1!=t2.f1; +explain plan select * from t1,t2 where t1.f1!=t2.f1; diff --git a/test/sql/Optimizer/join_tree_int.sql b/test/sql/Optimizer/join_tree_int.sql new file mode 100644 index 00000000..998b6c1d --- /dev/null +++ b/test/sql/Optimizer/join_tree_int.sql @@ -0,0 +1,20 @@ +echo create table t1(f1 int, f2 int); +create table t1(f1 int, f2 int); +echo create index treeidxt1f1 on t1(f1) tree; +create index treeidxt1f1 on t1(f1) tree; +echo create index treeidxt1f2 on t1(f2) tree; +create index treeidxt1f2 on t1(f2) tree; +echo create table t2(f1 int, f2 int); +create table t2(f1 int, f2 int); +echo create index treeidxt2f1 on t2(f1) tree; +create index treeidxt2f1 on t2(f1) tree; +echo create index treeidxt2f2 on t2(f2) tree; +create index treeidxt2f2 on t2(f2) tree; +echo explain plan select * from t1,t2; +explain plan select * from t1,t2; +echo explain plan select * from t1,t2 where t1.f1=t2.f1; +explain plan select * from t1,t2 where t1.f1=t2.f1; +echo explain plan select * from t1,t2 where t1.f1<=t2.f1; +explain plan select * from t1,t2 where t1.f1<=t2.f1; +echo explain plan select * from t1,t2 where t1.f1!=t2.f1; +explain plan select * from t1,t2 where t1.f1!=t2.f1; diff --git a/test/sql/Optimizer/leftjoin_hash_int.sql b/test/sql/Optimizer/leftjoin_hash_int.sql new file mode 100644 index 00000000..ddc5aa9c --- /dev/null +++ b/test/sql/Optimizer/leftjoin_hash_int.sql @@ -0,0 +1,20 @@ +echo create table t1(f1 int, f2 int); +create table t1(f1 int, f2 int); +echo create index hashidxt1f1 on t1(f1) hash; +create index hashidxt1f1 on t1(f1) hash; +echo create index hashidxt1f2 on t1(f2) hash; +create index hashidxt1f2 on t1(f2) hash; +echo create table t2(f1 int, f2 int); +create table t2(f1 int, f2 int); +echo create index hashidxt2f1 on t2(f1) hash; +create index hashidxt2f1 on t2(f1) hash; +echo create index hashidxt2f2 on t2(f2) hash; +create index hashidxt2f2 on t2(f2) hash; +echo explain plan select * from t1,t2; +explain plan select * from t1,t2; +echo explain plan select * from t1 left join t2 on t1.f1=t2.f1; +explain plan select * from t1 left join t2 on t1.f1=t2.f1; +echo explain plan select * from t1 left join t2 on t1.f1<=t2.f1; +explain plan select * from t1 left join t2 on t1.f1<=t2.f1; +echo explain plan select * from t1 left join t2 on t1.f1!=t2.f1; +explain plan select * from t1 left join t2 on t1.f1!=t2.f1; diff --git a/test/sql/Optimizer/leftjoin_tree_int.sql b/test/sql/Optimizer/leftjoin_tree_int.sql new file mode 100644 index 00000000..e920e030 --- /dev/null +++ b/test/sql/Optimizer/leftjoin_tree_int.sql @@ -0,0 +1,20 @@ +echo create table t1(f1 int, f2 int); +create table t1(f1 int, f2 int); +echo create index treeidxt1f1 on t1(f1) tree; +create index treeidxt1f1 on t1(f1) tree; +echo create index treeidxt1f2 on t1(f2) tree; +create index treeidxt1f2 on t1(f2) tree; +echo create table t2(f1 int, f2 int); +create table t2(f1 int, f2 int); +echo create index treeidxt2f1 on t2(f1) tree; +create index treeidxt2f1 on t2(f1) tree; +echo create index treeidxt2f2 on t2(f2) tree; +create index treeidxt2f2 on t2(f2) tree; +echo explain plan select * from t1,t2; +explain plan select * from t1,t2; +echo explain plan select * from t1 left join t2 on t1.f1=t2.f1; +explain plan select * from t1 left join t2 on t1.f1=t2.f1; +echo explain plan select * from t1 left join t2 on t1.f1<=t2.f1; +explain plan select * from t1 left join t2 on t1.f1<=t2.f1; +echo explain plan select * from t1 left join t2 on t1.f1!=t2.f1; +explain plan select * from t1 left join t2 on t1.f1!=t2.f1; diff --git a/test/sql/Optimizer/selfjoin_hash_int.sql b/test/sql/Optimizer/selfjoin_hash_int.sql new file mode 100644 index 00000000..3508702d --- /dev/null +++ b/test/sql/Optimizer/selfjoin_hash_int.sql @@ -0,0 +1,8 @@ +echo create table t1(f1 int, f2 int); +create table t1(f1 int, f2 int); +echo create index hashidxt1f1 on t1(f1) hash; +create index hashidxt1f1 on t1(f1) hash; +echo create index hashidxt1f2 on t1(f2) hash; +create index hashidxt1f2 on t1(f2) hash; +echo explain plan select a.f1,b.f1 from t1 a, t1 b where a.f1=b.f1; +explain plan select a.f1,b.f1 from t1 a, t1 b where a.f1=b.f1; diff --git a/test/sql/Optimizer/selfjoin_tree_int.sql b/test/sql/Optimizer/selfjoin_tree_int.sql new file mode 100644 index 00000000..60fb4c30 --- /dev/null +++ b/test/sql/Optimizer/selfjoin_tree_int.sql @@ -0,0 +1,8 @@ +echo create table t1(f1 int, f2 int); +create table t1(f1 int, f2 int); +echo create index treeidxt1f1 on t1(f1) tree; +create index treeidxt1f1 on t1(f1) tree; +echo create index treeidxt1f2 on t1(f2) tree; +create index treeidxt1f2 on t1(f2) tree; +echo explain plan select a.f1,b.f1 from t1 a, t1 b where a.f1=b.f1; +explain plan select a.f1,b.f1 from t1 a, t1 b where a.f1=b.f1; diff --git a/test/sql/Optimizer/singletabletest1.sql b/test/sql/Optimizer/singletabletest1.sql new file mode 100644 index 00000000..f42163c7 --- /dev/null +++ b/test/sql/Optimizer/singletabletest1.sql @@ -0,0 +1,35 @@ +echo No Primary key -Test Case - 1,2,3 +echo select * from t1; +explain plan select * from t1; +echo select * from t1 where f1=10; +explain plan select * from t1 where f1=10; +echo select * from t1 where f1>10; +explain plan select * from t1 where f1>10; + +create index idx1 on t1 (f1) hash primary; +echo Primary key -Test Case - 4,5,6 +echo select * from t1; +explain plan select * from t1; +echo select * from t1 where f1=10; +explain plan select * from t1 where f1=10; +echo select * from t1 where f1>10; +explain plan select * from t1 where f1>10; + +create index idx2 on t1 (f2) hash; +echo Hash Index -Test Case - 7,8,9 +echo select * from t1; +explain plan select * from t1; +echo select * from t1 where f2=10; +explain plan select * from t1 where f2=10; +echo select * from t1 where f2>10; +explain plan select * from t1 where f2>10; + +create index idx3 on t1 (f3) tree; +echo Tree Index -Test Case - 10,11,12 +echo select * from t1; +explain plan select * from t1; +echo select * from t1 where f3=10; +explain plan select * from t1 where f3=10; +echo select * from t1 where f2>10; +explain plan select * from t1 where f3>10; + diff --git a/test/sql/Optimizer/singletabletest2.sql b/test/sql/Optimizer/singletabletest2.sql new file mode 100644 index 00000000..c3bdfe4e --- /dev/null +++ b/test/sql/Optimizer/singletabletest2.sql @@ -0,0 +1,23 @@ +create index idx1 on t1 (f1) hash primary; +create index idx3 on t1 (f2) tree; +echo Multiple predicates Test Cases - 1,2,3 +echo select * from t1 where f1=10 and f3=20; +explain plan select * from t1 where f1=10 and f3 =20; +echo select * from t1 where f2>10 and f3=20; +explain plan select * from t1 where f1>10 and f3 =20; +echo select * from t1 where f3=20 and f1 >10; +explain plan select * from t1 where f3 =20 and f1>10; + + +echo Disjunctive Queries Test case - 4,5,6,7,8 +echo select * from t1 where f1!=10; +explain plan select * from t1 where f1!=10; +echo select * from t1 where f2!=10; +explain plan select * from t1 where f2!=10; +echo select * from t1 where f1=10 or f3=20; +explain plan select * from t1 where f1=10 or f3 =20; +echo select * from t1 where f2>10 or f3=20; +explain plan select * from t1 where f2>10 or f3 =20; +echo select * from t1 where f3=20 or f2 >10; +explain plan select * from t1 where f3 =20 or f2 >10; + diff --git a/test/sql/Optimizer/small_composite.sql b/test/sql/Optimizer/small_composite.sql new file mode 100644 index 00000000..34b57822 --- /dev/null +++ b/test/sql/Optimizer/small_composite.sql @@ -0,0 +1,27 @@ +echo create table t1(f1 smallint, f2 smallint, f3 smallint, f4 smallint); +create table t1(f1 smallint, f2 smallint, f3 smallint, f4 smallint); +echo create index hashsmallf1f2f3 on t1(f2,f3,f1) hash; +create index hashsmallf1f2f3 on t1(f2,f3,f1) hash; +echo explain plan select * from t1; +explain plan select * from t1; +echo explain plan select * from t1 where f1 = 2; +explain plan select * from t1 where f1 = 2; +echo explain plan select * from t1 where f1 = 2 and f2=2; +explain plan select * from t1 where f1 = 2 and f2=2; +echo explain plan select * from t1 where f1 = 2 and f2=2 and f3=2; +explain plan select * from t1 where f1 = 2 and f2=2 and f3=2; +echo explain plan select * from t1 where f1 = 2 or f2=2 or f3=2; +explain plan select * from t1 where f1 = 2 or f2=2 or f3=2; +echo explain plan select * from t1 where f1 = 2 and f2=2 or f3=2; +explain plan select * from t1 where f1 = 2 and f2=2 or f3=2; +echo explain plan select * from t1 where f1 = 2 and f2=2 and not(f3=2); +explain plan select * from t1 where f1 = 2 and f2=2 and not(f3=2); +echo explain plan select * from t1 where f1 in(1,2,3) and f2=2 and not(f3=2); +explain plan select * from t1 where f1 in(1,2,3) and f2=2 and not(f3=2); +echo explain plan select * from t1 where f1 in(1,2,3) and (f2 between 2 and 4) and not(f3=2); +explain plan select * from t1 where f1 in(1,2,3) and (f2 between 2 and 4) and not(f3=2); +echo explain plan select * from t1 where f1 in(1,2,3) or (f2 between 2 and 4) or not(f3=2); +explain plan select * from t1 where f1 in(1,2,3) or (f2 between 2 and 4) or not(f3=2); +echo explain plan select * from t1 where f1 in(1,2,3) or (f2 between 2 and 4) and not(f3=2); +explain plan select * from t1 where f1 in(1,2,3) or (f2 between 2 and 4) and not(f3=2); + diff --git a/test/sql/Optimizer/test001.ksh b/test/sql/Optimizer/test001.ksh new file mode 100755 index 00000000..a11990e0 --- /dev/null +++ b/test/sql/Optimizer/test001.ksh @@ -0,0 +1,40 @@ +#!/bin/ksh +# Test Case +# No Primary key tests +# 1)Single table no predicate should use table scan +# 2)Single table equi predicate on f1 should use table scan +# 3)Single table range predicate on f1 should use table scan +# Primary key tests: create primary hash index on f1 +# 4)Single table no predicate should use table scan +# 5)Single table equi predicate on f1 should use hash scan +# 6)Single table range predicate on f1 should use table scan +# Hash Index tests:create hash index on f2 +# 7)Single table no predicate should use table scan +# 8)Single table equi predicate on f2 should use hash scan +# 9)Single table range predicate on f2 should use table scan +# Tree Index tests:create tree index on f2 +# 10)Single table no predicate should use table scan +# 11)Single table equi predicate on f2 should use tree scan +# 12)Single table range predicate on f2 should use tree scan +QUITFILE=${PWD}/sql/Optimizer/drop.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then +REL_PATH=`pwd`/sql/Optimizer +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/createt1t2t3.sql > /dev/null 2>&1 +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/singletabletest1.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql > /dev/null 2>&1 + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql > /dev/null 2>&1 + exit 0; + diff --git a/test/sql/Optimizer/test002.ksh b/test/sql/Optimizer/test002.ksh new file mode 100755 index 00000000..ce33a989 --- /dev/null +++ b/test/sql/Optimizer/test002.ksh @@ -0,0 +1,35 @@ +#!/bin/ksh +# Test Case +# create hash index on f1 and tree index on f2 and no index on f3 +# Multiple Predicates +# 1)Single table equi predicate with f1 and f3 should use hash scan +# 2)Single table range predicate on f1 and equi on f3 should use tree scan +# 3)Single table equi on f3 and range predicate on f1 should use tree scan +# Disjunctive predicates +# 4)Single table nonequi predicate on f1 should use full scan +# 5)Single table nonequi predicate on f2 should use full scan +# 6)Single table f1=10 or f3=20 should use full scan +# 7)Single table f2>10 or f3=20 should use full scan +# 8)Single table f3=20 or f2 >10 should use full scan +QUITFILE=${PWD}/sql/Optimizer/drop.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then +REL_PATH=`pwd`/sql/Optimizer +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/createt1t2t3.sql > /dev/null 2>&1 +if [ $? -ne 0 ] +then + exit 1; +fi +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/singletabletest2.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql > /dev/null 2>&1 + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql > /dev/null 2>&1 + exit 0; + diff --git a/test/sql/Optimizer/test003.ksh b/test/sql/Optimizer/test003.ksh new file mode 100755 index 00000000..16549b58 --- /dev/null +++ b/test/sql/Optimizer/test003.ksh @@ -0,0 +1,33 @@ +#!/bin/ksh +# Explain plan on all datatypes with single predicate applying hash index(Relational operators). +# Create table with all datatypes +# create simple hash index on each datatypes. +# Apply explain plan on each datatypes using select with where clause. +# +QUITFILE=${PWD}/sql/Optimizer/drop.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then +REL_PATH=`pwd`/sql/Optimizer +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/hash_singleprrdicate.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/hash_singleprrdicate.sql + if [ $? -ne 0 ] + then + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql +rm -f ${REL_PATH}/dropt1.sql +exit 0; + diff --git a/test/sql/Optimizer/test004.ksh b/test/sql/Optimizer/test004.ksh new file mode 100755 index 00000000..ac3caa85 --- /dev/null +++ b/test/sql/Optimizer/test004.ksh @@ -0,0 +1,33 @@ +#!/bin/ksh +# Explain plan on all datatypes with single predicate applying tree index(Relational Operators). +# Create table with all datatypes +# Create simple tree index on each datatypes. +# Apply explain plan on each datatypes using select with where clause. +# +QUITFILE=${PWD}/sql/Optimizer/drop.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then +REL_PATH=`pwd`/sql/Optimizer +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/tree_singleprrdicate.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/tree_singleprrdicate.sql + if [ $? -ne 0 ] + then + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql +rm -f ${REL_PATH}/dropt1.sql +exit 0; + diff --git a/test/sql/Optimizer/test005.ksh b/test/sql/Optimizer/test005.ksh new file mode 100755 index 00000000..4ea4991f --- /dev/null +++ b/test/sql/Optimizer/test005.ksh @@ -0,0 +1,33 @@ +#!/bin/ksh +# IN, BETWEEN and LIKE operator test on Hash Index +# Create table with all datatypes +# create simple hash index on each datatypes. +# Apply explain plan using select with where clause. (in,between,like predicates) +# +QUITFILE=${PWD}/sql/Optimizer/drop.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then +REL_PATH=`pwd`/sql/Optimizer +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/hash_inbetweenlike.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/hash_inbetweenlike.sql + if [ $? -ne 0 ] + then + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql +rm -f ${REL_PATH}/dropt1.sql +exit 0; + diff --git a/test/sql/Optimizer/test006.ksh b/test/sql/Optimizer/test006.ksh new file mode 100755 index 00000000..e7ca84be --- /dev/null +++ b/test/sql/Optimizer/test006.ksh @@ -0,0 +1,33 @@ +#!/bin/ksh +# IN, BETWEEN and LIKE operator test on Tree Index +# Create table with all datatypes +# create simple tree index on each datatypes. +# Apply explain plan using select with where clause. (in,between,like predicates) +# +QUITFILE=${PWD}/sql/Optimizer/drop.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then +REL_PATH=`pwd`/sql/Optimizer +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/tree_inbetweenlike.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/tree_inbetweenlike.sql + if [ $? -ne 0 ] + then + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql +rm -f ${REL_PATH}/dropt1.sql +exit 0; + diff --git a/test/sql/Optimizer/test007.ksh b/test/sql/Optimizer/test007.ksh new file mode 100755 index 00000000..b1c7102e --- /dev/null +++ b/test/sql/Optimizer/test007.ksh @@ -0,0 +1,33 @@ +#!/bin/ksh +# IN, BETWEEN and LIKE operator test on Hash Index along with '=' operator +# Create table with all datatypes +# create simple hash index on each datatypes. +# Apply explain plan using select with multiple predicates.(in,between,like predicates along with '=' operator). +# +QUITFILE=${PWD}/sql/Optimizer/drop.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then +REL_PATH=`pwd`/sql/Optimizer +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/hash_multiplepredicate.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/hash_multiplepredicate.sql + if [ $? -ne 0 ] + then + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql +rm -f ${REL_PATH}/dropt1.sql +exit 0; + diff --git a/test/sql/Optimizer/test008.ksh b/test/sql/Optimizer/test008.ksh new file mode 100755 index 00000000..fb765c2c --- /dev/null +++ b/test/sql/Optimizer/test008.ksh @@ -0,0 +1,33 @@ +#!/bin/ksh +# Create table with 4 fields all are tinyint. +# create composite hash index on 3 fields. +# Apply explain plan using select with multiple predicates(Hash lookup). +# Apply explain plan using select with multiple predicates(range lookup). +# +QUITFILE=${PWD}/sql/Optimizer/drop.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then +REL_PATH=`pwd`/sql/Optimizer +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/tiny_composite.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/tiny_composite.sql + if [ $? -ne 0 ] + then + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql +rm -f ${REL_PATH}/dropt1.sql +exit 0; + diff --git a/test/sql/Optimizer/test009.ksh b/test/sql/Optimizer/test009.ksh new file mode 100755 index 00000000..9d974c54 --- /dev/null +++ b/test/sql/Optimizer/test009.ksh @@ -0,0 +1,33 @@ +#!/bin/ksh +# Create table with 4 fields all are smallint. +# create composite hash index on 3 fields. +# Apply explain plan using select with multiple predicates(Hash lookup). +# Apply explain plan using select with multiple predicates(range lookup). +# +QUITFILE=${PWD}/sql/Optimizer/drop.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then +REL_PATH=`pwd`/sql/Optimizer +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/small_composite.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/small_composite.sql + if [ $? -ne 0 ] + then + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql +rm -f ${REL_PATH}/dropt1.sql +exit 0; + diff --git a/test/sql/Optimizer/test010.ksh b/test/sql/Optimizer/test010.ksh new file mode 100755 index 00000000..89145c1c --- /dev/null +++ b/test/sql/Optimizer/test010.ksh @@ -0,0 +1,33 @@ +#!/bin/ksh +# Create table with 4 fields all are int. +# create composite hash index on 3 fields. +# Apply explain plan using select with multiple predicates(Hash lookup). +# Apply explain plan using select with multiple predicates(range lookup). +# +QUITFILE=${PWD}/sql/Optimizer/drop.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then +REL_PATH=`pwd`/sql/Optimizer +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/int_composite.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/int_composite.sql + if [ $? -ne 0 ] + then + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql +rm -f ${REL_PATH}/dropt1.sql +exit 0; + diff --git a/test/sql/Optimizer/test011.ksh b/test/sql/Optimizer/test011.ksh new file mode 100755 index 00000000..a212a74a --- /dev/null +++ b/test/sql/Optimizer/test011.ksh @@ -0,0 +1,33 @@ +#!/bin/ksh +# Create table with 4 fields all are bigint. +# create composite hash index on 3 fields. +# Apply explain plan using select with multiple predicates(Hash lookup). +# Apply explain plan using select with multiple predicates(range lookup). +# +QUITFILE=${PWD}/sql/Optimizer/drop.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then +REL_PATH=`pwd`/sql/Optimizer +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/big_composite.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/big_composite.sql + if [ $? -ne 0 ] + then + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql +rm -f ${REL_PATH}/dropt1.sql +exit 0; + diff --git a/test/sql/Optimizer/test012.ksh b/test/sql/Optimizer/test012.ksh new file mode 100755 index 00000000..091c6b18 --- /dev/null +++ b/test/sql/Optimizer/test012.ksh @@ -0,0 +1,33 @@ +#!/bin/ksh +# Create table with 4 fields all are char. +# create composite hash index on 3 fields. +# Apply explain plan using select with multiple predicates(Hash lookup). +# Apply explain plan using select with multiple predicates(range lookup). +# +QUITFILE=${PWD}/sql/Optimizer/drop.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then +REL_PATH=`pwd`/sql/Optimizer +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/char_composite.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/char_composite.sql + if [ $? -ne 0 ] + then + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql +rm -f ${REL_PATH}/dropt1.sql +exit 0; + diff --git a/test/sql/Optimizer/test013.ksh b/test/sql/Optimizer/test013.ksh new file mode 100755 index 00000000..7f7203b6 --- /dev/null +++ b/test/sql/Optimizer/test013.ksh @@ -0,0 +1,33 @@ +#!/bin/ksh +# Create table with 4 fields all are varchar. +# create composite hash index on 3 fields. +# Apply explain plan using select with multiple predicates(Hash lookup). +# Apply explain plan using select with multiple predicates(range lookup). +# +QUITFILE=${PWD}/sql/Optimizer/drop.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then +REL_PATH=`pwd`/sql/Optimizer +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/varchar_composite.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/varchar_composite.sql + if [ $? -ne 0 ] + then + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql +rm -f ${REL_PATH}/dropt1.sql +exit 0; + diff --git a/test/sql/Optimizer/test014.ksh b/test/sql/Optimizer/test014.ksh new file mode 100755 index 00000000..ffbf0cc8 --- /dev/null +++ b/test/sql/Optimizer/test014.ksh @@ -0,0 +1,33 @@ +#!/bin/ksh +# Create table with 4 fields all are date. +# create composite hash index on 3 fields. +# Apply explain plan using select with multiple predicates(Hash lookup). +# Apply explain plan using select with multiple predicates(range lookup). +# +QUITFILE=${PWD}/sql/Optimizer/drop.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then +REL_PATH=`pwd`/sql/Optimizer +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/date_composite.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/date_composite.sql + if [ $? -ne 0 ] + then + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql +rm -f ${REL_PATH}/dropt1.sql +exit 0; + diff --git a/test/sql/Optimizer/test015.ksh b/test/sql/Optimizer/test015.ksh new file mode 100755 index 00000000..bde96cdd --- /dev/null +++ b/test/sql/Optimizer/test015.ksh @@ -0,0 +1,33 @@ +#!/bin/ksh +# Create table with 4 fields all are time. +# create composite hash index on 3 fields. +# Apply explain plan using select with multiple predicates(Hash lookup). +# Apply explain plan using select with multiple predicates(range lookup). +# +QUITFILE=${PWD}/sql/Optimizer/drop.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then +REL_PATH=`pwd`/sql/Optimizer +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/time_composite.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/time_composite.sql + if [ $? -ne 0 ] + then + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql +rm -f ${REL_PATH}/dropt1.sql +exit 0; + diff --git a/test/sql/Optimizer/test016.ksh b/test/sql/Optimizer/test016.ksh new file mode 100755 index 00000000..d860d2ff --- /dev/null +++ b/test/sql/Optimizer/test016.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# Composite hash index on mixed datatypes and testing explain plan +# Create table with 6 fields (f1 smallint, f2 int, f3 bigint, f4 char, f5 date, f6 timestamp). +# create composite hash indexes in different combinations. +# Apply explain plan using select with multiple predicates(Hash lookup). +# Apply explain plan using select with multiple predicates(range lookup). +# +QUITFILE=${PWD}/sql/Optimizer/drop.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then +REL_PATH=`pwd`/sql/Optimizer +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/composite_mixdatatype.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/composite_mixdatatype.sql + if [ $? -ne 0 ] + then + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql +rm -f ${REL_PATH}/dropt1.sql +exit 0; + diff --git a/test/sql/Optimizer/test017.ksh b/test/sql/Optimizer/test017.ksh new file mode 100755 index 00000000..7d4df2df --- /dev/null +++ b/test/sql/Optimizer/test017.ksh @@ -0,0 +1,37 @@ +#!/bin/ksh +# explain plan for is null and is not null operator and composite hash index on mixed datatypes +#create table t1(f1 int, f2 int, f3 varchar(20),f4 date); +#create index idx on t1(f3,f4,f2) hash; +#explain plan select * from t1 where f2 is null; +#explain plan select * from t1 where f2 is not null; +#explain plan select * from t1 where f2 is null and f3 is not null; +#explain plan select * from t1 where f1 is null or f2 is not null or f3 is null or f4 is not null; +#explain plan select * from t1 where f1 is null and f2 is not null and f3 is null and f4 is not null; +# +QUITFILE=${PWD}/sql/Optimizer/drop.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then +REL_PATH=`pwd`/sql/Optimizer +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/explainplan_isnull_isnotnull.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/explainplan_isnull_isnotnull.sql + if [ $? -ne 0 ] + then + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql +rm -f ${REL_PATH}/dropt1.sql +exit 0; + diff --git a/test/sql/Optimizer/test018.ksh b/test/sql/Optimizer/test018.ksh new file mode 100755 index 00000000..8fc9d7e0 --- /dev/null +++ b/test/sql/Optimizer/test018.ksh @@ -0,0 +1,42 @@ +#!/bin/ksh +# EquiJoin and RangeJoin test using explain plan(Hash index on both table). +# create table t1(f1 int, f2 int); +# create index hashidxt1f1 on t1(f1) hash; +# create index hashidxt1f2 on t1(f2) hash; +# create table t2(f1 int, f2 int); +# create index hashidxt2f1 on t2(f1) hash; +# create index hashidxt2f2 on t2(f2) hash; +# explain plan select * from t1,t2; +# explain plan select * from t1,t2 where t1.f1=t2.f1; +# explain plan select * from t1,t2 where t1.f1<=t2.f1; +# explain plan select * from t1,t2 where t1.f1!=t2.f1; +# +QUITFILE=${PWD}/sql/Optimizer/drop.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then +REL_PATH=`pwd`/sql/Optimizer +fi + +echo "drop table t1;" >${REL_PATH}/dropt1t2.sql +echo "drop table t2;" >>${REL_PATH}/dropt1t2.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1t2.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join_hash_int.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join_hash_int.sql + if [ $? -ne 0 ] + then + rm -f ${REL_PATH}/dropt1t2.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2.sql +rm -f ${REL_PATH}/dropt1t2.sql + +exit 0; + diff --git a/test/sql/Optimizer/test019.ksh b/test/sql/Optimizer/test019.ksh new file mode 100755 index 00000000..c74ce831 --- /dev/null +++ b/test/sql/Optimizer/test019.ksh @@ -0,0 +1,42 @@ +#!/bin/ksh +# EquiJoin and RangeJoin test using explain plan(Tree index on both table). +# create table t1(f1 int, f2 int); +# create index treeidxt1f1 on t1(f1) tree; +# create index treeidxt1f2 on t1(f2) tree; +# create table t2(f1 int, f2 int); +# create index treeidxt2f1 on t2(f1) tree; +# create index treeidxt2f2 on t2(f2) tree; +# explain plan select * from t1,t2; +# explain plan select * from t1,t2 where t1.f1=t2.f1; +# explain plan select * from t1,t2 where t1.f1<=t2.f1; +# explain plan select * from t1,t2 where t1.f1!=t2.f1; +# +QUITFILE=${PWD}/sql/Optimizer/drop.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then +REL_PATH=`pwd`/sql/Optimizer +fi + +echo "drop table t1;" >${REL_PATH}/dropt1t2.sql +echo "drop table t2;" >>${REL_PATH}/dropt1t2.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1t2.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join_tree_int.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/join_tree_int.sql + if [ $? -ne 0 ] + then + rm -f ${REL_PATH}/dropt1t2.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2.sql +rm -f ${REL_PATH}/dropt1t2.sql + +exit 0; + diff --git a/test/sql/Optimizer/test020.ksh b/test/sql/Optimizer/test020.ksh new file mode 100755 index 00000000..bb6cf304 --- /dev/null +++ b/test/sql/Optimizer/test020.ksh @@ -0,0 +1,42 @@ +#!/bin/ksh +# Left OuterJoin test using explain plan(Hash index on both table). +# create table t1(f1 int, f2 int); +# create index hashidxt1f1 on t1(f1) hash; +# create index hashidxt1f2 on t1(f2) hash; +# create table t2(f1 int, f2 int); +# create index hashidxt2f1 on t2(f1) hash; +# create index hashidxt2f2 on t2(f2) hash; +# explain plan select * from t1,t2; +# explain plan select * from t1 left join t2 on t1.f1=t2.f1; +# explain plan select * from t1 left join t2 on t1.f1<=t2.f1; +# explain plan select * from t1 left join t2 on t1.f1!=t2.f1; +# +QUITFILE=${PWD}/sql/Optimizer/drop.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then +REL_PATH=`pwd`/sql/Optimizer +fi + +echo "drop table t1;" >${REL_PATH}/dropt1t2.sql +echo "drop table t2;" >>${REL_PATH}/dropt1t2.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1t2.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/leftjoin_hash_int.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/leftjoin_hash_int.sql + if [ $? -ne 0 ] + then + rm -f ${REL_PATH}/dropt1t2.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2.sql +rm -f ${REL_PATH}/dropt1t2.sql + +exit 0; + diff --git a/test/sql/Optimizer/test021.ksh b/test/sql/Optimizer/test021.ksh new file mode 100755 index 00000000..c99e3cf9 --- /dev/null +++ b/test/sql/Optimizer/test021.ksh @@ -0,0 +1,42 @@ +#!/bin/ksh +# Left OuterJoin test using explain plan(Tree index on both table). +# create table t1(f1 int, f2 int); +# create index treeidxt1f1 on t1(f1) tree; +# create index treeidxt1f2 on t1(f2) tree; +# create table t2(f1 int, f2 int); +# create index treeidxt2f1 on t2(f1) tree; +# create index treeidxt2f2 on t2(f2) tree; +# explain plan select * from t1,t2; +# explain plan select * from t1 left join t2 on t1.f1=t2.f1; +# explain plan select * from t1 left join t2 on t1.f1<=t2.f1; +# explain plan select * from t1 left join t2 on t1.f1!=t2.f1; +# +QUITFILE=${PWD}/sql/Optimizer/drop.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then +REL_PATH=`pwd`/sql/Optimizer +fi + +echo "drop table t1;" >${REL_PATH}/dropt1t2.sql +echo "drop table t2;" >>${REL_PATH}/dropt1t2.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1t2.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/leftjoin_tree_int.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/leftjoin_tree_int.sql + if [ $? -ne 0 ] + then + rm -f ${REL_PATH}/dropt1t2.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2.sql +rm -f ${REL_PATH}/dropt1t2.sql + +exit 0; + diff --git a/test/sql/Optimizer/test022.ksh b/test/sql/Optimizer/test022.ksh new file mode 100755 index 00000000..7f505776 --- /dev/null +++ b/test/sql/Optimizer/test022.ksh @@ -0,0 +1,42 @@ +#!/bin/ksh +# Inner Join test using explain plan(Hash index on both table). +# create table t1(f1 int, f2 int); +# create index hashidxt1f1 on t1(f1) hash; +# create index hashidxt1f2 on t1(f2) hash; +# create table t2(f1 int, f2 int); +# create index hashidxt2f1 on t2(f1) hash; +# create index hashidxt2f2 on t2(f2) hash; +# explain plan select * from t1,t2; +# explain plan select * from t1 inner join t2 on t1.f1=t2.f1; +# explain plan select * from t1 inner join t2 on t1.f1<=t2.f1; +# explain plan select * from t1 inner join t2 on t1.f1!=t2.f1; +# +QUITFILE=${PWD}/sql/Optimizer/drop.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then +REL_PATH=`pwd`/sql/Optimizer +fi + +echo "drop table t1;" >${REL_PATH}/dropt1t2.sql +echo "drop table t2;" >>${REL_PATH}/dropt1t2.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1t2.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/innerjoin_hash_int.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/innerjoin_hash_int.sql + if [ $? -ne 0 ] + then + rm -f ${REL_PATH}/dropt1t2.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2.sql +rm -f ${REL_PATH}/dropt1t2.sql + +exit 0; + diff --git a/test/sql/Optimizer/test023.ksh b/test/sql/Optimizer/test023.ksh new file mode 100755 index 00000000..3bd57768 --- /dev/null +++ b/test/sql/Optimizer/test023.ksh @@ -0,0 +1,42 @@ +#!/bin/ksh +# Inner Join test using explain plan(Tree index on both table). +# create table t1(f1 int, f2 int); +# create index treeidxt1f1 on t1(f1) tree; +# create index treeidxt1f2 on t1(f2) tree; +# create table t2(f1 int, f2 int); +# create index treeidxt2f1 on t2(f1) tree; +# create index treeidxt2f2 on t2(f2) tree; +# explain plan select * from t1,t2; +# explain plan select * from t1 inner join t2 on t1.f1=t2.f1; +# explain plan select * from t1 inner join t2 on t1.f1<=t2.f1; +# explain plan select * from t1 inner join t2 on t1.f1!=t2.f1; +# +QUITFILE=${PWD}/sql/Optimizer/drop.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then +REL_PATH=`pwd`/sql/Optimizer +fi + +echo "drop table t1;" >${REL_PATH}/dropt1t2.sql +echo "drop table t2;" >>${REL_PATH}/dropt1t2.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1t2.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/innerjoin_tree_int.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/innerjoin_tree_int.sql + if [ $? -ne 0 ] + then + rm -f ${REL_PATH}/dropt1t2.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2.sql +rm -f ${REL_PATH}/dropt1t2.sql + +exit 0; + diff --git a/test/sql/Optimizer/test024.ksh b/test/sql/Optimizer/test024.ksh new file mode 100755 index 00000000..fcf0c6f7 --- /dev/null +++ b/test/sql/Optimizer/test024.ksh @@ -0,0 +1,36 @@ +#!/bin/ksh +# Self Join test using explain plan(Hash index on both table). +# create table t1(f1 int, f2 int); +# create index hashidxt1f1 on t1(f1) hash; +# create index hashidxt1f2 on t1(f2) hash; +# explain plan select * from t1,t2; +# explain plan select a.f1,b.f1 from t1 a, t1 b where a.f1=b.f1; +# +QUITFILE=${PWD}/sql/Optimizer/drop.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then +REL_PATH=`pwd`/sql/Optimizer +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/selfjoin_hash_int.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/selfjoin_hash_int.sql + if [ $? -ne 0 ] + then + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql +rm -f ${REL_PATH}/dropt1.sql + +exit 0; + diff --git a/test/sql/Optimizer/test025.ksh b/test/sql/Optimizer/test025.ksh new file mode 100755 index 00000000..697371df --- /dev/null +++ b/test/sql/Optimizer/test025.ksh @@ -0,0 +1,36 @@ +#!/bin/ksh +# Self Join test using explain plan(Tree index on both table). +# create table t1(f1 int, f2 int); +# create index treeidxt1f1 on t1(f1) tree; +# create index treeidxt1f2 on t1(f2) tree; +# explain plan select * from t1,t2; +# explain plan select a.f1,b.f1 from t1 a, t1 b where a.f1=b.f1; +# +QUITFILE=${PWD}/sql/Optimizer/drop.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then +REL_PATH=`pwd`/sql/Optimizer +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/selfjoin_tree_int.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/selfjoin_tree_int.sql + if [ $? -ne 0 ] + then + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1.sql +rm -f ${REL_PATH}/dropt1.sql + +exit 0; + diff --git a/test/sql/Optimizer/time_composite.sql b/test/sql/Optimizer/time_composite.sql new file mode 100644 index 00000000..25dbca03 --- /dev/null +++ b/test/sql/Optimizer/time_composite.sql @@ -0,0 +1,27 @@ +echo create table t1(f1 time, f2 time, f3 time, f4 time); +create table t1(f1 time, f2 time, f3 time, f4 time); +echo create index hashtimef1f2f3 on t1(f2,f3,f1) hash; +create index hashtimef1f2f3 on t1(f2,f3,f1) hash; +echo explain plan select * from t1; +explain plan select * from t1; +echo explain plan select * from t1 where f1 = '03:03:03'; +explain plan select * from t1 where f1 = '03:03:03'; +echo explain plan select * from t1 where f1 = '03:03:03' and f2='03:03:03'; +explain plan select * from t1 where f1 = '03:03:03' and f2='03:03:03'; +echo explain plan select * from t1 where f1 = '03:03:03' and f2='03:03:03' and f3='03:03:03'; +explain plan select * from t1 where f1 = '03:03:03' and f2='03:03:03' and f3='03:03:03'; +echo explain plan select * from t1 where f1 = '03:03:03' or f2='03:03:03' or f3='03:03:03'; +explain plan select * from t1 where f1 = '03:03:03' or f2='03:03:03' or f3='03:03:03'; +echo explain plan select * from t1 where f1 = '03:03:03' and f2='03:03:03' or f3='03:03:03'; +explain plan select * from t1 where f1 = '03:03:03' and f2='03:03:03' or f3='03:03:03'; +echo explain plan select * from t1 where f1 = '03:03:03' and f2='03:03:03' and not(f3='03:03:03'); +explain plan select * from t1 where f1 = '03:03:03' and f2='03:03:03' and not(f3='03:03:03'); +echo explain plan select * from t1 where f1 in('03:03:03','03:03:03','03:03:03') and f2='03:03:03' and not(f3='03:03:03'); +explain plan select * from t1 where f1 in('03:03:03','03:03:03','03:03:03') and f2='03:03:03' and not(f3='03:03:03'); +echo explain plan select * from t1 where f1 in('03:03:03','05:05:05','06:06:06') and (f2 between '03:03:03' and '03:03:03') and not(f3='03:03:03'); +explain plan select * from t1 where f1 in('03:03:03','05:05:05','06:06:06') and (f2 between '03:03:03' and '03:03:03') and not(f3='03:03:03'); +echo explain plan select * from t1 where f1 in('05:05:05','06:06:06','03:03:03') or (f2 between '03:03:03' and '03:03:03') or not(f3='03:03:03'); +explain plan select * from t1 where f1 in('05:05:05','06:06:06','03:03:03') or (f2 between '03:03:03' and '03:03:03') or not(f3='03:03:03'); +echo explain plan select * from t1 where f1 in('03:03:03','06:06:06','05:05:05') or (f2 between '03:03:03' and '03:03:03') and not(f3='03:03:03'); +explain plan select * from t1 where f1 in('03:03:03','06:06:06','05:05:05') or (f2 between '03:03:03' and '03:03:03') and not(f3='03:03:03'); + diff --git a/test/sql/Optimizer/tiny_composite.sql b/test/sql/Optimizer/tiny_composite.sql new file mode 100644 index 00000000..583084a4 --- /dev/null +++ b/test/sql/Optimizer/tiny_composite.sql @@ -0,0 +1,27 @@ +echo create table t1(f1 tinyint, f2 tinyint, f3 tinyint, f4 tinyint); +create table t1(f1 tinyint, f2 tinyint, f3 tinyint, f4 tinyint); +echo create index hashtinyf1f2f3 on t1(f2,f3,f1) hash; +create index hashtinyf1f2f3 on t1(f2,f3,f1) hash; +echo explain plan select * from t1; +explain plan select * from t1; +echo explain plan select * from t1 where f1 = 2; +explain plan select * from t1 where f1 = 2; +echo explain plan select * from t1 where f1 = 2 and f2=2; +explain plan select * from t1 where f1 = 2 and f2=2; +echo explain plan select * from t1 where f1 = 2 and f2=2 and f3=2; +explain plan select * from t1 where f1 = 2 and f2=2 and f3=2; +echo explain plan select * from t1 where f1 = 2 or f2=2 or f3=2; +explain plan select * from t1 where f1 = 2 or f2=2 or f3=2; +echo explain plan select * from t1 where f1 = 2 and f2=2 or f3=2; +explain plan select * from t1 where f1 = 2 and f2=2 or f3=2; +echo explain plan select * from t1 where f1 = 2 and f2=2 and not(f3=2); +explain plan select * from t1 where f1 = 2 and f2=2 and not(f3=2); +echo explain plan select * from t1 where f1 in(1,2,3) and f2=2 and not(f3=2); +explain plan select * from t1 where f1 in(1,2,3) and f2=2 and not(f3=2); +echo explain plan select * from t1 where f1 in(1,2,3) and (f2 between 2 and 4) and not(f3=2); +explain plan select * from t1 where f1 in(1,2,3) and (f2 between 2 and 4) and not(f3=2); +echo explain plan select * from t1 where f1 in(1,2,3) or (f2 between 2 and 4) or not(f3=2); +explain plan select * from t1 where f1 in(1,2,3) or (f2 between 2 and 4) or not(f3=2); +echo explain plan select * from t1 where f1 in(1,2,3) or (f2 between 2 and 4) and not(f3=2); +explain plan select * from t1 where f1 in(1,2,3) or (f2 between 2 and 4) and not(f3=2); + diff --git a/test/sql/Optimizer/tree_inbetweenlike.sql b/test/sql/Optimizer/tree_inbetweenlike.sql new file mode 100644 index 00000000..390843aa --- /dev/null +++ b/test/sql/Optimizer/tree_inbetweenlike.sql @@ -0,0 +1,74 @@ +echo create table t1(f1 tinyint, f2 smallint, f3 int, f4 bigint, f5 char(10), f6 varchar(10), f7 date, f8 time, f9 float, f10 double, f11 timestamp); +create table t1(f1 tinyint, f2 smallint, f3 int, f4 bigint, f5 char(10), f6 varchar(10), f7 date, f8 time, f9 float, f10 double, f11 timestamp); +echo create index treetiny on t1(f1) tree; +create index treetiny on t1(f1) tree; +echo create index treesmall on t1(f2) tree; +create index treesmall on t1(f2) tree; +echo create index treeint on t1(f3) tree; +create index treeint on t1(f3) tree; +echo create index treebig on t1(f4) tree; +create index treebig on t1(f4) tree; +echo create index treechar on t1(f5) tree; +create index treechar on t1(f5) tree; +echo create index treevarchar on t1(f6) tree; +create index treevarchar on t1(f6) tree; +echo create index treedate on t1(f7) tree; +create index treedate on t1(f7) tree; +echo create index treetime on t1(f8) tree; +create index treetime on t1(f8) tree; +echo create index treefloat on t1(f9) tree; +create index treefloat on t1(f9) tree; +echo create index treedouble on t1(f10) tree; +create index treedouble on t1(f10) tree; +echo create index treetimestamp on t1(f11) tree; +create index treetimestamp on t1(f11) tree; +echo explain plan select * from t1; +explain plan select * from t1; +echo explain plan select * from t1 where f1 in (0,2,4); +explain plan select * from t1 where f1 in (0,2,4) ; +echo explain plan select * from t1 where f1 between 2 and 4; +explain plan select * from t1 where f1 between 2 and 4; +echo explain plan select * from t1 where f2 in (0,2,4);; +explain plan select * from t1 where f2 in (0,2,4); +echo explain plan select * from t1 where f2 between 2 and 4; +explain plan select * from t1 where f2 between 2 and 4; +echo explain plan select * from t1 where f3 in (1,2); +explain plan select * from t1 where f3 in (1,2) ; +echo explain plan select * from t1 where f3 between 1 and 4; +explain plan select * from t1 where f3 between 1 and 4; +echo explain plan select * from t1 where f4 in (1,2); +explain plan select * from t1 where f4 in (1,2) ; +echo explain plan select * from t1 where f4 between 1 and 4; +explain plan select * from t1 where f4 between 1 and 4; +echo explain plan select * from t1 where f5 in ('1','2'); +explain plan select * from t1 where f5 in ('1','2') ; +echo explain plan select * from t1 where f5 like 'N%'; +explain plan select * from t1 where f5 like 'N%'; +echo explain plan select * from t1 where f5 like 'N_h'; +explain plan select * from t1 where f5 like 'N_h'; +echo explain plan select * from t1 where f6 in ('1','2'); +explain plan select * from t1 where f6 in ('1','2') ; +echo explain plan select * from t1 where f6 like 'N%'; +explain plan select * from t1 where f6 like 'N%'; +echo explain plan select * from t1 where f6 like 'N_h'; +explain plan select * from t1 where f6 like 'N_h'; +echo explain plan select * from t1 where f7 in ('2003-11-12','2003-11-15'); +explain plan select * from t1 where f7 in ('2003-11-12','2003-11-15'); +echo explain plan select * from t1 where f7 between '2003-11-12' and '2003-11-15'; +explain plan select * from t1 where f7 between '2003-11-12' and '2003-11-15'; +echo explain plan select * from t1 where f8 in ('03:21:00','03:21:08'); +explain plan select * from t1 where f8 in ('03:21:00','03:21:08'); +echo explain plan select * from t1 where f8 between '03:21:00' and '03:21:08'; +explain plan select * from t1 where f8 between '03:21:00' and '03:21:08'; +echo explain plan select * from t1 where f9 in ('2.7','3.7'); +explain plan select * from t1 where f9 in ('2.7','3.7'); +echo explain plan select * from t1 where f9 between '2.7' and '3.7'; +explain plan select * from t1 where f9 between '2.7' and '3.7'; +echo explain plan select * from t1 where f10 in ('2.7','3.7'); +explain plan select * from t1 where f10 in ('2.7','3.7'); +echo explain plan select * from t1 where f10 between '2.7' and '3.7'; +explain plan select * from t1 where f10 between '2.7' and '3.7'; +echo explain plan select * from t1 where f11 in ('2003-11-12 01:01:01','2003-11-18 01:01:01'); +explain plan select * from t1 where f11 in ('2003-11-12 01:01:01','2003-11-18 01:01:01'); +echo explain plan select * from t1 where f11 between '2003-11-12 01:01:01' and '2003-11-18 01:01:01'; +explain plan select * from t1 where f11 between '2003-11-12 01:01:01' and '2003-11-18 01:01:01'; diff --git a/test/sql/Optimizer/tree_singleprrdicate.sql b/test/sql/Optimizer/tree_singleprrdicate.sql new file mode 100644 index 00000000..49cafe62 --- /dev/null +++ b/test/sql/Optimizer/tree_singleprrdicate.sql @@ -0,0 +1,57 @@ +echo create table t1(f1 tinyint, f2 smallint, f3 int, f4 bigint, f5 char(10), f6 varchar(10), f7 date, f8 time); +create table t1(f1 tinyint, f2 smallint, f3 int, f4 bigint, f5 char(10), f6 varchar(10), f7 date, f8 time); +echo create index treetiny on t1(f1) tree; +create index treetiny on t1(f1) tree; +echo create index treesmall on t1(f2) tree; +create index treesmall on t1(f2) tree; +echo create index treeint on t1(f3) tree; +create index treeint on t1(f3) tree; +echo create index treebig on t1(f4) tree; +create index treebig on t1(f4) tree; +echo create index treechar on t1(f5) tree; +create index treechar on t1(f5) tree; +echo create index treevarchar on t1(f6) tree; +create index treevarchar on t1(f6) tree; +echo create index treedate on t1(f7) tree; +create index treedate on t1(f7) tree; +echo create index treetime on t1(f8) tree; +create index treetime on t1(f8) tree; +insert into t1 values(1,11,111,1111,'CSQL1','Lakshya1','2001-11-12','01:21:00'); +insert into t1 values(2,22,222,2222,'CSQL2','Lakshya2','2002-11-12','02:21:00'); +insert into t1 values(3,33,333,3333,'CSQL3','Lakshya3','2003-11-12','03:21:00'); +insert into t1 values(4,44,444,4444,'CSQL4','Lakshya4','2004-11-12','04:21:00'); +insert into t1 values(5,55,555,5555,'CSQL5','Lakshya5','2005-11-12','05:21:00'); +echo explain plan select * from t1; +explain plan select * from t1; +echo explain plan select * from t1 where f1 = 2; +explain plan select * from t1 where f1 = 2; +echo explain plan select * from t1 where f1 < 3; +explain plan select * from t1 where f1 < 3; +echo explain plan select * from t1 where f2 = 22; +explain plan select * from t1 where f2 = 22; +echo explain plan select * from t1 where f2 > 33; +explain plan select * from t1 where f2 > 33; +echo explain plan select * from t1 where f3 = 333; +explain plan select * from t1 where f3 = 333; +echo explain plan select * from t1 where f3 <> 333; +explain plan select * from t1 where f3 <> 333; +echo explain plan select * from t1 where f4 = 4444; +explain plan select * from t1 where f4 = 4444; +echo explain plan select * from t1 where f4 != 4444; +explain plan select * from t1 where f4 != 4444; +echo explain plan select * from t1 where f5 = 'CSQL3'; +explain plan select * from t1 where f5 = 'CSQL3'; +echo explain plan select * from t1 where f5 <= 'CSQL3'; +explain plan select * from t1 where f5 <= 'CSQL3'; +echo explain plan select * from t1 where f6 = 'Lakshya3'; +explain plan select * from t1 where f6 = 'Lakshya3'; +echo explain plan select * from t1 where f6 >= 'Lakshya3'; +explain plan select * from t1 where f6 >= 'Lakshya3'; +echo explain plan select * from t1 where f7 = '2003-11-12'; +explain plan select * from t1 where f7 = '2003-11-12'; +echo explain plan select * from t1 where f7 > '2003-11-12'; +explain plan select * from t1 where f7 > '2003-11-12'; +echo explain plan select * from t1 where f8 = '03:21:00'; +explain plan select * from t1 where f8 = '03:21:00'; +echo explain plan select * from t1 where f8 < '03:21:00'; +explain plan select * from t1 where f8 < '03:21:00'; diff --git a/test/sql/Optimizer/varchar_composite.sql b/test/sql/Optimizer/varchar_composite.sql new file mode 100644 index 00000000..cf8eb09b --- /dev/null +++ b/test/sql/Optimizer/varchar_composite.sql @@ -0,0 +1,27 @@ +echo create table t1(f1 varchar, f2 varchar, f3 varchar, f4 varchar); +create table t1(f1 varchar, f2 varchar, f3 varchar, f4 varchar); +echo create index hashvarcharf1f2f3 on t1(f2,f3,f1) hash; +create index hashvarcharf1f2f3 on t1(f2,f3,f1) hash; +echo explain plan select * from t1; +explain plan select * from t1; +echo explain plan select * from t1 where f1 = 'a'; +explain plan select * from t1 where f1 = 'a'; +echo explain plan select * from t1 where f1 = 'a' and f2='a'; +explain plan select * from t1 where f1 = 'a' and f2='a'; +echo explain plan select * from t1 where f1 = 'a' and f2='a' and f3='a'; +explain plan select * from t1 where f1 = 'a' and f2='a' and f3='a'; +echo explain plan select * from t1 where f1 = 'a' or f2='a' or f3='a'; +explain plan select * from t1 where f1 = 'a' or f2='a' or f3='a'; +echo explain plan select * from t1 where f1 = 'a' and f2='a' or f3='a'; +explain plan select * from t1 where f1 = 'a' and f2='a' or f3='a'; +echo explain plan select * from t1 where f1 = 'a' and f2='a' and not(f3='a'); +explain plan select * from t1 where f1 = 'a' and f2='a' and not(f3='a'); +echo explain plan select * from t1 where f1 in('a','a','a') and f2='a' and not(f3='a'); +explain plan select * from t1 where f1 in('a','a','a') and f2='a' and not(f3='a'); +echo explain plan select * from t1 where f1 in('a','b','c') and f2 like 'a%' and not(f3='d'); +explain plan select * from t1 where f1 in('a','b','c') and f2 like 'a%' and not(f3='d'); +echo explain plan select * from t1 where f1 in('b','c','a') or f2 like 'a%' or not(f3='d'); +explain plan select * from t1 where f1 in('b','c','a') or f2 like 'a%' or not(f3='d'); +echo explain plan select * from t1 where f1 in('a','c','b') or f2 like 'a%' and not(f3='d'); +explain plan select * from t1 where f1 in('a','c','b') or f2 like 'a%' and not(f3='d'); + diff --git a/test/sql/Order/alldatatype.sql b/test/sql/Order/alldatatype.sql new file mode 100644 index 00000000..f7499d6b --- /dev/null +++ b/test/sql/Order/alldatatype.sql @@ -0,0 +1,18 @@ +create table t1(f0 tinyint, f1 smallint,f2 int,f3 bigint,f4 char(10),f5 float,f6 double,f7 date,f8 time,f9 timestamp); +insert into t1 values(1, 10,100 ,1000, 'Bijay',1000,100000,'2009-03-01','11:59:59','2009-03-01 11:59:59'); +insert into t1 values(2, 11,110 ,1100, 'Jitendr',2000,200000,'2009-03-02','11:59:58','2009-03-02 11:59:59'); +insert into t1 values(3, 12,120 ,1000, 'Nihar',3000,300000,'2009-03-03','11:59:57','2009-03-03 11:59:59'); +insert into t1 values(4, 13,130 ,1100, 'Kishor',4000,400000,'2009-03-04','11:59:59','2009-03-04 11:59:59'); +insert into t1 values(5, 14,100 ,1000, 'Praba',5000,500000,'2009-03-01','11:59:58','2009-03-01 11:59:59'); +insert into t1 values(6, 15,110 ,1100, 'Sanjit',6000,600000,'2009-03-02','11:59:57','2009-03-02 11:59:59'); +insert into t1 values(7, 16,120 ,1000, 'Sanjay',7000,700000,'2009-03-03','11:59:59','2009-03-03 11:59:59'); +insert into t1 values(1, 17,130 ,1100, 'Arindam',8000,800000,'2009-03-04','11:59:58','2009-03-04 11:59:59'); +insert into t1 values(2, 10,100 ,1000, 'Bijay',9000,900000,'2009-03-01','11:59:57','2009-03-01 11:59:59'); +insert into t1 values(3, 11,110 ,1100, 'Jitendr',1000,100000,'2009-03-02','11:59:58','2009-03-02 11:59:59'); +insert into t1 values(4, 12,120 ,1000, 'Nihar',2000,200000,'2009-03-03','11:59:57','2009-03-03 11:59:59'); +insert into t1 values(5, 13,130 ,1100, 'Kishor',3000,300000,'2009-03-05','11:59:56','2009-03-05 11:59:59'); +insert into t1 values(6, 14,100 ,1000, 'Praba',4000,400000,'2009-03-01','11:59:55','2009-03-04 11:59:59'); +insert into t1 values(7, 15,110 ,1100, 'Sanjit',5000,500000,'2009-03-02','11:59:56','2009-03-01 11:59:59'); +insert into t1 values(1, 16,120 ,1000, 'Sanjay',6000,600000,'2009-03-03','11:59:55','2009-03-03 11:59:59'); +insert into t1 values(2, 17,130 ,1100, 'Arindam',7000,700000,'2009-03-01','11:59:59','2009-03-01 11:59:59'); +select * from t1; diff --git a/test/sql/Order/drop_Articles_Authors_AuthorArticle.sql b/test/sql/Order/drop_Articles_Authors_AuthorArticle.sql new file mode 100644 index 00000000..40550010 --- /dev/null +++ b/test/sql/Order/drop_Articles_Authors_AuthorArticle.sql @@ -0,0 +1,6 @@ +echo DROP table AuthorArticle; +DROP table AuthorArticle; +echo DROP table Authors; +DROP table Authors; +echo DROP table Articles; +DROP table Articles; diff --git a/test/sql/Order/drop_t1_t2_t3.sql b/test/sql/Order/drop_t1_t2_t3.sql new file mode 100644 index 00000000..562cf995 --- /dev/null +++ b/test/sql/Order/drop_t1_t2_t3.sql @@ -0,0 +1,3 @@ +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; diff --git a/test/sql/Order/dropemp.sql b/test/sql/Order/dropemp.sql new file mode 100644 index 00000000..4da756e6 --- /dev/null +++ b/test/sql/Order/dropemp.sql @@ -0,0 +1 @@ +DROP TABLE emp; diff --git a/test/sql/Order/dropt1.sql b/test/sql/Order/dropt1.sql new file mode 100644 index 00000000..2d707d46 --- /dev/null +++ b/test/sql/Order/dropt1.sql @@ -0,0 +1,2 @@ +drop table t1; + diff --git a/test/sql/Order/exp.test001.ksh b/test/sql/Order/exp.test001.ksh new file mode 100644 index 00000000..75d795b5 --- /dev/null +++ b/test/sql/Order/exp.test001.ksh @@ -0,0 +1,57 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 +--------------------------------------------------------- + 98 1 10 AAA + 99 2 20 BBB + 100 2 10 CCC + 101 3 10 AAA + 102 2 20 BBB + +echo select * from t1 order by f2; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 +--------------------------------------------------------- + 98 1 10 AAA + 102 2 20 BBB + 100 2 10 CCC + 99 2 20 BBB + 101 3 10 AAA + +echo select * from t1 order by t1.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 +--------------------------------------------------------- + 98 1 10 AAA + 102 2 20 BBB + 100 2 10 CCC + 99 2 20 BBB + 101 3 10 AAA + +echo select f2,f3 from t1 order by f2; +--------------------------------------------------------- + f2 f3 +--------------------------------------------------------- + 1 10 + 2 20 + 2 10 + 2 20 + 3 10 + +echo select f4,f2 from t1 order by f4; +--------------------------------------------------------- + f4 f2 +--------------------------------------------------------- + AAA 3 + AAA 1 + BBB 2 + BBB 2 + CCC 2 + +Statement Executed diff --git a/test/sql/Order/exp.test002.ksh b/test/sql/Order/exp.test002.ksh new file mode 100644 index 00000000..5d1ddc0e --- /dev/null +++ b/test/sql/Order/exp.test002.ksh @@ -0,0 +1,130 @@ +echo CREATE TABLE Articles ( ArticleID SMALLINT, ArticleTitle CHAR(30) NOT NULL, Copyright INT NOT NULL,PRIMARY KEY(ArticleID)); +Statement Executed +echo INSERT INTO Articles VALUES (12786, 'How write a paper',1934); +Statement Executed: Rows Affected = 1 +echo INSERT INTO Articles VALUES (13331, 'Publish a paper ',1919); +Statement Executed: Rows Affected = 1 +echo INSERT INTO Articles VALUES (14356, 'Sell a paper ',1966); +Statement Executed: Rows Affected = 1 +echo INSERT INTO Articles VALUES (15729, 'Buy a paper ',1932); +Statement Executed: Rows Affected = 1 +echo INSERT INTO Articles VALUES (16284, 'Conferences ',1996); +Statement Executed: Rows Affected = 1 +echo INSERT INTO Articles VALUES (17695, 'Journal ',1980); +Statement Executed: Rows Affected = 1 +echo INSERT INTO Articles VALUES (19264, 'Information ',1992); +Statement Executed: Rows Affected = 1 +echo INSERT INTO Articles VALUES (19354, 'AI ',1993); +Statement Executed: Rows Affected = 1 +echo CREATE TABLE Authors (AuthID SMALLINT, AuthorFirstName CHAR(20), AuthorMiddleName CHAR(20), AuthorLastName CHAR(20),PRIMARY KEY(AuthID)); +Statement Executed +echo INSERT INTO Authors VALUES (1006, 'Henry', 'S.', 'Thompson'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO Authors VALUES(1007, 'Jason', 'Carol', 'Oak'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO Authors VALUES(1008, 'James', NULL, 'Elk'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO Authors VALUES(1009, 'Tom', 'M', 'Ride'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO Authors VALUES(1010, 'Jack', 'K', 'Ken'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO Authors VALUES(1011, 'Mary', 'G.', 'Lee'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO Authors VALUES(1012, 'Annie', NULL, 'Peng'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO Authors VALUES(1013, 'Alan', NULL, 'Wang'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO Authors VALUES(1014, 'Nelson', NULL, 'Yin'); +Statement Executed: Rows Affected = 1 +echo CREATE TABLE AuthorArticle (AuthID SMALLINT NOT NULL, ArticleID SMALLINT NOT NULL,FOREIGN KEY(AuthID) REFERENCES Authors(AuthID), FOREIGN KEY(ArticleID) REFERENCES Articles(ArticleID)); +Statement Executed +echo INSERT INTO AuthorArticle VALUES (1006, 14356); +Statement Executed: Rows Affected = 1 +echo INSERT INTO AuthorArticle VALUES (1008, 15729); +Statement Executed: Rows Affected = 1 +echo INSERT INTO AuthorArticle VALUES (1009, 12786); +Statement Executed: Rows Affected = 1 +echo INSERT INTO AuthorArticle VALUES (1010, 17695); +Statement Executed: Rows Affected = 1 +echo INSERT INTO AuthorArticle VALUES (1011, 15729); +Statement Executed: Rows Affected = 1 +echo INSERT INTO AuthorArticle VALUES (1012, 19264); +Statement Executed: Rows Affected = 1 +echo INSERT INTO AuthorArticle VALUES (1012, 19354); +Statement Executed: Rows Affected = 1 +echo INSERT INTO AuthorArticle VALUES (1014, 16284); +Statement Executed: Rows Affected = 1 +echo SELECT * FROM Articles; +--------------------------------------------------------- + Articles.ArticleID Articles.ArticleTitle Articles.Copyright +--------------------------------------------------------- + 12786 How write a paper 1934 + 13331 Publish a paper 1919 + 14356 Sell a paper 1966 + 15729 Buy a paper 1932 + 16284 Conferences 1996 + 17695 Journal 1980 + 19264 Information 1992 + 19354 AI 1993 + +echo SELECT * FROM Authors; +--------------------------------------------------------- + Authors.AuthID Authors.AuthorFirstName Authors.AuthorMiddleName Authors.AuthorLastName +--------------------------------------------------------- + 1006 Henry S. Thompson + 1007 Jason Carol Oak + 1008 James NULL Elk + 1009 Tom M Ride + 1010 Jack K Ken + 1011 Mary G. Lee + 1012 Annie NULL Peng + 1013 Alan NULL Wang + 1014 Nelson NULL Yin + +echo SELECT * FROM AuthorArticle; +--------------------------------------------------------- + AuthorArticle.AuthID AuthorArticle.ArticleID +--------------------------------------------------------- + 1006 14356 + 1008 15729 + 1009 12786 + 1010 17695 + 1011 15729 + 1012 19264 + 1012 19354 + 1014 16284 + +echo SELECT ArticleTitle, Copyright FROM Articles LEFT JOIN AuthorArticle ON Articles.ArticleID=AuthorArticle.ArticleID LEFT JOIN Authors ON AuthorArticle.AuthID=Authors.AuthID; +--------------------------------------------------------- + ArticleTitle Copyright +--------------------------------------------------------- + How write a paper 1934 + Publish a paper 1919 + Sell a paper 1966 + Buy a paper 1932 + Buy a paper 1932 + Conferences 1996 + Journal 1980 + Information 1992 + AI 1993 + +echo SELECT ArticleTitle, Copyright FROM Articles LEFT JOIN AuthorArticle ON Articles.ArticleID=AuthorArticle.ArticleID LEFT JOIN Authors ON AuthorArticle.AuthID=Authors.AuthID ORDER BY ArticleTitle; +--------------------------------------------------------- + ArticleTitle Copyright +--------------------------------------------------------- + AI 1993 + Buy a paper 1932 + Buy a paper 1932 + Conferences 1996 + How write a paper 1934 + Information 1992 + Journal 1980 + Publish a paper 1919 + Sell a paper 1966 + +echo DROP table AuthorArticle; +Statement Executed +echo DROP table Authors; +Statement Executed +echo DROP table Articles; +Statement Executed diff --git a/test/sql/Order/exp.test003.ksh b/test/sql/Order/exp.test003.ksh new file mode 100644 index 00000000..13db2f10 --- /dev/null +++ b/test/sql/Order/exp.test003.ksh @@ -0,0 +1,374 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +--------------------------------------------------------- + t1.f0 t1.f1 t1.f2 t1.f3 t1.f4 t1.f5 t1.f6 t1.f7 t1.f8 t1.f9 +--------------------------------------------------------- + 1 10 100 1000 Bijay 1000.000000 100000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + 2 11 110 1100 Jitendr 2000.000000 200000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 3 12 120 1000 Nihar 3000.000000 300000.000000 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 4 13 130 1100 Kishor 4000.000000 400000.000000 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 + 5 14 100 1000 Praba 5000.000000 500000.000000 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 + 6 15 110 1100 Sanjit 6000.000000 600000.000000 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 + 7 16 120 1000 Sanjay 7000.000000 700000.000000 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 + 1 17 130 1100 Arindam 8000.000000 800000.000000 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 + 2 10 100 1000 Bijay 9000.000000 900000.000000 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 + 3 11 110 1100 Jitendr 1000.000000 100000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 4 12 120 1000 Nihar 2000.000000 200000.000000 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 5 13 130 1100 Kishor 3000.000000 300000.000000 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 + 6 14 100 1000 Praba 4000.000000 400000.000000 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 + 7 15 110 1100 Sanjit 5000.000000 500000.000000 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 + 1 16 120 1000 Sanjay 6000.000000 600000.000000 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 + 2 17 130 1100 Arindam 7000.000000 700000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + +echo select f0,f4 from t1 order by f0; +--------------------------------------------------------- + f0 f4 +--------------------------------------------------------- + 1 Sanjay + 1 Arindam + 1 Bijay + 2 Arindam + 2 Bijay + 2 Jitendr + 3 Jitendr + 3 Nihar + 4 Nihar + 4 Kishor + 5 Kishor + 5 Praba + 6 Praba + 6 Sanjit + 7 Sanjit + 7 Sanjay + +echo select f1,f4 from t1 order by f1; +--------------------------------------------------------- + f1 f4 +--------------------------------------------------------- + 10 Bijay + 10 Bijay + 11 Jitendr + 11 Jitendr + 12 Nihar + 12 Nihar + 13 Kishor + 13 Kishor + 14 Praba + 14 Praba + 15 Sanjit + 15 Sanjit + 16 Sanjay + 16 Sanjay + 17 Arindam + 17 Arindam + +echo select f2,f4 from t1 order by f2; +--------------------------------------------------------- + f2 f4 +--------------------------------------------------------- + 100 Praba + 100 Bijay + 100 Praba + 100 Bijay + 110 Sanjit + 110 Jitendr + 110 Sanjit + 110 Jitendr + 120 Sanjay + 120 Nihar + 120 Sanjay + 120 Nihar + 130 Arindam + 130 Kishor + 130 Arindam + 130 Kishor + +echo select f3,f4 from t1 order by f3; +--------------------------------------------------------- + f3 f4 +--------------------------------------------------------- + 1000 Sanjay + 1000 Praba + 1000 Nihar + 1000 Bijay + 1000 Sanjay + 1000 Praba + 1000 Nihar + 1000 Bijay + 1100 Arindam + 1100 Sanjit + 1100 Kishor + 1100 Jitendr + 1100 Arindam + 1100 Sanjit + 1100 Kishor + 1100 Jitendr + +echo select f4,f4 from t1 order by f4; +--------------------------------------------------------- + f4 f4 +--------------------------------------------------------- + Arindam Arindam + Arindam Arindam + Bijay Bijay + Bijay Bijay + Jitendr Jitendr + Jitendr Jitendr + Kishor Kishor + Kishor Kishor + Nihar Nihar + Nihar Nihar + Praba Praba + Praba Praba + Sanjay Sanjay + Sanjay Sanjay + Sanjit Sanjit + Sanjit Sanjit + +echo select f5,f4 from t1 order by f5; +--------------------------------------------------------- + f5 f4 +--------------------------------------------------------- + 1000.000000 Jitendr + 1000.000000 Bijay + 2000.000000 Nihar + 2000.000000 Jitendr + 3000.000000 Kishor + 3000.000000 Nihar + 4000.000000 Praba + 4000.000000 Kishor + 5000.000000 Sanjit + 5000.000000 Praba + 6000.000000 Sanjay + 6000.000000 Sanjit + 7000.000000 Arindam + 7000.000000 Sanjay + 8000.000000 Arindam + 9000.000000 Bijay + +echo select f6,f4 from t1 order by f6; +--------------------------------------------------------- + f6 f4 +--------------------------------------------------------- + 100000.000000 Jitendr + 100000.000000 Bijay + 200000.000000 Nihar + 200000.000000 Jitendr + 300000.000000 Kishor + 300000.000000 Nihar + 400000.000000 Praba + 400000.000000 Kishor + 500000.000000 Sanjit + 500000.000000 Praba + 600000.000000 Sanjay + 600000.000000 Sanjit + 700000.000000 Arindam + 700000.000000 Sanjay + 800000.000000 Arindam + 900000.000000 Bijay + +echo select f7,f4 from t1 order by f7; +--------------------------------------------------------- + f7 f4 +--------------------------------------------------------- + 2009/3/1 Arindam + 2009/3/1 Praba + 2009/3/1 Bijay + 2009/3/1 Praba + 2009/3/1 Bijay + 2009/3/2 Sanjit + 2009/3/2 Jitendr + 2009/3/2 Sanjit + 2009/3/2 Jitendr + 2009/3/3 Sanjay + 2009/3/3 Nihar + 2009/3/3 Sanjay + 2009/3/3 Nihar + 2009/3/4 Arindam + 2009/3/4 Kishor + 2009/3/5 Kishor + +echo select f8,f4 from t1 order by f8; +--------------------------------------------------------- + f8 f4 +--------------------------------------------------------- + 11:59:55.0 Sanjay + 11:59:55.0 Praba + 11:59:56.0 Sanjit + 11:59:56.0 Kishor + 11:59:57.0 Nihar + 11:59:57.0 Bijay + 11:59:57.0 Sanjit + 11:59:57.0 Nihar + 11:59:58.0 Jitendr + 11:59:58.0 Arindam + 11:59:58.0 Praba + 11:59:58.0 Jitendr + 11:59:59.0 Arindam + 11:59:59.0 Sanjay + 11:59:59.0 Kishor + 11:59:59.0 Bijay + +echo select f9,f4 from t1 order by f9; +--------------------------------------------------------- + f9 f4 +--------------------------------------------------------- + 2009/3/1 11:59:59.0 Arindam + 2009/3/1 11:59:59.0 Sanjit + 2009/3/1 11:59:59.0 Bijay + 2009/3/1 11:59:59.0 Praba + 2009/3/1 11:59:59.0 Bijay + 2009/3/2 11:59:59.0 Jitendr + 2009/3/2 11:59:59.0 Sanjit + 2009/3/2 11:59:59.0 Jitendr + 2009/3/3 11:59:59.0 Sanjay + 2009/3/3 11:59:59.0 Nihar + 2009/3/3 11:59:59.0 Sanjay + 2009/3/3 11:59:59.0 Nihar + 2009/3/4 11:59:59.0 Praba + 2009/3/4 11:59:59.0 Arindam + 2009/3/4 11:59:59.0 Kishor + 2009/3/5 11:59:59.0 Kishor + +echo select f0,f1,f4 from t1 order by f0,f1; +--------------------------------------------------------- + f0 f1 f4 +--------------------------------------------------------- + 1 10 Bijay + 1 16 Sanjay + 1 17 Arindam + 2 10 Bijay + 2 11 Jitendr + 2 17 Arindam + 3 11 Jitendr + 3 12 Nihar + 4 12 Nihar + 4 13 Kishor + 5 13 Kishor + 5 14 Praba + 6 14 Praba + 6 15 Sanjit + 7 15 Sanjit + 7 16 Sanjay + +echo select f0,f1,f4 from t1 order by f1,f0; +--------------------------------------------------------- + f0 f1 f4 +--------------------------------------------------------- + 1 10 Bijay + 2 10 Bijay + 2 11 Jitendr + 3 11 Jitendr + 3 12 Nihar + 4 12 Nihar + 4 13 Kishor + 5 13 Kishor + 5 14 Praba + 6 14 Praba + 6 15 Sanjit + 7 15 Sanjit + 1 16 Sanjay + 7 16 Sanjay + 1 17 Arindam + 2 17 Arindam + +echo select f2,f3,f4 from t1 order by f2,f3,f4; +--------------------------------------------------------- + f2 f3 f4 +--------------------------------------------------------- + 100 1000 Bijay + 100 1000 Bijay + 100 1000 Praba + 100 1000 Praba + 110 1100 Jitendr + 110 1100 Jitendr + 110 1100 Sanjit + 110 1100 Sanjit + 120 1000 Nihar + 120 1000 Nihar + 120 1000 Sanjay + 120 1000 Sanjay + 130 1100 Arindam + 130 1100 Arindam + 130 1100 Kishor + 130 1100 Kishor + +echo select f7,f8,f4 from t1 order by f7,f8; +--------------------------------------------------------- + f7 f8 f4 +--------------------------------------------------------- + 2009/3/1 11:59:55.0 Praba + 2009/3/1 11:59:57.0 Bijay + 2009/3/1 11:59:58.0 Praba + 2009/3/1 11:59:59.0 Arindam + 2009/3/1 11:59:59.0 Bijay + 2009/3/2 11:59:56.0 Sanjit + 2009/3/2 11:59:57.0 Sanjit + 2009/3/2 11:59:58.0 Jitendr + 2009/3/2 11:59:58.0 Jitendr + 2009/3/3 11:59:55.0 Sanjay + 2009/3/3 11:59:57.0 Nihar + 2009/3/3 11:59:57.0 Nihar + 2009/3/3 11:59:59.0 Sanjay + 2009/3/4 11:59:58.0 Arindam + 2009/3/4 11:59:59.0 Kishor + 2009/3/5 11:59:56.0 Kishor + +echo select f7,f8,f9,f4 from t1 order by f7,f8,f9; +--------------------------------------------------------- + f7 f8 f9 f4 +--------------------------------------------------------- + 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 Praba + 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 Bijay + 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 Praba + 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 Arindam + 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 Bijay + 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 Sanjit + 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 Sanjit + 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 Jitendr + 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 Jitendr + 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 Sanjay + 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 Nihar + 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 Nihar + 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 Sanjay + 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 Arindam + 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 Kishor + 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 Kishor + +echo select f2,f3,f5,f6,f7,f8,f9,f4 from t1 order by f2,f3,f5,f6,f7,f8,f9; +--------------------------------------------------------- + f2 f3 f5 f6 f7 f8 f9 f4 +--------------------------------------------------------- + 100 1000 1000.000000 100000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 Bijay + 100 1000 4000.000000 400000.000000 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 Praba + 100 1000 5000.000000 500000.000000 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 Praba + 100 1000 9000.000000 900000.000000 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 Bijay + 110 1100 1000.000000 100000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 Jitendr + 110 1100 2000.000000 200000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 Jitendr + 110 1100 5000.000000 500000.000000 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 Sanjit + 110 1100 6000.000000 600000.000000 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 Sanjit + 120 1000 2000.000000 200000.000000 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 Nihar + 120 1000 3000.000000 300000.000000 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 Nihar + 120 1000 6000.000000 600000.000000 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 Sanjay + 120 1000 7000.000000 700000.000000 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 Sanjay + 130 1100 3000.000000 300000.000000 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 Kishor + 130 1100 4000.000000 400000.000000 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 Kishor + 130 1100 7000.000000 700000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 Arindam + 130 1100 8000.000000 800000.000000 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 Arindam + +Statement Executed diff --git a/test/sql/Order/exp.test004.ksh b/test/sql/Order/exp.test004.ksh new file mode 100644 index 00000000..bcfff01e --- /dev/null +++ b/test/sql/Order/exp.test004.ksh @@ -0,0 +1,374 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +--------------------------------------------------------- + t1.f0 t1.f1 t1.f2 t1.f3 t1.f4 t1.f5 t1.f6 t1.f7 t1.f8 t1.f9 +--------------------------------------------------------- + 1 10 100 1000 Bijay 1000.000000 100000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + 2 11 110 1100 Jitendr 2000.000000 200000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 3 12 120 1000 Nihar 3000.000000 300000.000000 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 4 13 130 1100 Kishor 4000.000000 400000.000000 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 + 5 14 100 1000 Praba 5000.000000 500000.000000 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 + 6 15 110 1100 Sanjit 6000.000000 600000.000000 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 + 7 16 120 1000 Sanjay 7000.000000 700000.000000 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 + 1 17 130 1100 Arindam 8000.000000 800000.000000 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 + 2 10 100 1000 Bijay 9000.000000 900000.000000 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 + 3 11 110 1100 Jitendr 1000.000000 100000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 4 12 120 1000 Nihar 2000.000000 200000.000000 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 5 13 130 1100 Kishor 3000.000000 300000.000000 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 + 6 14 100 1000 Praba 4000.000000 400000.000000 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 + 7 15 110 1100 Sanjit 5000.000000 500000.000000 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 + 1 16 120 1000 Sanjay 6000.000000 600000.000000 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 + 2 17 130 1100 Arindam 7000.000000 700000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + +echo select f0,f4 from t1 order by f0 desc; +--------------------------------------------------------- + f0 f4 +--------------------------------------------------------- + 7 Sanjit + 7 Sanjay + 6 Praba + 6 Sanjit + 5 Kishor + 5 Praba + 4 Nihar + 4 Kishor + 3 Jitendr + 3 Nihar + 2 Arindam + 2 Bijay + 2 Jitendr + 1 Sanjay + 1 Arindam + 1 Bijay + +echo select f1,f4 from t1 order by f1 desc; +--------------------------------------------------------- + f1 f4 +--------------------------------------------------------- + 17 Arindam + 17 Arindam + 16 Sanjay + 16 Sanjay + 15 Sanjit + 15 Sanjit + 14 Praba + 14 Praba + 13 Kishor + 13 Kishor + 12 Nihar + 12 Nihar + 11 Jitendr + 11 Jitendr + 10 Bijay + 10 Bijay + +echo select f2,f4 from t1 order by f2 desc; +--------------------------------------------------------- + f2 f4 +--------------------------------------------------------- + 130 Arindam + 130 Kishor + 130 Arindam + 130 Kishor + 120 Sanjay + 120 Nihar + 120 Sanjay + 120 Nihar + 110 Sanjit + 110 Jitendr + 110 Sanjit + 110 Jitendr + 100 Praba + 100 Bijay + 100 Praba + 100 Bijay + +echo select f3,f4 from t1 order by f3 desc; +--------------------------------------------------------- + f3 f4 +--------------------------------------------------------- + 1100 Arindam + 1100 Sanjit + 1100 Kishor + 1100 Jitendr + 1100 Arindam + 1100 Sanjit + 1100 Kishor + 1100 Jitendr + 1000 Sanjay + 1000 Praba + 1000 Nihar + 1000 Bijay + 1000 Sanjay + 1000 Praba + 1000 Nihar + 1000 Bijay + +echo select f4,f4 from t1 order by f4 desc; +--------------------------------------------------------- + f4 f4 +--------------------------------------------------------- + Sanjit Sanjit + Sanjit Sanjit + Sanjay Sanjay + Sanjay Sanjay + Praba Praba + Praba Praba + Nihar Nihar + Nihar Nihar + Kishor Kishor + Kishor Kishor + Jitendr Jitendr + Jitendr Jitendr + Bijay Bijay + Bijay Bijay + Arindam Arindam + Arindam Arindam + +echo select f5,f4 from t1 order by f5 desc; +--------------------------------------------------------- + f5 f4 +--------------------------------------------------------- + 9000.000000 Bijay + 8000.000000 Arindam + 7000.000000 Arindam + 7000.000000 Sanjay + 6000.000000 Sanjay + 6000.000000 Sanjit + 5000.000000 Sanjit + 5000.000000 Praba + 4000.000000 Praba + 4000.000000 Kishor + 3000.000000 Kishor + 3000.000000 Nihar + 2000.000000 Nihar + 2000.000000 Jitendr + 1000.000000 Jitendr + 1000.000000 Bijay + +echo select f6,f4 from t1 order by f6 desc; +--------------------------------------------------------- + f6 f4 +--------------------------------------------------------- + 900000.000000 Bijay + 800000.000000 Arindam + 700000.000000 Arindam + 700000.000000 Sanjay + 600000.000000 Sanjay + 600000.000000 Sanjit + 500000.000000 Sanjit + 500000.000000 Praba + 400000.000000 Praba + 400000.000000 Kishor + 300000.000000 Kishor + 300000.000000 Nihar + 200000.000000 Nihar + 200000.000000 Jitendr + 100000.000000 Jitendr + 100000.000000 Bijay + +echo select f7,f4 from t1 order by f7 desc; +--------------------------------------------------------- + f7 f4 +--------------------------------------------------------- + 2009/3/5 Kishor + 2009/3/4 Arindam + 2009/3/4 Kishor + 2009/3/3 Sanjay + 2009/3/3 Nihar + 2009/3/3 Sanjay + 2009/3/3 Nihar + 2009/3/2 Sanjit + 2009/3/2 Jitendr + 2009/3/2 Sanjit + 2009/3/2 Jitendr + 2009/3/1 Arindam + 2009/3/1 Praba + 2009/3/1 Bijay + 2009/3/1 Praba + 2009/3/1 Bijay + +echo select f8,f4 from t1 order by f8 desc; +--------------------------------------------------------- + f8 f4 +--------------------------------------------------------- + 11:59:59.0 Arindam + 11:59:59.0 Sanjay + 11:59:59.0 Kishor + 11:59:59.0 Bijay + 11:59:58.0 Jitendr + 11:59:58.0 Arindam + 11:59:58.0 Praba + 11:59:58.0 Jitendr + 11:59:57.0 Nihar + 11:59:57.0 Bijay + 11:59:57.0 Sanjit + 11:59:57.0 Nihar + 11:59:56.0 Sanjit + 11:59:56.0 Kishor + 11:59:55.0 Sanjay + 11:59:55.0 Praba + +echo select f9,f4 from t1 order by f9 desc; +--------------------------------------------------------- + f9 f4 +--------------------------------------------------------- + 2009/3/5 11:59:59.0 Kishor + 2009/3/4 11:59:59.0 Praba + 2009/3/4 11:59:59.0 Arindam + 2009/3/4 11:59:59.0 Kishor + 2009/3/3 11:59:59.0 Sanjay + 2009/3/3 11:59:59.0 Nihar + 2009/3/3 11:59:59.0 Sanjay + 2009/3/3 11:59:59.0 Nihar + 2009/3/2 11:59:59.0 Jitendr + 2009/3/2 11:59:59.0 Sanjit + 2009/3/2 11:59:59.0 Jitendr + 2009/3/1 11:59:59.0 Arindam + 2009/3/1 11:59:59.0 Sanjit + 2009/3/1 11:59:59.0 Bijay + 2009/3/1 11:59:59.0 Praba + 2009/3/1 11:59:59.0 Bijay + +echo select f0,f1,f4 from t1 order by f0,f1 desc; +--------------------------------------------------------- + f0 f1 f4 +--------------------------------------------------------- + 1 17 Arindam + 1 16 Sanjay + 1 10 Bijay + 2 17 Arindam + 2 11 Jitendr + 2 10 Bijay + 3 12 Nihar + 3 11 Jitendr + 4 13 Kishor + 4 12 Nihar + 5 14 Praba + 5 13 Kishor + 6 15 Sanjit + 6 14 Praba + 7 16 Sanjay + 7 15 Sanjit + +echo select f0,f1,f4 from t1 order by f1,f0 desc; +--------------------------------------------------------- + f0 f1 f4 +--------------------------------------------------------- + 2 10 Bijay + 1 10 Bijay + 3 11 Jitendr + 2 11 Jitendr + 4 12 Nihar + 3 12 Nihar + 5 13 Kishor + 4 13 Kishor + 6 14 Praba + 5 14 Praba + 7 15 Sanjit + 6 15 Sanjit + 7 16 Sanjay + 1 16 Sanjay + 2 17 Arindam + 1 17 Arindam + +echo select f2,f3,f4 from t1 order by f2,f3,f4 desc; +--------------------------------------------------------- + f2 f3 f4 +--------------------------------------------------------- + 100 1000 Praba + 100 1000 Praba + 100 1000 Bijay + 100 1000 Bijay + 110 1100 Sanjit + 110 1100 Sanjit + 110 1100 Jitendr + 110 1100 Jitendr + 120 1000 Sanjay + 120 1000 Sanjay + 120 1000 Nihar + 120 1000 Nihar + 130 1100 Kishor + 130 1100 Kishor + 130 1100 Arindam + 130 1100 Arindam + +echo select f7,f8,f4 from t1 order by f7,f8 desc; +--------------------------------------------------------- + f7 f8 f4 +--------------------------------------------------------- + 2009/3/1 11:59:59.0 Arindam + 2009/3/1 11:59:59.0 Bijay + 2009/3/1 11:59:58.0 Praba + 2009/3/1 11:59:57.0 Bijay + 2009/3/1 11:59:55.0 Praba + 2009/3/2 11:59:58.0 Jitendr + 2009/3/2 11:59:58.0 Jitendr + 2009/3/2 11:59:57.0 Sanjit + 2009/3/2 11:59:56.0 Sanjit + 2009/3/3 11:59:59.0 Sanjay + 2009/3/3 11:59:57.0 Nihar + 2009/3/3 11:59:57.0 Nihar + 2009/3/3 11:59:55.0 Sanjay + 2009/3/4 11:59:59.0 Kishor + 2009/3/4 11:59:58.0 Arindam + 2009/3/5 11:59:56.0 Kishor + +echo select f7,f8,f9,f4 from t1 order by f7,f8,f9 desc; +--------------------------------------------------------- + f7 f8 f9 f4 +--------------------------------------------------------- + 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 Praba + 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 Bijay + 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 Praba + 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 Arindam + 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 Bijay + 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 Sanjit + 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 Sanjit + 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 Jitendr + 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 Jitendr + 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 Sanjay + 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 Nihar + 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 Nihar + 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 Arindam + 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 Kishor + 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 Sanjay + 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 Kishor + +echo select f2,f3,f5,f6,f7,f8,f9,f4 from t1 order by f2,f3,f5,f6,f7,f8,f9 desc; +--------------------------------------------------------- + f2 f3 f5 f6 f7 f8 f9 f4 +--------------------------------------------------------- + 100 1000 1000.000000 100000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 Bijay + 100 1000 4000.000000 400000.000000 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 Praba + 100 1000 9000.000000 900000.000000 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 Bijay + 110 1100 1000.000000 100000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 Jitendr + 110 1100 2000.000000 200000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 Jitendr + 110 1100 5000.000000 500000.000000 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 Sanjit + 120 1000 2000.000000 200000.000000 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 Nihar + 120 1000 3000.000000 300000.000000 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 Nihar + 100 1000 5000.000000 500000.000000 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 Praba + 120 1000 6000.000000 600000.000000 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 Sanjay + 130 1100 3000.000000 300000.000000 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 Kishor + 130 1100 4000.000000 400000.000000 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 Kishor + 110 1100 6000.000000 600000.000000 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 Sanjit + 120 1000 7000.000000 700000.000000 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 Sanjay + 130 1100 7000.000000 700000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 Arindam + 130 1100 8000.000000 800000.000000 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 Arindam + +Statement Executed diff --git a/test/sql/Order/exp.test005.ksh b/test/sql/Order/exp.test005.ksh new file mode 100644 index 00000000..f4b6e0ab --- /dev/null +++ b/test/sql/Order/exp.test005.ksh @@ -0,0 +1,133 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo SELECT * FROM t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 +--------------------------------------------------------- + 3 AAA 2.500000 2008/7/1 + 2 AAA 2.500000 2008/7/2 + 4 GGG 4.500000 2008/7/3 + 1 DEF 1.500000 2008/7/1 + 6 CCC 6.500000 2008/7/2 + 5 HHH 5.500000 2008/7/3 + 2 AAA 2.500000 2008/7/1 + 6 CCC 6.500000 2008/7/4 + 3 ABB 2.600000 2008/7/5 + 2 BBB 1.600000 2008/7/4 + 1 DDD 1.600000 2008/7/1 + +echo SELECT * FROM t1 WHERE f1 <= 4 ORDER BY f1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 +--------------------------------------------------------- + 1 DDD 1.600000 2008/7/1 + 1 DEF 1.500000 2008/7/1 + 2 BBB 1.600000 2008/7/4 + 2 AAA 2.500000 2008/7/1 + 2 AAA 2.500000 2008/7/2 + 3 ABB 2.600000 2008/7/5 + 3 AAA 2.500000 2008/7/1 + 4 GGG 4.500000 2008/7/3 + +echo SELECT * FROM t1 WHERE f1 <= 4 ORDER BY f1 DESC; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 +--------------------------------------------------------- + 4 GGG 4.500000 2008/7/3 + 3 ABB 2.600000 2008/7/5 + 3 AAA 2.500000 2008/7/1 + 2 BBB 1.600000 2008/7/4 + 2 AAA 2.500000 2008/7/1 + 2 AAA 2.500000 2008/7/2 + 1 DDD 1.600000 2008/7/1 + 1 DEF 1.500000 2008/7/1 + +echo SELECT f1, t1.f2, f4 FROM t1 WHERE t1.f1 <= 4 OR t1.f3 <= 4.5 ORDER BY t1.f1, f4; +--------------------------------------------------------- + f1 t1.f2 f4 +--------------------------------------------------------- + 1 DDD 2008/7/1 + 1 DEF 2008/7/1 + 2 AAA 2008/7/1 + 2 AAA 2008/7/2 + 2 BBB 2008/7/4 + 3 AAA 2008/7/1 + 3 ABB 2008/7/5 + 4 GGG 2008/7/3 + +echo SELECT f1, f2, t1.f4 FROM t1 WHERE t1.f1 <= 4 OR t1.f3 <= 4.5 ORDER BY f1, t1.f4 DESC; +--------------------------------------------------------- + f1 f2 t1.f4 +--------------------------------------------------------- + 1 DDD 2008/7/1 + 1 DEF 2008/7/1 + 2 BBB 2008/7/4 + 2 AAA 2008/7/2 + 2 AAA 2008/7/1 + 3 ABB 2008/7/5 + 3 AAA 2008/7/1 + 4 GGG 2008/7/3 + +echo SELECT f1, f2, t1.f4 FROM t1 WHERE t1.f1 <= 4 OR t1.f3 <= 4.5 ORDER BY f1 DESC, t1.f4 DESC; +--------------------------------------------------------- + f1 f2 t1.f4 +--------------------------------------------------------- + 4 GGG 2008/7/3 + 3 ABB 2008/7/5 + 3 AAA 2008/7/1 + 2 BBB 2008/7/4 + 2 AAA 2008/7/2 + 2 AAA 2008/7/1 + 1 DDD 2008/7/1 + 1 DEF 2008/7/1 + +echo SELECT f1, t1.f4, f2 FROM t1 WHERE t1.f1 <= 4 OR t1.f3 <= 4.5 ORDER BY t1.f1, f4, t1.f2; +--------------------------------------------------------- + f1 t1.f4 f2 +--------------------------------------------------------- + 1 2008/7/1 DDD + 1 2008/7/1 DEF + 2 2008/7/1 AAA + 2 2008/7/2 AAA + 2 2008/7/4 BBB + 3 2008/7/1 AAA + 3 2008/7/5 ABB + 4 2008/7/3 GGG + +echo SELECT t1.f1, f4, t1.f2 FROM t1 WHERE t1.f1 <= 4 OR t1.f3 <= 4.5 ORDER BY f1, t1.f4, f2 DESC; +--------------------------------------------------------- + t1.f1 f4 t1.f2 +--------------------------------------------------------- + 1 2008/7/1 DEF + 1 2008/7/1 DDD + 2 2008/7/1 AAA + 2 2008/7/2 AAA + 2 2008/7/4 BBB + 3 2008/7/1 AAA + 3 2008/7/5 ABB + 4 2008/7/3 GGG + +echo SELECT t1.f1, f4, t1.f2 FROM t1 WHERE t1.f1 <= 4 OR t1.f3 <= 4.5 ORDER BY f1 DESC, t1.f4 DESC, f2 DESC; +--------------------------------------------------------- + t1.f1 f4 t1.f2 +--------------------------------------------------------- + 4 2008/7/3 GGG + 3 2008/7/5 ABB + 3 2008/7/1 AAA + 2 2008/7/4 BBB + 2 2008/7/2 AAA + 1 2008/7/1 DEF + 2 2008/7/1 AAA + 1 2008/7/1 DDD + +Statement Executed diff --git a/test/sql/Order/exp.test006.ksh b/test/sql/Order/exp.test006.ksh new file mode 100644 index 00000000..d4eeb955 --- /dev/null +++ b/test/sql/Order/exp.test006.ksh @@ -0,0 +1,77 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo SELECT * FROM t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 +--------------------------------------------------------- + 3 AAA 2.500000 2008/7/1 + 2 AAA 2.500000 2008/7/2 + 4 GGG 4.500000 2008/7/3 + 1 DEF 1.500000 2008/7/1 + 6 CCC 6.500000 2008/7/2 + 5 HHH 5.500000 2008/7/3 + 2 AAA 2.500000 2008/7/1 + 6 CCC 6.500000 2008/7/4 + 3 ABB 2.600000 2008/7/5 + 2 BBB 1.600000 2008/7/4 + 1 DDD 1.600000 2008/7/1 + +echo SELECT f1, f2, SUM(f3) FROM t1 GROUP BY f1, f2 ORDER BY f1; +--------------------------------------------------------- + f1 f2 SUM(f3) +--------------------------------------------------------- + 1 DDD 1.600000 + 1 DEF 1.500000 + 2 BBB 1.600000 + 2 AAA 5.000000 + 3 ABB 2.600000 + 3 AAA 2.500000 + 4 GGG 4.500000 + 5 HHH 5.500000 + 6 CCC 13.000000 + +echo SELECT f1, f2, SUM(f3), COUNT(f4) FROM t1 GROUP BY f1, f2 ORDER BY f1, f2; +--------------------------------------------------------- + f1 f2 SUM(f3) COUNT(f4) +--------------------------------------------------------- + 1 DDD 1.600000 1 + 1 DEF 1.500000 1 + 2 AAA 5.000000 2 + 2 BBB 1.600000 1 + 3 AAA 2.500000 1 + 3 ABB 2.600000 1 + 4 GGG 4.500000 1 + 5 HHH 5.500000 1 + 6 CCC 13.000000 2 + +echo SELECT f1, SUM(f3), MIN(f2), MAX(f4) FROM t1 GROUP BY f1 ORDER BY f1; +--------------------------------------------------------- + f1 SUM(f3) MIN(f2) MAX(f4) +--------------------------------------------------------- + 1 3.100000 DDD 2008/7/1 + 2 6.600000 AAA 2008/7/4 + 3 5.100000 AAA 2008/7/5 + 4 4.500000 GGG 2008/7/3 + 5 5.500000 HHH 2008/7/3 + 6 13.000000 CCC 2008/7/4 + +echo SELECT f1, SUM(f3), MIN(f2), MAX(f4) FROM t1 GROUP BY f1 HAVING SUM(f3) <= 5.5 ORDER BY f1; +--------------------------------------------------------- + f1 SUM(f3) MIN(f2) MAX(f4) +--------------------------------------------------------- + 1 3.100000 DDD 2008/7/1 + 3 5.100000 AAA 2008/7/5 + 4 4.500000 GGG 2008/7/3 + 5 5.500000 HHH 2008/7/3 + +Statement Executed diff --git a/test/sql/Order/exp.test007.ksh b/test/sql/Order/exp.test007.ksh new file mode 100644 index 00000000..c1b55d26 --- /dev/null +++ b/test/sql/Order/exp.test007.ksh @@ -0,0 +1,282 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo SELECT * FROM t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 +--------------------------------------------------------- + 3 AAA 2.500000 2008/7/1 + 2 AAA 2.500000 2008/7/2 + 4 GGG 4.500000 2008/7/3 + 1 DEF 1.500000 2008/7/1 + 6 CCC 6.500000 2008/7/2 + 5 HHH 5.500000 2008/7/3 + 2 AAA 2.500000 2008/7/1 + 6 CCC 6.500000 2008/7/4 + 3 ABB 2.600000 2008/7/5 + 2 BBB 1.600000 2008/7/4 + 1 DDD 1.600000 2008/7/1 + +echo SELECT * FROM t2; +--------------------------------------------------------- + t2.f1 t2.f2 t2.f3 t2.f4 +--------------------------------------------------------- + 1 DEF 1.500000 2008/7/1 + 9 QQQ 9.500000 2008/7/2 + 3 MMM 2.500000 2008/7/3 + 4 GGG 4.600000 2008/7/1 + 7 PPP 7.500000 2008/7/2 + 8 NNN 8.500000 2008/7/3 + 9 QQQ 9.500000 2008/7/1 + 8 AAA 8.500000 2008/7/4 + 7 AAA 7.500000 2008/7/5 + 9 BBB 9.800000 2008/7/4 + 8 EEE 8.800000 2008/7/1 + +echo SELECT * FROM t3; +--------------------------------------------------------- + t3.f1 t3.f2 t3.f3 t3.f4 +--------------------------------------------------------- + 1 DEF 1.500000 2008/7/1 + 2 AAA 2.500000 2008/7/2 + 7 PPP 7.500000 2008/7/3 + 8 NNN 8.500000 2008/7/4 + 9 QQQ 9.500000 2008/7/1 + 10 NNN 10.500000 2008/7/2 + 1 DEF 1.500000 2008/7/3 + 2 AAA 2.500000 2008/7/4 + 7 PPP 7.500000 2008/7/1 + 8 NNN 8.500000 2008/7/2 + 10 NNN 10.500000 2008/7/4 + +echo SELECT * FROM t1,t2 WHERE t1.f1 = t2.f1 ORDER BY t1.f1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 t2.f1 t2.f2 t2.f3 t2.f4 +--------------------------------------------------------- + 1 DDD 1.600000 2008/7/1 1 DEF 1.500000 2008/7/1 + 1 DEF 1.500000 2008/7/1 1 DEF 1.500000 2008/7/1 + 3 ABB 2.600000 2008/7/5 3 MMM 2.500000 2008/7/3 + 3 AAA 2.500000 2008/7/1 3 MMM 2.500000 2008/7/3 + 4 GGG 4.500000 2008/7/3 4 GGG 4.600000 2008/7/1 + +echo SELECT t1.f1, t2.f1, t3.f1 FROM t1,t2,t3 WHERE t1.f1 = t2.f1 and t2.f1 = t3.f1 ORDER BY t1.f1; +--------------------------------------------------------- + t1.f1 t2.f1 t3.f1 +--------------------------------------------------------- + 1 1 1 + 1 1 1 + 1 1 1 + 1 1 1 + +echo SELECT * FROM t1,t2 WHERE t1.f1 = t2.f1 ORDER BY t1.f1,t2.f1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 t2.f1 t2.f2 t2.f3 t2.f4 +--------------------------------------------------------- + 1 DDD 1.600000 2008/7/1 1 DEF 1.500000 2008/7/1 + 1 DEF 1.500000 2008/7/1 1 DEF 1.500000 2008/7/1 + 3 ABB 2.600000 2008/7/5 3 MMM 2.500000 2008/7/3 + 3 AAA 2.500000 2008/7/1 3 MMM 2.500000 2008/7/3 + 4 GGG 4.500000 2008/7/3 4 GGG 4.600000 2008/7/1 + +echo SELECT t1.f1, t3.f1, t2.f1 FROM t1,t2,t3 WHERE t1.f1 = t2.f1 and t3.f1 = t1.f1 ORDER BY t1.f1,t3.f1,t2.f1; +--------------------------------------------------------- + t1.f1 t3.f1 t2.f1 +--------------------------------------------------------- + 1 1 1 + 1 1 1 + 1 1 1 + 1 1 1 + +echo SELECT t1.f1, t3.f1, t2.f1 FROM t1,t2,t3 WHERE t1.f1 = t2.f1 and t3.f1 = t1.f1 ORDER BY t1.f1 DESC,t3.f1 DESC,t2.f1 DESC; +--------------------------------------------------------- + t1.f1 t3.f1 t2.f1 +--------------------------------------------------------- + 1 1 1 + 1 1 1 + 1 1 1 + 1 1 1 + +echo SELECT t1.f1, t2.f1, t1.f4, t2.f4 FROM t1,t2 WHERE t1.f1 < 2 OR t1.f3 < 2.5 ORDER BY t1.f4, t2.f4; +--------------------------------------------------------- + t1.f1 t2.f1 t1.f4 t2.f4 +--------------------------------------------------------- + 1 8 2008/7/1 2008/7/1 + 1 9 2008/7/1 2008/7/1 + 1 4 2008/7/1 2008/7/1 + 1 1 2008/7/1 2008/7/1 + 1 8 2008/7/1 2008/7/1 + 1 9 2008/7/1 2008/7/1 + 1 4 2008/7/1 2008/7/1 + 1 1 2008/7/1 2008/7/1 + 1 7 2008/7/1 2008/7/2 + 1 9 2008/7/1 2008/7/2 + 1 7 2008/7/1 2008/7/2 + 1 9 2008/7/1 2008/7/2 + 1 8 2008/7/1 2008/7/3 + 1 3 2008/7/1 2008/7/3 + 1 8 2008/7/1 2008/7/3 + 1 3 2008/7/1 2008/7/3 + 1 9 2008/7/1 2008/7/4 + 1 8 2008/7/1 2008/7/4 + 1 9 2008/7/1 2008/7/4 + 1 8 2008/7/1 2008/7/4 + 1 7 2008/7/1 2008/7/5 + 1 7 2008/7/1 2008/7/5 + 2 8 2008/7/4 2008/7/1 + 2 9 2008/7/4 2008/7/1 + 2 4 2008/7/4 2008/7/1 + 2 1 2008/7/4 2008/7/1 + 2 7 2008/7/4 2008/7/2 + 2 9 2008/7/4 2008/7/2 + 2 8 2008/7/4 2008/7/3 + 2 3 2008/7/4 2008/7/3 + 2 9 2008/7/4 2008/7/4 + 2 8 2008/7/4 2008/7/4 + 2 7 2008/7/4 2008/7/5 + +echo SELECT t1.f1, t2.f1, t1.f4, t2.f4 FROM t1,t2 WHERE t1.f1 < 2 OR t1.f3 < 2.5 ORDER BY t1.f1, t1.f4 DESC ; +--------------------------------------------------------- + t1.f1 t2.f1 t1.f4 t2.f4 +--------------------------------------------------------- + 1 8 2008/7/1 2008/7/1 + 1 9 2008/7/1 2008/7/4 + 1 7 2008/7/1 2008/7/5 + 1 8 2008/7/1 2008/7/4 + 1 9 2008/7/1 2008/7/1 + 1 8 2008/7/1 2008/7/3 + 1 7 2008/7/1 2008/7/2 + 1 4 2008/7/1 2008/7/1 + 1 3 2008/7/1 2008/7/3 + 1 9 2008/7/1 2008/7/2 + 1 1 2008/7/1 2008/7/1 + 1 8 2008/7/1 2008/7/1 + 1 9 2008/7/1 2008/7/4 + 1 7 2008/7/1 2008/7/5 + 1 8 2008/7/1 2008/7/4 + 1 9 2008/7/1 2008/7/1 + 1 8 2008/7/1 2008/7/3 + 1 7 2008/7/1 2008/7/2 + 1 4 2008/7/1 2008/7/1 + 1 3 2008/7/1 2008/7/3 + 1 9 2008/7/1 2008/7/2 + 1 1 2008/7/1 2008/7/1 + 2 8 2008/7/4 2008/7/1 + 2 9 2008/7/4 2008/7/4 + 2 7 2008/7/4 2008/7/5 + 2 8 2008/7/4 2008/7/4 + 2 9 2008/7/4 2008/7/1 + 2 8 2008/7/4 2008/7/3 + 2 7 2008/7/4 2008/7/2 + 2 4 2008/7/4 2008/7/1 + 2 3 2008/7/4 2008/7/3 + 2 9 2008/7/4 2008/7/2 + 2 1 2008/7/4 2008/7/1 + +echo SELECT t1.f1, t2.f4, t2.f1 FROM t1,t2 WHERE t1.f1 < 2 OR t2.f1 < 2 ORDER BY t1.f1, t2.f4 ; +--------------------------------------------------------- + t1.f1 t2.f4 t2.f1 +--------------------------------------------------------- + 1 2008/7/1 8 + 1 2008/7/1 9 + 1 2008/7/1 4 + 1 2008/7/1 1 + 1 2008/7/1 8 + 1 2008/7/1 9 + 1 2008/7/1 4 + 1 2008/7/1 1 + 1 2008/7/2 7 + 1 2008/7/2 9 + 1 2008/7/2 7 + 1 2008/7/2 9 + 1 2008/7/3 8 + 1 2008/7/3 3 + 1 2008/7/3 8 + 1 2008/7/3 3 + 1 2008/7/4 9 + 1 2008/7/4 8 + 1 2008/7/4 9 + 1 2008/7/4 8 + 1 2008/7/5 7 + 1 2008/7/5 7 + 2 2008/7/1 1 + 2 2008/7/1 1 + 2 2008/7/1 1 + 3 2008/7/1 1 + 3 2008/7/1 1 + 4 2008/7/1 1 + 5 2008/7/1 1 + 6 2008/7/1 1 + 6 2008/7/1 1 + +echo SELECT t1.f1, t2.f4, t2.f1 FROM t1,t2 WHERE t1.f1 < 2 OR t2.f1 < 2 ORDER BY t1.f1 DESC, t2.f4 ; +--------------------------------------------------------- + t1.f1 t2.f4 t2.f1 +--------------------------------------------------------- + 6 2008/7/1 1 + 6 2008/7/1 1 + 5 2008/7/1 1 + 4 2008/7/1 1 + 3 2008/7/1 1 + 3 2008/7/1 1 + 2 2008/7/1 1 + 2 2008/7/1 1 + 2 2008/7/1 1 + 1 2008/7/1 8 + 1 2008/7/1 9 + 1 2008/7/1 4 + 1 2008/7/1 1 + 1 2008/7/1 8 + 1 2008/7/1 9 + 1 2008/7/1 4 + 1 2008/7/1 1 + 1 2008/7/2 7 + 1 2008/7/2 9 + 1 2008/7/2 7 + 1 2008/7/2 9 + 1 2008/7/3 8 + 1 2008/7/3 3 + 1 2008/7/3 8 + 1 2008/7/3 3 + 1 2008/7/4 9 + 1 2008/7/4 8 + 1 2008/7/4 9 + 1 2008/7/4 8 + 1 2008/7/5 7 + 1 2008/7/5 7 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Order/exp.test008.ksh b/test/sql/Order/exp.test008.ksh new file mode 100644 index 00000000..644bb540 --- /dev/null +++ b/test/sql/Order/exp.test008.ksh @@ -0,0 +1,282 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo SELECT * FROM t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 +--------------------------------------------------------- + 3 AAA 2.500000 2008/7/1 + 2 AAA 2.500000 2008/7/2 + 4 GGG 4.500000 2008/7/3 + 1 DEF 1.500000 2008/7/1 + 6 CCC 6.500000 2008/7/2 + 5 HHH 5.500000 2008/7/3 + 2 AAA 2.500000 2008/7/1 + 6 CCC 6.500000 2008/7/4 + 3 ABB 2.600000 2008/7/5 + 2 BBB 1.600000 2008/7/4 + 1 DDD 1.600000 2008/7/1 + +echo SELECT * FROM t2; +--------------------------------------------------------- + t2.f1 t2.f2 t2.f3 t2.f4 +--------------------------------------------------------- + 1 DEF 1.500000 2008/7/1 + 9 QQQ 9.500000 2008/7/2 + 3 MMM 2.500000 2008/7/3 + 4 GGG 4.600000 2008/7/1 + 7 PPP 7.500000 2008/7/2 + 8 NNN 8.500000 2008/7/3 + 9 QQQ 9.500000 2008/7/1 + 8 AAA 8.500000 2008/7/4 + 7 AAA 7.500000 2008/7/5 + 9 BBB 9.800000 2008/7/4 + 8 EEE 8.800000 2008/7/1 + +echo SELECT * FROM t3; +--------------------------------------------------------- + t3.f1 t3.f2 t3.f3 t3.f4 +--------------------------------------------------------- + 1 DEF 1.500000 2008/7/1 + 2 AAA 2.500000 2008/7/2 + 7 PPP 7.500000 2008/7/3 + 8 NNN 8.500000 2008/7/4 + 9 QQQ 9.500000 2008/7/1 + 10 NNN 10.500000 2008/7/2 + 1 DEF 1.500000 2008/7/3 + 2 AAA 2.500000 2008/7/4 + 7 PPP 7.500000 2008/7/1 + 8 NNN 8.500000 2008/7/2 + 10 NNN 10.500000 2008/7/4 + +echo SELECT * FROM t1 INNER JOIN t2 ON t1.f1 = t2.f1 ORDER BY t1.f1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 t2.f1 t2.f2 t2.f3 t2.f4 +--------------------------------------------------------- + 1 DDD 1.600000 2008/7/1 1 DEF 1.500000 2008/7/1 + 1 DEF 1.500000 2008/7/1 1 DEF 1.500000 2008/7/1 + 3 ABB 2.600000 2008/7/5 3 MMM 2.500000 2008/7/3 + 3 AAA 2.500000 2008/7/1 3 MMM 2.500000 2008/7/3 + 4 GGG 4.500000 2008/7/3 4 GGG 4.600000 2008/7/1 + +echo SELECT t1.f1, t2.f1, t3.f1 FROM t1 INNER JOIN t2 ON t1.f1 = t2.f1 INNER JOIN t3 ON t2.f1 = t3.f1 ORDER BY t1.f1; +--------------------------------------------------------- + t1.f1 t2.f1 t3.f1 +--------------------------------------------------------- + 1 1 1 + 1 1 1 + 1 1 1 + 1 1 1 + +echo SELECT * FROM t1 INNER JOIN t2 ON t1.f1 = t2.f1 ORDER BY t1.f1,t2.f1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 t2.f1 t2.f2 t2.f3 t2.f4 +--------------------------------------------------------- + 1 DDD 1.600000 2008/7/1 1 DEF 1.500000 2008/7/1 + 1 DEF 1.500000 2008/7/1 1 DEF 1.500000 2008/7/1 + 3 ABB 2.600000 2008/7/5 3 MMM 2.500000 2008/7/3 + 3 AAA 2.500000 2008/7/1 3 MMM 2.500000 2008/7/3 + 4 GGG 4.500000 2008/7/3 4 GGG 4.600000 2008/7/1 + +echo SELECT t1.f1, t3.f1, t2.f1 FROM t1 INNER JOIN t2 ON t1.f1 = t2.f1 INNER JOIN t3 ON t3.f1 = t1.f1 ORDER BY t1.f1,t3.f1,t2.f1; +--------------------------------------------------------- + t1.f1 t3.f1 t2.f1 +--------------------------------------------------------- + 1 1 1 + 1 1 1 + 1 1 1 + 1 1 1 + +echo SELECT t1.f1, t3.f1, t2.f1 FROM t1 INNER JOIN t2 ON t1.f1 = t2.f1 INNER JOIN t3 ON t3.f1 = t1.f1 ORDER BY t1.f1 DESC,t3.f1 DESC,t2.f1 DESC; +--------------------------------------------------------- + t1.f1 t3.f1 t2.f1 +--------------------------------------------------------- + 1 1 1 + 1 1 1 + 1 1 1 + 1 1 1 + +echo SELECT t1.f1, t2.f1, t1.f4, t2.f4 FROM t1 INNER JOIN t2 ON t1.f1 < 2 OR t1.f3 < 2.5 ORDER BY t1.f4, t2.f4; +--------------------------------------------------------- + t1.f1 t2.f1 t1.f4 t2.f4 +--------------------------------------------------------- + 1 8 2008/7/1 2008/7/1 + 1 9 2008/7/1 2008/7/1 + 1 4 2008/7/1 2008/7/1 + 1 1 2008/7/1 2008/7/1 + 1 8 2008/7/1 2008/7/1 + 1 9 2008/7/1 2008/7/1 + 1 4 2008/7/1 2008/7/1 + 1 1 2008/7/1 2008/7/1 + 1 7 2008/7/1 2008/7/2 + 1 9 2008/7/1 2008/7/2 + 1 7 2008/7/1 2008/7/2 + 1 9 2008/7/1 2008/7/2 + 1 8 2008/7/1 2008/7/3 + 1 3 2008/7/1 2008/7/3 + 1 8 2008/7/1 2008/7/3 + 1 3 2008/7/1 2008/7/3 + 1 9 2008/7/1 2008/7/4 + 1 8 2008/7/1 2008/7/4 + 1 9 2008/7/1 2008/7/4 + 1 8 2008/7/1 2008/7/4 + 1 7 2008/7/1 2008/7/5 + 1 7 2008/7/1 2008/7/5 + 2 8 2008/7/4 2008/7/1 + 2 9 2008/7/4 2008/7/1 + 2 4 2008/7/4 2008/7/1 + 2 1 2008/7/4 2008/7/1 + 2 7 2008/7/4 2008/7/2 + 2 9 2008/7/4 2008/7/2 + 2 8 2008/7/4 2008/7/3 + 2 3 2008/7/4 2008/7/3 + 2 9 2008/7/4 2008/7/4 + 2 8 2008/7/4 2008/7/4 + 2 7 2008/7/4 2008/7/5 + +echo SELECT t1.f1, t2.f1, t1.f4, t2.f4 FROM t1 INNER JOIN t2 ON t1.f1 < 2 OR t1.f3 < 2.5 ORDER BY t1.f1, t1.f4 DESC ; +--------------------------------------------------------- + t1.f1 t2.f1 t1.f4 t2.f4 +--------------------------------------------------------- + 1 8 2008/7/1 2008/7/1 + 1 9 2008/7/1 2008/7/4 + 1 7 2008/7/1 2008/7/5 + 1 8 2008/7/1 2008/7/4 + 1 9 2008/7/1 2008/7/1 + 1 8 2008/7/1 2008/7/3 + 1 7 2008/7/1 2008/7/2 + 1 4 2008/7/1 2008/7/1 + 1 3 2008/7/1 2008/7/3 + 1 9 2008/7/1 2008/7/2 + 1 1 2008/7/1 2008/7/1 + 1 8 2008/7/1 2008/7/1 + 1 9 2008/7/1 2008/7/4 + 1 7 2008/7/1 2008/7/5 + 1 8 2008/7/1 2008/7/4 + 1 9 2008/7/1 2008/7/1 + 1 8 2008/7/1 2008/7/3 + 1 7 2008/7/1 2008/7/2 + 1 4 2008/7/1 2008/7/1 + 1 3 2008/7/1 2008/7/3 + 1 9 2008/7/1 2008/7/2 + 1 1 2008/7/1 2008/7/1 + 2 8 2008/7/4 2008/7/1 + 2 9 2008/7/4 2008/7/4 + 2 7 2008/7/4 2008/7/5 + 2 8 2008/7/4 2008/7/4 + 2 9 2008/7/4 2008/7/1 + 2 8 2008/7/4 2008/7/3 + 2 7 2008/7/4 2008/7/2 + 2 4 2008/7/4 2008/7/1 + 2 3 2008/7/4 2008/7/3 + 2 9 2008/7/4 2008/7/2 + 2 1 2008/7/4 2008/7/1 + +echo SELECT t1.f1, t2.f4, t2.f1 FROM t1 INNER JOIN t2 ON t1.f1 < 2 OR t2.f1 < 2 ORDER BY t1.f1, t2.f4 ; +--------------------------------------------------------- + t1.f1 t2.f4 t2.f1 +--------------------------------------------------------- + 1 2008/7/1 8 + 1 2008/7/1 9 + 1 2008/7/1 4 + 1 2008/7/1 1 + 1 2008/7/1 8 + 1 2008/7/1 9 + 1 2008/7/1 4 + 1 2008/7/1 1 + 1 2008/7/2 7 + 1 2008/7/2 9 + 1 2008/7/2 7 + 1 2008/7/2 9 + 1 2008/7/3 8 + 1 2008/7/3 3 + 1 2008/7/3 8 + 1 2008/7/3 3 + 1 2008/7/4 9 + 1 2008/7/4 8 + 1 2008/7/4 9 + 1 2008/7/4 8 + 1 2008/7/5 7 + 1 2008/7/5 7 + 2 2008/7/1 1 + 2 2008/7/1 1 + 2 2008/7/1 1 + 3 2008/7/1 1 + 3 2008/7/1 1 + 4 2008/7/1 1 + 5 2008/7/1 1 + 6 2008/7/1 1 + 6 2008/7/1 1 + +echo SELECT t1.f1, t2.f4, t2.f1 FROM t1 INNER JOIN t2 ON t1.f1 < 2 OR t2.f1 < 2 ORDER BY t1.f1 DESC, t2.f4 ; +--------------------------------------------------------- + t1.f1 t2.f4 t2.f1 +--------------------------------------------------------- + 6 2008/7/1 1 + 6 2008/7/1 1 + 5 2008/7/1 1 + 4 2008/7/1 1 + 3 2008/7/1 1 + 3 2008/7/1 1 + 2 2008/7/1 1 + 2 2008/7/1 1 + 2 2008/7/1 1 + 1 2008/7/1 8 + 1 2008/7/1 9 + 1 2008/7/1 4 + 1 2008/7/1 1 + 1 2008/7/1 8 + 1 2008/7/1 9 + 1 2008/7/1 4 + 1 2008/7/1 1 + 1 2008/7/2 7 + 1 2008/7/2 9 + 1 2008/7/2 7 + 1 2008/7/2 9 + 1 2008/7/3 8 + 1 2008/7/3 3 + 1 2008/7/3 8 + 1 2008/7/3 3 + 1 2008/7/4 9 + 1 2008/7/4 8 + 1 2008/7/4 9 + 1 2008/7/4 8 + 1 2008/7/5 7 + 1 2008/7/5 7 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Order/exp.test009.ksh b/test/sql/Order/exp.test009.ksh new file mode 100644 index 00000000..dc36b12e --- /dev/null +++ b/test/sql/Order/exp.test009.ksh @@ -0,0 +1,343 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo SELECT * FROM t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 +--------------------------------------------------------- + 3 AAA 2.500000 2008/7/1 + 2 AAA 2.500000 2008/7/2 + 4 GGG 4.500000 2008/7/3 + 1 DEF 1.500000 2008/7/1 + 6 CCC 6.500000 2008/7/2 + 5 HHH 5.500000 2008/7/3 + 2 AAA 2.500000 2008/7/1 + 6 CCC 6.500000 2008/7/4 + 3 ABB 2.600000 2008/7/5 + 2 BBB 1.600000 2008/7/4 + 1 DDD 1.600000 2008/7/1 + +echo SELECT * FROM t2; +--------------------------------------------------------- + t2.f1 t2.f2 t2.f3 t2.f4 +--------------------------------------------------------- + 1 DEF 1.500000 2008/7/1 + 9 QQQ 9.500000 2008/7/2 + 3 MMM 2.500000 2008/7/3 + 4 GGG 4.600000 2008/7/1 + 7 PPP 7.500000 2008/7/2 + 8 NNN 8.500000 2008/7/3 + 9 QQQ 9.500000 2008/7/1 + 8 AAA 8.500000 2008/7/4 + 7 AAA 7.500000 2008/7/5 + 9 BBB 9.800000 2008/7/4 + 8 EEE 8.800000 2008/7/1 + +echo SELECT * FROM t3; +--------------------------------------------------------- + t3.f1 t3.f2 t3.f3 t3.f4 +--------------------------------------------------------- + 1 DEF 1.500000 2008/7/1 + 2 AAA 2.500000 2008/7/2 + 7 PPP 7.500000 2008/7/3 + 8 NNN 8.500000 2008/7/4 + 9 QQQ 9.500000 2008/7/1 + 10 NNN 10.500000 2008/7/2 + 1 DEF 1.500000 2008/7/3 + 2 AAA 2.500000 2008/7/4 + 7 PPP 7.500000 2008/7/1 + 8 NNN 8.500000 2008/7/2 + 10 NNN 10.500000 2008/7/4 + +echo SELECT * FROM t1 LEFT JOIN t2 ON t1.f1 = t2.f1 ORDER BY t1.f1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 t2.f1 t2.f2 t2.f3 t2.f4 +--------------------------------------------------------- + 1 DDD 1.600000 2008/7/1 1 DEF 1.500000 2008/7/1 + 1 DEF 1.500000 2008/7/1 1 DEF 1.500000 2008/7/1 + 2 BBB 1.600000 2008/7/4 NULL NULL NULL NULL + 2 AAA 2.500000 2008/7/1 NULL NULL NULL NULL + 2 AAA 2.500000 2008/7/2 NULL NULL NULL NULL + 3 ABB 2.600000 2008/7/5 3 MMM 2.500000 2008/7/3 + 3 AAA 2.500000 2008/7/1 3 MMM 2.500000 2008/7/3 + 4 GGG 4.500000 2008/7/3 4 GGG 4.600000 2008/7/1 + 5 HHH 5.500000 2008/7/3 NULL NULL NULL NULL + 6 CCC 6.500000 2008/7/4 NULL NULL NULL NULL + 6 CCC 6.500000 2008/7/2 NULL NULL NULL NULL + +echo SELECT t1.f1, t2.f1, t3.f1 FROM t1 LEFT JOIN t2 ON t1.f1 = t2.f1 LEFT JOIN t3 ON t2.f1 = t3.f1 ORDER BY t1.f1; +--------------------------------------------------------- + t1.f1 t2.f1 t3.f1 +--------------------------------------------------------- + 1 1 1 + 1 1 1 + 1 1 1 + 1 1 1 + 2 NULL NULL + 2 NULL NULL + 2 NULL NULL + 3 3 NULL + 3 3 NULL + 4 4 NULL + 5 NULL NULL + 6 NULL NULL + 6 NULL NULL + +echo SELECT * FROM t1 LEFT JOIN t2 ON t1.f1 = t2.f1 ORDER BY t1.f1,t2.f1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 t2.f1 t2.f2 t2.f3 t2.f4 +--------------------------------------------------------- + 1 DDD 1.600000 2008/7/1 1 DEF 1.500000 2008/7/1 + 1 DEF 1.500000 2008/7/1 1 DEF 1.500000 2008/7/1 + 2 BBB 1.600000 2008/7/4 NULL NULL NULL NULL + 2 AAA 2.500000 2008/7/1 NULL NULL NULL NULL + 2 AAA 2.500000 2008/7/2 NULL NULL NULL NULL + 3 ABB 2.600000 2008/7/5 3 MMM 2.500000 2008/7/3 + 3 AAA 2.500000 2008/7/1 3 MMM 2.500000 2008/7/3 + 4 GGG 4.500000 2008/7/3 4 GGG 4.600000 2008/7/1 + 5 HHH 5.500000 2008/7/3 NULL NULL NULL NULL + 6 CCC 6.500000 2008/7/4 NULL NULL NULL NULL + 6 CCC 6.500000 2008/7/2 NULL NULL NULL NULL + +echo SELECT t1.f1, t3.f1, t2.f1 FROM t1 LEFT JOIN t2 ON t1.f1 = t2.f1 LEFT JOIN t3 ON t3.f1 = t1.f1 ORDER BY t1.f1,t3.f1,t2.f1; +--------------------------------------------------------- + t1.f1 t3.f1 t2.f1 +--------------------------------------------------------- + 1 1 1 + 1 1 1 + 1 1 1 + 1 1 1 + 2 2 NULL + 2 2 NULL + 2 2 NULL + 2 2 NULL + 2 2 NULL + 2 2 NULL + 3 NULL 3 + 3 NULL 3 + 4 NULL 4 + 5 NULL NULL + 6 NULL NULL + 6 NULL NULL + +echo SELECT t1.f1, t3.f1, t2.f1 FROM t1 LEFT JOIN t2 ON t1.f1 = t2.f1 LEFT JOIN t3 ON t3.f1 = t1.f1 ORDER BY t1.f1 DESC,t3.f1 DESC,t2.f1 DESC; +--------------------------------------------------------- + t1.f1 t3.f1 t2.f1 +--------------------------------------------------------- + 6 NULL NULL + 6 NULL NULL + 5 NULL NULL + 4 NULL 4 + 3 NULL 3 + 3 NULL 3 + 2 2 NULL + 2 2 NULL + 2 2 NULL + 2 2 NULL + 2 2 NULL + 2 2 NULL + 1 1 1 + 1 1 1 + 1 1 1 + 1 1 1 + +echo SELECT t1.f1, t2.f1, t1.f4, t2.f4 FROM t1 LEFT JOIN t2 ON t1.f1 < 2 OR t1.f3 < 2.5 ORDER BY t1.f4, t2.f4; +--------------------------------------------------------- + t1.f1 t2.f1 t1.f4 t2.f4 +--------------------------------------------------------- + 3 NULL 2008/7/1 NULL + 1 8 2008/7/1 2008/7/1 + 1 9 2008/7/1 2008/7/1 + 1 4 2008/7/1 2008/7/1 + 1 1 2008/7/1 2008/7/1 + 1 8 2008/7/1 2008/7/1 + 1 9 2008/7/1 2008/7/1 + 1 4 2008/7/1 2008/7/1 + 1 1 2008/7/1 2008/7/1 + 1 7 2008/7/1 2008/7/2 + 1 9 2008/7/1 2008/7/2 + 1 7 2008/7/1 2008/7/2 + 1 9 2008/7/1 2008/7/2 + 1 8 2008/7/1 2008/7/3 + 1 3 2008/7/1 2008/7/3 + 1 8 2008/7/1 2008/7/3 + 1 3 2008/7/1 2008/7/3 + 1 9 2008/7/1 2008/7/4 + 1 8 2008/7/1 2008/7/4 + 1 9 2008/7/1 2008/7/4 + 1 8 2008/7/1 2008/7/4 + 1 7 2008/7/1 2008/7/5 + 1 7 2008/7/1 2008/7/5 + 2 NULL 2008/7/1 NULL + 2 NULL 2008/7/2 NULL + 6 NULL 2008/7/2 NULL + 4 NULL 2008/7/3 NULL + 5 NULL 2008/7/3 NULL + 2 8 2008/7/4 2008/7/1 + 2 9 2008/7/4 2008/7/1 + 2 4 2008/7/4 2008/7/1 + 2 1 2008/7/4 2008/7/1 + 2 7 2008/7/4 2008/7/2 + 2 9 2008/7/4 2008/7/2 + 2 8 2008/7/4 2008/7/3 + 2 3 2008/7/4 2008/7/3 + 2 9 2008/7/4 2008/7/4 + 2 8 2008/7/4 2008/7/4 + 2 7 2008/7/4 2008/7/5 + 6 NULL 2008/7/4 NULL + 3 NULL 2008/7/5 NULL + +echo SELECT t1.f1, t2.f1, t1.f4, t2.f4 FROM t1 LEFT JOIN t2 ON t1.f1 < 2 OR t1.f3 < 2.5 ORDER BY t1.f1, t1.f4 DESC ; +--------------------------------------------------------- + t1.f1 t2.f1 t1.f4 t2.f4 +--------------------------------------------------------- + 1 8 2008/7/1 2008/7/1 + 1 9 2008/7/1 2008/7/4 + 1 7 2008/7/1 2008/7/5 + 1 8 2008/7/1 2008/7/4 + 1 9 2008/7/1 2008/7/1 + 1 8 2008/7/1 2008/7/3 + 1 7 2008/7/1 2008/7/2 + 1 4 2008/7/1 2008/7/1 + 1 3 2008/7/1 2008/7/3 + 1 9 2008/7/1 2008/7/2 + 1 1 2008/7/1 2008/7/1 + 1 8 2008/7/1 2008/7/1 + 1 9 2008/7/1 2008/7/4 + 1 7 2008/7/1 2008/7/5 + 1 8 2008/7/1 2008/7/4 + 1 9 2008/7/1 2008/7/1 + 1 8 2008/7/1 2008/7/3 + 1 7 2008/7/1 2008/7/2 + 1 4 2008/7/1 2008/7/1 + 1 3 2008/7/1 2008/7/3 + 1 9 2008/7/1 2008/7/2 + 1 1 2008/7/1 2008/7/1 + 2 8 2008/7/4 2008/7/1 + 2 9 2008/7/4 2008/7/4 + 2 7 2008/7/4 2008/7/5 + 2 8 2008/7/4 2008/7/4 + 2 9 2008/7/4 2008/7/1 + 2 8 2008/7/4 2008/7/3 + 2 7 2008/7/4 2008/7/2 + 2 4 2008/7/4 2008/7/1 + 2 3 2008/7/4 2008/7/3 + 2 9 2008/7/4 2008/7/2 + 2 1 2008/7/4 2008/7/1 + 2 NULL 2008/7/2 NULL + 2 NULL 2008/7/1 NULL + 3 NULL 2008/7/5 NULL + 3 NULL 2008/7/1 NULL + 4 NULL 2008/7/3 NULL + 5 NULL 2008/7/3 NULL + 6 NULL 2008/7/4 NULL + 6 NULL 2008/7/2 NULL + +echo SELECT t1.f1, t2.f4, t2.f1 FROM t1 LEFT JOIN t2 ON t1.f1 < 2 OR t2.f1 < 2 ORDER BY t1.f1, t2.f4 ; +--------------------------------------------------------- + t1.f1 t2.f4 t2.f1 +--------------------------------------------------------- + 1 2008/7/1 8 + 1 2008/7/1 9 + 1 2008/7/1 4 + 1 2008/7/1 1 + 1 2008/7/1 8 + 1 2008/7/1 9 + 1 2008/7/1 4 + 1 2008/7/1 1 + 1 2008/7/2 7 + 1 2008/7/2 9 + 1 2008/7/2 7 + 1 2008/7/2 9 + 1 2008/7/3 8 + 1 2008/7/3 3 + 1 2008/7/3 8 + 1 2008/7/3 3 + 1 2008/7/4 9 + 1 2008/7/4 8 + 1 2008/7/4 9 + 1 2008/7/4 8 + 1 2008/7/5 7 + 1 2008/7/5 7 + 2 2008/7/1 1 + 2 2008/7/1 1 + 2 2008/7/1 1 + 3 2008/7/1 1 + 3 2008/7/1 1 + 4 2008/7/1 1 + 5 2008/7/1 1 + 6 2008/7/1 1 + 6 2008/7/1 1 + +echo SELECT t1.f1, t2.f4, t2.f1 FROM t1 LEFT JOIN t2 ON t1.f1 < 2 OR t2.f1 < 2 ORDER BY t1.f1 DESC, t2.f4 ; +--------------------------------------------------------- + t1.f1 t2.f4 t2.f1 +--------------------------------------------------------- + 6 2008/7/1 1 + 6 2008/7/1 1 + 5 2008/7/1 1 + 4 2008/7/1 1 + 3 2008/7/1 1 + 3 2008/7/1 1 + 2 2008/7/1 1 + 2 2008/7/1 1 + 2 2008/7/1 1 + 1 2008/7/1 8 + 1 2008/7/1 9 + 1 2008/7/1 4 + 1 2008/7/1 1 + 1 2008/7/1 8 + 1 2008/7/1 9 + 1 2008/7/1 4 + 1 2008/7/1 1 + 1 2008/7/2 7 + 1 2008/7/2 9 + 1 2008/7/2 7 + 1 2008/7/2 9 + 1 2008/7/3 8 + 1 2008/7/3 3 + 1 2008/7/3 8 + 1 2008/7/3 3 + 1 2008/7/4 9 + 1 2008/7/4 8 + 1 2008/7/4 9 + 1 2008/7/4 8 + 1 2008/7/5 7 + 1 2008/7/5 7 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/Order/exp.test010.ksh b/test/sql/Order/exp.test010.ksh new file mode 100644 index 00000000..16f5eb11 --- /dev/null +++ b/test/sql/Order/exp.test010.ksh @@ -0,0 +1,196 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +--------------------------------------------------------- + emp.empid emp.ename emp.basic emp.join_date emp.mgrno emp.mgrname emp.allowances emp.mgr_date +--------------------------------------------------------- + 7 SUMAN 7500.000000 2007/2/2 1:1:1.0 7 SUMAN 7500.000000 2007/2/2 1:1:1.0 + 1 JAMES 7000.000000 2007/2/2 1:1:1.0 3 PITER 8000.000000 2007/2/3 1:1:1.0 + 4 HARRY 8500.000000 2007/2/6 1:1:1.0 3 PITER 8000.000000 2007/2/3 1:1:1.0 + 2 LALIT 7500.000000 2007/2/1 1:1:1.0 1 JAMES 7000.000000 2007/2/2 1:1:1.0 + 3 PITER 8000.000000 2007/2/3 1:1:1.0 2 LALIT 7500.000000 2007/2/1 1:1:1.0 + 5 MAHES 6500.000000 2007/2/4 1:1:1.0 4 HARRY 8500.000000 2007/2/6 1:1:1.0 + 8 LATIF 7000.000000 2007/2/1 1:1:1.0 3 PITER 8000.000000 2007/2/3 1:1:1.0 + 6 RAMAN 6000.000000 2007/2/5 1:1:1.0 4 HARRY 8500.000000 2007/2/6 1:1:1.0 + +echo SELECT a.empid, a.ename, b.ename FROM emp as a, emp as b WHERE a.empid=b.mgrno; +--------------------------------------------------------- + a.empid a.ename b.ename +--------------------------------------------------------- + 7 SUMAN SUMAN + 1 JAMES LALIT + 4 HARRY MAHES + 4 HARRY RAMAN + 2 LALIT PITER + 3 PITER JAMES + 3 PITER HARRY + 3 PITER LATIF + +echo SELECT a.empid, a.ename, b.ename FROM emp as a, emp as b WHERE a.empid=b.mgrno ORDER BY a.empid; +--------------------------------------------------------- + a.empid a.ename b.ename +--------------------------------------------------------- + 1 JAMES LALIT + 2 LALIT PITER + 3 PITER LATIF + 3 PITER HARRY + 3 PITER JAMES + 4 HARRY RAMAN + 4 HARRY MAHES + 7 SUMAN SUMAN + +echo SELECT a.empid, a.ename, b.ename FROM emp as a, emp as b WHERE a.empid=b.mgrno ORDER BY a.empid, b.ename DESC; +--------------------------------------------------------- + a.empid a.ename b.ename +--------------------------------------------------------- + 1 JAMES LALIT + 2 LALIT PITER + 3 PITER LATIF + 3 PITER JAMES + 3 PITER HARRY + 4 HARRY RAMAN + 4 HARRY MAHES + 7 SUMAN SUMAN + +echo SELECT a.ename, b.ename FROM emp as a, emp as b WHERE a.ename=b.mgrname; +--------------------------------------------------------- + a.ename b.ename +--------------------------------------------------------- + SUMAN SUMAN + JAMES LALIT + HARRY MAHES + HARRY RAMAN + LALIT PITER + PITER JAMES + PITER HARRY + PITER LATIF + +echo SELECT a.ename, b.ename FROM emp as a, emp as b WHERE a.ename=b.mgrname ORDER BY a.ename; +--------------------------------------------------------- + a.ename b.ename +--------------------------------------------------------- + HARRY RAMAN + HARRY MAHES + JAMES LALIT + LALIT PITER + PITER LATIF + PITER HARRY + PITER JAMES + SUMAN SUMAN + +echo SELECT a.ename, b.ename FROM emp as a, emp as b WHERE a.ename=b.mgrname ORDER BY a.ename, b.empid DESC; +--------------------------------------------------------- + a.ename b.ename +--------------------------------------------------------- + HARRY RAMAN + HARRY MAHES + JAMES LALIT + LALIT PITER + PITER LATIF + PITER HARRY + PITER JAMES + SUMAN SUMAN + +echo SELECT a.ename, b.ename, a.basic FROM emp as a, emp as b WHERE a.basic=b.allowances; +--------------------------------------------------------- + a.ename b.ename a.basic +--------------------------------------------------------- + SUMAN SUMAN 7500.000000 + SUMAN PITER 7500.000000 + JAMES LALIT 7000.000000 + HARRY MAHES 8500.000000 + HARRY RAMAN 8500.000000 + LALIT SUMAN 7500.000000 + LALIT PITER 7500.000000 + PITER JAMES 8000.000000 + PITER HARRY 8000.000000 + PITER LATIF 8000.000000 + LATIF LALIT 7000.000000 + +echo SELECT a.ename, b.ename, a.basic FROM emp as a, emp as b WHERE a.basic=b.allowances ORDER BY a.basic; +--------------------------------------------------------- + a.ename b.ename a.basic +--------------------------------------------------------- + LATIF LALIT 7000.000000 + JAMES LALIT 7000.000000 + LALIT PITER 7500.000000 + LALIT SUMAN 7500.000000 + SUMAN PITER 7500.000000 + SUMAN SUMAN 7500.000000 + PITER LATIF 8000.000000 + PITER HARRY 8000.000000 + PITER JAMES 8000.000000 + HARRY RAMAN 8500.000000 + HARRY MAHES 8500.000000 + +echo SELECT a.ename, b.ename, a.basic FROM emp as a, emp as b WHERE a.basic=b.allowances ORDER BY a.basic DESC, b.ename DESC; +--------------------------------------------------------- + a.ename b.ename a.basic +--------------------------------------------------------- + HARRY RAMAN 8500.000000 + HARRY MAHES 8500.000000 + PITER LATIF 8000.000000 + PITER JAMES 8000.000000 + PITER HARRY 8000.000000 + LALIT SUMAN 7500.000000 + SUMAN SUMAN 7500.000000 + LALIT PITER 7500.000000 + SUMAN PITER 7500.000000 + LATIF LALIT 7000.000000 + JAMES LALIT 7000.000000 + +echo SELECT a.ename, b.ename, b.mgr_date FROM emp as a, emp as b WHERE a.mgr_date=b.join_date; +--------------------------------------------------------- + a.ename b.ename b.mgr_date +--------------------------------------------------------- + SUMAN SUMAN 2007/2/2 1:1:1.0 + SUMAN JAMES 2007/2/3 1:1:1.0 + JAMES PITER 2007/2/1 1:1:1.0 + HARRY PITER 2007/2/1 1:1:1.0 + LALIT SUMAN 2007/2/2 1:1:1.0 + LALIT JAMES 2007/2/3 1:1:1.0 + PITER LALIT 2007/2/2 1:1:1.0 + PITER LATIF 2007/2/3 1:1:1.0 + MAHES HARRY 2007/2/3 1:1:1.0 + LATIF PITER 2007/2/1 1:1:1.0 + RAMAN HARRY 2007/2/3 1:1:1.0 + +echo SELECT a.ename, b.ename, a.mgr_date FROM emp as a, emp as b WHERE a.mgr_date=b.join_date ORDER BY a.mgr_date; +--------------------------------------------------------- + a.ename b.ename a.mgr_date +--------------------------------------------------------- + PITER LATIF 2007/2/1 1:1:1.0 + PITER LALIT 2007/2/1 1:1:1.0 + LALIT JAMES 2007/2/2 1:1:1.0 + LALIT SUMAN 2007/2/2 1:1:1.0 + SUMAN JAMES 2007/2/2 1:1:1.0 + SUMAN SUMAN 2007/2/2 1:1:1.0 + LATIF PITER 2007/2/3 1:1:1.0 + HARRY PITER 2007/2/3 1:1:1.0 + JAMES PITER 2007/2/3 1:1:1.0 + RAMAN HARRY 2007/2/6 1:1:1.0 + MAHES HARRY 2007/2/6 1:1:1.0 + +echo SELECT a.ename, b.ename, a.join_date, b.join_date, a.basic, b.basic, a.empid, b.empid FROM emp as a, emp as b WHERE a.mgr_date=b.join_date ORDER BY a.mgr_date DESC; +--------------------------------------------------------- + a.ename b.ename a.join_date b.join_date a.basic b.basic a.empid b.empid +--------------------------------------------------------- + RAMAN HARRY 2007/2/5 1:1:1.0 2007/2/6 1:1:1.0 6000.000000 8500.000000 6 4 + MAHES HARRY 2007/2/4 1:1:1.0 2007/2/6 1:1:1.0 6500.000000 8500.000000 5 4 + LATIF PITER 2007/2/1 1:1:1.0 2007/2/3 1:1:1.0 7000.000000 8000.000000 8 3 + HARRY PITER 2007/2/6 1:1:1.0 2007/2/3 1:1:1.0 8500.000000 8000.000000 4 3 + JAMES PITER 2007/2/2 1:1:1.0 2007/2/3 1:1:1.0 7000.000000 8000.000000 1 3 + LALIT JAMES 2007/2/1 1:1:1.0 2007/2/2 1:1:1.0 7500.000000 7000.000000 2 1 + LALIT SUMAN 2007/2/1 1:1:1.0 2007/2/2 1:1:1.0 7500.000000 7500.000000 2 7 + SUMAN JAMES 2007/2/2 1:1:1.0 2007/2/2 1:1:1.0 7500.000000 7000.000000 7 1 + SUMAN SUMAN 2007/2/2 1:1:1.0 2007/2/2 1:1:1.0 7500.000000 7500.000000 7 7 + PITER LATIF 2007/2/3 1:1:1.0 2007/2/1 1:1:1.0 8000.000000 7000.000000 3 8 + PITER LALIT 2007/2/3 1:1:1.0 2007/2/1 1:1:1.0 8000.000000 7500.000000 3 2 + +Statement Executed diff --git a/test/sql/Order/exp.test011.ksh b/test/sql/Order/exp.test011.ksh new file mode 100644 index 00000000..38cbdb34 --- /dev/null +++ b/test/sql/Order/exp.test011.ksh @@ -0,0 +1,101 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo SELECT * FROM t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 +--------------------------------------------------------- + 3 AAA 2.500000 2008/7/1 + 2 AAA 2.500000 2008/7/2 + 4 GGG 4.500000 2008/7/3 + 1 DEF 1.500000 2008/7/1 + 6 CCC 6.500000 2008/7/2 + 5 HHH 5.500000 2008/7/3 + 2 AAA 2.500000 2008/7/1 + 6 CCC 6.500000 2008/7/4 + 3 ABB 2.600000 2008/7/5 + 2 BBB 1.600000 2008/7/4 + 1 DDD 1.600000 2008/7/1 + +echo SELECT * FROM t2; +--------------------------------------------------------- + t2.f1 t2.f2 t2.f3 t2.f4 +--------------------------------------------------------- + 1 DEF 1.500000 2008/7/1 + 9 QQQ 9.500000 2008/7/2 + 3 MMM 2.500000 2008/7/3 + 4 GGG 4.600000 2008/7/1 + 7 PPP 7.500000 2008/7/2 + 8 NNN 8.500000 2008/7/3 + 9 QQQ 9.500000 2008/7/1 + 8 AAA 8.500000 2008/7/4 + 7 AAA 7.500000 2008/7/5 + 9 BBB 9.800000 2008/7/4 + 8 EEE 8.800000 2008/7/1 + +echo SELECT * FROM t3; +--------------------------------------------------------- + t3.f1 t3.f2 t3.f3 t3.f4 +--------------------------------------------------------- + 1 DEF 1.500000 2008/7/1 + 2 AAA 2.500000 2008/7/2 + 7 PPP 7.500000 2008/7/3 + 8 NNN 8.500000 2008/7/4 + 9 QQQ 9.500000 2008/7/1 + 10 NNN 10.500000 2008/7/2 + 1 DEF 1.500000 2008/7/3 + 2 AAA 2.500000 2008/7/4 + 7 PPP 7.500000 2008/7/1 + 8 NNN 8.500000 2008/7/2 + 10 NNN 10.500000 2008/7/4 + +echo SELECT t1.f1, t2.f1, SUM(t1.f3) FROM t1 INNER JOIN t2 ON t1.f1=t2.f1 AND t1.f1 IN(1,2,4,5,6) AND t2.f1 BETWEEN 2 AND 6 LEFT JOIN t3 ON t2.f1 != 5 WHERE t1.f1 <= t2.f1 OR t2.f2 >=2 AND (t2.f3 LIKE 'A%' OR t2.f3 LIKE 'B%' OR t2.f3 LIKE 'Q%') GROUP BY t1.f1, t2.f1 HAVING SUM(t1.f3) >1 ORDER BY t1.f1; + + + +echo SELECT t1.f1, t2.f1, t3.f1, SUM(t1.f3) FROM t1 INNER JOIN t2 ON t1.f1=t2.f1 AND t1.f1 IN(1,2,4,5,6) OR t2.f1 BETWEEN 2 AND 6 LEFT JOIN t3 ON t2.f1 != 5 WHERE t1.f1 <= t2.f1 OR t2.f2 >=2 OR t2.f3 LIKE 'A%' OR t2.f3 LIKE 'B%' OR t2.f3 LIKE 'Q%' GROUP BY t1.f1, t2.f1, t3.f1 HAVING SUM(t1.f3) >1 ORDER BY t1.f1; + + + +echo SELECT t1.f1, t2.f1, t3.f1, SUM(t1.f3) FROM t1 INNER JOIN t2 ON t1.f1=t2.f1 AND t1.f1 IN(1,2,4,5,6) AND t2.f1 BETWEEN 2 AND 6 LEFT JOIN t3 ON t2.f1 != 5 WHERE t1.f1 <= t2.f1 OR t2.f2 >=2 AND (t2.f3 LIKE 'A%' OR t2.f3 LIKE 'B%' OR t2.f3 LIKE 'Q%') GROUP BY t1.f1, t2.f1, t3.f1 HAVING SUM(t1.f3) >1 ORDER BY t1.f1; + +For the above 3 queries retrieved records are more than expected records. Just verify it + +Statement Executed +Statement Executed +Statement Executed + + diff --git a/test/sql/Order/leftjoin2.sql b/test/sql/Order/leftjoin2.sql new file mode 100644 index 00000000..a3884ca7 --- /dev/null +++ b/test/sql/Order/leftjoin2.sql @@ -0,0 +1,66 @@ +echo CREATE TABLE Articles ( ArticleID SMALLINT, ArticleTitle CHAR(30) NOT NULL, Copyright INT NOT NULL,PRIMARY KEY(ArticleID)); +CREATE TABLE Articles ( ArticleID SMALLINT, ArticleTitle CHAR(30) NOT NULL, Copyright INT NOT NULL,PRIMARY KEY(ArticleID)); +echo INSERT INTO Articles VALUES (12786, 'How write a paper',1934); +INSERT INTO Articles VALUES (12786, 'How write a paper',1934); +echo INSERT INTO Articles VALUES (13331, 'Publish a paper ',1919); +INSERT INTO Articles VALUES (13331, 'Publish a paper ',1919); +echo INSERT INTO Articles VALUES (14356, 'Sell a paper ',1966); +INSERT INTO Articles VALUES (14356, 'Sell a paper ',1966); +echo INSERT INTO Articles VALUES (15729, 'Buy a paper ',1932); +INSERT INTO Articles VALUES (15729, 'Buy a paper ',1932); +echo INSERT INTO Articles VALUES (16284, 'Conferences ',1996); +INSERT INTO Articles VALUES (16284, 'Conferences ',1996); +echo INSERT INTO Articles VALUES (17695, 'Journal ',1980); +INSERT INTO Articles VALUES (17695, 'Journal ',1980); +echo INSERT INTO Articles VALUES (19264, 'Information ',1992); +INSERT INTO Articles VALUES (19264, 'Information ',1992); +echo INSERT INTO Articles VALUES (19354, 'AI ',1993); +INSERT INTO Articles VALUES (19354, 'AI ',1993); +echo CREATE TABLE Authors (AuthID SMALLINT, AuthorFirstName CHAR(20), AuthorMiddleName CHAR(20), AuthorLastName CHAR(20),PRIMARY KEY(AuthID)); +CREATE TABLE Authors (AuthID SMALLINT, AuthorFirstName CHAR(20), AuthorMiddleName CHAR(20), AuthorLastName CHAR(20),PRIMARY KEY(AuthID)); +echo INSERT INTO Authors VALUES (1006, 'Henry', 'S.', 'Thompson'); +INSERT INTO Authors VALUES (1006, 'Henry', 'S.', 'Thompson'); +echo INSERT INTO Authors VALUES(1007, 'Jason', 'Carol', 'Oak'); +INSERT INTO Authors VALUES(1007, 'Jason', 'Carol', 'Oak'); +echo INSERT INTO Authors VALUES(1008, 'James', NULL, 'Elk'); +INSERT INTO Authors VALUES(1008, 'James', NULL, 'Elk'); +echo INSERT INTO Authors VALUES(1009, 'Tom', 'M', 'Ride'); +INSERT INTO Authors VALUES(1009, 'Tom', 'M', 'Ride'); +echo INSERT INTO Authors VALUES(1010, 'Jack', 'K', 'Ken'); +INSERT INTO Authors VALUES(1010, 'Jack', 'K', 'Ken'); +echo INSERT INTO Authors VALUES(1011, 'Mary', 'G.', 'Lee'); +INSERT INTO Authors VALUES(1011, 'Mary', 'G.', 'Lee'); +echo INSERT INTO Authors VALUES(1012, 'Annie', NULL, 'Peng'); +INSERT INTO Authors VALUES(1012, 'Annie', NULL, 'Peng'); +echo INSERT INTO Authors VALUES(1013, 'Alan', NULL, 'Wang'); +INSERT INTO Authors VALUES(1013, 'Alan', NULL, 'Wang'); +echo INSERT INTO Authors VALUES(1014, 'Nelson', NULL, 'Yin'); +INSERT INTO Authors VALUES(1014, 'Nelson', NULL, 'Yin'); +echo CREATE TABLE AuthorArticle (AuthID SMALLINT NOT NULL, ArticleID SMALLINT NOT NULL,FOREIGN KEY(AuthID) REFERENCES Authors(AuthID), FOREIGN KEY(ArticleID) REFERENCES Articles(ArticleID)); +CREATE TABLE AuthorArticle (AuthID SMALLINT NOT NULL, ArticleID SMALLINT NOT NULL,FOREIGN KEY(AuthID) REFERENCES Authors(AuthID), FOREIGN KEY(ArticleID) REFERENCES Articles(ArticleID)); +echo INSERT INTO AuthorArticle VALUES (1006, 14356); +INSERT INTO AuthorArticle VALUES (1006, 14356); +echo INSERT INTO AuthorArticle VALUES (1008, 15729); +INSERT INTO AuthorArticle VALUES (1008, 15729); +echo INSERT INTO AuthorArticle VALUES (1009, 12786); +INSERT INTO AuthorArticle VALUES (1009, 12786); +echo INSERT INTO AuthorArticle VALUES (1010, 17695); +INSERT INTO AuthorArticle VALUES (1010, 17695); +echo INSERT INTO AuthorArticle VALUES (1011, 15729); +INSERT INTO AuthorArticle VALUES (1011, 15729); +echo INSERT INTO AuthorArticle VALUES (1012, 19264); +INSERT INTO AuthorArticle VALUES (1012, 19264); +echo INSERT INTO AuthorArticle VALUES (1012, 19354); +INSERT INTO AuthorArticle VALUES (1012, 19354); +echo INSERT INTO AuthorArticle VALUES (1014, 16284); +INSERT INTO AuthorArticle VALUES (1014, 16284); +echo SELECT * FROM Articles; +SELECT * FROM Articles; +echo SELECT * FROM Authors; +SELECT * FROM Authors; +echo SELECT * FROM AuthorArticle; +SELECT * FROM AuthorArticle; +echo SELECT ArticleTitle, Copyright FROM Articles LEFT JOIN AuthorArticle ON Articles.ArticleID=AuthorArticle.ArticleID LEFT JOIN Authors ON AuthorArticle.AuthID=Authors.AuthID; +SELECT ArticleTitle, Copyright FROM Articles LEFT JOIN AuthorArticle ON Articles.ArticleID=AuthorArticle.ArticleID LEFT JOIN Authors ON AuthorArticle.AuthID=Authors.AuthID; +echo SELECT ArticleTitle, Copyright FROM Articles LEFT JOIN AuthorArticle ON Articles.ArticleID=AuthorArticle.ArticleID LEFT JOIN Authors ON AuthorArticle.AuthID=Authors.AuthID ORDER BY ArticleTitle; +SELECT ArticleTitle, Copyright FROM Articles LEFT JOIN AuthorArticle ON Articles.ArticleID=AuthorArticle.ArticleID LEFT JOIN Authors ON AuthorArticle.AuthID=Authors.AuthID ORDER BY ArticleTitle; diff --git a/test/sql/Order/order1.sql b/test/sql/Order/order1.sql new file mode 100644 index 00000000..01f168dc --- /dev/null +++ b/test/sql/Order/order1.sql @@ -0,0 +1,21 @@ +create table t1(f1 int,f2 int,f3 int,f4 char(10),primary key(f1)); +insert into t1 values(98,1,10,'AAA'); +insert into t1 values(99,2,20,'BBB'); +insert into t1 values(100,2,10,'CCC'); +insert into t1 values(101,3,10,'AAA'); +insert into t1 values(102,2,20,'BBB'); + +echo select * from t1; +select * from t1; + +echo select * from t1 order by f2; +select * from t1 order by f2; + +echo select * from t1 order by t1.f2; +select * from t1 order by t1.f2; + +echo select f2,f3 from t1 order by f2; +select f2,f3 from t1 order by f2; + +echo select f4,f2 from t1 order by f4; +select f4,f2 from t1 order by f4; diff --git a/test/sql/Order/order_alldatatypes.sql b/test/sql/Order/order_alldatatypes.sql new file mode 100644 index 00000000..2de7437c --- /dev/null +++ b/test/sql/Order/order_alldatatypes.sql @@ -0,0 +1,33 @@ +echo select f0,f4 from t1 order by f0; +select f0,f4 from t1 order by f0; +echo select f1,f4 from t1 order by f1; +select f1,f4 from t1 order by f1; +echo select f2,f4 from t1 order by f2; +select f2,f4 from t1 order by f2; +echo select f3,f4 from t1 order by f3; +select f3,f4 from t1 order by f3; +echo select f4,f4 from t1 order by f4; +select f4,f4 from t1 order by f4; +echo select f5,f4 from t1 order by f5; +select f5,f4 from t1 order by f5; +echo select f6,f4 from t1 order by f6; +select f6,f4 from t1 order by f6; +echo select f7,f4 from t1 order by f7; +select f7,f4 from t1 order by f7; +echo select f8,f4 from t1 order by f8; +select f8,f4 from t1 order by f8; +echo select f9,f4 from t1 order by f9; +select f9,f4 from t1 order by f9; +echo select f0,f1,f4 from t1 order by f0,f1; +select f0,f1,f4 from t1 order by f0,f1; +echo select f0,f1,f4 from t1 order by f1,f0; +select f0,f1,f4 from t1 order by f1,f0; +echo select f2,f3,f4 from t1 order by f2,f3,f4; +select f2,f3,f4 from t1 order by f2,f3,f4; +echo select f7,f8,f4 from t1 order by f7,f8; +select f7,f8,f4 from t1 order by f7,f8; +echo select f7,f8,f9,f4 from t1 order by f7,f8,f9; +select f7,f8,f9,f4 from t1 order by f7,f8,f9; +echo select f2,f3,f5,f6,f7,f8,f9,f4 from t1 order by f2,f3,f5,f6,f7,f8,f9; +select f2,f3,f5,f6,f7,f8,f9,f4 from t1 order by f2,f3,f5,f6,f7,f8,f9; + diff --git a/test/sql/Order/order_desc_alldatatypes.sql b/test/sql/Order/order_desc_alldatatypes.sql new file mode 100644 index 00000000..93491db6 --- /dev/null +++ b/test/sql/Order/order_desc_alldatatypes.sql @@ -0,0 +1,33 @@ +echo select f0,f4 from t1 order by f0 desc; +select f0,f4 from t1 order by f0 desc; +echo select f1,f4 from t1 order by f1 desc; +select f1,f4 from t1 order by f1 desc; +echo select f2,f4 from t1 order by f2 desc; +select f2,f4 from t1 order by f2 desc; +echo select f3,f4 from t1 order by f3 desc; +select f3,f4 from t1 order by f3 desc; +echo select f4,f4 from t1 order by f4 desc; +select f4,f4 from t1 order by f4 desc; +echo select f5,f4 from t1 order by f5 desc; +select f5,f4 from t1 order by f5 desc; +echo select f6,f4 from t1 order by f6 desc; +select f6,f4 from t1 order by f6 desc; +echo select f7,f4 from t1 order by f7 desc; +select f7,f4 from t1 order by f7 desc; +echo select f8,f4 from t1 order by f8 desc; +select f8,f4 from t1 order by f8 desc; +echo select f9,f4 from t1 order by f9 desc; +select f9,f4 from t1 order by f9 desc; +echo select f0,f1,f4 from t1 order by f0,f1 desc; +select f0,f1,f4 from t1 order by f0,f1 desc; +echo select f0,f1,f4 from t1 order by f1,f0 desc; +select f0,f1,f4 from t1 order by f1,f0 desc; +echo select f2,f3,f4 from t1 order by f2,f3,f4 desc; +select f2,f3,f4 from t1 order by f2,f3,f4 desc; +echo select f7,f8,f4 from t1 order by f7,f8 desc; +select f7,f8,f4 from t1 order by f7,f8 desc; +echo select f7,f8,f9,f4 from t1 order by f7,f8,f9 desc; +select f7,f8,f9,f4 from t1 order by f7,f8,f9 desc; +echo select f2,f3,f5,f6,f7,f8,f9,f4 from t1 order by f2,f3,f5,f6,f7,f8,f9 desc; +select f2,f3,f5,f6,f7,f8,f9,f4 from t1 order by f2,f3,f5,f6,f7,f8,f9 desc; + diff --git a/test/sql/Order/order_group.sql b/test/sql/Order/order_group.sql new file mode 100644 index 00000000..2f2609f7 --- /dev/null +++ b/test/sql/Order/order_group.sql @@ -0,0 +1,8 @@ +echo SELECT f1, f2, SUM(f3) FROM t1 GROUP BY f1, f2 ORDER BY f1; +SELECT f1, f2, SUM(f3) FROM t1 GROUP BY f1, f2 ORDER BY f1; +echo SELECT f1, f2, SUM(f3), COUNT(f4) FROM t1 GROUP BY f1, f2 ORDER BY f1, f2; +SELECT f1, f2, SUM(f3), COUNT(f4) FROM t1 GROUP BY f1, f2 ORDER BY f1, f2; +echo SELECT f1, SUM(f3), MIN(f2), MAX(f4) FROM t1 GROUP BY f1 ORDER BY f1; +SELECT f1, SUM(f3), MIN(f2), MAX(f4) FROM t1 GROUP BY f1 ORDER BY f1; +echo SELECT f1, SUM(f3), MIN(f2), MAX(f4) FROM t1 GROUP BY f1 HAVING SUM(f3) <= 5.5 ORDER BY f1; +SELECT f1, SUM(f3), MIN(f2), MAX(f4) FROM t1 GROUP BY f1 HAVING SUM(f3) <= 5.5 ORDER BY f1; diff --git a/test/sql/Order/order_inner.sql b/test/sql/Order/order_inner.sql new file mode 100644 index 00000000..e8a32e3a --- /dev/null +++ b/test/sql/Order/order_inner.sql @@ -0,0 +1,18 @@ +echo SELECT * FROM t1 INNER JOIN t2 ON t1.f1 = t2.f1 ORDER BY t1.f1; +SELECT * FROM t1 INNER JOIN t2 ON t1.f1 = t2.f1 ORDER BY t1.f1; +echo SELECT t1.f1, t2.f1, t3.f1 FROM t1 INNER JOIN t2 ON t1.f1 = t2.f1 INNER JOIN t3 ON t2.f1 = t3.f1 ORDER BY t1.f1; +SELECT t1.f1, t2.f1, t3.f1 FROM t1 INNER JOIN t2 ON t1.f1 = t2.f1 INNER JOIN t3 ON t2.f1 = t3.f1 ORDER BY t1.f1; +echo SELECT * FROM t1 INNER JOIN t2 ON t1.f1 = t2.f1 ORDER BY t1.f1,t2.f1; +SELECT * FROM t1 INNER JOIN t2 ON t1.f1 = t2.f1 ORDER BY t1.f1,t2.f1; +echo SELECT t1.f1, t3.f1, t2.f1 FROM t1 INNER JOIN t2 ON t1.f1 = t2.f1 INNER JOIN t3 ON t3.f1 = t1.f1 ORDER BY t1.f1,t3.f1,t2.f1; +SELECT t1.f1, t3.f1, t2.f1 FROM t1 INNER JOIN t2 ON t1.f1 = t2.f1 INNER JOIN t3 ON t3.f1 = t1.f1 ORDER BY t1.f1,t3.f1,t2.f1; +echo SELECT t1.f1, t3.f1, t2.f1 FROM t1 INNER JOIN t2 ON t1.f1 = t2.f1 INNER JOIN t3 ON t3.f1 = t1.f1 ORDER BY t1.f1 DESC,t3.f1 DESC,t2.f1 DESC; +SELECT t1.f1, t3.f1, t2.f1 FROM t1 INNER JOIN t2 ON t1.f1 = t2.f1 INNER JOIN t3 ON t3.f1 = t1.f1 ORDER BY t1.f1 DESC,t3.f1 DESC,t2.f1 DESC; +echo SELECT t1.f1, t2.f1, t1.f4, t2.f4 FROM t1 INNER JOIN t2 ON t1.f1 < 2 OR t1.f3 < 2.5 ORDER BY t1.f4, t2.f4; +SELECT t1.f1, t2.f1, t1.f4, t2.f4 FROM t1 INNER JOIN t2 ON t1.f1 < 2 OR t1.f3 < 2.5 ORDER BY t1.f4, t2.f4; +echo SELECT t1.f1, t2.f1, t1.f4, t2.f4 FROM t1 INNER JOIN t2 ON t1.f1 < 2 OR t1.f3 < 2.5 ORDER BY t1.f1, t1.f4 DESC ; +SELECT t1.f1, t2.f1, t1.f4, t2.f4 FROM t1 INNER JOIN t2 ON t1.f1 < 2 OR t1.f3 < 2.5 ORDER BY t1.f1, t1.f4 DESC ; +echo SELECT t1.f1, t2.f4, t2.f1 FROM t1 INNER JOIN t2 ON t1.f1 < 2 OR t2.f1 < 2 ORDER BY t1.f1, t2.f4 ; +SELECT t1.f1, t2.f4, t2.f1 FROM t1 INNER JOIN t2 ON t1.f1 < 2 OR t2.f1 < 2 ORDER BY t1.f1, t2.f4 ; +echo SELECT t1.f1, t2.f4, t2.f1 FROM t1 INNER JOIN t2 ON t1.f1 < 2 OR t2.f1 < 2 ORDER BY t1.f1 DESC, t2.f4 ; +SELECT t1.f1, t2.f4, t2.f1 FROM t1 INNER JOIN t2 ON t1.f1 < 2 OR t2.f1 < 2 ORDER BY t1.f1 DESC, t2.f4 ; diff --git a/test/sql/Order/order_inner_left.sql b/test/sql/Order/order_inner_left.sql new file mode 100644 index 00000000..31692898 --- /dev/null +++ b/test/sql/Order/order_inner_left.sql @@ -0,0 +1,6 @@ +echo SELECT t1.f1, t2.f1, SUM(t1.f3) FROM t1 INNER JOIN t2 ON t1.f1=t2.f1 AND t1.f1 IN(1,2,4,5,6) AND t2.f1 BETWEEN 2 AND 6 LEFT JOIN t3 ON t2.f1 != 5 WHERE t1.f1 <= t2.f1 OR t2.f2 >=2 AND (t2.f3 LIKE 'A%' OR t2.f3 LIKE 'B%' OR t2.f3 LIKE 'Q%') GROUP BY t1.f1, t2.f1 HAVING SUM(t1.f3) >1 ORDER BY t1.f1; +SELECT t1.f1, t2.f1, SUM(t1.f3) FROM t1 INNER JOIN t2 ON t1.f1=t2.f1 AND t1.f1 IN(1,2,4,5,6) AND t2.f1 BETWEEN 2 AND 6 LEFT JOIN t3 ON t2.f1 != 5 WHERE t1.f1 <= t2.f1 OR t2.f2 >=2 AND (t2.f3 LIKE 'A%' OR t2.f3 LIKE 'B%' OR t2.f3 LIKE 'Q%') GROUP BY t1.f1, t2.f1 HAVING SUM(t1.f3) >1 ORDER BY t1.f1; +echo SELECT t1.f1, t2.f1, t3.f1, SUM(t1.f3) FROM t1 INNER JOIN t2 ON t1.f1=t2.f1 AND t1.f1 IN(1,2,4,5,6) OR t2.f1 BETWEEN 2 AND 6 LEFT JOIN t3 ON t2.f1 != 5 WHERE t1.f1 <= t2.f1 OR t2.f2 >=2 OR t2.f3 LIKE 'A%' OR t2.f3 LIKE 'B%' OR t2.f3 LIKE 'Q%' GROUP BY t1.f1, t2.f1, t3.f1 HAVING SUM(t1.f3) >1 ORDER BY t1.f1; +SELECT t1.f1, t2.f1, t3.f1, SUM(t1.f3) FROM t1 INNER JOIN t2 ON t1.f1=t2.f1 AND t1.f1 IN(1,2,4,5,6) OR t2.f1 BETWEEN 2 AND 6 LEFT JOIN t3 ON t2.f1 != 5 WHERE t1.f1 <= t2.f1 OR t2.f2 >=2 OR t2.f3 LIKE 'A%' OR t2.f3 LIKE 'B%' OR t2.f3 LIKE 'Q%' GROUP BY t1.f1, t2.f1, t3.f1 HAVING SUM(t1.f3) >1 ORDER BY t1.f1; +echo SELECT t1.f1, t2.f1, t3.f1, SUM(t1.f3) FROM t1 INNER JOIN t2 ON t1.f1=t2.f1 AND t1.f1 IN(1,2,4,5,6) AND t2.f1 BETWEEN 2 AND 6 LEFT JOIN t3 ON t2.f1 != 5 WHERE t1.f1 <= t2.f1 OR t2.f2 >=2 AND (t2.f3 LIKE 'A%' OR t2.f3 LIKE 'B%' OR t2.f3 LIKE 'Q%') GROUP BY t1.f1, t2.f1, t3.f1 HAVING SUM(t1.f3) >1 ORDER BY t1.f1; +SELECT t1.f1, t2.f1, t3.f1, SUM(t1.f3) FROM t1 INNER JOIN t2 ON t1.f1=t2.f1 AND t1.f1 IN(1,2,4,5,6) AND t2.f1 BETWEEN 2 AND 6 LEFT JOIN t3 ON t2.f1 != 5 WHERE t1.f1 <= t2.f1 OR t2.f2 >=2 AND (t2.f3 LIKE 'A%' OR t2.f3 LIKE 'B%' OR t2.f3 LIKE 'Q%') GROUP BY t1.f1, t2.f1, t3.f1 HAVING SUM(t1.f3) >1 ORDER BY t1.f1; diff --git a/test/sql/Order/order_join.sql b/test/sql/Order/order_join.sql new file mode 100644 index 00000000..c686c4c2 --- /dev/null +++ b/test/sql/Order/order_join.sql @@ -0,0 +1,18 @@ +echo SELECT * FROM t1,t2 WHERE t1.f1 = t2.f1 ORDER BY t1.f1; +SELECT * FROM t1,t2 WHERE t1.f1 = t2.f1 ORDER BY t1.f1; +echo SELECT t1.f1, t2.f1, t3.f1 FROM t1,t2,t3 WHERE t1.f1 = t2.f1 and t2.f1 = t3.f1 ORDER BY t1.f1; +SELECT t1.f1, t2.f1, t3.f1 FROM t1,t2,t3 WHERE t1.f1 = t2.f1 and t2.f1 = t3.f1 ORDER BY t1.f1; +echo SELECT * FROM t1,t2 WHERE t1.f1 = t2.f1 ORDER BY t1.f1,t2.f1; +SELECT * FROM t1,t2 WHERE t1.f1 = t2.f1 ORDER BY t1.f1,t2.f1; +echo SELECT t1.f1, t3.f1, t2.f1 FROM t1,t2,t3 WHERE t1.f1 = t2.f1 and t3.f1 = t1.f1 ORDER BY t1.f1,t3.f1,t2.f1; +SELECT t1.f1, t3.f1, t2.f1 FROM t1,t2,t3 WHERE t1.f1 = t2.f1 and t3.f1 = t1.f1 ORDER BY t1.f1,t3.f1,t2.f1; +echo SELECT t1.f1, t3.f1, t2.f1 FROM t1,t2,t3 WHERE t1.f1 = t2.f1 and t3.f1 = t1.f1 ORDER BY t1.f1 DESC,t3.f1 DESC,t2.f1 DESC; +SELECT t1.f1, t3.f1, t2.f1 FROM t1,t2,t3 WHERE t1.f1 = t2.f1 and t3.f1 = t1.f1 ORDER BY t1.f1 DESC,t3.f1 DESC,t2.f1 DESC; +echo SELECT t1.f1, t2.f1, t1.f4, t2.f4 FROM t1,t2 WHERE t1.f1 < 2 OR t1.f3 < 2.5 ORDER BY t1.f4, t2.f4; +SELECT t1.f1, t2.f1, t1.f4, t2.f4 FROM t1,t2 WHERE t1.f1 < 2 OR t1.f3 < 2.5 ORDER BY t1.f4, t2.f4; +echo SELECT t1.f1, t2.f1, t1.f4, t2.f4 FROM t1,t2 WHERE t1.f1 < 2 OR t1.f3 < 2.5 ORDER BY t1.f1, t1.f4 DESC ; +SELECT t1.f1, t2.f1, t1.f4, t2.f4 FROM t1,t2 WHERE t1.f1 < 2 OR t1.f3 < 2.5 ORDER BY t1.f1, t1.f4 DESC ; +echo SELECT t1.f1, t2.f4, t2.f1 FROM t1,t2 WHERE t1.f1 < 2 OR t2.f1 < 2 ORDER BY t1.f1, t2.f4 ; +SELECT t1.f1, t2.f4, t2.f1 FROM t1,t2 WHERE t1.f1 < 2 OR t2.f1 < 2 ORDER BY t1.f1, t2.f4 ; +echo SELECT t1.f1, t2.f4, t2.f1 FROM t1,t2 WHERE t1.f1 < 2 OR t2.f1 < 2 ORDER BY t1.f1 DESC, t2.f4 ; +SELECT t1.f1, t2.f4, t2.f1 FROM t1,t2 WHERE t1.f1 < 2 OR t2.f1 < 2 ORDER BY t1.f1 DESC, t2.f4 ; diff --git a/test/sql/Order/order_left.sql b/test/sql/Order/order_left.sql new file mode 100644 index 00000000..77ff6c60 --- /dev/null +++ b/test/sql/Order/order_left.sql @@ -0,0 +1,18 @@ +echo SELECT * FROM t1 LEFT JOIN t2 ON t1.f1 = t2.f1 ORDER BY t1.f1; +SELECT * FROM t1 LEFT JOIN t2 ON t1.f1 = t2.f1 ORDER BY t1.f1; +echo SELECT t1.f1, t2.f1, t3.f1 FROM t1 LEFT JOIN t2 ON t1.f1 = t2.f1 LEFT JOIN t3 ON t2.f1 = t3.f1 ORDER BY t1.f1; +SELECT t1.f1, t2.f1, t3.f1 FROM t1 LEFT JOIN t2 ON t1.f1 = t2.f1 LEFT JOIN t3 ON t2.f1 = t3.f1 ORDER BY t1.f1; +echo SELECT * FROM t1 LEFT JOIN t2 ON t1.f1 = t2.f1 ORDER BY t1.f1,t2.f1; +SELECT * FROM t1 LEFT JOIN t2 ON t1.f1 = t2.f1 ORDER BY t1.f1,t2.f1; +echo SELECT t1.f1, t3.f1, t2.f1 FROM t1 LEFT JOIN t2 ON t1.f1 = t2.f1 LEFT JOIN t3 ON t3.f1 = t1.f1 ORDER BY t1.f1,t3.f1,t2.f1; +SELECT t1.f1, t3.f1, t2.f1 FROM t1 LEFT JOIN t2 ON t1.f1 = t2.f1 LEFT JOIN t3 ON t3.f1 = t1.f1 ORDER BY t1.f1,t3.f1,t2.f1; +echo SELECT t1.f1, t3.f1, t2.f1 FROM t1 LEFT JOIN t2 ON t1.f1 = t2.f1 LEFT JOIN t3 ON t3.f1 = t1.f1 ORDER BY t1.f1 DESC,t3.f1 DESC,t2.f1 DESC; +SELECT t1.f1, t3.f1, t2.f1 FROM t1 LEFT JOIN t2 ON t1.f1 = t2.f1 LEFT JOIN t3 ON t3.f1 = t1.f1 ORDER BY t1.f1 DESC,t3.f1 DESC,t2.f1 DESC; +echo SELECT t1.f1, t2.f1, t1.f4, t2.f4 FROM t1 LEFT JOIN t2 ON t1.f1 < 2 OR t1.f3 < 2.5 ORDER BY t1.f4, t2.f4; +SELECT t1.f1, t2.f1, t1.f4, t2.f4 FROM t1 LEFT JOIN t2 ON t1.f1 < 2 OR t1.f3 < 2.5 ORDER BY t1.f4, t2.f4; +echo SELECT t1.f1, t2.f1, t1.f4, t2.f4 FROM t1 LEFT JOIN t2 ON t1.f1 < 2 OR t1.f3 < 2.5 ORDER BY t1.f1, t1.f4 DESC ; +SELECT t1.f1, t2.f1, t1.f4, t2.f4 FROM t1 LEFT JOIN t2 ON t1.f1 < 2 OR t1.f3 < 2.5 ORDER BY t1.f1, t1.f4 DESC ; +echo SELECT t1.f1, t2.f4, t2.f1 FROM t1 LEFT JOIN t2 ON t1.f1 < 2 OR t2.f1 < 2 ORDER BY t1.f1, t2.f4 ; +SELECT t1.f1, t2.f4, t2.f1 FROM t1 LEFT JOIN t2 ON t1.f1 < 2 OR t2.f1 < 2 ORDER BY t1.f1, t2.f4 ; +echo SELECT t1.f1, t2.f4, t2.f1 FROM t1 LEFT JOIN t2 ON t1.f1 < 2 OR t2.f1 < 2 ORDER BY t1.f1 DESC, t2.f4 ; +SELECT t1.f1, t2.f4, t2.f1 FROM t1 LEFT JOIN t2 ON t1.f1 < 2 OR t2.f1 < 2 ORDER BY t1.f1 DESC, t2.f4 ; diff --git a/test/sql/Order/order_self.sql b/test/sql/Order/order_self.sql new file mode 100644 index 00000000..0286f1c8 --- /dev/null +++ b/test/sql/Order/order_self.sql @@ -0,0 +1,24 @@ +echo SELECT a.empid, a.ename, b.ename FROM emp as a, emp as b WHERE a.empid=b.mgrno; +SELECT a.empid, a.ename, b.ename FROM emp as a, emp as b WHERE a.empid=b.mgrno; +echo SELECT a.empid, a.ename, b.ename FROM emp as a, emp as b WHERE a.empid=b.mgrno ORDER BY a.empid; +SELECT a.empid, a.ename, b.ename FROM emp as a, emp as b WHERE a.empid=b.mgrno ORDER BY a.empid; +echo SELECT a.empid, a.ename, b.ename FROM emp as a, emp as b WHERE a.empid=b.mgrno ORDER BY a.empid, b.ename DESC; +SELECT a.empid, a.ename, b.ename FROM emp as a, emp as b WHERE a.empid=b.mgrno ORDER BY a.empid, b.ename DESC; +echo SELECT a.ename, b.ename FROM emp as a, emp as b WHERE a.ename=b.mgrname; +SELECT a.ename, b.ename FROM emp as a, emp as b WHERE a.ename=b.mgrname; +echo SELECT a.ename, b.ename FROM emp as a, emp as b WHERE a.ename=b.mgrname ORDER BY a.ename; +SELECT a.ename, b.ename FROM emp as a, emp as b WHERE a.ename=b.mgrname ORDER BY a.ename; +echo SELECT a.ename, b.ename FROM emp as a, emp as b WHERE a.ename=b.mgrname ORDER BY a.ename, b.empid DESC; +SELECT a.ename, b.ename FROM emp as a, emp as b WHERE a.ename=b.mgrname ORDER BY a.ename, b.empid DESC; +echo SELECT a.ename, b.ename, a.basic FROM emp as a, emp as b WHERE a.basic=b.allowances; +SELECT a.ename, b.ename, a.basic FROM emp as a, emp as b WHERE a.basic=b.allowances; +echo SELECT a.ename, b.ename, a.basic FROM emp as a, emp as b WHERE a.basic=b.allowances ORDER BY a.basic; +SELECT a.ename, b.ename, a.basic FROM emp as a, emp as b WHERE a.basic=b.allowances ORDER BY a.basic; +echo SELECT a.ename, b.ename, a.basic FROM emp as a, emp as b WHERE a.basic=b.allowances ORDER BY a.basic DESC, b.ename DESC; +SELECT a.ename, b.ename, a.basic FROM emp as a, emp as b WHERE a.basic=b.allowances ORDER BY a.basic DESC, b.ename DESC; +echo SELECT a.ename, b.ename, b.mgr_date FROM emp as a, emp as b WHERE a.mgr_date=b.join_date; +SELECT a.ename, b.ename, b.mgr_date FROM emp as a, emp as b WHERE a.mgr_date=b.join_date; +echo SELECT a.ename, b.ename, a.mgr_date FROM emp as a, emp as b WHERE a.mgr_date=b.join_date ORDER BY a.mgr_date; +SELECT a.ename, b.ename, a.mgr_date FROM emp as a, emp as b WHERE a.mgr_date=b.join_date ORDER BY a.mgr_date; +echo SELECT a.ename, b.ename, a.join_date, b.join_date, a.basic, b.basic, a.empid, b.empid FROM emp as a, emp as b WHERE a.mgr_date=b.join_date ORDER BY a.mgr_date DESC; +SELECT a.ename, b.ename, a.join_date, b.join_date, a.basic, b.basic, a.empid, b.empid FROM emp as a, emp as b WHERE a.mgr_date=b.join_date ORDER BY a.mgr_date DESC; diff --git a/test/sql/Order/order_single_multiple.sql b/test/sql/Order/order_single_multiple.sql new file mode 100644 index 00000000..8e428ad3 --- /dev/null +++ b/test/sql/Order/order_single_multiple.sql @@ -0,0 +1,16 @@ +echo SELECT * FROM t1 WHERE f1 <= 4 ORDER BY f1; +SELECT * FROM t1 WHERE f1 <= 4 ORDER BY f1; +echo SELECT * FROM t1 WHERE f1 <= 4 ORDER BY f1 DESC; +SELECT * FROM t1 WHERE f1 <= 4 ORDER BY f1 DESC; +echo SELECT f1, t1.f2, f4 FROM t1 WHERE t1.f1 <= 4 OR t1.f3 <= 4.5 ORDER BY t1.f1, f4; +SELECT f1, t1.f2, f4 FROM t1 WHERE t1.f1 <= 4 OR t1.f3 <= 4.5 ORDER BY t1.f1, f4; +echo SELECT f1, f2, t1.f4 FROM t1 WHERE t1.f1 <= 4 OR t1.f3 <= 4.5 ORDER BY f1, t1.f4 DESC; +SELECT f1, f2, t1.f4 FROM t1 WHERE t1.f1 <= 4 OR t1.f3 <= 4.5 ORDER BY f1, t1.f4 DESC; +echo SELECT f1, f2, t1.f4 FROM t1 WHERE t1.f1 <= 4 OR t1.f3 <= 4.5 ORDER BY f1 DESC, t1.f4 DESC; +SELECT f1, f2, t1.f4 FROM t1 WHERE t1.f1 <= 4 OR t1.f3 <= 4.5 ORDER BY f1 DESC, t1.f4 DESC; +echo SELECT f1, t1.f4, f2 FROM t1 WHERE t1.f1 <= 4 OR t1.f3 <= 4.5 ORDER BY t1.f1, f4, t1.f2; +SELECT f1, t1.f4, f2 FROM t1 WHERE t1.f1 <= 4 OR t1.f3 <= 4.5 ORDER BY t1.f1, f4, t1.f2; +echo SELECT t1.f1, f4, t1.f2 FROM t1 WHERE t1.f1 <= 4 OR t1.f3 <= 4.5 ORDER BY f1, t1.f4, f2 DESC; +SELECT t1.f1, f4, t1.f2 FROM t1 WHERE t1.f1 <= 4 OR t1.f3 <= 4.5 ORDER BY f1, t1.f4, f2 DESC; +echo SELECT t1.f1, f4, t1.f2 FROM t1 WHERE t1.f1 <= 4 OR t1.f3 <= 4.5 ORDER BY f1 DESC, t1.f4 DESC, f2 DESC; +SELECT t1.f1, f4, t1.f2 FROM t1 WHERE t1.f1 <= 4 OR t1.f3 <= 4.5 ORDER BY f1 DESC, t1.f4 DESC, f2 DESC; diff --git a/test/sql/Order/table_self.sql b/test/sql/Order/table_self.sql new file mode 100644 index 00000000..5d3a4f9d --- /dev/null +++ b/test/sql/Order/table_self.sql @@ -0,0 +1,10 @@ +CREATE TABLE emp(empid INT, ename CHAR(15), basic DOUBLE, join_date TIMESTAMP, mgrno INT, mgrname CHAR(15), allowances DOUBLE, mgr_date TIMESTAMP); +INSERT INTO emp VALUES(7, 'SUMAN', 7500, '2007-02-02 01:01:01', 7, 'SUMAN', 7500, '2007-02-02 01:01:01'); +INSERT INTO emp VALUES(1, 'JAMES', 7000, '2007-02-02 01:01:01', 3, 'PITER', 8000, '2007-02-03 01:01:01'); +INSERT INTO emp VALUES(4, 'HARRY', 8500, '2007-02-06 01:01:01', 3, 'PITER', 8000, '2007-02-03 01:01:01'); +INSERT INTO emp VALUES(2, 'LALIT', 7500, '2007-02-01 01:01:01', 1, 'JAMES', 7000, '2007-02-02 01:01:01'); +INSERT INTO emp VALUES(3, 'PITER', 8000, '2007-02-03 01:01:01', 2, 'LALIT', 7500, '2007-02-01 01:01:01'); +INSERT INTO emp VALUES(5, 'MAHES', 6500, '2007-02-04 01:01:01', 4, 'HARRY', 8500, '2007-02-06 01:01:01'); +INSERT INTO emp VALUES(8, 'LATIF', 7000, '2007-02-01 01:01:01', 3, 'PITER', 8000, '2007-02-03 01:01:01'); +INSERT INTO emp VALUES(6, 'RAMAN', 6000, '2007-02-05 01:01:01', 4, 'HARRY', 8500, '2007-02-06 01:01:01'); +SELECT * FROM emp; diff --git a/test/sql/Order/table_t1.sql b/test/sql/Order/table_t1.sql new file mode 100644 index 00000000..4ec9674b --- /dev/null +++ b/test/sql/Order/table_t1.sql @@ -0,0 +1,15 @@ +CREATE TABLE t1(f1 int, f2 CHAR(10), f3 FLOAT, f4 DATE); +INSERT INTO t1 VALUES(3, 'AAA', 2.5, '2008-07-01'); +INSERT INTO t1 VALUES(2, 'AAA', 2.5, '2008-07-02'); +INSERT INTO t1 VALUES(4, 'GGG', 4.5, '2008-07-03'); +INSERT INTO t1 VALUES(1, 'DEF', 1.5, '2008-07-01'); +INSERT INTO t1 VALUES(6, 'CCC', 6.5, '2008-07-02'); +INSERT INTO t1 VALUES(5, 'HHH', 5.5, '2008-07-03'); +INSERT INTO t1 VALUES(2, 'AAA', 2.5, '2008-07-01'); +INSERT INTO t1 VALUES(6, 'CCC', 6.5, '2008-07-04'); +INSERT INTO t1 VALUES(3, 'ABB', 2.6, '2008-07-05'); +INSERT INTO t1 VALUES(2, 'BBB', 1.6, '2008-07-04'); +INSERT INTO t1 VALUES(1, 'DDD', 1.6, '2008-07-01'); + +echo SELECT * FROM t1; +SELECT * FROM t1; diff --git a/test/sql/Order/table_t1_t2_t3.sql b/test/sql/Order/table_t1_t2_t3.sql new file mode 100644 index 00000000..35f64ae1 --- /dev/null +++ b/test/sql/Order/table_t1_t2_t3.sql @@ -0,0 +1,46 @@ +CREATE TABLE t1(f1 int, f2 CHAR(10), f3 FLOAT, f4 DATE); +INSERT INTO t1 VALUES(3, 'AAA', 2.5, '2008-07-01'); +INSERT INTO t1 VALUES(2, 'AAA', 2.5, '2008-07-02'); +INSERT INTO t1 VALUES(4, 'GGG', 4.5, '2008-07-03'); +INSERT INTO t1 VALUES(1, 'DEF', 1.5, '2008-07-01'); +INSERT INTO t1 VALUES(6, 'CCC', 6.5, '2008-07-02'); +INSERT INTO t1 VALUES(5, 'HHH', 5.5, '2008-07-03'); +INSERT INTO t1 VALUES(2, 'AAA', 2.5, '2008-07-01'); +INSERT INTO t1 VALUES(6, 'CCC', 6.5, '2008-07-04'); +INSERT INTO t1 VALUES(3, 'ABB', 2.6, '2008-07-05'); +INSERT INTO t1 VALUES(2, 'BBB', 1.6, '2008-07-04'); +INSERT INTO t1 VALUES(1, 'DDD', 1.6, '2008-07-01'); + +CREATE TABLE t2(f1 int, f2 CHAR(10), f3 FLOAT, f4 DATE); +INSERT INTO t2 VALUES(1, 'DEF', 1.5, '2008-07-01'); +INSERT INTO t2 VALUES(9, 'QQQ', 9.5, '2008-07-02'); +INSERT INTO t2 VALUES(3, 'MMM', 2.5, '2008-07-03'); +INSERT INTO t2 VALUES(4, 'GGG', 4.6, '2008-07-01'); +INSERT INTO t2 VALUES(7, 'PPP', 7.5, '2008-07-02'); +INSERT INTO t2 VALUES(8, 'NNN', 8.5, '2008-07-03'); +INSERT INTO t2 VALUES(9, 'QQQ', 9.5, '2008-07-01'); +INSERT INTO t2 VALUES(8, 'AAA', 8.5, '2008-07-04'); +INSERT INTO t2 VALUES(7, 'AAA', 7.5, '2008-07-05'); +INSERT INTO t2 VALUES(9, 'BBB', 9.8, '2008-07-04'); +INSERT INTO t2 VALUES(8, 'EEE', 8.8, '2008-07-01'); + +CREATE TABLE t3(f1 int, f2 CHAR(10), f3 FLOAT, f4 DATE); +INSERT INTO t3 VALUES(1, 'DEF', 1.5, '2008-07-01'); +INSERT INTO t3 VALUES(2, 'AAA', 2.5, '2008-07-02'); +INSERT INTO t3 VALUES(7, 'PPP', 7.5, '2008-07-03'); +INSERT INTO t3 VALUES(8, 'NNN', 8.5, '2008-07-04'); +INSERT INTO t3 VALUES(9, 'QQQ', 9.5, '2008-07-01'); +INSERT INTO t3 VALUES(10,'NNN',10.5, '2008-07-02'); +INSERT INTO t3 VALUES(1, 'DEF', 1.5, '2008-07-03'); +INSERT INTO t3 VALUES(2, 'AAA', 2.5, '2008-07-04'); +INSERT INTO t3 VALUES(7, 'PPP', 7.5, '2008-07-01'); +INSERT INTO t3 VALUES(8, 'NNN', 8.5, '2008-07-02'); +INSERT INTO t3 VALUES(10,'NNN',10.5, '2008-07-04'); + +echo SELECT * FROM t1; +SELECT * FROM t1; +echo SELECT * FROM t2; +SELECT * FROM t2; +echo SELECT * FROM t3; +SELECT * FROM t3; + diff --git a/test/sql/Order/test001.ksh b/test/sql/Order/test001.ksh new file mode 100755 index 00000000..4fdc8a0e --- /dev/null +++ b/test/sql/Order/test001.ksh @@ -0,0 +1,24 @@ +#!/bin/ksh +# Testing ORDER BY Clause +# +CREATEFILE=${PWD}/sql/Order/dropt1.sql +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Order +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/order1.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Order/test002.ksh b/test/sql/Order/test002.ksh new file mode 100755 index 00000000..9cde151c --- /dev/null +++ b/test/sql/Order/test002.ksh @@ -0,0 +1,24 @@ +#!/bin/ksh +# Test order by on left joined tables. +# +CREATEFILE=${PWD}/sql/Order/drop_Articles_Authors_AuthorArticle.sql +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Order +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/leftjoin2.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_Articles_Authors_AuthorArticle.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_Articles_Authors_AuthorArticle.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +exit 0; diff --git a/test/sql/Order/test003.ksh b/test/sql/Order/test003.ksh new file mode 100755 index 00000000..bcaefd3f --- /dev/null +++ b/test/sql/Order/test003.ksh @@ -0,0 +1,32 @@ +#!/bin/ksh +# Test order by on all datatypes +# Test order by on group of fields on all datatypes. +# +CREATEFILE=${PWD}/sql/Order/drop_Articles_Authors_AuthorArticle.sql +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Order +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/alldatatype.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/order_alldatatypes.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Order/test004.ksh b/test/sql/Order/test004.ksh new file mode 100755 index 00000000..d050fb66 --- /dev/null +++ b/test/sql/Order/test004.ksh @@ -0,0 +1,32 @@ +#!/bin/ksh +# Test order by in descending order on all datatypes +# Test order by in descending order on group of fields on all datatypes. +# +CREATEFILE=${PWD}/sql/Order/drop_Articles_Authors_AuthorArticle.sql +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Order +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/alldatatype.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/order_desc_alldatatypes.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Order/test005.ksh b/test/sql/Order/test005.ksh new file mode 100755 index 00000000..dc842b70 --- /dev/null +++ b/test/sql/Order/test005.ksh @@ -0,0 +1,33 @@ +#!/bin/ksh +# Testing Field Format for both Projection list and order by list. +# Order by and in ascending order on single table with where clause +# Order by and in descending order on single table with where clause +# +CREATEFILE=${PWD}/sql/Order/drop_Articles_Authors_AuthorArticle.sql +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Order +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/table_t1.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/order_single_multiple.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Order/test006.ksh b/test/sql/Order/test006.ksh new file mode 100755 index 00000000..93fb0ae8 --- /dev/null +++ b/test/sql/Order/test006.ksh @@ -0,0 +1,31 @@ +#!/bin/ksh +# Testing Order by on Group by and having. +# +CREATEFILE=${PWD}/sql/Order/dropt1.sql +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Order +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/table_t1.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/order_group.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Order/test007.ksh b/test/sql/Order/test007.ksh new file mode 100755 index 00000000..0e6954ef --- /dev/null +++ b/test/sql/Order/test007.ksh @@ -0,0 +1,31 @@ +#!/bin/ksh +# Testing Order by on joining multiple tables. +# +CREATEFILE=${PWD}/sql/Order/dropt1.sql +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Order +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/table_t1_t2_t3.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/order_join.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Order/test008.ksh b/test/sql/Order/test008.ksh new file mode 100755 index 00000000..5ff805c6 --- /dev/null +++ b/test/sql/Order/test008.ksh @@ -0,0 +1,31 @@ +#!/bin/ksh +# Testing Order by applying INNER JOIN on multiple tables. +# +CREATEFILE=${PWD}/sql/Order/dropt1.sql +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Order +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/table_t1_t2_t3.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/order_inner.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Order/test009.ksh b/test/sql/Order/test009.ksh new file mode 100755 index 00000000..4907ced5 --- /dev/null +++ b/test/sql/Order/test009.ksh @@ -0,0 +1,31 @@ +#!/bin/ksh +# Testing Order by applying LEFT JOIN on multiple tables. +# +CREATEFILE=${PWD}/sql/Order/dropt1.sql +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Order +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/table_t1_t2_t3.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/order_left.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Order/test010.ksh b/test/sql/Order/test010.ksh new file mode 100755 index 00000000..1afc97c4 --- /dev/null +++ b/test/sql/Order/test010.ksh @@ -0,0 +1,31 @@ +#!/bin/ksh +# Testing Order by on SELF JOINed table. +# +CREATEFILE=${PWD}/sql/Order/dropemp.sql +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Order +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/table_self.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropemp.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/order_self.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropemp.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropemp.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Order/test011.ksh b/test/sql/Order/test011.ksh new file mode 100755 index 00000000..a77e1bc7 --- /dev/null +++ b/test/sql/Order/test011.ksh @@ -0,0 +1,32 @@ +#!/bin/ksh +# Testing Order by applying INNER JOIN and LEFT JOIN on multiple tables . +# This script is also for testing all the keywords supported for select query. +# +CREATEFILE=${PWD}/sql/Order/dropt1.sql +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Order +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/table_t1_t2_t3.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/order_inner_left.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/OuterJoin/alldatatype.sql b/test/sql/OuterJoin/alldatatype.sql new file mode 100644 index 00000000..c18024b7 --- /dev/null +++ b/test/sql/OuterJoin/alldatatype.sql @@ -0,0 +1,24 @@ +create table t1(f1 smallint,f2 int,f3 bigint,f4 char(10),f5 float,f6 double,f7 date,f8 time,f9 timestamp); +insert into t1 values(10,100 ,1000, 'Bijay',1000,100000,'2009-03-01','11:59:59','2009-03-01 11:59:59'); +insert into t1 values(11,110 ,1100, 'Jitendr',2000,200000,'2009-03-02','11:59:58','2009-03-02 11:59:59'); +insert into t1 values(12,120 ,1000, 'Nihar',3000,300000,'2009-03-03','11:59:57','2009-03-03 11:59:59'); +insert into t1 values(13,130 ,1500, 'Kishor',4000,400000,'2009-03-04','11:59:59','2009-03-04 11:59:59'); +insert into t1 values(14,100 ,1000, 'Praba',5000,500000,'2009-03-01','11:59:58','2009-03-01 11:59:59'); +create table t2(f1 smallint,f2 int,f3 bigint,f4 char(10),f5 float,f6 double,f7 date,f8 time,f9 timestamp); +insert into t2 values(13,110 ,1100, 'Sanjit',6000,600000,'2009-03-02','11:59:57','2009-03-02 11:59:59'); +insert into t2 values(16,120 ,1000, 'Sanjay',6500,700000,'2009-03-03','11:59:59','2009-03-03 11:59:59'); +insert into t2 values(17,130 ,1100, 'Arindam',8000,800000,'2009-03-04','11:59:58','2009-03-04 11:59:59'); +insert into t2 values(10,100 ,1000, 'Bijay',9000,900000,'2009-03-01','11:59:57','2009-03-01 11:59:59'); +insert into t2 values(11,110 ,1100, 'Jitendr',1000,100000,'2009-03-02','11:59:58','2009-03-02 11:59:59'); +create table t3(f1 smallint,f2 int,f3 bigint,f4 char(10),f5 float,f6 double,f7 date,f8 time,f9 timestamp); +insert into t3 values(12,120 ,1000, 'Nihar',2000,200000,'2009-03-03','11:59:56','2009-03-03 11:59:59'); +insert into t3 values(13,130 ,1100, 'Kishor',3000,300000,'2009-03-05','11:59:56','2009-03-05 11:59:59'); +insert into t3 values(14,100 ,1000, 'Praba',4000,400000,'2009-03-01','11:59:55','2009-03-04 11:59:59'); +insert into t3 values(15,110 ,1100, 'Sanjit',5000,500000,'2009-03-02','11:59:56','2009-03-01 11:59:59'); +insert into t3 values(16,120 ,1000, 'Sanjay',6000,600000,'2009-03-03','11:59:55','2009-03-03 11:59:59'); +echo select * from t1; +select * from t1; +echo select * from t2; +select * from t2; +echo select * from t3; +select * from t3; diff --git a/test/sql/OuterJoin/drop_Articles_Authors_AuthorArticle.sql b/test/sql/OuterJoin/drop_Articles_Authors_AuthorArticle.sql new file mode 100644 index 00000000..40550010 --- /dev/null +++ b/test/sql/OuterJoin/drop_Articles_Authors_AuthorArticle.sql @@ -0,0 +1,6 @@ +echo DROP table AuthorArticle; +DROP table AuthorArticle; +echo DROP table Authors; +DROP table Authors; +echo DROP table Articles; +DROP table Articles; diff --git a/test/sql/OuterJoin/drop_t1_t2_t3.sql b/test/sql/OuterJoin/drop_t1_t2_t3.sql new file mode 100644 index 00000000..562cf995 --- /dev/null +++ b/test/sql/OuterJoin/drop_t1_t2_t3.sql @@ -0,0 +1,3 @@ +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; diff --git a/test/sql/OuterJoin/dropt1t2.sql b/test/sql/OuterJoin/dropt1t2.sql new file mode 100644 index 00000000..436e4f57 --- /dev/null +++ b/test/sql/OuterJoin/dropt1t2.sql @@ -0,0 +1,3 @@ +drop table t1; +drop table t2; + diff --git a/test/sql/OuterJoin/exp.test001.ksh b/test/sql/OuterJoin/exp.test001.ksh new file mode 100644 index 00000000..6756970f --- /dev/null +++ b/test/sql/OuterJoin/exp.test001.ksh @@ -0,0 +1,13 @@ +Statement Executed +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 +--------------------------------------------------------- + 1 1 1 1 + 2 2 NULL NULL + +Statement Executed +Statement Executed diff --git a/test/sql/OuterJoin/exp.test002.ksh b/test/sql/OuterJoin/exp.test002.ksh new file mode 100644 index 00000000..a63a753a --- /dev/null +++ b/test/sql/OuterJoin/exp.test002.ksh @@ -0,0 +1,116 @@ +echo CREATE TABLE Articles ( ArticleID SMALLINT, ArticleTitle CHAR(30) NOT NULL, Copyright INT NOT NULL,PRIMARY KEY(ArticleID)); +Statement Executed +echo INSERT INTO Articles VALUES (12786, 'How write a paper',1934); +Statement Executed: Rows Affected = 1 +echo INSERT INTO Articles VALUES (13331, 'Publish a paper ',1919); +Statement Executed: Rows Affected = 1 +echo INSERT INTO Articles VALUES (14356, 'Sell a paper ',1966); +Statement Executed: Rows Affected = 1 +echo INSERT INTO Articles VALUES (15729, 'Buy a paper ',1932); +Statement Executed: Rows Affected = 1 +echo INSERT INTO Articles VALUES (16284, 'Conferences ',1996); +Statement Executed: Rows Affected = 1 +echo INSERT INTO Articles VALUES (17695, 'Journal ',1980); +Statement Executed: Rows Affected = 1 +echo INSERT INTO Articles VALUES (19264, 'Information ',1992); +Statement Executed: Rows Affected = 1 +echo INSERT INTO Articles VALUES (19354, 'AI ',1993); +Statement Executed: Rows Affected = 1 +echo CREATE TABLE Authors (AuthID SMALLINT, AuthorFirstName CHAR(20), AuthorMiddleName CHAR(20), AuthorLastName CHAR(20),PRIMARY KEY(AuthID)); +Statement Executed +echo INSERT INTO Authors VALUES (1006, 'Henry', 'S.', 'Thompson'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO Authors VALUES(1007, 'Jason', 'Carol', 'Oak'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO Authors VALUES(1008, 'James', NULL, 'Elk'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO Authors VALUES(1009, 'Tom', 'M', 'Ride'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO Authors VALUES(1010, 'Jack', 'K', 'Ken'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO Authors VALUES(1011, 'Mary', 'G.', 'Lee'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO Authors VALUES(1012, 'Annie', NULL, 'Peng'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO Authors VALUES(1013, 'Alan', NULL, 'Wang'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO Authors VALUES(1014, 'Nelson', NULL, 'Yin'); +Statement Executed: Rows Affected = 1 +echo CREATE TABLE AuthorArticle (AuthID SMALLINT NOT NULL, ArticleID SMALLINT NOT NULL,FOREIGN KEY(AuthID) REFERENCES Authors(AuthID), FOREIGN KEY(ArticleID) REFERENCES Articles(ArticleID)); +Statement Executed +echo INSERT INTO AuthorArticle VALUES (1006, 14356); +Statement Executed: Rows Affected = 1 +echo INSERT INTO AuthorArticle VALUES (1008, 15729); +Statement Executed: Rows Affected = 1 +echo INSERT INTO AuthorArticle VALUES (1009, 12786); +Statement Executed: Rows Affected = 1 +echo INSERT INTO AuthorArticle VALUES (1010, 17695); +Statement Executed: Rows Affected = 1 +echo INSERT INTO AuthorArticle VALUES (1011, 15729); +Statement Executed: Rows Affected = 1 +echo INSERT INTO AuthorArticle VALUES (1012, 19264); +Statement Executed: Rows Affected = 1 +echo INSERT INTO AuthorArticle VALUES (1012, 19354); +Statement Executed: Rows Affected = 1 +echo INSERT INTO AuthorArticle VALUES (1014, 16284); +Statement Executed: Rows Affected = 1 +echo SELECT * FROM Articles; +--------------------------------------------------------- + Articles.ArticleID Articles.ArticleTitle Articles.Copyright +--------------------------------------------------------- + 12786 How write a paper 1934 + 13331 Publish a paper 1919 + 14356 Sell a paper 1966 + 15729 Buy a paper 1932 + 16284 Conferences 1996 + 17695 Journal 1980 + 19264 Information 1992 + 19354 AI 1993 + +echo SELECT * FROM Authors; +--------------------------------------------------------- + Authors.AuthID Authors.AuthorFirstName Authors.AuthorMiddleName Authors.AuthorLastName +--------------------------------------------------------- + 1006 Henry S. Thompson + 1007 Jason Carol Oak + 1008 James NULL Elk + 1009 Tom M Ride + 1010 Jack K Ken + 1011 Mary G. Lee + 1012 Annie NULL Peng + 1013 Alan NULL Wang + 1014 Nelson NULL Yin + +echo SELECT * FROM AuthorArticle; +--------------------------------------------------------- + AuthorArticle.AuthID AuthorArticle.ArticleID +--------------------------------------------------------- + 1006 14356 + 1008 15729 + 1009 12786 + 1010 17695 + 1011 15729 + 1012 19264 + 1012 19354 + 1014 16284 + +echo SELECT ArticleTitle, Copyright FROM Articles LEFT JOIN AuthorArticle ON Articles.ArticleID=AuthorArticle.ArticleID LEFT JOIN Authors ON AuthorArticle.AuthID=Authors.AuthID; +--------------------------------------------------------- + ArticleTitle Copyright +--------------------------------------------------------- + How write a paper 1934 + Publish a paper 1919 + Sell a paper 1966 + Buy a paper 1932 + Buy a paper 1932 + Conferences 1996 + Journal 1980 + Information 1992 + AI 1993 + +echo DROP table AuthorArticle; +Statement Executed +echo DROP table Authors; +Statement Executed +echo DROP table Articles; +Statement Executed diff --git a/test/sql/OuterJoin/exp.test003.ksh b/test/sql/OuterJoin/exp.test003.ksh new file mode 100644 index 00000000..bef78855 --- /dev/null +++ b/test/sql/OuterJoin/exp.test003.ksh @@ -0,0 +1,152 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 t1.f5 t1.f6 t1.f7 t1.f8 t1.f9 +--------------------------------------------------------- + 10 100 1000 Bijay 1000.000000 100000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + 11 110 1100 Jitendr 2000.000000 200000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 12 120 1000 Nihar 3000.000000 300000.000000 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 1500 Kishor 4000.000000 400000.000000 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 + 14 100 1000 Praba 5000.000000 500000.000000 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 + +echo select * from t2; +--------------------------------------------------------- + t2.f1 t2.f2 t2.f3 t2.f4 t2.f5 t2.f6 t2.f7 t2.f8 t2.f9 +--------------------------------------------------------- + 13 110 1100 Sanjit 6000.000000 600000.000000 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 + 16 120 1000 Sanjay 6500.000000 700000.000000 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 + 17 130 1100 Arindam 8000.000000 800000.000000 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 + 10 100 1000 Bijay 9000.000000 900000.000000 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 + 11 110 1100 Jitendr 1000.000000 100000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + +echo select * from t3; +--------------------------------------------------------- + t3.f1 t3.f2 t3.f3 t3.f4 t3.f5 t3.f6 t3.f7 t3.f8 t3.f9 +--------------------------------------------------------- + 12 120 1000 Nihar 2000.000000 200000.000000 2009/3/3 11:59:56.0 2009/3/3 11:59:59.0 + 13 130 1100 Kishor 3000.000000 300000.000000 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 + 14 100 1000 Praba 4000.000000 400000.000000 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 + 15 110 1100 Sanjit 5000.000000 500000.000000 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 + 16 120 1000 Sanjay 6000.000000 600000.000000 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 + +echo select t1.f1, t1.f3, t1.f6, t1.f9, t2.f1, t2.f3, t2.f6, t2.f9 from t1 left join t2 on t1.f1 = t2.f1; +--------------------------------------------------------- + t1.f1 t1.f3 t1.f6 t1.f9 t2.f1 t2.f3 t2.f6 t2.f9 +--------------------------------------------------------- + 10 1000 100000.000000 2009/3/1 11:59:59.0 10 1000 900000.000000 2009/3/1 11:59:59.0 + 11 1100 200000.000000 2009/3/2 11:59:59.0 11 1100 100000.000000 2009/3/2 11:59:59.0 + 12 1000 300000.000000 2009/3/3 11:59:59.0 NULL NULL NULL NULL + 13 1500 400000.000000 2009/3/4 11:59:59.0 13 1100 600000.000000 2009/3/2 11:59:59.0 + 14 1000 500000.000000 2009/3/1 11:59:59.0 NULL NULL NULL NULL + +echo select t1.f1, t1.f3, t1.f6, t1.f9, t2.f1, t2.f3, t2.f6, t2.f9 from t1 left join t2 on t1.f2 = t2.f2; +--------------------------------------------------------- + t1.f1 t1.f3 t1.f6 t1.f9 t2.f1 t2.f3 t2.f6 t2.f9 +--------------------------------------------------------- + 10 1000 100000.000000 2009/3/1 11:59:59.0 10 1000 900000.000000 2009/3/1 11:59:59.0 + 11 1100 200000.000000 2009/3/2 11:59:59.0 13 1100 600000.000000 2009/3/2 11:59:59.0 + 11 1100 200000.000000 2009/3/2 11:59:59.0 11 1100 100000.000000 2009/3/2 11:59:59.0 + 12 1000 300000.000000 2009/3/3 11:59:59.0 16 1000 700000.000000 2009/3/3 11:59:59.0 + 13 1500 400000.000000 2009/3/4 11:59:59.0 17 1100 800000.000000 2009/3/4 11:59:59.0 + 14 1000 500000.000000 2009/3/1 11:59:59.0 10 1000 900000.000000 2009/3/1 11:59:59.0 + +echo select t1.f1, t1.f3, t1.f6, t1.f9, t2.f1, t2.f3, t2.f6, t2.f9 from t1 left join t2 on t1.f3 = t2.f3; +--------------------------------------------------------- + t1.f1 t1.f3 t1.f6 t1.f9 t2.f1 t2.f3 t2.f6 t2.f9 +--------------------------------------------------------- + 10 1000 100000.000000 2009/3/1 11:59:59.0 16 1000 700000.000000 2009/3/3 11:59:59.0 + 10 1000 100000.000000 2009/3/1 11:59:59.0 10 1000 900000.000000 2009/3/1 11:59:59.0 + 11 1100 200000.000000 2009/3/2 11:59:59.0 13 1100 600000.000000 2009/3/2 11:59:59.0 + 11 1100 200000.000000 2009/3/2 11:59:59.0 17 1100 800000.000000 2009/3/4 11:59:59.0 + 11 1100 200000.000000 2009/3/2 11:59:59.0 11 1100 100000.000000 2009/3/2 11:59:59.0 + 12 1000 300000.000000 2009/3/3 11:59:59.0 16 1000 700000.000000 2009/3/3 11:59:59.0 + 12 1000 300000.000000 2009/3/3 11:59:59.0 10 1000 900000.000000 2009/3/1 11:59:59.0 + 13 1500 400000.000000 2009/3/4 11:59:59.0 NULL NULL NULL NULL + 14 1000 500000.000000 2009/3/1 11:59:59.0 16 1000 700000.000000 2009/3/3 11:59:59.0 + 14 1000 500000.000000 2009/3/1 11:59:59.0 10 1000 900000.000000 2009/3/1 11:59:59.0 + +echo select t1.f1, t1.f3, t1.f6, t1.f9, t2.f1, t2.f3, t2.f6, t2.f9 from t1 left join t2 on t1.f4 = t2.f4; +--------------------------------------------------------- + t1.f1 t1.f3 t1.f6 t1.f9 t2.f1 t2.f3 t2.f6 t2.f9 +--------------------------------------------------------- + 10 1000 100000.000000 2009/3/1 11:59:59.0 10 1000 900000.000000 2009/3/1 11:59:59.0 + 11 1100 200000.000000 2009/3/2 11:59:59.0 11 1100 100000.000000 2009/3/2 11:59:59.0 + 12 1000 300000.000000 2009/3/3 11:59:59.0 NULL NULL NULL NULL + 13 1500 400000.000000 2009/3/4 11:59:59.0 NULL NULL NULL NULL + 14 1000 500000.000000 2009/3/1 11:59:59.0 NULL NULL NULL NULL + +echo select t1.f1, t1.f3, t1.f6, t1.f9, t2.f1, t2.f3, t2.f6, t2.f9 from t1 left join t2 on t1.f5 = t2.f5; +--------------------------------------------------------- + t1.f1 t1.f3 t1.f6 t1.f9 t2.f1 t2.f3 t2.f6 t2.f9 +--------------------------------------------------------- + 10 1000 100000.000000 2009/3/1 11:59:59.0 11 1100 100000.000000 2009/3/2 11:59:59.0 + 11 1100 200000.000000 2009/3/2 11:59:59.0 NULL NULL NULL NULL + 12 1000 300000.000000 2009/3/3 11:59:59.0 NULL NULL NULL NULL + 13 1500 400000.000000 2009/3/4 11:59:59.0 NULL NULL NULL NULL + 14 1000 500000.000000 2009/3/1 11:59:59.0 NULL NULL NULL NULL + +echo select t1.f1, t1.f3, t1.f6, t1.f9, t2.f1, t2.f3, t2.f6, t2.f9 from t1 left join t2 on t1.f6 = t2.f6; +--------------------------------------------------------- + t1.f1 t1.f3 t1.f6 t1.f9 t2.f1 t2.f3 t2.f6 t2.f9 +--------------------------------------------------------- + 10 1000 100000.000000 2009/3/1 11:59:59.0 11 1100 100000.000000 2009/3/2 11:59:59.0 + 11 1100 200000.000000 2009/3/2 11:59:59.0 NULL NULL NULL NULL + 12 1000 300000.000000 2009/3/3 11:59:59.0 NULL NULL NULL NULL + 13 1500 400000.000000 2009/3/4 11:59:59.0 NULL NULL NULL NULL + 14 1000 500000.000000 2009/3/1 11:59:59.0 NULL NULL NULL NULL + +echo select t1.f1, t1.f3, t1.f6, t1.f9, t2.f1, t2.f3, t2.f6, t2.f9 from t1 left join t2 on t1.f7 = t2.f7; +--------------------------------------------------------- + t1.f1 t1.f3 t1.f6 t1.f9 t2.f1 t2.f3 t2.f6 t2.f9 +--------------------------------------------------------- + 10 1000 100000.000000 2009/3/1 11:59:59.0 10 1000 900000.000000 2009/3/1 11:59:59.0 + 11 1100 200000.000000 2009/3/2 11:59:59.0 13 1100 600000.000000 2009/3/2 11:59:59.0 + 11 1100 200000.000000 2009/3/2 11:59:59.0 11 1100 100000.000000 2009/3/2 11:59:59.0 + 12 1000 300000.000000 2009/3/3 11:59:59.0 16 1000 700000.000000 2009/3/3 11:59:59.0 + 13 1500 400000.000000 2009/3/4 11:59:59.0 17 1100 800000.000000 2009/3/4 11:59:59.0 + 14 1000 500000.000000 2009/3/1 11:59:59.0 10 1000 900000.000000 2009/3/1 11:59:59.0 + +echo select t1.f1, t1.f3, t1.f6, t1.f9, t2.f1, t2.f3, t2.f6, t2.f9 from t1 left join t2 on t1.f8 = t2.f8; +--------------------------------------------------------- + t1.f1 t1.f3 t1.f6 t1.f9 t2.f1 t2.f3 t2.f6 t2.f9 +--------------------------------------------------------- + 10 1000 100000.000000 2009/3/1 11:59:59.0 16 1000 700000.000000 2009/3/3 11:59:59.0 + 11 1100 200000.000000 2009/3/2 11:59:59.0 17 1100 800000.000000 2009/3/4 11:59:59.0 + 11 1100 200000.000000 2009/3/2 11:59:59.0 11 1100 100000.000000 2009/3/2 11:59:59.0 + 12 1000 300000.000000 2009/3/3 11:59:59.0 13 1100 600000.000000 2009/3/2 11:59:59.0 + 12 1000 300000.000000 2009/3/3 11:59:59.0 10 1000 900000.000000 2009/3/1 11:59:59.0 + 13 1500 400000.000000 2009/3/4 11:59:59.0 16 1000 700000.000000 2009/3/3 11:59:59.0 + 14 1000 500000.000000 2009/3/1 11:59:59.0 17 1100 800000.000000 2009/3/4 11:59:59.0 + 14 1000 500000.000000 2009/3/1 11:59:59.0 11 1100 100000.000000 2009/3/2 11:59:59.0 + +echo select t1.f1, t1.f3, t1.f6, t1.f9, t2.f1, t2.f3, t2.f6, t2.f9 from t1 left join t2 on t1.f9 = t2.f9; +--------------------------------------------------------- + t1.f1 t1.f3 t1.f6 t1.f9 t2.f1 t2.f3 t2.f6 t2.f9 +--------------------------------------------------------- + 10 1000 100000.000000 2009/3/1 11:59:59.0 10 1000 900000.000000 2009/3/1 11:59:59.0 + 11 1100 200000.000000 2009/3/2 11:59:59.0 13 1100 600000.000000 2009/3/2 11:59:59.0 + 11 1100 200000.000000 2009/3/2 11:59:59.0 11 1100 100000.000000 2009/3/2 11:59:59.0 + 12 1000 300000.000000 2009/3/3 11:59:59.0 16 1000 700000.000000 2009/3/3 11:59:59.0 + 13 1500 400000.000000 2009/3/4 11:59:59.0 17 1100 800000.000000 2009/3/4 11:59:59.0 + 14 1000 500000.000000 2009/3/1 11:59:59.0 10 1000 900000.000000 2009/3/1 11:59:59.0 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/OuterJoin/exp.test004.ksh b/test/sql/OuterJoin/exp.test004.ksh new file mode 100644 index 00000000..4998555e --- /dev/null +++ b/test/sql/OuterJoin/exp.test004.ksh @@ -0,0 +1,170 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 t1.f5 t1.f6 t1.f7 t1.f8 t1.f9 +--------------------------------------------------------- + 10 100 1000 Bijay 1000.000000 100000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + 11 110 1100 Jitendr 2000.000000 200000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 12 120 1000 Nihar 3000.000000 300000.000000 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 1500 Kishor 4000.000000 400000.000000 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 + 14 100 1000 Praba 5000.000000 500000.000000 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 + +echo select * from t2; +--------------------------------------------------------- + t2.f1 t2.f2 t2.f3 t2.f4 t2.f5 t2.f6 t2.f7 t2.f8 t2.f9 +--------------------------------------------------------- + 13 110 1100 Sanjit 6000.000000 600000.000000 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 + 16 120 1000 Sanjay 6500.000000 700000.000000 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 + 17 130 1100 Arindam 8000.000000 800000.000000 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 + 10 100 1000 Bijay 9000.000000 900000.000000 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 + 11 110 1100 Jitendr 1000.000000 100000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + +echo select * from t3; +--------------------------------------------------------- + t3.f1 t3.f2 t3.f3 t3.f4 t3.f5 t3.f6 t3.f7 t3.f8 t3.f9 +--------------------------------------------------------- + 12 120 1000 Nihar 2000.000000 200000.000000 2009/3/3 11:59:56.0 2009/3/3 11:59:59.0 + 13 130 1100 Kishor 3000.000000 300000.000000 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 + 14 100 1000 Praba 4000.000000 400000.000000 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 + 15 110 1100 Sanjit 5000.000000 500000.000000 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 + 16 120 1000 Sanjay 6000.000000 600000.000000 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 + +echo select t1.f1, t1.f2, t2.f1, t2.f2, t3.f1, t3.f2 from t1 left join t2 on t1.f1 = t2.f1 left join t3 on t2.f1 = t3.f1; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 10 100 10 100 NULL NULL + 11 110 11 110 NULL NULL + 12 120 NULL NULL NULL NULL + 13 130 13 110 13 130 + 14 100 NULL NULL NULL NULL + +echo select t1.f1, t1.f2, t2.f1, t2.f2, t3.f1, t3.f2 from t1 left join t2 on t1.f2 = t2.f2 left join t3 on t2.f2 = t3.f2; +--------------------------------------------------------- + t1.f1 t1.f2 t2.f1 t2.f2 t3.f1 t3.f2 +--------------------------------------------------------- + 10 100 10 100 14 100 + 11 110 13 110 15 110 + 11 110 11 110 15 110 + 12 120 16 120 12 120 + 12 120 16 120 16 120 + 13 130 17 130 13 130 + 14 100 10 100 14 100 + +echo select t1.f1, t1.f3, t2.f1, t2.f3, t3.f1, t3.f3 from t1 left join t2 on t1.f3 = t2.f3 left join t3 on t2.f3 = t3.f3; +--------------------------------------------------------- + t1.f1 t1.f3 t2.f1 t2.f3 t3.f1 t3.f3 +--------------------------------------------------------- + 10 1000 16 1000 12 1000 + 10 1000 16 1000 14 1000 + 10 1000 16 1000 16 1000 + 10 1000 10 1000 12 1000 + 10 1000 10 1000 14 1000 + 10 1000 10 1000 16 1000 + 11 1100 13 1100 13 1100 + 11 1100 13 1100 15 1100 + 11 1100 17 1100 13 1100 + 11 1100 17 1100 15 1100 + 11 1100 11 1100 13 1100 + 11 1100 11 1100 15 1100 + 12 1000 16 1000 12 1000 + 12 1000 16 1000 14 1000 + 12 1000 16 1000 16 1000 + 12 1000 10 1000 12 1000 + 12 1000 10 1000 14 1000 + 12 1000 10 1000 16 1000 + 13 1500 NULL NULL NULL NULL + 14 1000 16 1000 12 1000 + 14 1000 16 1000 14 1000 + 14 1000 16 1000 16 1000 + 14 1000 10 1000 12 1000 + 14 1000 10 1000 14 1000 + 14 1000 10 1000 16 1000 + +echo select t1.f1, t1.f4, t2.f1, t2.f4, t3.f1, t3.f4 from t1 left join t2 on t1.f4 = t2.f4 left join t3 on t2.f4 = t3.f4; +--------------------------------------------------------- + t1.f1 t1.f4 t2.f1 t2.f4 t3.f1 t3.f4 +--------------------------------------------------------- + 10 Bijay 10 Bijay NULL NULL + 11 Jitendr 11 Jitendr NULL NULL + 12 Nihar NULL NULL NULL NULL + 13 Kishor NULL NULL NULL NULL + 14 Praba NULL NULL NULL NULL + +echo select t1.f1, t1.f5, t2.f1, t2.f5, t3.f1, t3.f5 from t1 left join t2 on t1.f5 = t2.f5 left join t3 on t2.f5 = t3.f5; +--------------------------------------------------------- + t1.f1 t1.f5 t2.f1 t2.f5 t3.f1 t3.f5 +--------------------------------------------------------- + 10 1000.000000 11 1000.000000 NULL NULL + 11 2000.000000 NULL NULL NULL NULL + 12 3000.000000 NULL NULL NULL NULL + 13 4000.000000 NULL NULL NULL NULL + 14 5000.000000 NULL NULL NULL NULL + +echo select t1.f1, t1.f6, t2.f1, t2.f6, t3.f1, t3.f6 from t1 left join t2 on t1.f6 = t2.f6 left join t3 on t2.f6 = t3.f6; +--------------------------------------------------------- + t1.f1 t1.f6 t2.f1 t2.f6 t3.f1 t3.f6 +--------------------------------------------------------- + 10 100000.000000 11 100000.000000 NULL NULL + 11 200000.000000 NULL NULL NULL NULL + 12 300000.000000 NULL NULL NULL NULL + 13 400000.000000 NULL NULL NULL NULL + 14 500000.000000 NULL NULL NULL NULL + +echo select t1.f1, t1.f7, t2.f1, t2.f7, t3.f1, t3.f7 from t1 left join t2 on t1.f7 = t2.f7 left join t3 on t2.f7 = t3.f7; +--------------------------------------------------------- + t1.f1 t1.f7 t2.f1 t2.f7 t3.f1 t3.f7 +--------------------------------------------------------- + 10 2009/3/1 10 2009/3/1 14 2009/3/1 + 11 2009/3/2 13 2009/3/2 15 2009/3/2 + 11 2009/3/2 11 2009/3/2 15 2009/3/2 + 12 2009/3/3 16 2009/3/3 12 2009/3/3 + 12 2009/3/3 16 2009/3/3 16 2009/3/3 + 13 2009/3/4 17 2009/3/4 NULL NULL + 14 2009/3/1 10 2009/3/1 14 2009/3/1 + +echo select t1.f1, t1.f8, t2.f1, t2.f8, t3.f1, t3.f8 from t1 left join t2 on t1.f8 = t2.f8 left join t3 on t2.f8 = t3.f8; +--------------------------------------------------------- + t1.f1 t1.f8 t2.f1 t2.f8 t3.f1 t3.f8 +--------------------------------------------------------- + 10 11:59:59.0 16 11:59:59.0 NULL NULL + 11 11:59:58.0 17 11:59:58.0 NULL NULL + 11 11:59:58.0 11 11:59:58.0 NULL NULL + 12 11:59:57.0 13 11:59:57.0 NULL NULL + 12 11:59:57.0 10 11:59:57.0 NULL NULL + 13 11:59:59.0 16 11:59:59.0 NULL NULL + 14 11:59:58.0 17 11:59:58.0 NULL NULL + 14 11:59:58.0 11 11:59:58.0 NULL NULL + +echo select t1.f1, t1.f9, t2.f1, t2.f9, t3.f1, t3.f9 from t1 left join t2 on t1.f9 = t2.f9 left join t3 on t2.f9 = t3.f9; +--------------------------------------------------------- + t1.f1 t1.f9 t2.f1 t2.f9 t3.f1 t3.f9 +--------------------------------------------------------- + 10 2009/3/1 11:59:59.0 10 2009/3/1 11:59:59.0 15 2009/3/1 11:59:59.0 + 11 2009/3/2 11:59:59.0 13 2009/3/2 11:59:59.0 NULL NULL + 11 2009/3/2 11:59:59.0 11 2009/3/2 11:59:59.0 NULL NULL + 12 2009/3/3 11:59:59.0 16 2009/3/3 11:59:59.0 12 2009/3/3 11:59:59.0 + 12 2009/3/3 11:59:59.0 16 2009/3/3 11:59:59.0 16 2009/3/3 11:59:59.0 + 13 2009/3/4 11:59:59.0 17 2009/3/4 11:59:59.0 14 2009/3/4 11:59:59.0 + 14 2009/3/1 11:59:59.0 10 2009/3/1 11:59:59.0 15 2009/3/1 11:59:59.0 + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/OuterJoin/exp.test005.ksh b/test/sql/OuterJoin/exp.test005.ksh new file mode 100644 index 00000000..6e67b2b6 --- /dev/null +++ b/test/sql/OuterJoin/exp.test005.ksh @@ -0,0 +1,69 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 t1.f5 t1.f6 t1.f7 t1.f8 t1.f9 +--------------------------------------------------------- + 10 100 1000 Bijay 1000.000000 100000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + 11 110 1100 Jitendr 2000.000000 200000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 12 120 1000 Nihar 3000.000000 300000.000000 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 1500 Kishor 4000.000000 400000.000000 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 + 14 100 1000 Praba 5000.000000 500000.000000 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 + +echo select * from t2; +--------------------------------------------------------- + t2.f1 t2.f2 t2.f3 t2.f4 t2.f5 t2.f6 t2.f7 t2.f8 t2.f9 +--------------------------------------------------------- + 13 110 1100 Sanjit 6000.000000 600000.000000 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 + 16 120 1000 Sanjay 6500.000000 700000.000000 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 + 17 130 1100 Arindam 8000.000000 800000.000000 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 + 10 100 1000 Bijay 9000.000000 900000.000000 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 + 11 110 1100 Jitendr 1000.000000 100000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + +echo select * from t3; +--------------------------------------------------------- + t3.f1 t3.f2 t3.f3 t3.f4 t3.f5 t3.f6 t3.f7 t3.f8 t3.f9 +--------------------------------------------------------- + 12 120 1000 Nihar 2000.000000 200000.000000 2009/3/3 11:59:56.0 2009/3/3 11:59:59.0 + 13 130 1100 Kishor 3000.000000 300000.000000 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 + 14 100 1000 Praba 4000.000000 400000.000000 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 + 15 110 1100 Sanjit 5000.000000 500000.000000 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 + 16 120 1000 Sanjay 6000.000000 600000.000000 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 + +echo select t1.f1, t1.f2, t2.f1, t2.f2, t3.f1, t3.f2 from t1 left join t2 on t1.f1 = t2.f1 left join t3 on t2.f1 = t3.f1 left join t1 on t3.f1 = t1.f1; +Statement prepare failed with error -19 +echo select t1.f1, t1.f2, t2.f1, t2.f2, t3.f1, t3.f2 from t1 left join t2 on t1.f2 = t2.f2 left join t3 on t2.f2 = t3.f2 left join t1 on t3.f2 = t1.f2; +Statement prepare failed with error -19 +echo select t1.f1, t1.f3, t2.f1, t2.f3, t3.f1, t3.f3 from t1 left join t2 on t1.f3 = t2.f3 left join t3 on t2.f3 = t3.f3 left join t1 on t3.f3 = t1.f3; +Statement prepare failed with error -19 +echo select t1.f1, t1.f4, t2.f1, t2.f4, t3.f1, t3.f4 from t1 left join t2 on t1.f4 = t2.f4 left join t3 on t2.f4 = t3.f4 left join t1 on t3.f4 = t1.f4; +Statement prepare failed with error -19 +echo select t1.f1, t1.f5, t2.f1, t2.f5, t3.f1, t3.f5 from t1 left join t2 on t1.f5 = t2.f5 left join t3 on t2.f5 = t3.f5 left join t1 on t3.f5 = t1.f5; +Statement prepare failed with error -19 +echo select t1.f1, t1.f6, t2.f1, t2.f6, t3.f1, t3.f6 from t1 left join t2 on t1.f6 = t2.f6 left join t3 on t2.f6 = t3.f6 left join t1 on t3.f6 = t1.f6; +Statement prepare failed with error -19 +echo select t1.f1, t1.f7, t2.f1, t2.f7, t3.f1, t3.f7 from t1 left join t2 on t1.f7 = t2.f7 left join t3 on t2.f7 = t3.f7 left join t1 on t3.f7 = t1.f7; +Statement prepare failed with error -19 +echo select t1.f1, t1.f8, t2.f1, t2.f8, t3.f1, t3.f8 from t1 left join t2 on t1.f8 = t2.f8 left join t3 on t2.f8 = t3.f8 left join t1 on t3.f8 = t1.f8; +Statement prepare failed with error -19 +echo select t1.f1, t1.f9, t2.f1, t2.f9, t3.f1, t3.f9 from t1 left join t2 on t1.f9 = t2.f9 left join t3 on t2.f9 = t3.f9 left join t1 on t3.f9 = t1.f9; +Statement prepare failed with error -19 +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/OuterJoin/exp.test006.ksh b/test/sql/OuterJoin/exp.test006.ksh new file mode 100644 index 00000000..95c1438f --- /dev/null +++ b/test/sql/OuterJoin/exp.test006.ksh @@ -0,0 +1,117 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 t1.f5 t1.f6 t1.f7 t1.f8 t1.f9 +--------------------------------------------------------- + 10 100 1000 Bijay 1000.000000 100000.000000 2009/3/1 11:59:59.0 2009/3/1 11:59:59.0 + 11 110 1100 Jitendr 2000.000000 200000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + 12 120 1000 Nihar 3000.000000 300000.000000 2009/3/3 11:59:57.0 2009/3/3 11:59:59.0 + 13 130 1500 Kishor 4000.000000 400000.000000 2009/3/4 11:59:59.0 2009/3/4 11:59:59.0 + 14 100 1000 Praba 5000.000000 500000.000000 2009/3/1 11:59:58.0 2009/3/1 11:59:59.0 + +echo select * from t2; +--------------------------------------------------------- + t2.f1 t2.f2 t2.f3 t2.f4 t2.f5 t2.f6 t2.f7 t2.f8 t2.f9 +--------------------------------------------------------- + 13 110 1100 Sanjit 6000.000000 600000.000000 2009/3/2 11:59:57.0 2009/3/2 11:59:59.0 + 16 120 1000 Sanjay 6500.000000 700000.000000 2009/3/3 11:59:59.0 2009/3/3 11:59:59.0 + 17 130 1100 Arindam 8000.000000 800000.000000 2009/3/4 11:59:58.0 2009/3/4 11:59:59.0 + 10 100 1000 Bijay 9000.000000 900000.000000 2009/3/1 11:59:57.0 2009/3/1 11:59:59.0 + 11 110 1100 Jitendr 1000.000000 100000.000000 2009/3/2 11:59:58.0 2009/3/2 11:59:59.0 + +echo select * from t3; +--------------------------------------------------------- + t3.f1 t3.f2 t3.f3 t3.f4 t3.f5 t3.f6 t3.f7 t3.f8 t3.f9 +--------------------------------------------------------- + 12 120 1000 Nihar 2000.000000 200000.000000 2009/3/3 11:59:56.0 2009/3/3 11:59:59.0 + 13 130 1100 Kishor 3000.000000 300000.000000 2009/3/5 11:59:56.0 2009/3/5 11:59:59.0 + 14 100 1000 Praba 4000.000000 400000.000000 2009/3/1 11:59:55.0 2009/3/4 11:59:59.0 + 15 110 1100 Sanjit 5000.000000 500000.000000 2009/3/2 11:59:56.0 2009/3/1 11:59:59.0 + 16 120 1000 Sanjay 6000.000000 600000.000000 2009/3/3 11:59:55.0 2009/3/3 11:59:59.0 + +echo SELECT t1.f1, t1.f4, t2.f1, t2.f4 FROM t1 LEFT JOIN t2 ON t1.f1 IN(12,10,14) OR t1.f1=t2.f1; +--------------------------------------------------------- + t1.f1 t1.f4 t2.f1 t2.f4 +--------------------------------------------------------- + 10 Bijay 13 Sanjit + 10 Bijay 16 Sanjay + 10 Bijay 17 Arindam + 10 Bijay 10 Bijay + 10 Bijay 11 Jitendr + 11 Jitendr 11 Jitendr + 12 Nihar 13 Sanjit + 12 Nihar 16 Sanjay + 12 Nihar 17 Arindam + 12 Nihar 10 Bijay + 12 Nihar 11 Jitendr + 13 Kishor 13 Sanjit + 14 Praba 13 Sanjit + 14 Praba 16 Sanjay + 14 Praba 17 Arindam + 14 Praba 10 Bijay + 14 Praba 11 Jitendr + +echo SELECT t1.f1, t1.f4, t2.f1, t2.f4 FROM t1 LEFT JOIN t2 ON t1.f1 BETWEEN 11 AND 14; +--------------------------------------------------------- + t1.f1 t1.f4 t2.f1 t2.f4 +--------------------------------------------------------- + 10 Bijay NULL NULL + 11 Jitendr 13 Sanjit + 11 Jitendr 16 Sanjay + 11 Jitendr 17 Arindam + 11 Jitendr 10 Bijay + 11 Jitendr 11 Jitendr + 12 Nihar 13 Sanjit + 12 Nihar 16 Sanjay + 12 Nihar 17 Arindam + 12 Nihar 10 Bijay + 12 Nihar 11 Jitendr + 13 Kishor 13 Sanjit + 13 Kishor 16 Sanjay + 13 Kishor 17 Arindam + 13 Kishor 10 Bijay + 13 Kishor 11 Jitendr + 14 Praba 13 Sanjit + 14 Praba 16 Sanjay + 14 Praba 17 Arindam + 14 Praba 10 Bijay + 14 Praba 11 Jitendr + +echo SELECT t1.f1, t1.f4, t2.f1, t2.f4 FROM t1 LEFT JOIN t2 ON t1.f4 >= 'K' AND t1.f4 LIKE 'N%' OR t1.f4 LIKE '%a'; +--------------------------------------------------------- + t1.f1 t1.f4 t2.f1 t2.f4 +--------------------------------------------------------- + 10 Bijay NULL NULL + 11 Jitendr NULL NULL + 12 Nihar 13 Sanjit + 12 Nihar 16 Sanjay + 12 Nihar 17 Arindam + 12 Nihar 10 Bijay + 12 Nihar 11 Jitendr + 13 Kishor NULL NULL + 14 Praba 13 Sanjit + 14 Praba 16 Sanjay + 14 Praba 17 Arindam + 14 Praba 10 Bijay + 14 Praba 11 Jitendr + +Statement Executed +Statement Executed +Statement Executed diff --git a/test/sql/OuterJoin/leftjoin2.sql b/test/sql/OuterJoin/leftjoin2.sql new file mode 100644 index 00000000..94ba44c6 --- /dev/null +++ b/test/sql/OuterJoin/leftjoin2.sql @@ -0,0 +1,64 @@ +echo CREATE TABLE Articles ( ArticleID SMALLINT, ArticleTitle CHAR(30) NOT NULL, Copyright INT NOT NULL,PRIMARY KEY(ArticleID)); +CREATE TABLE Articles ( ArticleID SMALLINT, ArticleTitle CHAR(30) NOT NULL, Copyright INT NOT NULL,PRIMARY KEY(ArticleID)); +echo INSERT INTO Articles VALUES (12786, 'How write a paper',1934); +INSERT INTO Articles VALUES (12786, 'How write a paper',1934); +echo INSERT INTO Articles VALUES (13331, 'Publish a paper ',1919); +INSERT INTO Articles VALUES (13331, 'Publish a paper ',1919); +echo INSERT INTO Articles VALUES (14356, 'Sell a paper ',1966); +INSERT INTO Articles VALUES (14356, 'Sell a paper ',1966); +echo INSERT INTO Articles VALUES (15729, 'Buy a paper ',1932); +INSERT INTO Articles VALUES (15729, 'Buy a paper ',1932); +echo INSERT INTO Articles VALUES (16284, 'Conferences ',1996); +INSERT INTO Articles VALUES (16284, 'Conferences ',1996); +echo INSERT INTO Articles VALUES (17695, 'Journal ',1980); +INSERT INTO Articles VALUES (17695, 'Journal ',1980); +echo INSERT INTO Articles VALUES (19264, 'Information ',1992); +INSERT INTO Articles VALUES (19264, 'Information ',1992); +echo INSERT INTO Articles VALUES (19354, 'AI ',1993); +INSERT INTO Articles VALUES (19354, 'AI ',1993); +echo CREATE TABLE Authors (AuthID SMALLINT, AuthorFirstName CHAR(20), AuthorMiddleName CHAR(20), AuthorLastName CHAR(20),PRIMARY KEY(AuthID)); +CREATE TABLE Authors (AuthID SMALLINT, AuthorFirstName CHAR(20), AuthorMiddleName CHAR(20), AuthorLastName CHAR(20),PRIMARY KEY(AuthID)); +echo INSERT INTO Authors VALUES (1006, 'Henry', 'S.', 'Thompson'); +INSERT INTO Authors VALUES (1006, 'Henry', 'S.', 'Thompson'); +echo INSERT INTO Authors VALUES(1007, 'Jason', 'Carol', 'Oak'); +INSERT INTO Authors VALUES(1007, 'Jason', 'Carol', 'Oak'); +echo INSERT INTO Authors VALUES(1008, 'James', NULL, 'Elk'); +INSERT INTO Authors VALUES(1008, 'James', NULL, 'Elk'); +echo INSERT INTO Authors VALUES(1009, 'Tom', 'M', 'Ride'); +INSERT INTO Authors VALUES(1009, 'Tom', 'M', 'Ride'); +echo INSERT INTO Authors VALUES(1010, 'Jack', 'K', 'Ken'); +INSERT INTO Authors VALUES(1010, 'Jack', 'K', 'Ken'); +echo INSERT INTO Authors VALUES(1011, 'Mary', 'G.', 'Lee'); +INSERT INTO Authors VALUES(1011, 'Mary', 'G.', 'Lee'); +echo INSERT INTO Authors VALUES(1012, 'Annie', NULL, 'Peng'); +INSERT INTO Authors VALUES(1012, 'Annie', NULL, 'Peng'); +echo INSERT INTO Authors VALUES(1013, 'Alan', NULL, 'Wang'); +INSERT INTO Authors VALUES(1013, 'Alan', NULL, 'Wang'); +echo INSERT INTO Authors VALUES(1014, 'Nelson', NULL, 'Yin'); +INSERT INTO Authors VALUES(1014, 'Nelson', NULL, 'Yin'); +echo CREATE TABLE AuthorArticle (AuthID SMALLINT NOT NULL, ArticleID SMALLINT NOT NULL,FOREIGN KEY(AuthID) REFERENCES Authors(AuthID), FOREIGN KEY(ArticleID) REFERENCES Articles(ArticleID)); +CREATE TABLE AuthorArticle (AuthID SMALLINT NOT NULL, ArticleID SMALLINT NOT NULL,FOREIGN KEY(AuthID) REFERENCES Authors(AuthID), FOREIGN KEY(ArticleID) REFERENCES Articles(ArticleID)); +echo INSERT INTO AuthorArticle VALUES (1006, 14356); +INSERT INTO AuthorArticle VALUES (1006, 14356); +echo INSERT INTO AuthorArticle VALUES (1008, 15729); +INSERT INTO AuthorArticle VALUES (1008, 15729); +echo INSERT INTO AuthorArticle VALUES (1009, 12786); +INSERT INTO AuthorArticle VALUES (1009, 12786); +echo INSERT INTO AuthorArticle VALUES (1010, 17695); +INSERT INTO AuthorArticle VALUES (1010, 17695); +echo INSERT INTO AuthorArticle VALUES (1011, 15729); +INSERT INTO AuthorArticle VALUES (1011, 15729); +echo INSERT INTO AuthorArticle VALUES (1012, 19264); +INSERT INTO AuthorArticle VALUES (1012, 19264); +echo INSERT INTO AuthorArticle VALUES (1012, 19354); +INSERT INTO AuthorArticle VALUES (1012, 19354); +echo INSERT INTO AuthorArticle VALUES (1014, 16284); +INSERT INTO AuthorArticle VALUES (1014, 16284); +echo SELECT * FROM Articles; +SELECT * FROM Articles; +echo SELECT * FROM Authors; +SELECT * FROM Authors; +echo SELECT * FROM AuthorArticle; +SELECT * FROM AuthorArticle; +echo SELECT ArticleTitle, Copyright FROM Articles LEFT JOIN AuthorArticle ON Articles.ArticleID=AuthorArticle.ArticleID LEFT JOIN Authors ON AuthorArticle.AuthID=Authors.AuthID; +SELECT ArticleTitle, Copyright FROM Articles LEFT JOIN AuthorArticle ON Articles.ArticleID=AuthorArticle.ArticleID LEFT JOIN Authors ON AuthorArticle.AuthID=Authors.AuthID; diff --git a/test/sql/OuterJoin/leftjoin_in_between_like.sql b/test/sql/OuterJoin/leftjoin_in_between_like.sql new file mode 100644 index 00000000..2ef29848 --- /dev/null +++ b/test/sql/OuterJoin/leftjoin_in_between_like.sql @@ -0,0 +1,6 @@ +echo SELECT t1.f1, t1.f4, t2.f1, t2.f4 FROM t1 LEFT JOIN t2 ON t1.f1 IN(12,10,14) OR t1.f1=t2.f1; +SELECT t1.f1, t1.f4, t2.f1, t2.f4 FROM t1 LEFT JOIN t2 ON t1.f1 IN(12,10,14) OR t1.f1=t2.f1; +echo SELECT t1.f1, t1.f4, t2.f1, t2.f4 FROM t1 LEFT JOIN t2 ON t1.f1 BETWEEN 11 AND 14; +SELECT t1.f1, t1.f4, t2.f1, t2.f4 FROM t1 LEFT JOIN t2 ON t1.f1 BETWEEN 11 AND 14; +echo SELECT t1.f1, t1.f4, t2.f1, t2.f4 FROM t1 LEFT JOIN t2 ON t1.f4 >= 'K' AND t1.f4 LIKE 'N%' OR t1.f4 LIKE '%a'; +SELECT t1.f1, t1.f4, t2.f1, t2.f4 FROM t1 LEFT JOIN t2 ON t1.f4 >= 'K' AND t1.f4 LIKE 'N%' OR t1.f4 LIKE '%a'; diff --git a/test/sql/OuterJoin/leftjoin_t1_t2.sql b/test/sql/OuterJoin/leftjoin_t1_t2.sql new file mode 100644 index 00000000..11d87396 --- /dev/null +++ b/test/sql/OuterJoin/leftjoin_t1_t2.sql @@ -0,0 +1,18 @@ +echo select t1.f1, t1.f3, t1.f6, t1.f9, t2.f1, t2.f3, t2.f6, t2.f9 from t1 left join t2 on t1.f1 = t2.f1; +select t1.f1, t1.f3, t1.f6, t1.f9, t2.f1, t2.f3, t2.f6, t2.f9 from t1 left join t2 on t1.f1 = t2.f1; +echo select t1.f1, t1.f3, t1.f6, t1.f9, t2.f1, t2.f3, t2.f6, t2.f9 from t1 left join t2 on t1.f2 = t2.f2; +select t1.f1, t1.f3, t1.f6, t1.f9, t2.f1, t2.f3, t2.f6, t2.f9 from t1 left join t2 on t1.f2 = t2.f2; +echo select t1.f1, t1.f3, t1.f6, t1.f9, t2.f1, t2.f3, t2.f6, t2.f9 from t1 left join t2 on t1.f3 = t2.f3; +select t1.f1, t1.f3, t1.f6, t1.f9, t2.f1, t2.f3, t2.f6, t2.f9 from t1 left join t2 on t1.f3 = t2.f3; +echo select t1.f1, t1.f3, t1.f6, t1.f9, t2.f1, t2.f3, t2.f6, t2.f9 from t1 left join t2 on t1.f4 = t2.f4; +select t1.f1, t1.f3, t1.f6, t1.f9, t2.f1, t2.f3, t2.f6, t2.f9 from t1 left join t2 on t1.f4 = t2.f4; +echo select t1.f1, t1.f3, t1.f6, t1.f9, t2.f1, t2.f3, t2.f6, t2.f9 from t1 left join t2 on t1.f5 = t2.f5; +select t1.f1, t1.f3, t1.f6, t1.f9, t2.f1, t2.f3, t2.f6, t2.f9 from t1 left join t2 on t1.f5 = t2.f5; +echo select t1.f1, t1.f3, t1.f6, t1.f9, t2.f1, t2.f3, t2.f6, t2.f9 from t1 left join t2 on t1.f6 = t2.f6; +select t1.f1, t1.f3, t1.f6, t1.f9, t2.f1, t2.f3, t2.f6, t2.f9 from t1 left join t2 on t1.f6 = t2.f6; +echo select t1.f1, t1.f3, t1.f6, t1.f9, t2.f1, t2.f3, t2.f6, t2.f9 from t1 left join t2 on t1.f7 = t2.f7; +select t1.f1, t1.f3, t1.f6, t1.f9, t2.f1, t2.f3, t2.f6, t2.f9 from t1 left join t2 on t1.f7 = t2.f7; +echo select t1.f1, t1.f3, t1.f6, t1.f9, t2.f1, t2.f3, t2.f6, t2.f9 from t1 left join t2 on t1.f8 = t2.f8; +select t1.f1, t1.f3, t1.f6, t1.f9, t2.f1, t2.f3, t2.f6, t2.f9 from t1 left join t2 on t1.f8 = t2.f8; +echo select t1.f1, t1.f3, t1.f6, t1.f9, t2.f1, t2.f3, t2.f6, t2.f9 from t1 left join t2 on t1.f9 = t2.f9; +select t1.f1, t1.f3, t1.f6, t1.f9, t2.f1, t2.f3, t2.f6, t2.f9 from t1 left join t2 on t1.f9 = t2.f9; diff --git a/test/sql/OuterJoin/leftjoin_t1_t2_t3.sql b/test/sql/OuterJoin/leftjoin_t1_t2_t3.sql new file mode 100644 index 00000000..cf4e3976 --- /dev/null +++ b/test/sql/OuterJoin/leftjoin_t1_t2_t3.sql @@ -0,0 +1,18 @@ +echo select t1.f1, t1.f2, t2.f1, t2.f2, t3.f1, t3.f2 from t1 left join t2 on t1.f1 = t2.f1 left join t3 on t2.f1 = t3.f1; +select t1.f1, t1.f2, t2.f1, t2.f2, t3.f1, t3.f2 from t1 left join t2 on t1.f1 = t2.f1 left join t3 on t2.f1 = t3.f1; +echo select t1.f1, t1.f2, t2.f1, t2.f2, t3.f1, t3.f2 from t1 left join t2 on t1.f2 = t2.f2 left join t3 on t2.f2 = t3.f2; +select t1.f1, t1.f2, t2.f1, t2.f2, t3.f1, t3.f2 from t1 left join t2 on t1.f2 = t2.f2 left join t3 on t2.f2 = t3.f2; +echo select t1.f1, t1.f3, t2.f1, t2.f3, t3.f1, t3.f3 from t1 left join t2 on t1.f3 = t2.f3 left join t3 on t2.f3 = t3.f3; +select t1.f1, t1.f3, t2.f1, t2.f3, t3.f1, t3.f3 from t1 left join t2 on t1.f3 = t2.f3 left join t3 on t2.f3 = t3.f3; +echo select t1.f1, t1.f4, t2.f1, t2.f4, t3.f1, t3.f4 from t1 left join t2 on t1.f4 = t2.f4 left join t3 on t2.f4 = t3.f4; +select t1.f1, t1.f4, t2.f1, t2.f4, t3.f1, t3.f4 from t1 left join t2 on t1.f4 = t2.f4 left join t3 on t2.f4 = t3.f4; +echo select t1.f1, t1.f5, t2.f1, t2.f5, t3.f1, t3.f5 from t1 left join t2 on t1.f5 = t2.f5 left join t3 on t2.f5 = t3.f5; +select t1.f1, t1.f5, t2.f1, t2.f5, t3.f1, t3.f5 from t1 left join t2 on t1.f5 = t2.f5 left join t3 on t2.f5 = t3.f5; +echo select t1.f1, t1.f6, t2.f1, t2.f6, t3.f1, t3.f6 from t1 left join t2 on t1.f6 = t2.f6 left join t3 on t2.f6 = t3.f6; +select t1.f1, t1.f6, t2.f1, t2.f6, t3.f1, t3.f6 from t1 left join t2 on t1.f6 = t2.f6 left join t3 on t2.f6 = t3.f6; +echo select t1.f1, t1.f7, t2.f1, t2.f7, t3.f1, t3.f7 from t1 left join t2 on t1.f7 = t2.f7 left join t3 on t2.f7 = t3.f7; +select t1.f1, t1.f7, t2.f1, t2.f7, t3.f1, t3.f7 from t1 left join t2 on t1.f7 = t2.f7 left join t3 on t2.f7 = t3.f7; +echo select t1.f1, t1.f8, t2.f1, t2.f8, t3.f1, t3.f8 from t1 left join t2 on t1.f8 = t2.f8 left join t3 on t2.f8 = t3.f8; +select t1.f1, t1.f8, t2.f1, t2.f8, t3.f1, t3.f8 from t1 left join t2 on t1.f8 = t2.f8 left join t3 on t2.f8 = t3.f8; +echo select t1.f1, t1.f9, t2.f1, t2.f9, t3.f1, t3.f9 from t1 left join t2 on t1.f9 = t2.f9 left join t3 on t2.f9 = t3.f9; +select t1.f1, t1.f9, t2.f1, t2.f9, t3.f1, t3.f9 from t1 left join t2 on t1.f9 = t2.f9 left join t3 on t2.f9 = t3.f9; diff --git a/test/sql/OuterJoin/leftjoin_t1_t2_t3_t1.sql b/test/sql/OuterJoin/leftjoin_t1_t2_t3_t1.sql new file mode 100644 index 00000000..7dcf71e5 --- /dev/null +++ b/test/sql/OuterJoin/leftjoin_t1_t2_t3_t1.sql @@ -0,0 +1,18 @@ +echo select t1.f1, t1.f2, t2.f1, t2.f2, t3.f1, t3.f2 from t1 left join t2 on t1.f1 = t2.f1 left join t3 on t2.f1 = t3.f1 left join t1 on t3.f1 = t1.f1; +select t1.f1, t1.f2, t2.f1, t2.f2, t3.f1, t3.f2 from t1 left join t2 on t1.f1 = t2.f1 left join t3 on t2.f1 = t3.f1 left join t1 on t3.f1 = t1.f1; +echo select t1.f1, t1.f2, t2.f1, t2.f2, t3.f1, t3.f2 from t1 left join t2 on t1.f2 = t2.f2 left join t3 on t2.f2 = t3.f2 left join t1 on t3.f2 = t1.f2; +select t1.f1, t1.f2, t2.f1, t2.f2, t3.f1, t3.f2 from t1 left join t2 on t1.f2 = t2.f2 left join t3 on t2.f2 = t3.f2 left join t1 on t3.f2 = t1.f2; +echo select t1.f1, t1.f3, t2.f1, t2.f3, t3.f1, t3.f3 from t1 left join t2 on t1.f3 = t2.f3 left join t3 on t2.f3 = t3.f3 left join t1 on t3.f3 = t1.f3; +select t1.f1, t1.f3, t2.f1, t2.f3, t3.f1, t3.f3 from t1 left join t2 on t1.f3 = t2.f3 left join t3 on t2.f3 = t3.f3 left join t1 on t3.f3 = t1.f3; +echo select t1.f1, t1.f4, t2.f1, t2.f4, t3.f1, t3.f4 from t1 left join t2 on t1.f4 = t2.f4 left join t3 on t2.f4 = t3.f4 left join t1 on t3.f4 = t1.f4; +select t1.f1, t1.f4, t2.f1, t2.f4, t3.f1, t3.f4 from t1 left join t2 on t1.f4 = t2.f4 left join t3 on t2.f4 = t3.f4 left join t1 on t3.f4 = t1.f4; +echo select t1.f1, t1.f5, t2.f1, t2.f5, t3.f1, t3.f5 from t1 left join t2 on t1.f5 = t2.f5 left join t3 on t2.f5 = t3.f5 left join t1 on t3.f5 = t1.f5; +select t1.f1, t1.f5, t2.f1, t2.f5, t3.f1, t3.f5 from t1 left join t2 on t1.f5 = t2.f5 left join t3 on t2.f5 = t3.f5 left join t1 on t3.f5 = t1.f5; +echo select t1.f1, t1.f6, t2.f1, t2.f6, t3.f1, t3.f6 from t1 left join t2 on t1.f6 = t2.f6 left join t3 on t2.f6 = t3.f6 left join t1 on t3.f6 = t1.f6; +select t1.f1, t1.f6, t2.f1, t2.f6, t3.f1, t3.f6 from t1 left join t2 on t1.f6 = t2.f6 left join t3 on t2.f6 = t3.f6 left join t1 on t3.f6 = t1.f6; +echo select t1.f1, t1.f7, t2.f1, t2.f7, t3.f1, t3.f7 from t1 left join t2 on t1.f7 = t2.f7 left join t3 on t2.f7 = t3.f7 left join t1 on t3.f7 = t1.f7; +select t1.f1, t1.f7, t2.f1, t2.f7, t3.f1, t3.f7 from t1 left join t2 on t1.f7 = t2.f7 left join t3 on t2.f7 = t3.f7 left join t1 on t3.f7 = t1.f7; +echo select t1.f1, t1.f8, t2.f1, t2.f8, t3.f1, t3.f8 from t1 left join t2 on t1.f8 = t2.f8 left join t3 on t2.f8 = t3.f8 left join t1 on t3.f8 = t1.f8; +select t1.f1, t1.f8, t2.f1, t2.f8, t3.f1, t3.f8 from t1 left join t2 on t1.f8 = t2.f8 left join t3 on t2.f8 = t3.f8 left join t1 on t3.f8 = t1.f8; +echo select t1.f1, t1.f9, t2.f1, t2.f9, t3.f1, t3.f9 from t1 left join t2 on t1.f9 = t2.f9 left join t3 on t2.f9 = t3.f9 left join t1 on t3.f9 = t1.f9; +select t1.f1, t1.f9, t2.f1, t2.f9, t3.f1, t3.f9 from t1 left join t2 on t1.f9 = t2.f9 left join t3 on t2.f9 = t3.f9 left join t1 on t3.f9 = t1.f9; diff --git a/test/sql/OuterJoin/simpleleft.sql b/test/sql/OuterJoin/simpleleft.sql new file mode 100644 index 00000000..51995769 --- /dev/null +++ b/test/sql/OuterJoin/simpleleft.sql @@ -0,0 +1,6 @@ +CREATE TABLE t1 (f1 INT , f2 INT , primary key(f1)); +CREATE TABLE t2 (f1 INT , f2 INT , primary key(f1)); +INSERT INTO t1 VALUES(1,1); +INSERT INTO t1 VALUES(2,2); +INSERT INTO t2 VALUES(1,1); +select * from t1 left join t2 on t1.f1=t2.f1; diff --git a/test/sql/OuterJoin/test001.ksh b/test/sql/OuterJoin/test001.ksh new file mode 100755 index 00000000..c9604d03 --- /dev/null +++ b/test/sql/OuterJoin/test001.ksh @@ -0,0 +1,24 @@ +#!/bin/ksh +# Testing simple left join on two table with integers +# +CREATEFILE=${PWD}/sql/OuterJoin/dropt1t2.sql +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/OuterJoin +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/simpleleft.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1t2.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1t2.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/OuterJoin/test002.ksh b/test/sql/OuterJoin/test002.ksh new file mode 100755 index 00000000..9e41f225 --- /dev/null +++ b/test/sql/OuterJoin/test002.ksh @@ -0,0 +1,24 @@ +#!/bin/ksh +# Testing simple left join on two table with integers +# +CREATEFILE=${PWD}/sql/OuterJoin/dropt1t2.sql +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/OuterJoin +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/leftjoin2.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_Articles_Authors_AuthorArticle.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_Articles_Authors_AuthorArticle.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/OuterJoin/test003.ksh b/test/sql/OuterJoin/test003.ksh new file mode 100755 index 00000000..d5ac4b16 --- /dev/null +++ b/test/sql/OuterJoin/test003.ksh @@ -0,0 +1,31 @@ +#!/bin/ksh +# Testing Left Join on two tables with All Datatypes. +# +CREATEFILE=${PWD}/sql/OuterJoin/dropt1t2.sql +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/OuterJoin +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/alldatatype.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/leftjoin_t1_t2.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/OuterJoin/test004.ksh b/test/sql/OuterJoin/test004.ksh new file mode 100755 index 00000000..b98d15d6 --- /dev/null +++ b/test/sql/OuterJoin/test004.ksh @@ -0,0 +1,31 @@ +#!/bin/ksh +# Testing Left Join on three tables with All Datatypes. +# +CREATEFILE=${PWD}/sql/OuterJoin/dropt1t2.sql +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/OuterJoin +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/alldatatype.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/leftjoin_t1_t2_t3.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/OuterJoin/test005.ksh b/test/sql/OuterJoin/test005.ksh new file mode 100755 index 00000000..812d1623 --- /dev/null +++ b/test/sql/OuterJoin/test005.ksh @@ -0,0 +1,32 @@ +#!/bin/ksh +# Testing Left Join on three tables with All Datatypes. +# select t1.f1, t1.f2, t2.f1, t2.f2, t3.f1, t3.f2 from t1 left join t2 on t1.f1 = t2.f1 left join t3 on t2.f1 = t3.f1 left join t1 on t3.f1 = t1.f1; +# +CREATEFILE=${PWD}/sql/OuterJoin/dropt1t2.sql +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/OuterJoin +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/alldatatype.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/leftjoin_t1_t2_t3_t1.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/OuterJoin/test006.ksh b/test/sql/OuterJoin/test006.ksh new file mode 100755 index 00000000..170d04ce --- /dev/null +++ b/test/sql/OuterJoin/test006.ksh @@ -0,0 +1,31 @@ +#!/bin/ksh +# Testing Left Join on two tables using IN, BETWEEN and LIKE operators with All Datatypes. +# +CREATEFILE=${PWD}/sql/OuterJoin/dropt1t2.sql +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/OuterJoin +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/alldatatype.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/leftjoin_in_between_like.sql +if [ $? -ne 0 ] +then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql + exit 2; +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop_t1_t2_t3.sql +if [ $? -ne 0 ] +then + exit 3; +fi + +exit 0; diff --git a/test/sql/Predicate/TODO b/test/sql/Predicate/TODO new file mode 100644 index 00000000..e69de29b diff --git a/test/sql/Predicate/csql.conf b/test/sql/Predicate/csql.conf new file mode 100644 index 00000000..eb9d5a2e --- /dev/null +++ b/test/sql/Predicate/csql.conf @@ -0,0 +1,147 @@ +# CSQL System Configuration File + +#####################################Server Section######################## + +# Site ID for this CSQL server +SITE_ID=1 + +#Important: For Server section parameters, make sure that the value is same for the +# server process and all the csql client process which connects to it. otherwise, +# behavior is undefined + +# Page size. Each database is logically divided into pages and allocation happens +# in this unit of pages. Increasing this value will reduce frequent allocation of pages. +PAGE_SIZE= 8192 + +#Total number of client process which can connect and work with the +# database concurrently +MAX_PROCS = 100 + +# Maximum size of the system database. +MAX_SYS_DB_SIZE=1048576 + +#Maximum size of the user database file. +MAX_DB_SIZE=10485760 + +#Shared memory key to be used by the system to create and locate system database. +SYS_DB_KEY=2222 + +#Shared memory key to be used by the system to create and locate user database. +USER_DB_KEY=3333 + +#Log level 0->no logging 1->Fine 2->Finer 3->Finest +LOG_LEVEL=0 + +#Give full path for the log file where important system actions are stored. +LOG_FILE=/tmp/csql/log/log.out + +#The virtual memory start address at which the shared memory segment +# will be created and attached. +MAP_ADDRESS=400000000 + +# Whether to enable durability +DURABILITY=false + +# Whether to enable memory map architecture for user database +MMAP=false + +# Specifies the durability mode for redo log generation +# Valid values are +# 1 ->uses standard redo logging with O_APPEND mode +# 2 ->uses standard logging with serialization +# 3 ->uses O_SYNC flag +# 4 ->uses O_DIRECT flag + +DURABLE_MODE=1 + +#Give full path for the database file where table and record information will +#be stored for durability +DATABASE_FILE=/tmp/csql/db + +#Important: For Server section parameters, make sure that the value is same for the server process and all the csql client process which connects to it. otherwise, behavior is undefined + +# Give full path for the std error file to store all the errors during database operations +STDERR_FILE=stderr + +#####################################Client Section######################## + +#Mutex timeout interval seconds +MUTEX_TIMEOUT_SECS=0 +MUTEX_TIMEOUT_USECS=5000 +MUTEX_TIMEOUT_RETRIES=10 + +#Lock timeout interval seconds +LOCK_TIMEOUT_SECS=0 +LOCK_TIMEOUT_USECS=5000 +LOCK_TIMEOUT_RETRIES=10 + +#Statement Cache Size +STMT_CACHE_SIZE=10 + +#Enable statement cache for statements with no parameters +STMT_CACHE_NOPARAM=false + +#####################################Cache Section######################## + +#Whether to enable caching of tables from target database +CACHE_TABLE=false + +#DSN Name to connect to the target database. +#This should be present in ~/odbc.ini file +DSN=myodbc3 + +# Whethere to enable bidirectional updates for cached tables. +ENABLE_BIDIRECTIONAL_CACHE=false + +CACHE_RECEIVER_WAIT_SECS=10 + +#Mode of operation SYNC or ASYNC +CACHE_MODE=SYNC + +##########################SqlNetworkServer Section######################## + +# Whether to enable SqlNetwork server +CSQL_SQL_SERVER=false + +#Set port for Network access +PORT=5678 + +# Max number of seconds that the network layer waits to receive a pkt +NETWORK_RESPONSE_TIMEOUT=3 + +# Max number of seconds that the network layer waits to connect to sql server +NETWORK_CONNECT_TIMEOUT=5 + +#Whether to enable Replication across the sites +REPLICATION=false + +#No of sites to replicate +REPLICATION_SITES=16 + +#Give full path for the file where all the table information is stored +TABLE_CONFIG_FILE=/tmp/csql/csqltable.conf + +#Give full path of the file where all the DSN information is stored +DS_CONFIG_FILE=/tmp/csql/csqlds.conf + +#Give full path for the file where all the peer site information is stored +NETWORK_CONFIG_FILE=/tmp/csql/csqlnw.conf + +# Give full path for conflict Resolution file +CONFL_RESOL_FILE=/tmp/csql/conflResoFile.txt + +# MSGKEY for creating msg queue for MsgQueue Server +MSG_KEY=2525 + +# Maximum message that the message queue server is able to handle for +# asynchronous updates. This value is is default value of 'kernel.msgmax' +# parameter. +ASYNC_MSGMAX=8192 + +# Maximum number of messages that the message queue server will hold for a site +# that is down in the replication group. +MAX_QUEUE_LOGS=100 + +# Shared memory key for id generators +ID_SHM_KEY=1947 +#####################################End Section######################## diff --git a/test/sql/Predicate/exp.test001.ksh b/test/sql/Predicate/exp.test001.ksh new file mode 100644 index 00000000..0d8564d2 --- /dev/null +++ b/test/sql/Predicate/exp.test001.ksh @@ -0,0 +1,73 @@ +echo CREATE TABLE t1 (f1 INT , f2 VARCHAR (12)); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1 ABCD + 2 ABCDE + 3 ABCEF + 4 ABCCF + 5 ABCFF + 6 ABCDG + 7 ABDCG + +echo select * from t1 where f2='ABCD'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1 ABCD + +echo select * from t1 where f2<'ABCD'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 4 ABCCF + +echo select * from t1 where f2>'ABCD'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2 ABCDE + 3 ABCEF + 5 ABCFF + 6 ABCDG + 7 ABDCG + +echo select * from t1 where f2<='ABCD'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1 ABCD + 4 ABCCF + +echo select * from t1 where f2>='ABCD'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1 ABCD + 2 ABCDE + 3 ABCEF + 5 ABCFF + 6 ABCDG + 7 ABDCG + +echo select * from t1 where f2!='ABCD'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2 ABCDE + 3 ABCEF + 4 ABCCF + 5 ABCFF + 6 ABCDG + 7 ABDCG + +Statement Executed diff --git a/test/sql/Predicate/exp.test002.ksh b/test/sql/Predicate/exp.test002.ksh new file mode 100644 index 00000000..cacaf8fb --- /dev/null +++ b/test/sql/Predicate/exp.test002.ksh @@ -0,0 +1,73 @@ +echo CREATE TABLE t1 (f1 INT , f2 VARCHAR (12)); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1 ABCD + 2 ABCDE + 3 ABCEF + 4 ABCCF + 5 ABCFF + 6 ABCDG + 7 ABDCG + +echo select * from t1 where f2 like 'ABC%'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1 ABCD + 2 ABCDE + 3 ABCEF + 4 ABCCF + 5 ABCFF + 6 ABCDG + +echo select * from t1 where f2 like 'ABCD%'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1 ABCD + 2 ABCDE + 6 ABCDG + +echo select * from t1 where f2 like 'ABC%F'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 3 ABCEF + 4 ABCCF + 5 ABCFF + +echo select * from t1 where f2 like 'ABCD_'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2 ABCDE + 6 ABCDG + +echo select * from t1 where f2 in ('ABCDE','ABCCF','ABCDG'); +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2 ABCDE + 4 ABCCF + 6 ABCDG + +echo select * from t1 where f2 in ('ABCDE','ADCBF','ABCDG'); +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2 ABCDE + 6 ABCDG + +echo select * from t1 where f2 in ('ABCDE','ADCBF',NULL); +Statement prepare failed with error -19 +Statement Executed diff --git a/test/sql/Predicate/exp.test003.ksh b/test/sql/Predicate/exp.test003.ksh new file mode 100644 index 00000000..aab28b3f --- /dev/null +++ b/test/sql/Predicate/exp.test003.ksh @@ -0,0 +1,42 @@ +echo CREATE TABLE t1 (f1 INT , f2 VARCHAR (12)); +Statement Executed +echo INSERT INTO t1 VALUES(1, 'ABCD'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(2, 'NULL'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(3, NULL); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(4, 'ABCEF'); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 (f1) VALUES (5); +Statement Executed: Rows Affected = 1 +echo INSERT INTO t1 VALUES(6, 'ABCFF'); +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1 ABCD + 2 NULL + 3 NULL + 4 ABCEF + 5 NULL + 6 ABCFF + +echo select * from t1 where f2 is null; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 3 NULL + 5 NULL + +echo select * from t1 where f2 is not null; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1 ABCD + 2 NULL + 4 ABCEF + 6 ABCFF + +Statement Executed diff --git a/test/sql/Predicate/exp.test004.ksh b/test/sql/Predicate/exp.test004.ksh new file mode 100644 index 00000000..3e8e04d9 --- /dev/null +++ b/test/sql/Predicate/exp.test004.ksh @@ -0,0 +1,96 @@ +echo Create table t1(f1 varchar(10), f2 char(10), f3 varchar(10), f4 int); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 +--------------------------------------------------------- + CSQL1 LAKS1 BBSR1 10 + CSQL1 LAKS1 BBSR2 20 + CSQL1 LAKS2 BBSR3 30 + CSQL1 LAKS2 BBSR4 40 + CSQL2 LAKS3 BBSR5 50 + CSQL2 LAKS3 BBSR6 60 + CSQL2 LAKS4 BBSR7 70 + CSQL2 LAKS4 BBSR8 80 + +echo select * from t1 where f1='CSQL2'; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 +--------------------------------------------------------- + CSQL2 LAKS3 BBSR5 50 + CSQL2 LAKS3 BBSR6 60 + CSQL2 LAKS4 BBSR7 70 + CSQL2 LAKS4 BBSR8 80 + +echo select * from t1 where not(f1='CSQL2'); +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 +--------------------------------------------------------- + CSQL1 LAKS1 BBSR1 10 + CSQL1 LAKS1 BBSR2 20 + CSQL1 LAKS2 BBSR3 30 + CSQL1 LAKS2 BBSR4 40 + +echo select * from t1 where f1='CSQL1' and f2='LAKS1'; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 +--------------------------------------------------------- + CSQL1 LAKS1 BBSR1 10 + CSQL1 LAKS1 BBSR2 20 + +echo select * from t1 where f2='LAKS1' and not(f1='CSQL2'); +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 +--------------------------------------------------------- + CSQL1 LAKS1 BBSR1 10 + CSQL1 LAKS1 BBSR2 20 + +echo select * from t1 where f1='CSQL1' and f2='LAKS1' and f3='BBSR1'; +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 +--------------------------------------------------------- + CSQL1 LAKS1 BBSR1 10 + +echo select * from t1 where f1='CSQL1' and f2='LAKS1' and not(f3='BBSR1'); +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 +--------------------------------------------------------- + CSQL1 LAKS1 BBSR2 20 + +echo select * from t1 where f1='CSQL1' and f2='LAKS1' and not(f4=20); +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 +--------------------------------------------------------- + CSQL1 LAKS1 BBSR1 10 + +echo select * from t1 where f1='CSQL1' and f2='LAKS1' or not(f4=20); +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 +--------------------------------------------------------- + CSQL1 LAKS1 BBSR1 10 + CSQL1 LAKS1 BBSR2 20 + CSQL1 LAKS2 BBSR3 30 + CSQL1 LAKS2 BBSR4 40 + CSQL2 LAKS3 BBSR5 50 + CSQL2 LAKS3 BBSR6 60 + CSQL2 LAKS4 BBSR7 70 + CSQL2 LAKS4 BBSR8 80 + +echo select * from t1 where f1='CSQL1' or f2='LAKS1' and not(f4=20); +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 t1.f4 +--------------------------------------------------------- + CSQL1 LAKS1 BBSR1 10 + CSQL1 LAKS1 BBSR2 20 + CSQL1 LAKS2 BBSR3 30 + CSQL1 LAKS2 BBSR4 40 + +Statement Executed diff --git a/test/sql/Predicate/test001.ksh b/test/sql/Predicate/test001.ksh new file mode 100755 index 00000000..6854fffa --- /dev/null +++ b/test/sql/Predicate/test001.ksh @@ -0,0 +1,51 @@ +#!/bin/ksh +# Testing Relational Operators(=,<,>,<=,>=,!=) with varchar +# CREATE TABLE t1 (f1 INT , f2 VARCHAR (12)); +# INSERT INTO t1 VALUES(1, 'ABCD'); +# INSERT INTO t1 VALUES(2, 'ABCDE'); +# INSERT INTO t1 VALUES(3, 'ABCEF'); +# INSERT INTO t1 VALUES(4, 'ABCCF'); +# INSERT INTO t1 VALUES(5, 'ABCFF'); +# INSERT INTO t1 VALUES(6, 'ABCDG'); +# INSERT INTO t1 VALUES(7, 'ABDCG'); +# Test the below queries return proper result set or not. +# select * from t1; +# select * from t1 where f2='ABCD'; +# select * from t1 where f2<'ABCD'; +# select * from t1 where f2>'ABCD'; +# select * from t1 where f2<='ABCD'; +# select * from t1 where f2>='ABCD'; +# select * from t1 where f2!='ABCD'; +# +CREATEFILE=${PWD}/sql/Predicate/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Predicate +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_relational.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_relational.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/Predicate/test002.ksh b/test/sql/Predicate/test002.ksh new file mode 100755 index 00000000..2b53abb1 --- /dev/null +++ b/test/sql/Predicate/test002.ksh @@ -0,0 +1,52 @@ +#!/bin/ksh +# Testing LIKE, IN Operators with varchar +# CREATE TABLE t1 (f1 INT , f2 VARCHAR (12)); +# INSERT INTO t1 VALUES(1, 'ABCD'); +# INSERT INTO t1 VALUES(2, 'ABCDE'); +# INSERT INTO t1 VALUES(3, 'ABCEF'); +# INSERT INTO t1 VALUES(4, 'ABCCF'); +# INSERT INTO t1 VALUES(5, 'ABCFF'); +# INSERT INTO t1 VALUES(6, 'ABCDG'); +# INSERT INTO t1 VALUES(7, 'ABDCG'); +# Test the below queries return proper result set or not. +# select * from t1; +# select * from t1 where f2 like 'ABC%'; +# select * from t1 where f2 like 'ABCD%'; +# select * from t1 where f2 like 'ABC%F'; +# select * from t1 where f2 in ('ABCDE','ABCCF','ABCDG'); +# select * from t1 where f2 in ('ABCDE','ADCBF','ABCDG'); +# The below statement should be fail, saying "Condition value should not be NULL" +# select * from t1 where f2 in ('ABCDE','ADCBF',NULL); +# +CREATEFILE=${PWD}/sql/Predicate/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Predicate +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_like_in.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_like_in.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/Predicate/test003.ksh b/test/sql/Predicate/test003.ksh new file mode 100755 index 00000000..e01c9c15 --- /dev/null +++ b/test/sql/Predicate/test003.ksh @@ -0,0 +1,45 @@ +#!/bin/ksh +# Testing 'is null'/'is not null' Operators with varchar +# CREATE TABLE t1 (f1 INT , f2 VARCHAR (12)); +# INSERT INTO t1 VALUES(1, 'ABCD'); +# INSERT INTO t1 VALUES(2, 'NULL'); +# INSERT INTO t1 VALUES(3, 'ABCEF'); +# INSERT INTO t1 (f1) VALUES (4); +# INSERT INTO t1 VALUES(5, 'ABCFF'); +# Test the below queries return proper result set or not. +# select * from t1; +# select * from t1 where f2 is null; +# select * from t1 where f2 is not null; +# +CREATEFILE=${PWD}/sql/Predicate/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Predicate +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_NULL.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_NULL.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/Predicate/test004.ksh b/test/sql/Predicate/test004.ksh new file mode 100755 index 00000000..17b49388 --- /dev/null +++ b/test/sql/Predicate/test004.ksh @@ -0,0 +1,55 @@ +#!/bin/ksh +# Testing Logical Operators(AND, OR, NOT) with varchar +# Create table t1(f1 varchar(10), f2 char(10), f3 varchar(10), f4 int); +# Insert into t1 values('CSQL1', 'LAKS1','BBSR1',10); +# Insert into t1 values('CSQL1', 'LAKS1','BBSR2',20); +# Insert into t1 values('CSQL1', 'LAKS2','BBSR3',30); +# Insert into t1 values('CSQL1', 'LAKS2','BBSR4',40); +# Insert into t1 values('CSQL2', 'LAKS3','BBSR5',50); +# Insert into t1 values('CSQL2', 'LAKS3','BBSR6',60); +# Insert into t1 values('CSQL2', 'LAKS4','BBSR7',70); +# Insert into t1 values('CSQL2', 'LAKS4','BBSR8',80); +# Test the below queries return proper result set or not. +# select * from t1; +# select * from t1 where f1='CSQL2'; +# select * from t1 where not(f1='CSQL2'); +# select * from t1 where f1='CSQL1' and f2='LAKS1'; +# select * from t1 where f2='LAKS1' and not(f1='CSQL2'); +# select * from t1 where f1='CSQL1' and f2='LAKS1' and f3='BBSR1'; +# select * from t1 where f1='CSQL1' and f2='LAKS1' and not(f3='BBSR1'); +# select * from t1 where f1='CSQL1' and f2='LAKS1' and not(f4=20); +# select * from t1 where f1='CSQL1' and f2='LAKS1' or not(f4=20); +# select * from t1 where f1='CSQL1' or f2='LAKS1' and not(f4=20); +# +CREATEFILE=${PWD}/sql/Predicate/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Predicate +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_logical.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_logical.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/Predicate/test005.ksh b/test/sql/Predicate/test005.ksh new file mode 100755 index 00000000..36b7babe --- /dev/null +++ b/test/sql/Predicate/test005.ksh @@ -0,0 +1,54 @@ +#!/bin/ksh +# Testing Relational Operators(,<,>,<,>=,!=) with varchar in Update statement. ( ) +# REATE TABLE t1 (f1 INT , f2 VARCHAR (12)); +# NSERT INTO t1 VALUES(1, 'ABCDE'); +# NSERT INTO t1 VALUES(2, 'ABCDF'); +# NSERT INTO t1 VALUES(3, 'ABCDG'); +# NSERT INTO t1 VALUES(4, 'ABCDH'); +# NSERT INTO t1 VALUES(5, 'ABCDI'); +# NSERT INTO t1 VALUES(6, 'NBCDE'); +# NSERT INTO t1 VALUES(7, 'NBCDF'); +# NSERT INTO t1 VALUES(8, 'NBCDG'); +# NSERT INTO t1 VALUES(9, 'NBCDH'); +# NSERT INTO t1 VALUES(10, 'NBCDI'); +# est the below Update statements return proper result set or not. +# elect * from t1; +# pdate t1 set f1=100, f2='Lakshya10' where f2='NBCDI'; +# pdate t1 set f1=85, f2='Lakshya8.5' where f2>='NBCDG'; +# pdate t1 set f1=70, f2='Lakshya7' where f2>'NBCDE'; +# pdate t1 set f1=15, f2='Lakshya1.5' where f2<'ABCDG'; +# update t1 set f1=30, f2='Lakshya3' where f2<='ABCDH'; +# update t1 set f1=55, f2='Lakshya5.5' where f2!='Lakshya8.5'; +# +CREATEFILE=${PWD}/sql/Predicate/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Predicate +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_relational_upd.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_relational_upd.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/Predicate/test006.ksh b/test/sql/Predicate/test006.ksh new file mode 100755 index 00000000..56f65ee2 --- /dev/null +++ b/test/sql/Predicate/test006.ksh @@ -0,0 +1,48 @@ +#!/bin/ksh +# Testing LIKE, IN Operators with varchar in Update Statement. ( ) +# CREATE TABLE t1 (f1 INT , f2 VARCHAR (12)); +# INSERT INTO t1 VALUES(1, 'ABCDE'); +# INSERT INTO t1 VALUES(2, 'ABCDF'); +# INSERT INTO t1 VALUES(3, 'NBCDGH'); +# INSERT INTO t1 VALUES(4, 'NABCDIJ'); +# INSERT INTO t1 VALUES(5, 'PQRST'); +# INSERT INTO t1 VALUES(6, 'NIHAR'); +# INSERT INTO t1 VALUES(7, 'RAHUL'); +# Test the below Update statements return proper result set or not. +# select * from t1; +# Update t1 set f1=10, f2='CSQL1' where f2 LIKE 'ABCD%'; +# Update t1 set f1=25, f2='CSQL2.5' where f2 LIKE '_BCD%'; +# Update t1 set f1=56, f2='CSQL6.5' where f2 in ('NIHAR','rahul','CSQL1'); +# +CREATEFILE=${PWD}/sql/Predicate/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Predicate +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_like_in_upd.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_like_in_upd.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/Predicate/test007.ksh b/test/sql/Predicate/test007.ksh new file mode 100755 index 00000000..8c20b443 --- /dev/null +++ b/test/sql/Predicate/test007.ksh @@ -0,0 +1,46 @@ +#!/bin/ksh +# Testing 'is null'/'is not null' Operators with varchar using Update statement. ( ) +# CREATE TABLE t1 (f1 INT , f2 VARCHAR (12)); +# INSERT INTO t1 VALUES(1, 'ABCD'); +# INSERT INTO t1 VALUES(2, 'NULL'); +# INSERT INTO t1 VALUES(3, NULL); +# INSERT INTO t1 VALUES(4, 'ABCEF'); +# INSERT INTO t1 (f1) VALUES (5); +# INSERT INTO t1 VALUES(6, 'ABCFF'); +# Test the below queries return proper result set or not. +# select * from t1; +# Update t1 set f1= 15, f2=NULL where f2 IS NOT NULL; +# Update t1 set f1= 25, f2='CSQL_LAKSHYA' where f2 IS NULL and f1 <= 3; +# +CREATEFILE=${PWD}/sql/Predicate/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Predicate +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_NULL_upd.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_NULL_upd.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/Predicate/test008.ksh b/test/sql/Predicate/test008.ksh new file mode 100755 index 00000000..e50d377b --- /dev/null +++ b/test/sql/Predicate/test008.ksh @@ -0,0 +1,54 @@ +#!/bin/ksh +# Testing Logical Operators(AND, OR, NOT) with varchar using Update statement. (sql/Predicate/test004.ksh) +# Create table t1(f1 varchar(10), f2 char(10), f3 varchar(10), f4 int); +# Insert into t1 values('CSQL1', 'LAKS1','BBSR1',10); +# Insert into t1 values('CSQL1', 'LAKS1','BBSR2',20); +# Insert into t1 values('CSQL1', 'LAKS2','BBSR3',30); +# Insert into t1 values('CSQL1', 'LAKS2','BBSR4',40); +# Insert into t1 values('CSQL2', 'LAKS3','BBSR5',50); +# Insert into t1 values('CSQL2', 'LAKS3','BBSR6',60); +# Insert into t1 values('CSQL2', 'LAKS4','BBSR7',70); +# Insert into t1 values('CSQL2', 'LAKS4','BBSR8',80); +# Test the below queries return proper result set or not. +# select * from t1; +# update t1 set f3='Orissa1',f4=100 where f3='BBSR1' and f1='CSQL1'; +# update t1 set f3='Orissa1',f4=100 where not(f3='BBSR1') and f1='CSQL2'; +# update t1 set f3='Orissa2',f4=200 where f3='BBSR2' or f1='CSQL1'; +# update t1 set f3='Orissa3',f4=300 where f1='CSQL1' and f3 like '__issa2'; +# update t1 set f3='Orissa4',f4=400 where f2='LAKS2' and f3 like '_r%3'; +# update t1 set f3='Orissa4',f4=400 where not(f3='Orissa1') or f2 in ('LAKS3','LAKS5'); +# update t1 set f3='Orissa4',f4=400 where not(f3='Orissa1') or f2 in ('LAKS3',NULL); +# update t1 set f3='Orissa5',f2='LAKS5' where f1='CSQL1' and f3 like 'O_is_a4'; +# +CREATEFILE=${PWD}/sql/Predicate/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Predicate +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_logical_upd.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_logical_upd.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/Predicate/test009.ksh b/test/sql/Predicate/test009.ksh new file mode 100755 index 00000000..5fa3da73 --- /dev/null +++ b/test/sql/Predicate/test009.ksh @@ -0,0 +1,54 @@ +#!/bin/ksh +# Testing Relational Operators(,<,>,<,>=,!=) with varchar in Delete statement. ( ) +# CREATE TABLE t1 (f1 INT , f2 VARCHAR (12)); +# INSERT INTO t1 VALUES(1, 'ABCDE'); +# INSERT INTO t1 VALUES(2, 'ABCDF'); +# INSERT INTO t1 VALUES(3, 'ABCDG'); +# INSERT INTO t1 VALUES(4, 'ABCDH'); +# INSERT INTO t1 VALUES(5, 'ABCDI'); +# INSERT INTO t1 VALUES(6, 'NBCDE'); +# INSERT INTO t1 VALUES(7, 'NBCDF'); +# INSERT INTO t1 VALUES(8, 'NBCDG'); +# INSERT INTO t1 VALUES(9, 'NBCDH'); +# INSERT INTO t1 VALUES(10, 'NBCDI'); +# Test the below Update statements return proper result set or not. +# select * from t1; +# delete from t1 where f2='NBCDI'; +# delete from t1 where f2>'NBCDG'; +# delete from t1 where f2>='NBCDF'; +# delete from t1 where f2<'ABCDF'; +# delete from t1 where f2<='ABCDH'; +# delete from t1 where f2!='NBCDE'; +# +CREATEFILE=${PWD}/sql/Predicate/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Predicate +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_relational_del.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_relational_del.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/Predicate/test010.ksh b/test/sql/Predicate/test010.ksh new file mode 100755 index 00000000..b4ec16d0 --- /dev/null +++ b/test/sql/Predicate/test010.ksh @@ -0,0 +1,48 @@ +#!/bin/ksh +# Testing LIKE, IN Operators with varchar in Delete Statement. ( ) +# CREATE TABLE t1 (f1 INT , f2 VARCHAR (12)); +# INSERT INTO t1 VALUES(1, 'ABCDE'); +# INSERT INTO t1 VALUES(2, 'ABCDF'); +# INSERT INTO t1 VALUES(3, 'NBCDGH'); +# INSERT INTO t1 VALUES(4, 'NABCDIJ'); +# INSERT INTO t1 VALUES(5, 'PQRST'); +# INSERT INTO t1 VALUES(6, 'NIHAR'); +# INSERT INTO t1 VALUES(7, 'RAHUL'); +# Test the below Update statements return proper result set or not. +# select * from t1; +# DELETE FROM t1 where f2 LIKE 'ABCD%'; +# DELETE FROM t1 where f2 LIKE '_BCD%'; +# DELETE FROM t1 where f2 in ('NIHAR','rahul','CSQL1'); +# +CREATEFILE=${PWD}/sql/Predicate/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Predicate +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_like_in_del.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_like_in_del.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/Predicate/test011.ksh b/test/sql/Predicate/test011.ksh new file mode 100755 index 00000000..5d84e56b --- /dev/null +++ b/test/sql/Predicate/test011.ksh @@ -0,0 +1,46 @@ +#!/bin/ksh +# Testing 'is null'/'is not null' Operators with varchar using Delete statement. ( ) +# CREATE TABLE t1 (f1 INT , f2 VARCHAR (12)); +# INSERT INTO t1 VALUES(1, 'ABCD'); +# INSERT INTO t1 VALUES(2, 'NULL'); +# INSERT INTO t1 VALUES(3, NULL); +# INSERT INTO t1 VALUES(4, 'ABCEF'); +# INSERT INTO t1 (f1) VALUES (5); +# INSERT INTO t1 VALUES(6, 'ABCFF'); +# Test the below queries return proper result set or not. +# select * from t1; +# DELETE FROM t1 where f2 IS NOT NULL; +# DELETE FROM t1 where f2 IS NULL; +# +CREATEFILE=${PWD}/sql/Predicate/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Predicate +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_NULL_del.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_NULL_del.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/Predicate/test012.ksh b/test/sql/Predicate/test012.ksh new file mode 100755 index 00000000..2add08c9 --- /dev/null +++ b/test/sql/Predicate/test012.ksh @@ -0,0 +1,49 @@ +#!/bin/ksh +# Testing Logical Operators(AND, OR, NOT) with varchar using Delete statement. (sql/Predicate/test004.ksh) +# Create table t1(f1 varchar(10), f2 char(10), f3 varchar(10), f4 int); +# Insert into t1 values('CSQL1', 'LAKS1','BBSR1',10); +# Insert into t1 values('CSQL1', 'LAKS1','BBSR2',20); +# Insert into t1 values('CSQL1', 'LAKS2','BBSR3',30); +# Insert into t1 values('CSQL1', 'LAKS2','BBSR4',40); +# Insert into t1 values('CSQL2', 'LAKS3','BBSR5',50); +# Insert into t1 values('CSQL2', 'LAKS3','BBSR6',60); +# Insert into t1 values('CSQL2', 'LAKS4','BBSR7',70); +# Insert into t1 values('CSQL2', 'LAKS4','BBSR8',80); +# Test the below queries return proper result set or not. +# select * from t1; +# delete from t1 where f3='BBSR1' and f1='CSQL1'; +# delete from t1 where not(f3='BBSR1') and f1='CSQL2'; +# delete from t1 where f1='CSQL1' and f3 like 'B_S%' and f4<=30; +# +CREATEFILE=${PWD}/sql/Predicate/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/Predicate +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_logical_del.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/varchar_logical_del.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/Predicate/varchar_NULL.sql b/test/sql/Predicate/varchar_NULL.sql new file mode 100644 index 00000000..bba3be29 --- /dev/null +++ b/test/sql/Predicate/varchar_NULL.sql @@ -0,0 +1,21 @@ +echo CREATE TABLE t1 (f1 INT , f2 VARCHAR (12)); +CREATE TABLE t1 (f1 INT , f2 VARCHAR (12)); +echo INSERT INTO t1 VALUES(1, 'ABCD'); +INSERT INTO t1 VALUES(1, 'ABCD'); +echo INSERT INTO t1 VALUES(2, 'NULL'); +INSERT INTO t1 VALUES(2, 'NULL'); +echo INSERT INTO t1 VALUES(3, NULL); +INSERT INTO t1 VALUES(3, NULL); +echo INSERT INTO t1 VALUES(4, 'ABCEF'); +INSERT INTO t1 VALUES(4, 'ABCEF'); +echo INSERT INTO t1 (f1) VALUES (5); +INSERT INTO t1 (f1) VALUES (5); +echo INSERT INTO t1 VALUES(6, 'ABCFF'); +INSERT INTO t1 VALUES(6, 'ABCFF'); +echo select * from t1; +select * from t1; +echo select * from t1 where f2 is null; +select * from t1 where f2 is null; +echo select * from t1 where f2 is not null; +select * from t1 where f2 is not null; + diff --git a/test/sql/Predicate/varchar_NULL_del.sql b/test/sql/Predicate/varchar_NULL_del.sql new file mode 100644 index 00000000..86e921da --- /dev/null +++ b/test/sql/Predicate/varchar_NULL_del.sql @@ -0,0 +1,18 @@ +echo CREATE TABLE t1 (f1 INT , f2 VARCHAR (12)); +CREATE TABLE t1 (f1 INT , f2 VARCHAR (12)); +INSERT INTO t1 VALUES(1, 'ABCD'); +INSERT INTO t1 VALUES(2, 'NULL'); +INSERT INTO t1 VALUES(3, NULL); +INSERT INTO t1 VALUES(4, 'ABCEF'); +INSERT INTO t1 (f1) VALUES (5); +INSERT INTO t1 VALUES(6, 'ABCFF'); +echo select * from t1; +select * from t1; +echo DELETE FROM t1 where f2 IS NOT NULL; +DELETE FROM t1 where f2 IS NOT NULL; +echo select * from t1; +select * from t1; +echo DELETE FROM t1 where f2 IS NULL; +DELETE FROM t1 where f2 IS NULL; +echo select * from t1; +select * from t1; diff --git a/test/sql/Predicate/varchar_NULL_upd.sql b/test/sql/Predicate/varchar_NULL_upd.sql new file mode 100644 index 00000000..adc695dd --- /dev/null +++ b/test/sql/Predicate/varchar_NULL_upd.sql @@ -0,0 +1,18 @@ +echo CREATE TABLE t1 (f1 INT , f2 VARCHAR (12)); +CREATE TABLE t1 (f1 INT , f2 VARCHAR (12)); +INSERT INTO t1 VALUES(1, 'ABCD'); +INSERT INTO t1 VALUES(2, 'NULL'); +INSERT INTO t1 VALUES(3, NULL); +INSERT INTO t1 VALUES(4, 'ABCEF'); +INSERT INTO t1 (f1) VALUES (5); +INSERT INTO t1 VALUES(6, 'ABCFF'); +echo select * from t1; +select * from t1; +echo Update t1 set f1= 15, f2=NULL where f2 IS NOT NULL; +Update t1 set f1= 15, f2=NULL where f2 IS NOT NULL; +echo select * from t1; +select * from t1; +echo Update t1 set f1= 25, f2='CSQL_LAKSHYA' where f2 IS NULL and f1 <= 3; +Update t1 set f1= 25, f2='CSQL_LAKSHYA' where f2 IS NULL and f1 <= 3; +echo select * from t1; +select * from t1; diff --git a/test/sql/Predicate/varchar_like_in.sql b/test/sql/Predicate/varchar_like_in.sql new file mode 100644 index 00000000..ea385dfc --- /dev/null +++ b/test/sql/Predicate/varchar_like_in.sql @@ -0,0 +1,25 @@ +echo CREATE TABLE t1 (f1 INT , f2 VARCHAR (12)); +CREATE TABLE t1 (f1 INT , f2 VARCHAR (12)); +INSERT INTO t1 VALUES(1, 'ABCD'); +INSERT INTO t1 VALUES(2, 'ABCDE'); +INSERT INTO t1 VALUES(3, 'ABCEF'); +INSERT INTO t1 VALUES(4, 'ABCCF'); +INSERT INTO t1 VALUES(5, 'ABCFF'); +INSERT INTO t1 VALUES(6, 'ABCDG'); +INSERT INTO t1 VALUES(7, 'ABDCG'); +echo select * from t1; +select * from t1; +echo select * from t1 where f2 like 'ABC%'; +select * from t1 where f2 like 'ABC%'; +echo select * from t1 where f2 like 'ABCD%'; +select * from t1 where f2 like 'ABCD%'; +echo select * from t1 where f2 like 'ABC%F'; +select * from t1 where f2 like 'ABC%F'; +echo select * from t1 where f2 like 'ABCD_'; +select * from t1 where f2 like 'ABCD_'; +echo select * from t1 where f2 in ('ABCDE','ABCCF','ABCDG'); +select * from t1 where f2 in ('ABCDE','ABCCF','ABCDG'); +echo select * from t1 where f2 in ('ABCDE','ADCBF','ABCDG'); +select * from t1 where f2 in ('ABCDE','ADCBF','ABCDG'); +echo select * from t1 where f2 in ('ABCDE','ADCBF',NULL); +select * from t1 where f2 in ('ABCDE','ADCBF',NULL); diff --git a/test/sql/Predicate/varchar_like_in_del.sql b/test/sql/Predicate/varchar_like_in_del.sql new file mode 100644 index 00000000..006685e2 --- /dev/null +++ b/test/sql/Predicate/varchar_like_in_del.sql @@ -0,0 +1,23 @@ +echo CREATE TABLE t1 (f1 INT , f2 VARCHAR (12)); +CREATE TABLE t1 (f1 INT , f2 VARCHAR (12)); +INSERT INTO t1 VALUES(1, 'ABCDE'); +INSERT INTO t1 VALUES(2, 'ABCDF'); +INSERT INTO t1 VALUES(3, 'NBCDGH'); +INSERT INTO t1 VALUES(4, 'NABCDIJ'); +INSERT INTO t1 VALUES(5, 'PQRST'); +INSERT INTO t1 VALUES(6, 'NIHAR'); +INSERT INTO t1 VALUES(7, 'RAHUL'); +echo select * from t1; +select * from t1; +echo DELETE FROM t1 where f2 LIKE 'ABCD%'; +DELETE FROM t1 where f2 LIKE 'ABCD%'; +echo select * from t1; +select * from t1; +echo DELETE FROM t1 where f2 LIKE '_BCD%'; +DELETE FROM t1 where f2 LIKE '_BCD%'; +echo select * from t1; +select * from t1; +echo DELETE FROM t1 where f2 in ('NIHAR','rahul','CSQL1'); +DELETE FROM t1 where f2 in ('NIHAR','rahul','CSQL1'); +echo select * from t1; +select * from t1; diff --git a/test/sql/Predicate/varchar_like_in_upd.sql b/test/sql/Predicate/varchar_like_in_upd.sql new file mode 100644 index 00000000..c796082a --- /dev/null +++ b/test/sql/Predicate/varchar_like_in_upd.sql @@ -0,0 +1,23 @@ +echo CREATE TABLE t1 (f1 INT , f2 VARCHAR (12)); +CREATE TABLE t1 (f1 INT , f2 VARCHAR (12)); +INSERT INTO t1 VALUES(1, 'ABCDE'); +INSERT INTO t1 VALUES(2, 'ABCDF'); +INSERT INTO t1 VALUES(3, 'NBCDGH'); +INSERT INTO t1 VALUES(4, 'NABCDIJ'); +INSERT INTO t1 VALUES(5, 'PQRST'); +INSERT INTO t1 VALUES(6, 'NIHAR'); +INSERT INTO t1 VALUES(7, 'RAHUL'); +echo select * from t1; +select * from t1; +echo Update t1 set f1=10, f2='CSQL1' where f2 LIKE 'ABCD%'; +Update t1 set f1=10, f2='CSQL1' where f2 LIKE 'ABCD%'; +echo select * from t1; +select * from t1; +echo Update t1 set f1=25, f2='CSQL2.5' where f2 LIKE '_BCD%'; +Update t1 set f1=25, f2='CSQL2.5' where f2 LIKE '_BCD%'; +echo select * from t1; +select * from t1; +echo Update t1 set f1=56, f2='CSQL6.5' where f2 in ('NIHAR','rahul','CSQL1'); +Update t1 set f1=56, f2='CSQL6.5' where f2 in ('NIHAR','rahul','CSQL1'); +echo select * from t1; +select * from t1; diff --git a/test/sql/Predicate/varchar_logical.sql b/test/sql/Predicate/varchar_logical.sql new file mode 100644 index 00000000..0ec851af --- /dev/null +++ b/test/sql/Predicate/varchar_logical.sql @@ -0,0 +1,30 @@ +echo Create table t1(f1 varchar(10), f2 char(10), f3 varchar(10), f4 int); +Create table t1(f1 varchar(10), f2 char(10), f3 varchar(10), f4 int); +Insert into t1 values('CSQL1', 'LAKS1','BBSR1',10); +Insert into t1 values('CSQL1', 'LAKS1','BBSR2',20); +Insert into t1 values('CSQL1', 'LAKS2','BBSR3',30); +Insert into t1 values('CSQL1', 'LAKS2','BBSR4',40); +Insert into t1 values('CSQL2', 'LAKS3','BBSR5',50); +Insert into t1 values('CSQL2', 'LAKS3','BBSR6',60); +Insert into t1 values('CSQL2', 'LAKS4','BBSR7',70); +Insert into t1 values('CSQL2', 'LAKS4','BBSR8',80); +echo select * from t1; +select * from t1; +echo select * from t1 where f1='CSQL2'; +select * from t1 where f1='CSQL2'; +echo select * from t1 where not(f1='CSQL2'); +select * from t1 where not(f1='CSQL2'); +echo select * from t1 where f1='CSQL1' and f2='LAKS1'; +select * from t1 where f1='CSQL1' and f2='LAKS1'; +echo select * from t1 where f2='LAKS1' and not(f1='CSQL2'); +select * from t1 where f2='LAKS1' and not(f1='CSQL2'); +echo select * from t1 where f1='CSQL1' and f2='LAKS1' and f3='BBSR1'; +select * from t1 where f1='CSQL1' and f2='LAKS1' and f3='BBSR1'; +echo select * from t1 where f1='CSQL1' and f2='LAKS1' and not(f3='BBSR1'); +select * from t1 where f1='CSQL1' and f2='LAKS1' and not(f3='BBSR1'); +echo select * from t1 where f1='CSQL1' and f2='LAKS1' and not(f4=20); +select * from t1 where f1='CSQL1' and f2='LAKS1' and not(f4=20); +echo select * from t1 where f1='CSQL1' and f2='LAKS1' or not(f4=20); +select * from t1 where f1='CSQL1' and f2='LAKS1' or not(f4=20); +echo select * from t1 where f1='CSQL1' or f2='LAKS1' and not(f4=20); +select * from t1 where f1='CSQL1' or f2='LAKS1' and not(f4=20); diff --git a/test/sql/Predicate/varchar_logical_del.sql b/test/sql/Predicate/varchar_logical_del.sql new file mode 100644 index 00000000..2c880373 --- /dev/null +++ b/test/sql/Predicate/varchar_logical_del.sql @@ -0,0 +1,24 @@ +echo Create table t1(f1 varchar(10), f2 char(10), f3 varchar(10), f4 int); +Create table t1(f1 varchar(10), f2 char(10), f3 varchar(10), f4 int); +Insert into t1 values('CSQL1', 'LAKS1','BBSR1',10); +Insert into t1 values('CSQL1', 'LAKS1','BBSR2',20); +Insert into t1 values('CSQL1', 'LAKS2','BBSR3',30); +Insert into t1 values('CSQL1', 'LAKS2','BBSR4',40); +Insert into t1 values('CSQL2', 'LAKS3','BBSR5',50); +Insert into t1 values('CSQL2', 'LAKS3','BBSR6',60); +Insert into t1 values('CSQL2', 'LAKS4','BBSR7',70); +Insert into t1 values('CSQL2', 'LAKS4','BBSR8',80); +echo select * from t1; +select * from t1; +echo delete from t1 where f3='BBSR1' and f1='CSQL1'; +delete from t1 where f3='BBSR1' and f1='CSQL1'; +echo select * from t1; +select * from t1; +echo delete from t1 where not(f3='BBSR1') and f1='CSQL2'; +delete from t1 where not(f3='BBSR1') and f1='CSQL2'; +echo select * from t1; +select * from t1; +echo delete from t1 where f1='CSQL1' and f3 like 'B_S%' and f4<=30; +delete from t1 where f1='CSQL1' and f3 like 'B_S%' and f4<=30; +echo select * from t1; +select * from t1; diff --git a/test/sql/Predicate/varchar_logical_upd.sql b/test/sql/Predicate/varchar_logical_upd.sql new file mode 100644 index 00000000..37f5ba69 --- /dev/null +++ b/test/sql/Predicate/varchar_logical_upd.sql @@ -0,0 +1,44 @@ +echo Create table t1(f1 varchar(10), f2 char(10), f3 varchar(10), f4 int); +Create table t1(f1 varchar(10), f2 char(10), f3 varchar(10), f4 int); +Insert into t1 values('CSQL1', 'LAKS1','BBSR1',10); +Insert into t1 values('CSQL1', 'LAKS1','BBSR2',20); +Insert into t1 values('CSQL1', 'LAKS2','BBSR3',30); +Insert into t1 values('CSQL1', 'LAKS2','BBSR4',40); +Insert into t1 values('CSQL2', 'LAKS3','BBSR5',50); +Insert into t1 values('CSQL2', 'LAKS3','BBSR6',60); +Insert into t1 values('CSQL2', 'LAKS4','BBSR7',70); +Insert into t1 values('CSQL2', 'LAKS4','BBSR8',80); +echo select * from t1; +select * from t1; +echo update t1 set f3='Orissa1',f4=100 where f3='BBSR1' and f1='CSQL1'; +update t1 set f3='Orissa1',f4=100 where f3='BBSR1' and f1='CSQL1'; +echo select * from t1; +select * from t1; +echo update t1 set f3='Orissa1',f4=100 where not(f3='BBSR1') and f1='CSQL2'; +update t1 set f3='Orissa1',f4=100 where not(f3='BBSR1') and f1='CSQL2'; +echo select * from t1; +select * from t1; +echo update t1 set f3='Orissa2',f4=200 where f3='BBSR2' or f1='CSQL1'; +update t1 set f3='Orissa2',f4=200 where f3='BBSR2' or f1='CSQL1'; +echo select * from t1; +select * from t1; +echo update t1 set f3='Orissa3',f4=300 where f1='CSQL1' and f3 like '__issa2'; +update t1 set f3='Orissa3',f4=300 where f1='CSQL1' and f3 like '__issa2'; +echo select * from t1; +select * from t1; +echo update t1 set f3='Orissa4',f4=400 where f2='LAKS2' and f3 like '_r%3'; +update t1 set f3='Orissa4',f4=400 where f2='LAKS2' and f3 like '_r%3'; +echo select * from t1; +select * from t1; +echo update t1 set f3='Orissa4',f4=400 where not(f3='Orissa1') or f2 in ('LAKS3','LAKS5'); +update t1 set f3='Orissa4',f4=400 where not(f3='Orissa1') or f2 in ('LAKS3','LAKS5'); +echo select * from t1; +select * from t1; +echo update t1 set f3='Orissa4',f4=400 where not(f3='Orissa1') or f2 in ('LAKS3',NULL); +update t1 set f3='Orissa4',f4=400 where not(f3='Orissa1') or f2 in ('LAKS3',NULL); +echo select * from t1; +select * from t1; +echo update t1 set f3='Orissa5',f2='LAKS5' where f1='CSQL1' and f3 like 'O_is_a4'; +update t1 set f3='Orissa5',f2='LAKS5' where f1='CSQL1' and f3 like 'O_is_a4'; +echo select * from t1; +select * from t1; diff --git a/test/sql/Predicate/varchar_relational.sql b/test/sql/Predicate/varchar_relational.sql new file mode 100644 index 00000000..6720e540 --- /dev/null +++ b/test/sql/Predicate/varchar_relational.sql @@ -0,0 +1,23 @@ +echo CREATE TABLE t1 (f1 INT , f2 VARCHAR (12)); +CREATE TABLE t1 (f1 INT , f2 VARCHAR (12)); +INSERT INTO t1 VALUES(1, 'ABCD'); +INSERT INTO t1 VALUES(2, 'ABCDE'); +INSERT INTO t1 VALUES(3, 'ABCEF'); +INSERT INTO t1 VALUES(4, 'ABCCF'); +INSERT INTO t1 VALUES(5, 'ABCFF'); +INSERT INTO t1 VALUES(6, 'ABCDG'); +INSERT INTO t1 VALUES(7, 'ABDCG'); +echo select * from t1; +select * from t1; +echo select * from t1 where f2='ABCD'; +select * from t1 where f2='ABCD'; +echo select * from t1 where f2<'ABCD'; +select * from t1 where f2<'ABCD'; +echo select * from t1 where f2>'ABCD'; +select * from t1 where f2>'ABCD'; +echo select * from t1 where f2<='ABCD'; +select * from t1 where f2<='ABCD'; +echo select * from t1 where f2>='ABCD'; +select * from t1 where f2>='ABCD'; +echo select * from t1 where f2!='ABCD'; +select * from t1 where f2!='ABCD'; diff --git a/test/sql/Predicate/varchar_relational_del.sql b/test/sql/Predicate/varchar_relational_del.sql new file mode 100644 index 00000000..a5a6e7e3 --- /dev/null +++ b/test/sql/Predicate/varchar_relational_del.sql @@ -0,0 +1,38 @@ +echo CREATE TABLE t1 (f1 INT , f2 VARCHAR (12)); +CREATE TABLE t1 (f1 INT , f2 VARCHAR (12)); +INSERT INTO t1 VALUES(1, 'ABCDE'); +INSERT INTO t1 VALUES(2, 'ABCDF'); +INSERT INTO t1 VALUES(3, 'ABCDG'); +INSERT INTO t1 VALUES(4, 'ABCDH'); +INSERT INTO t1 VALUES(5, 'ABCDI'); +INSERT INTO t1 VALUES(6, 'NBCDE'); +INSERT INTO t1 VALUES(7, 'NBCDF'); +INSERT INTO t1 VALUES(8, 'NBCDG'); +INSERT INTO t1 VALUES(9, 'NBCDH'); +INSERT INTO t1 VALUES(10, 'NBCDI'); +echo select * from t1; +select * from t1; +echo delete from t1 where f2='NBCDI'; +delete from t1 where f2='NBCDI'; +echo select * from t1; +select * from t1; +echo delete from t1 where f2>'NBCDG'; +delete from t1 where f2>'NBCDG'; +echo select * from t1; +select * from t1; +echo delete from t1 where f2>='NBCDF'; +delete from t1 where f2>='NBCDF'; +echo select * from t1; +select * from t1; +echo delete from t1 where f2<'ABCDF'; +delete from t1 where f2<'ABCDF'; +echo select * from t1; +select * from t1; +echo delete from t1 where f2<='ABCDH'; +delete from t1 where f2<='ABCDH'; +echo select * from t1; +select * from t1; +echo delete from t1 where f2!='NBCDE'; +delete from t1 where f2!='NBCDE'; +echo select * from t1; +select * from t1; diff --git a/test/sql/Predicate/varchar_relational_upd.sql b/test/sql/Predicate/varchar_relational_upd.sql new file mode 100644 index 00000000..332bed9c --- /dev/null +++ b/test/sql/Predicate/varchar_relational_upd.sql @@ -0,0 +1,38 @@ +echo CREATE TABLE t1 (f1 INT , f2 VARCHAR (12)); +CREATE TABLE t1 (f1 INT , f2 VARCHAR (12)); +INSERT INTO t1 VALUES(1, 'ABCDE'); +INSERT INTO t1 VALUES(2, 'ABCDF'); +INSERT INTO t1 VALUES(3, 'ABCDG'); +INSERT INTO t1 VALUES(4, 'ABCDH'); +INSERT INTO t1 VALUES(5, 'ABCDI'); +INSERT INTO t1 VALUES(6, 'NBCDE'); +INSERT INTO t1 VALUES(7, 'NBCDF'); +INSERT INTO t1 VALUES(8, 'NBCDG'); +INSERT INTO t1 VALUES(9, 'NBCDH'); +INSERT INTO t1 VALUES(10, 'NBCDI'); +echo select * from t1; +select * from t1; +echo update t1 set f1=100, f2='Lakshya10' where f2='NBCDI'; +update t1 set f1=100, f2='Lakshya10' where f2='NBCDI'; +echo select * from t1; +select * from t1; +echo update t1 set f1=85, f2='Lakshya8.5' where f2>='NBCDG'; +update t1 set f1=85, f2='Lakshya8.5' where f2>='NBCDG'; +echo select * from t1; +select * from t1; +echo update t1 set f1=70, f2='Lakshya7' where f2>'NBCDE'; +update t1 set f1=70, f2='Lakshya7' where f2>'NBCDE'; +echo select * from t1; +select * from t1; +echo update t1 set f1=15, f2='Lakshya1.5' where f2<'ABCDG'; +update t1 set f1=15, f2='Lakshya1.5' where f2<'ABCDG'; +echo select * from t1; +select * from t1; +echo update t1 set f1=30, f2='Lakshya3' where f2<='ABCDH'; +update t1 set f1=30, f2='Lakshya3' where f2<='ABCDH'; +echo select * from t1; +select * from t1; +echo update t1 set f1=55, f2='Lakshya5.5' where f2!='Lakshya8.5'; +update t1 set f1=55, f2='Lakshya5.5' where f2!='Lakshya8.5'; +echo select * from t1; +select * from t1; diff --git a/test/sql/ScalarFunction/Date_with_now.sql b/test/sql/ScalarFunction/Date_with_now.sql new file mode 100644 index 00000000..8fb2a65d --- /dev/null +++ b/test/sql/ScalarFunction/Date_with_now.sql @@ -0,0 +1,37 @@ +echo create table t1(f1 int,f2 date); +create table t1(f1 int,f2 date); +echo insert into t1 values(1,'2003/12/10'); +insert into t1 values(1,'2003/12/10'); +echo insert into t1 values(2,'2004/12/10'); +insert into t1 values(2,'2004/12/10'); +echo insert into t1 values(3,'2005/12/10'); +insert into t1 values(3,'2005/12/10'); +echo insert into t1 values(4,'2006/12/10'); +insert into t1 values(4,'2006/12/10'); +echo insert into t1 values(5,now()); +insert into t1 values(5,now()); +echo insert into t1 values(6,'2007/12/10'); +insert into t1 values(6,'2007/12/10'); +echo insert into t1 values(7,now()); +insert into t1 values(7,now()); +echo select * from t1; +select * from t1; +echo select * from t1 where f2<=now(); +select * from t1 where f2<=now(); +echo select * from t1 where f2>now(); +select * from t1 where f2>now(); +echo select * from t1; +select * from t1; +echo update t1 set f2=now() where f1<=2; +update t1 set f2=now() where f1<=2; +echo select * from t1; +select * from t1; +echo update t1 set f2=now(),f1=10 where f2='2007/12/10'; +update t1 set f2=now(),f1=10 where f2='2007/12/10'; +echo select * from t1; +select * from t1; +echo drop table t1; +drop table t1; + + + diff --git a/test/sql/ScalarFunction/TODO b/test/sql/ScalarFunction/TODO new file mode 100644 index 00000000..e69de29b diff --git a/test/sql/ScalarFunction/csql.conf b/test/sql/ScalarFunction/csql.conf new file mode 100644 index 00000000..eb9d5a2e --- /dev/null +++ b/test/sql/ScalarFunction/csql.conf @@ -0,0 +1,147 @@ +# CSQL System Configuration File + +#####################################Server Section######################## + +# Site ID for this CSQL server +SITE_ID=1 + +#Important: For Server section parameters, make sure that the value is same for the +# server process and all the csql client process which connects to it. otherwise, +# behavior is undefined + +# Page size. Each database is logically divided into pages and allocation happens +# in this unit of pages. Increasing this value will reduce frequent allocation of pages. +PAGE_SIZE= 8192 + +#Total number of client process which can connect and work with the +# database concurrently +MAX_PROCS = 100 + +# Maximum size of the system database. +MAX_SYS_DB_SIZE=1048576 + +#Maximum size of the user database file. +MAX_DB_SIZE=10485760 + +#Shared memory key to be used by the system to create and locate system database. +SYS_DB_KEY=2222 + +#Shared memory key to be used by the system to create and locate user database. +USER_DB_KEY=3333 + +#Log level 0->no logging 1->Fine 2->Finer 3->Finest +LOG_LEVEL=0 + +#Give full path for the log file where important system actions are stored. +LOG_FILE=/tmp/csql/log/log.out + +#The virtual memory start address at which the shared memory segment +# will be created and attached. +MAP_ADDRESS=400000000 + +# Whether to enable durability +DURABILITY=false + +# Whether to enable memory map architecture for user database +MMAP=false + +# Specifies the durability mode for redo log generation +# Valid values are +# 1 ->uses standard redo logging with O_APPEND mode +# 2 ->uses standard logging with serialization +# 3 ->uses O_SYNC flag +# 4 ->uses O_DIRECT flag + +DURABLE_MODE=1 + +#Give full path for the database file where table and record information will +#be stored for durability +DATABASE_FILE=/tmp/csql/db + +#Important: For Server section parameters, make sure that the value is same for the server process and all the csql client process which connects to it. otherwise, behavior is undefined + +# Give full path for the std error file to store all the errors during database operations +STDERR_FILE=stderr + +#####################################Client Section######################## + +#Mutex timeout interval seconds +MUTEX_TIMEOUT_SECS=0 +MUTEX_TIMEOUT_USECS=5000 +MUTEX_TIMEOUT_RETRIES=10 + +#Lock timeout interval seconds +LOCK_TIMEOUT_SECS=0 +LOCK_TIMEOUT_USECS=5000 +LOCK_TIMEOUT_RETRIES=10 + +#Statement Cache Size +STMT_CACHE_SIZE=10 + +#Enable statement cache for statements with no parameters +STMT_CACHE_NOPARAM=false + +#####################################Cache Section######################## + +#Whether to enable caching of tables from target database +CACHE_TABLE=false + +#DSN Name to connect to the target database. +#This should be present in ~/odbc.ini file +DSN=myodbc3 + +# Whethere to enable bidirectional updates for cached tables. +ENABLE_BIDIRECTIONAL_CACHE=false + +CACHE_RECEIVER_WAIT_SECS=10 + +#Mode of operation SYNC or ASYNC +CACHE_MODE=SYNC + +##########################SqlNetworkServer Section######################## + +# Whether to enable SqlNetwork server +CSQL_SQL_SERVER=false + +#Set port for Network access +PORT=5678 + +# Max number of seconds that the network layer waits to receive a pkt +NETWORK_RESPONSE_TIMEOUT=3 + +# Max number of seconds that the network layer waits to connect to sql server +NETWORK_CONNECT_TIMEOUT=5 + +#Whether to enable Replication across the sites +REPLICATION=false + +#No of sites to replicate +REPLICATION_SITES=16 + +#Give full path for the file where all the table information is stored +TABLE_CONFIG_FILE=/tmp/csql/csqltable.conf + +#Give full path of the file where all the DSN information is stored +DS_CONFIG_FILE=/tmp/csql/csqlds.conf + +#Give full path for the file where all the peer site information is stored +NETWORK_CONFIG_FILE=/tmp/csql/csqlnw.conf + +# Give full path for conflict Resolution file +CONFL_RESOL_FILE=/tmp/csql/conflResoFile.txt + +# MSGKEY for creating msg queue for MsgQueue Server +MSG_KEY=2525 + +# Maximum message that the message queue server is able to handle for +# asynchronous updates. This value is is default value of 'kernel.msgmax' +# parameter. +ASYNC_MSGMAX=8192 + +# Maximum number of messages that the message queue server will hold for a site +# that is down in the replication group. +MAX_QUEUE_LOGS=100 + +# Shared memory key for id generators +ID_SHM_KEY=1947 +#####################################End Section######################## diff --git a/test/sql/ScalarFunction/date_add_day.sql b/test/sql/ScalarFunction/date_add_day.sql new file mode 100644 index 00000000..ecd453f6 --- /dev/null +++ b/test/sql/ScalarFunction/date_add_day.sql @@ -0,0 +1,23 @@ +echo Create table t1(f1 date, f2 date); +Create table t1(f1 date, f2 date); +insert into t1 values('2008-01-20', '2010-01-01'); +insert into t1 values('2009-04-20', '2011-02-01'); +insert into t1 values('2010-02-27', '2010-03-01'); +insert into t1 values('2011-02-28', '2013-02-01'); +insert into t1 values('2012-02-29', '2014-01-01'); +echo select * from t1; +select * from t1; +echo select * from t1 where date_add(f1 interval 2 day) = '2010-03-01'; +select * from t1 where date_add(f1 interval 2 day) = '2010-03-01'; +echo select * from t1 where date_add(f1 interval 15 day) <= '2008-02-04'; +select * from t1 where date_add(f1 interval 15 day) <= '2008-02-04'; +echo select * from t1 where date_add(f1 interval 15 day) >= '2009-05-05'; +select * from t1 where date_add(f1 interval 15 day) >= '2009-05-05'; +echo select * from t1 where date_add(f1 interval 40 day) <= '2008-03-01'; +select * from t1 where date_add(f1 interval 40 day) <= '2008-03-01'; +echo select * from t1 where date_add(f1 interval 40 day) >= '2009-05-30'; +select * from t1 where date_add(f1 interval 40 day) >= '2009-05-30'; +echo select * from t1 where date_add(f1 interval 365 day) <= '2010-04-20'; +select * from t1 where date_add(f1 interval 365 day) <= '2010-04-20'; +echo select * from t1 where date_add(f1 interval 366 day) >= '2010-04-21'; +select * from t1 where date_add(f1 interval 366 day) >= '2010-04-21'; diff --git a/test/sql/ScalarFunction/date_add_month.sql b/test/sql/ScalarFunction/date_add_month.sql new file mode 100644 index 00000000..71d0a7f7 --- /dev/null +++ b/test/sql/ScalarFunction/date_add_month.sql @@ -0,0 +1,16 @@ +echo Create table t1(f1 date, f2 date); +Create table t1(f1 date, f2 date); +insert into t1 values('2001-05-01', '2001-05-01'); +insert into t1 values('2001-06-01', '2001-06-01'); +insert into t1 values('2001-07-01', '2002-07-01'); +insert into t1 values('2001-08-01', '2002-08-01'); +insert into t1 values('2001-09-01', '2002-09-01'); +echo select * from t1; +select * from t1; +echo select * from t1 where date_add(f1 interval 5 month) < '2001-12-01'; +select * from t1 where date_add(f1 interval 5 month) < '2001-12-01'; +echo select * from t1 where date_add(f1 interval 6 month) = '2002-01-01'; +select * from t1 where date_add(f1 interval 6 month) = '2002-01-01'; +echo select * from t1 where date_add(f1 interval 18 month)>= '2003-01-01'; +select * from t1 where date_add(f1 interval 18 month)>= '2003-01-01'; + diff --git a/test/sql/ScalarFunction/date_add_year.sql b/test/sql/ScalarFunction/date_add_year.sql new file mode 100644 index 00000000..5fd488ac --- /dev/null +++ b/test/sql/ScalarFunction/date_add_year.sql @@ -0,0 +1,17 @@ +echo Create table t1(f1 date, f2 date); +Create table t1(f1 date, f2 date); +insert into t1 values('2001-01-01', '2005-01-01'); +insert into t1 values('2002-01-01', '2006-01-01'); +insert into t1 values('2003-01-01', '2007-01-01'); +insert into t1 values('2004-01-01', '2009-01-01'); +insert into t1 values('2005-01-01', '2010-01-01'); +echo select * from t1; +select * from t1; +echo select * from t1 where date_add(f1 interval 4 year) = '2007-01-01'; +select * from t1 where date_add(f1 interval 4 year) = '2007-01-01'; +echo select * from t1 where date_add(f1 interval 4 year) = f2; +select * from t1 where date_add(f1 interval 4 year) = f2; +echo select * from t1 where date_add(f1 interval 4 year) <= '2007-01-01'; +select * from t1 where date_add(f1 interval 4 year) <= '2007-01-01'; +echo select * from t1 where date_add(f1 interval 4 year) > '2007-01-01'; +select * from t1 where date_add(f1 interval 4 year) > '2007-01-01'; diff --git a/test/sql/ScalarFunction/date_diff.sql b/test/sql/ScalarFunction/date_diff.sql new file mode 100644 index 00000000..e5a7c609 --- /dev/null +++ b/test/sql/ScalarFunction/date_diff.sql @@ -0,0 +1,39 @@ +echo Create table t1(f1 date, f2 date); +Create table t1(f1 date, f2 date); +insert into t1 values('2001-01-01', '2001-01-03'); +insert into t1 values('2001-01-01', '2001-02-01'); +insert into t1 values('2001-01-01', '2001-03-01'); +insert into t1 values('2001-01-01', '2002-01-01'); +insert into t1 values('2001-01-01', '2002-02-02'); +echo select * from t1; +select * from t1; +echo select * from t1 where date_diff(f2,f1)=2; +select * from t1 where date_diff(f2,f1)=2; +echo select * from t1 where date_diff(f1,f2)=2; +select * from t1 where date_diff(f1,f2)=2; +echo select * from t1 where date_diff(f2,f1)=31; +select * from t1 where date_diff(f2,f1)=31; +echo select * from t1 where date_diff(f2,f1)=59; +select * from t1 where date_diff(f2,f1)=59; +echo select * from t1 where date_diff(f2,f1)=365; +select * from t1 where date_diff(f2,f1)=365; +echo select * from t1 where date_diff(f2,f1)=397; +select * from t1 where date_diff(f2,f1)=397; +echo select * from t1 where date_diff(f2,f1)<59; +select * from t1 where date_diff(f2,f1)<59; +echo select * from t1 where date_diff(f2,f1)<=59; +select * from t1 where date_diff(f2,f1)<=59; +echo select * from t1 where date_diff(f2,f1)>59; +select * from t1 where date_diff(f2,f1)>59; +echo select * from t1 where date_diff(f2,f1)>=59; +select * from t1 where date_diff(f2,f1)>=59; +echo select * from t1 where date_diff(f2,f1)!=59; +select * from t1 where date_diff(f2,f1)!=59; +echo select * from t1 where date_diff(f2,'2001-01-01')=2; +select * from t1 where date_diff(f2,'2001-01-01')=2; +echo select * from t1 where date_diff(f2,'2001-01-01')>=59; +select * from t1 where date_diff(f2,'2001-01-01')>=59; +echo select * from t1 where date_diff(f2,'2001-01-01')!=365; +select * from t1 where date_diff(f2,'2001-01-01')!=365; +echo select * from t1 where datediff('2001-01-02','2001-01-01')=1; +select * from t1 where date_diff('2001-01-02','2001-01-01')=1; diff --git a/test/sql/ScalarFunction/date_sub_day.sql b/test/sql/ScalarFunction/date_sub_day.sql new file mode 100644 index 00000000..21b783f5 --- /dev/null +++ b/test/sql/ScalarFunction/date_sub_day.sql @@ -0,0 +1,25 @@ +echo Create table t1(f1 date, f2 date); +Create table t1(f1 date, f2 date); +insert into t1 values('2008-01-20', '2010-01-01'); +insert into t1 values('2009-04-20', '2011-02-01'); +insert into t1 values('2010-02-27', '2012-03-01'); +insert into t1 values('2011-02-28', '2013-03-01'); +insert into t1 values('2012-02-29', '2014-01-01'); +echo select * from t1; +select * from t1; +echo select * from t1 where date_sub(f2 interval 2 day) = '2012-02-28'; +select * from t1 where date_sub(f2 interval 2 day) = '2012-02-28'; +echo select * from t1 where date_sub(f2 interval 15 day) <= '2012-02-28'; +select * from t1 where date_sub(f2 interval 15 day) <= '2012-02-28'; +echo select * from t1 where date_sub(f2 interval 15 day) >= '2012-02-15'; +select * from t1 where date_sub(f2 interval 15 day) >= '2012-02-15'; +echo select * from t1 where date_sub(f2 interval 40 day) <= '2012-01-21'; +select * from t1 where date_sub(f2 interval 40 day) <= '2012-01-21'; +echo select * from t1 where date_sub(f2 interval 40 day) != '2012-01-21'; +select * from t1 where date_sub(f2 interval 40 day) != '2012-01-21'; +echo select * from t1 where date_sub(f2 interval 365 day) <= '2011-03-02'; +select * from t1 where date_sub(f2 interval 365 day) <= '2011-03-02'; +echo select * from t1 where date_sub(f2 interval 366 day) >= '2011-03-02'; +select * from t1 where date_sub(f2 interval 366 day) >= '2011-03-02'; +echo select * from t1 where date_sub(f2 interval 366 day) != '2011-03-02'; +select * from t1 where date_sub(f2 interval 366 day) != '2011-03-02'; diff --git a/test/sql/ScalarFunction/date_sub_month.sql b/test/sql/ScalarFunction/date_sub_month.sql new file mode 100644 index 00000000..1aa31c34 --- /dev/null +++ b/test/sql/ScalarFunction/date_sub_month.sql @@ -0,0 +1,21 @@ +echo Create table t1(f1 date, f2 date); +Create table t1(f1 date, f2 date); +insert into t1 values('2001-01-01', '2001-01-01'); +insert into t1 values('2002-01-01', '2001-02-01'); +insert into t1 values('2003-01-01', '2001-03-01'); +insert into t1 values('2004-01-01', '2001-04-01'); +insert into t1 values('2005-01-01', '2001-05-01'); +echo select * from t1; +select * from t1; +echo select * from t1 where date_sub(f2 interval 6 month) = '2000-09-01'; +select * from t1 where date_sub(f2 interval 6 month) = '2000-09-01'; +echo select * from t1 where date_sub(f2 interval 6 month) <= '2000-09-01'; +select * from t1 where date_sub(f2 interval 6 month) <= '2000-09-01'; +echo select * from t1 where date_sub(f2 interval 6 month) >= '2000-09-01'; +select * from t1 where date_sub(f2 interval 6 month) >= '2000-09-01'; +echo select * from t1 where date_sub(f2 interval 18 month) = '1999-09-01'; +select * from t1 where date_sub(f2 interval 18 month) = '1999-09-01'; +echo select * from t1 where date_sub(f2 interval 18 month) <= '1999-09-01'; +select * from t1 where date_sub(f2 interval 18 month) <= '1999-09-01'; +echo select * from t1 where date_sub(f2 interval 18 month) >= '1999-09-01'; +select * from t1 where date_sub(f2 interval 18 month) >= '1999-09-01'; diff --git a/test/sql/ScalarFunction/date_sub_year.sql b/test/sql/ScalarFunction/date_sub_year.sql new file mode 100644 index 00000000..2c04d632 --- /dev/null +++ b/test/sql/ScalarFunction/date_sub_year.sql @@ -0,0 +1,17 @@ +echo Create table t1(f1 date, f2 date); +Create table t1(f1 date, f2 date); +insert into t1 values('2001-01-01', '2001-01-03'); +insert into t1 values('2001-01-01', '2001-02-01'); +insert into t1 values('2001-01-01', '2001-03-01'); +insert into t1 values('2001-01-01', '2002-01-01'); +insert into t1 values('2001-01-01', '2002-02-02'); +echo select * from t1; +select * from t1; +echo select * from t1 where date_sub(f2 interval 6 year) = '1995-03-01'; +select * from t1 where date_sub(f2 interval 6 year) = '1995-03-01'; +echo select * from t1 where date_sub(f2 interval 6 year) <= '1995-03-01'; +select * from t1 where date_sub(f2 interval 6 year) <= '1995-03-01'; +echo select * from t1 where date_sub(f2 interval 6 year) >= '1995-03-01'; +select * from t1 where date_sub(f2 interval 6 year) >= '1995-03-01'; +echo select * from t1 where date_sub(f2 interval 6 year) != '1995-03-01'; +select * from t1 where date_sub(f2 interval 6 year) != '1995-03-01'; diff --git a/test/sql/ScalarFunction/exp.test001.ksh b/test/sql/ScalarFunction/exp.test001.ksh new file mode 100644 index 00000000..fb9df645 --- /dev/null +++ b/test/sql/ScalarFunction/exp.test001.ksh @@ -0,0 +1,125 @@ +echo Create table t1(f1 date, f2 date); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2001/1/3 + 2001/1/1 2001/2/1 + 2001/1/1 2001/3/1 + 2001/1/1 2002/1/1 + 2001/1/1 2002/2/2 + +echo select * from t1 where date_diff(f2,f1)=2; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2001/1/3 + +echo select * from t1 where date_diff(f1,f2)=2; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + +echo select * from t1 where date_diff(f2,f1)=31; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2001/2/1 + +echo select * from t1 where date_diff(f2,f1)=59; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2001/3/1 + +echo select * from t1 where date_diff(f2,f1)=365; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2002/1/1 + +echo select * from t1 where date_diff(f2,f1)=397; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2002/2/2 + +echo select * from t1 where date_diff(f2,f1)<59; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2001/1/3 + 2001/1/1 2001/2/1 + +echo select * from t1 where date_diff(f2,f1)<=59; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2001/1/3 + 2001/1/1 2001/2/1 + 2001/1/1 2001/3/1 + +echo select * from t1 where date_diff(f2,f1)>59; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2002/1/1 + 2001/1/1 2002/2/2 + +echo select * from t1 where date_diff(f2,f1)>=59; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2001/3/1 + 2001/1/1 2002/1/1 + 2001/1/1 2002/2/2 + +echo select * from t1 where date_diff(f2,f1)!=59; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2001/1/3 + 2001/1/1 2001/2/1 + 2001/1/1 2002/1/1 + 2001/1/1 2002/2/2 + +echo select * from t1 where date_diff(f2,'2001-01-01')=2; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2001/1/3 + +echo select * from t1 where date_diff(f2,'2001-01-01')>=59; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2001/3/1 + 2001/1/1 2002/1/1 + 2001/1/1 2002/2/2 + +echo select * from t1 where date_diff(f2,'2001-01-01')!=365; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2001/1/3 + 2001/1/1 2001/2/1 + 2001/1/1 2001/3/1 + 2001/1/1 2002/2/2 + +echo select * from t1 where datediff('2001-01-02','2001-01-01')=1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2001/1/3 + 2001/1/1 2001/2/1 + 2001/1/1 2001/3/1 + 2001/1/1 2002/1/1 + 2001/1/1 2002/2/2 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test002.ksh b/test/sql/ScalarFunction/exp.test002.ksh new file mode 100644 index 00000000..aae25ea7 --- /dev/null +++ b/test/sql/ScalarFunction/exp.test002.ksh @@ -0,0 +1,125 @@ +echo Create table t1(f1 time, f2 time); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 1:1:3.0 + 1:1:1.0 1:2:1.0 + 1:1:1.0 1:3:1.0 + 1:1:1.0 2:1:1.0 + 1:1:1.0 2:2:2.0 + +echo select * from t1 where time_diff(f2,f1)=2; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 1:1:3.0 + +echo select * from t1 where time_diff(f1,f2)=2; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + +echo select * from t1 where time_diff(f2,f1)=60; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 1:2:1.0 + +echo select * from t1 where time_diff(f2,f1)=120; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 1:3:1.0 + +echo select * from t1 where time_diff(f2,f1)=3600; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 2:1:1.0 + +echo select * from t1 where time_diff(f2,f1)=3661; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 2:2:2.0 + +echo select * from t1 where time_diff(f2,f1)<120; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 1:1:3.0 + 1:1:1.0 1:2:1.0 + +echo select * from t1 where time_diff(f2,f1)<=120; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 1:1:3.0 + 1:1:1.0 1:2:1.0 + 1:1:1.0 1:3:1.0 + +echo select * from t1 where time_diff(f2,f1)>120; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 2:1:1.0 + 1:1:1.0 2:2:2.0 + +echo select * from t1 where time_diff(f2,f1)>=120; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 1:3:1.0 + 1:1:1.0 2:1:1.0 + 1:1:1.0 2:2:2.0 + +echo select * from t1 where time_diff(f2,f1)!=120; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 1:1:3.0 + 1:1:1.0 1:2:1.0 + 1:1:1.0 2:1:1.0 + 1:1:1.0 2:2:2.0 + +echo select * from t1 where time_diff(f2,'01:01:01')=2; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 1:1:3.0 + +echo select * from t1 where time_diff(f2,'01:01:01')>=120; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 1:3:1.0 + 1:1:1.0 2:1:1.0 + 1:1:1.0 2:2:2.0 + +echo select * from t1 where time_diff(f2,'01:01:01')!=3600; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 1:1:3.0 + 1:1:1.0 1:2:1.0 + 1:1:1.0 1:3:1.0 + 1:1:1.0 2:2:2.0 + +echo select * from t1 where time_diff('01:01:02','01:01:01')=1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 1:1:3.0 + 1:1:1.0 1:2:1.0 + 1:1:1.0 1:3:1.0 + 1:1:1.0 2:1:1.0 + 1:1:1.0 2:2:2.0 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test003.ksh b/test/sql/ScalarFunction/exp.test003.ksh new file mode 100644 index 00000000..d8a9c609 --- /dev/null +++ b/test/sql/ScalarFunction/exp.test003.ksh @@ -0,0 +1,47 @@ +echo Create table t1(f1 date, f2 date); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2005/1/1 + 2002/1/1 2006/1/1 + 2003/1/1 2007/1/1 + 2004/1/1 2009/1/1 + 2005/1/1 2010/1/1 + +echo select * from t1 where date_add(f1 interval 4 year) = '2007-01-01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/1 2007/1/1 + +echo select * from t1 where date_add(f1 interval 4 year) = f2; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2005/1/1 + 2002/1/1 2006/1/1 + 2003/1/1 2007/1/1 + +echo select * from t1 where date_add(f1 interval 4 year) <= '2007-01-01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2005/1/1 + 2002/1/1 2006/1/1 + 2003/1/1 2007/1/1 + +echo select * from t1 where date_add(f1 interval 4 year) > '2007-01-01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2004/1/1 2009/1/1 + 2005/1/1 2010/1/1 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test004.ksh b/test/sql/ScalarFunction/exp.test004.ksh new file mode 100644 index 00000000..2de515e8 --- /dev/null +++ b/test/sql/ScalarFunction/exp.test004.ksh @@ -0,0 +1,39 @@ +echo Create table t1(f1 date, f2 date); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/5/1 2001/5/1 + 2001/6/1 2001/6/1 + 2001/7/1 2002/7/1 + 2001/8/1 2002/8/1 + 2001/9/1 2002/9/1 + +echo select * from t1 where date_add(f1 interval 5 month) < '2001-12-01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/5/1 2001/5/1 + 2001/6/1 2001/6/1 + +echo select * from t1 where date_add(f1 interval 6 month) = '2002-01-01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/7/1 2002/7/1 + +echo select * from t1 where date_add(f1 interval 18 month)>= '2003-01-01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/7/1 2002/7/1 + 2001/8/1 2002/8/1 + 2001/9/1 2002/9/1 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test005.ksh b/test/sql/ScalarFunction/exp.test005.ksh new file mode 100644 index 00000000..17e184b2 --- /dev/null +++ b/test/sql/ScalarFunction/exp.test005.ksh @@ -0,0 +1,70 @@ +echo Create table t1(f1 date, f2 date); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2008/1/20 2010/1/1 + 2009/4/20 2011/2/1 + 2010/2/27 2010/3/1 + 2011/2/28 2013/2/1 + 2012/2/29 2014/1/1 + +echo select * from t1 where date_add(f1 interval 2 day) = '2010-03-01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2010/2/27 2010/3/1 + +echo select * from t1 where date_add(f1 interval 15 day) <= '2008-02-04'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2008/1/20 2010/1/1 + +echo select * from t1 where date_add(f1 interval 15 day) >= '2009-05-05'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2009/4/20 2011/2/1 + 2010/2/27 2010/3/1 + 2011/2/28 2013/2/1 + 2012/2/29 2014/1/1 + +echo select * from t1 where date_add(f1 interval 40 day) <= '2008-03-01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2008/1/20 2010/1/1 + +echo select * from t1 where date_add(f1 interval 40 day) >= '2009-05-30'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2009/4/20 2011/2/1 + 2010/2/27 2010/3/1 + 2011/2/28 2013/2/1 + 2012/2/29 2014/1/1 + +echo select * from t1 where date_add(f1 interval 365 day) <= '2010-04-20'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2008/1/20 2010/1/1 + 2009/4/20 2011/2/1 + +echo select * from t1 where date_add(f1 interval 366 day) >= '2010-04-21'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2009/4/20 2011/2/1 + 2010/2/27 2010/3/1 + 2011/2/28 2013/2/1 + 2012/2/29 2014/1/1 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test006.ksh b/test/sql/ScalarFunction/exp.test006.ksh new file mode 100644 index 00000000..0062cca5 --- /dev/null +++ b/test/sql/ScalarFunction/exp.test006.ksh @@ -0,0 +1,49 @@ +echo Create table t1(f1 date, f2 date); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2001/1/3 + 2001/1/1 2001/2/1 + 2001/1/1 2001/3/1 + 2001/1/1 2002/1/1 + 2001/1/1 2002/2/2 + +echo select * from t1 where date_sub(f2 interval 6 year) = '1995-03-01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2001/3/1 + +echo select * from t1 where date_sub(f2 interval 6 year) <= '1995-03-01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2001/1/3 + 2001/1/1 2001/2/1 + 2001/1/1 2001/3/1 + +echo select * from t1 where date_sub(f2 interval 6 year) >= '1995-03-01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2001/3/1 + 2001/1/1 2002/1/1 + 2001/1/1 2002/2/2 + +echo select * from t1 where date_sub(f2 interval 6 year) != '1995-03-01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2001/1/3 + 2001/1/1 2001/2/1 + 2001/1/1 2002/1/1 + 2001/1/1 2002/2/2 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test007.ksh b/test/sql/ScalarFunction/exp.test007.ksh new file mode 100644 index 00000000..05a05372 --- /dev/null +++ b/test/sql/ScalarFunction/exp.test007.ksh @@ -0,0 +1,62 @@ +echo Create table t1(f1 date, f2 date); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2001/1/1 + 2002/1/1 2001/2/1 + 2003/1/1 2001/3/1 + 2004/1/1 2001/4/1 + 2005/1/1 2001/5/1 + +echo select * from t1 where date_sub(f2 interval 6 month) = '2000-09-01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/1 2001/3/1 + +echo select * from t1 where date_sub(f2 interval 6 month) <= '2000-09-01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2001/1/1 + 2002/1/1 2001/2/1 + 2003/1/1 2001/3/1 + +echo select * from t1 where date_sub(f2 interval 6 month) >= '2000-09-01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/1 2001/3/1 + 2004/1/1 2001/4/1 + 2005/1/1 2001/5/1 + +echo select * from t1 where date_sub(f2 interval 18 month) = '1999-09-01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/1 2001/3/1 + +echo select * from t1 where date_sub(f2 interval 18 month) <= '1999-09-01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2001/1/1 + 2002/1/1 2001/2/1 + 2003/1/1 2001/3/1 + +echo select * from t1 where date_sub(f2 interval 18 month) >= '1999-09-01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/1 2001/3/1 + 2004/1/1 2001/4/1 + 2005/1/1 2001/5/1 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test008.ksh b/test/sql/ScalarFunction/exp.test008.ksh new file mode 100644 index 00000000..d32e11bd --- /dev/null +++ b/test/sql/ScalarFunction/exp.test008.ksh @@ -0,0 +1,82 @@ +echo Create table t1(f1 date, f2 date); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2008/1/20 2010/1/1 + 2009/4/20 2011/2/1 + 2010/2/27 2012/3/1 + 2011/2/28 2013/3/1 + 2012/2/29 2014/1/1 + +echo select * from t1 where date_sub(f2 interval 2 day) = '2012-02-28'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2010/2/27 2012/3/1 + +echo select * from t1 where date_sub(f2 interval 15 day) <= '2012-02-28'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2008/1/20 2010/1/1 + 2009/4/20 2011/2/1 + 2010/2/27 2012/3/1 + +echo select * from t1 where date_sub(f2 interval 15 day) >= '2012-02-15'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2010/2/27 2012/3/1 + 2011/2/28 2013/3/1 + 2012/2/29 2014/1/1 + +echo select * from t1 where date_sub(f2 interval 40 day) <= '2012-01-21'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2008/1/20 2010/1/1 + 2009/4/20 2011/2/1 + 2010/2/27 2012/3/1 + +echo select * from t1 where date_sub(f2 interval 40 day) != '2012-01-21'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2008/1/20 2010/1/1 + 2009/4/20 2011/2/1 + 2011/2/28 2013/3/1 + 2012/2/29 2014/1/1 + +echo select * from t1 where date_sub(f2 interval 365 day) <= '2011-03-02'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2008/1/20 2010/1/1 + 2009/4/20 2011/2/1 + 2010/2/27 2012/3/1 + +echo select * from t1 where date_sub(f2 interval 366 day) >= '2011-03-02'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2011/2/28 2013/3/1 + 2012/2/29 2014/1/1 + +echo select * from t1 where date_sub(f2 interval 366 day) != '2011-03-02'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2008/1/20 2010/1/1 + 2009/4/20 2011/2/1 + 2010/2/27 2012/3/1 + 2011/2/28 2013/3/1 + 2012/2/29 2014/1/1 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test009.ksh b/test/sql/ScalarFunction/exp.test009.ksh new file mode 100644 index 00000000..69fef838 --- /dev/null +++ b/test/sql/ScalarFunction/exp.test009.ksh @@ -0,0 +1,71 @@ +echo Create table t1(f1 time, f2 time); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 1:30:1.0 + 2:1:1.0 6:30:1.0 + 3:1:1.0 11:30:1.0 + 4:1:1.0 16:30:1.0 + 5:1:1.0 21:30:1.0 + +echo select * from t1 where time_add(f2 interval 2 hour) = '13:30:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 3:1:1.0 11:30:1.0 + +echo select * from t1 where time_add(f2 interval 2 hour) <= '13:30:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 1:30:1.0 + 2:1:1.0 6:30:1.0 + 3:1:1.0 11:30:1.0 + +echo select * from t1 where time_add(f2 interval 2 hour) >= '13:30:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 3:1:1.0 11:30:1.0 + 4:1:1.0 16:30:1.0 + 5:1:1.0 21:30:1.0 + +echo select * from t1 where time_add(f2 interval 10 hour) = '11:30:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 1:30:1.0 + +echo select * from t1 where time_add(f2 interval 10 hour) <= '11:30:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 1:30:1.0 + 4:1:1.0 16:30:1.0 + 5:1:1.0 21:30:1.0 + +echo select * from t1 where time_add(f2 interval 10 hour) >= '11:30:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 1:30:1.0 + 2:1:1.0 6:30:1.0 + 3:1:1.0 11:30:1.0 + +echo select * from t1 where time_add(f2 interval 10 hour) != '11:30:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2:1:1.0 6:30:1.0 + 3:1:1.0 11:30:1.0 + 4:1:1.0 16:30:1.0 + 5:1:1.0 21:30:1.0 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test010.ksh b/test/sql/ScalarFunction/exp.test010.ksh new file mode 100644 index 00000000..aa355d61 --- /dev/null +++ b/test/sql/ScalarFunction/exp.test010.ksh @@ -0,0 +1,69 @@ +echo Create table t1(f1 time, f2 time); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 1:30:1.0 + 2:1:1.0 2:30:1.0 + 3:1:1.0 3:30:1.0 + 4:1:1.0 4:30:1.0 + 5:1:1.0 5:30:1.0 + +echo select * from t1 where time_add(f2 interval 30 minute) = '04:00:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 3:1:1.0 3:30:1.0 + +echo select * from t1 where time_add(f2 interval 30 minute) <= '04:00:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 1:30:1.0 + 2:1:1.0 2:30:1.0 + 3:1:1.0 3:30:1.0 + +echo select * from t1 where time_add(f2 interval 30 minute) >= '04:00:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 3:1:1.0 3:30:1.0 + 4:1:1.0 4:30:1.0 + 5:1:1.0 5:30:1.0 + +echo select * from t1 where time_add(f2 interval 240 minute) = '07:30:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 3:1:1.0 3:30:1.0 + +echo select * from t1 where time_add(f2 interval 240 minute) <= '07:30:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 1:30:1.0 + 2:1:1.0 2:30:1.0 + 3:1:1.0 3:30:1.0 + +echo select * from t1 where time_add(f2 interval 1200 minute) >= '21:30:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 1:30:1.0 + 2:1:1.0 2:30:1.0 + 3:1:1.0 3:30:1.0 + +echo select * from t1 where time_add(f2 interval 1200 minute) < '21:30:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 4:1:1.0 4:30:1.0 + 5:1:1.0 5:30:1.0 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test011.ksh b/test/sql/ScalarFunction/exp.test011.ksh new file mode 100644 index 00000000..d8e19521 --- /dev/null +++ b/test/sql/ScalarFunction/exp.test011.ksh @@ -0,0 +1,69 @@ +echo Create table t1(f1 time, f2 time); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 1:30:1.0 + 2:1:1.0 2:30:1.0 + 3:1:1.0 3:30:1.0 + 4:1:1.0 4:30:1.0 + 5:1:1.0 5:30:1.0 + +echo select * from t1 where time_add(f2 interval 1800 second) = '04:00:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 3:1:1.0 3:30:1.0 + +echo select * from t1 where time_add(f2 interval 1800 second) <= '04:00:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 1:30:1.0 + 2:1:1.0 2:30:1.0 + 3:1:1.0 3:30:1.0 + +echo select * from t1 where time_add(f2 interval 1800 second) >= '04:00:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 3:1:1.0 3:30:1.0 + 4:1:1.0 4:30:1.0 + 5:1:1.0 5:30:1.0 + +echo select * from t1 where time_add(f2 interval 14400 second) = '07:30:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 3:1:1.0 3:30:1.0 + +echo select * from t1 where time_add(f2 interval 14400 second) <= '07:30:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 1:30:1.0 + 2:1:1.0 2:30:1.0 + 3:1:1.0 3:30:1.0 + +echo select * from t1 where time_add(f2 interval 72000 second) >= '21:30:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 1:30:1.0 + 2:1:1.0 2:30:1.0 + 3:1:1.0 3:30:1.0 + +echo select * from t1 where time_add(f2 interval 72000 second) < '21:30:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 4:1:1.0 4:30:1.0 + 5:1:1.0 5:30:1.0 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test012.ksh b/test/sql/ScalarFunction/exp.test012.ksh new file mode 100644 index 00000000..faa30907 --- /dev/null +++ b/test/sql/ScalarFunction/exp.test012.ksh @@ -0,0 +1,71 @@ +echo Create table t1(f1 time, f2 time); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 1:30:1.0 + 2:1:1.0 6:30:1.0 + 3:1:1.0 11:30:1.0 + 4:1:1.0 16:30:1.0 + 5:1:1.0 21:30:1.0 + +echo select * from t1 where time_sub(f2 interval 2 hour) = '14:30:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 4:1:1.0 16:30:1.0 + +echo select * from t1 where time_sub(f2 interval 2 hour) <= '14:30:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2:1:1.0 6:30:1.0 + 3:1:1.0 11:30:1.0 + 4:1:1.0 16:30:1.0 + +echo select * from t1 where time_sub(f2 interval 2 hour) >= '14:30:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 1:30:1.0 + 4:1:1.0 16:30:1.0 + 5:1:1.0 21:30:1.0 + +echo select * from t1 where time_sub(f2 interval 26 hour) = '14:30:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 4:1:1.0 16:30:1.0 + +echo select * from t1 where time_sub(f2 interval 26 hour)<= '14:30:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2:1:1.0 6:30:1.0 + 3:1:1.0 11:30:1.0 + 4:1:1.0 16:30:1.0 + +echo select * from t1 where time_sub(f2 interval 26 hour)>= '14:30:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 1:30:1.0 + 4:1:1.0 16:30:1.0 + 5:1:1.0 21:30:1.0 + +echo select * from t1 where time_sub(f2 interval 26 hour)!= '14:30:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 1:30:1.0 + 2:1:1.0 6:30:1.0 + 3:1:1.0 11:30:1.0 + 5:1:1.0 21:30:1.0 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test013.ksh b/test/sql/ScalarFunction/exp.test013.ksh new file mode 100644 index 00000000..137c3c1a --- /dev/null +++ b/test/sql/ScalarFunction/exp.test013.ksh @@ -0,0 +1,70 @@ +echo Create table t1(f1 time, f2 time); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 1:10:1.0 + 2:1:1.0 1:30:1.0 + 3:1:1.0 1:50:1.0 + 4:1:1.0 13:20:1.0 + 5:1:1.0 13:40:1.0 + +echo select * from t1 where time_sub(f2 interval 50 minute) = '01:00:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 3:1:1.0 1:50:1.0 + +echo select * from t1 where time_sub(f2 interval 50 minute) <= '01:00:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 1:10:1.0 + 2:1:1.0 1:30:1.0 + 3:1:1.0 1:50:1.0 + +echo select * from t1 where time_sub(f2 interval 50 minute) >= '01:00:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 3:1:1.0 1:50:1.0 + 4:1:1.0 13:20:1.0 + 5:1:1.0 13:40:1.0 + +echo select * from t1 where time_sub(f2 interval 170 minute) = '23:00:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 3:1:1.0 1:50:1.0 + +echo select * from t1 where time_sub(f2 interval 170 minute)!= '23:00:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 1:10:1.0 + 2:1:1.0 1:30:1.0 + 4:1:1.0 13:20:1.0 + 5:1:1.0 13:40:1.0 + +echo select * from t1 where time_sub(f2 interval 170 minute)<= '23:00:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 3:1:1.0 1:50:1.0 + 4:1:1.0 13:20:1.0 + 5:1:1.0 13:40:1.0 + +echo select * from t1 where time_sub(f2 interval 170 minute) > '23:00:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 1:10:1.0 + 2:1:1.0 1:30:1.0 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test014.ksh b/test/sql/ScalarFunction/exp.test014.ksh new file mode 100644 index 00000000..43818ec0 --- /dev/null +++ b/test/sql/ScalarFunction/exp.test014.ksh @@ -0,0 +1,70 @@ +echo Create table t1(f1 time, f2 time); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 1:10:1.0 + 2:1:1.0 1:30:1.0 + 3:1:1.0 1:50:1.0 + 4:1:1.0 13:20:1.0 + 5:1:1.0 13:40:1.0 + +echo select * from t1 where time_sub(f2 interval 3000 second) = '01:00:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 3:1:1.0 1:50:1.0 + +echo select * from t1 where time_sub(f2 interval 3000 second) <= '01:00:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 1:10:1.0 + 2:1:1.0 1:30:1.0 + 3:1:1.0 1:50:1.0 + +echo select * from t1 where time_sub(f2 interval 3000 second) >= '01:00:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 3:1:1.0 1:50:1.0 + 4:1:1.0 13:20:1.0 + 5:1:1.0 13:40:1.0 + +echo select * from t1 where time_sub(f2 interval 10200 second) = '23:00:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 3:1:1.0 1:50:1.0 + +echo select * from t1 where time_sub(f2 interval 10200 second)!= '23:00:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 1:10:1.0 + 2:1:1.0 1:30:1.0 + 4:1:1.0 13:20:1.0 + 5:1:1.0 13:40:1.0 + +echo select * from t1 where time_sub(f2 interval 10200 second)<= '23:00:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 3:1:1.0 1:50:1.0 + 4:1:1.0 13:20:1.0 + 5:1:1.0 13:40:1.0 + +echo select * from t1 where time_sub(f2 interval 10200 second) > '23:00:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 1:1:1.0 1:10:1.0 + 2:1:1.0 1:30:1.0 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test015.ksh b/test/sql/ScalarFunction/exp.test015.ksh new file mode 100644 index 00000000..d604d342 --- /dev/null +++ b/test/sql/ScalarFunction/exp.test015.ksh @@ -0,0 +1,48 @@ +echo Create table t1(f1 timestamp, f2 timestamp); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/1 2:1:1.0 + 2002/1/1 1:1:1.0 2001/2/1 1:1:1.0 + 2003/1/1 1:1:1.0 2001/3/1 1:1:1.0 + 2004/1/1 1:1:1.0 2002/4/1 1:1:1.0 + 2005/1/1 1:1:1.0 2002/5/1 1:1:1.0 + +echo select * from t1 where timestamp_add(f1 interval 5 year) ='2008-01-01 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/1 1:1:1.0 2001/3/1 1:1:1.0 + +echo select * from t1 where timestamp_add(f1 interval 5 year)<='2008-01-01 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/1 2:1:1.0 + 2002/1/1 1:1:1.0 2001/2/1 1:1:1.0 + 2003/1/1 1:1:1.0 2001/3/1 1:1:1.0 + +echo select * from t1 where timestamp_add(f1 interval 5 year) >'2008-01-01 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2004/1/1 1:1:1.0 2002/4/1 1:1:1.0 + 2005/1/1 1:1:1.0 2002/5/1 1:1:1.0 + +echo select * from t1 where timestamp_add(f1 interval 5 year)!='2008-01-01 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/1 2:1:1.0 + 2002/1/1 1:1:1.0 2001/2/1 1:1:1.0 + 2004/1/1 1:1:1.0 2002/4/1 1:1:1.0 + 2005/1/1 1:1:1.0 2002/5/1 1:1:1.0 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test016.ksh b/test/sql/ScalarFunction/exp.test016.ksh new file mode 100644 index 00000000..9b0c04c6 --- /dev/null +++ b/test/sql/ScalarFunction/exp.test016.ksh @@ -0,0 +1,78 @@ +echo Create table t1(f1 timestamp, f2 timestamp); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/1 2:1:1.0 + 2002/1/1 1:1:1.0 2001/2/1 1:1:1.0 + 2003/1/1 1:1:1.0 2001/3/1 1:1:1.0 + 2004/1/1 1:1:1.0 2001/4/1 1:1:1.0 + 2005/1/1 1:1:1.0 2001/5/1 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 10 month) ='2002-01-01 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/1 1:1:1.0 2001/3/1 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 10 month)<='2002-01-01 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/1 2:1:1.0 + 2002/1/1 1:1:1.0 2001/2/1 1:1:1.0 + 2003/1/1 1:1:1.0 2001/3/1 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 10 month) >'2002-01-01 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2004/1/1 1:1:1.0 2001/4/1 1:1:1.0 + 2005/1/1 1:1:1.0 2001/5/1 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 10 month)!='2002-01-01 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/1 2:1:1.0 + 2002/1/1 1:1:1.0 2001/2/1 1:1:1.0 + 2004/1/1 1:1:1.0 2001/4/1 1:1:1.0 + 2005/1/1 1:1:1.0 2001/5/1 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 130 month) ='2012-01-01 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/1 1:1:1.0 2001/3/1 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 130 month)<='2012-01-01 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/1 2:1:1.0 + 2002/1/1 1:1:1.0 2001/2/1 1:1:1.0 + 2003/1/1 1:1:1.0 2001/3/1 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 130 month) >'2012-01-01 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2004/1/1 1:1:1.0 2001/4/1 1:1:1.0 + 2005/1/1 1:1:1.0 2001/5/1 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 130 month)!='2012-01-01 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/1 2:1:1.0 + 2002/1/1 1:1:1.0 2001/2/1 1:1:1.0 + 2004/1/1 1:1:1.0 2001/4/1 1:1:1.0 + 2005/1/1 1:1:1.0 2001/5/1 1:1:1.0 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test017.ksh b/test/sql/ScalarFunction/exp.test017.ksh new file mode 100644 index 00000000..f4481e31 --- /dev/null +++ b/test/sql/ScalarFunction/exp.test017.ksh @@ -0,0 +1,69 @@ +echo Create table t1(f1 timestamp, f2 timestamp); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/20 1:1:1.0 + 2002/1/1 1:1:1.0 2002/2/20 1:1:1.0 + 2003/1/1 1:1:1.0 2003/2/20 1:1:1.0 + 2004/1/1 1:1:1.0 2004/2/20 1:1:1.0 + 2005/1/1 1:1:1.0 2005/11/20 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 15 day) ='2001-02-04 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/20 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 15 day)<='2002-03-07 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/20 1:1:1.0 + 2002/1/1 1:1:1.0 2002/2/20 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 15 day)>='2003-03-07 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/1 1:1:1.0 2003/2/20 1:1:1.0 + 2004/1/1 1:1:1.0 2004/2/20 1:1:1.0 + 2005/1/1 1:1:1.0 2005/11/20 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 15 day) ='2004-03-06 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2004/1/1 1:1:1.0 2004/2/20 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 15 day)!='2005-12-05 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/20 1:1:1.0 + 2002/1/1 1:1:1.0 2002/2/20 1:1:1.0 + 2003/1/1 1:1:1.0 2003/2/20 1:1:1.0 + 2004/1/1 1:1:1.0 2004/2/20 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 45 day) ='2006-01-04 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2005/1/1 1:1:1.0 2005/11/20 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 45 day)!='2006-01-04 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/20 1:1:1.0 + 2002/1/1 1:1:1.0 2002/2/20 1:1:1.0 + 2003/1/1 1:1:1.0 2003/2/20 1:1:1.0 + 2004/1/1 1:1:1.0 2004/2/20 1:1:1.0 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test018.ksh b/test/sql/ScalarFunction/exp.test018.ksh new file mode 100644 index 00000000..77a12132 --- /dev/null +++ b/test/sql/ScalarFunction/exp.test018.ksh @@ -0,0 +1,96 @@ +echo Create table t1(f1 timestamp, f2 timestamp); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/25 1:1:1.0 + 2002/1/1 1:1:1.0 2002/2/25 1:1:1.0 + 2003/1/1 1:1:1.0 2003/2/25 1:1:1.0 + 2004/1/1 1:1:1.0 2004/2/25 1:1:1.0 + 2005/1/1 1:1:1.0 2005/11/25 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 4 hour) ='2003-02-25 05:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/1 1:1:1.0 2003/2/25 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 4 hour)<='2003-02-25 05:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/25 1:1:1.0 + 2002/1/1 1:1:1.0 2002/2/25 1:1:1.0 + 2003/1/1 1:1:1.0 2003/2/25 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 4 hour) >'2003-02-25 05:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2004/1/1 1:1:1.0 2004/2/25 1:1:1.0 + 2005/1/1 1:1:1.0 2005/11/25 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 244 hour) ='2001-02-04 05:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/25 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 244 hour)>='2001-02-04 05:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/25 1:1:1.0 + 2002/1/1 1:1:1.0 2002/2/25 1:1:1.0 + 2003/1/1 1:1:1.0 2003/2/25 1:1:1.0 + 2004/1/1 1:1:1.0 2004/2/25 1:1:1.0 + 2005/1/1 1:1:1.0 2005/11/25 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 244 hour) ='2002-03-07 05:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/2/25 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 244 hour)<='2002-03-07 05:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/25 1:1:1.0 + 2002/1/1 1:1:1.0 2002/2/25 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 244 hour) ='2004-03-06 05:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2004/1/1 1:1:1.0 2004/2/25 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 244 hour)>='2004-03-06 05:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2004/1/1 1:1:1.0 2004/2/25 1:1:1.0 + 2005/1/1 1:1:1.0 2005/11/25 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 960 hour) ='2006-01-04 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2005/1/1 1:1:1.0 2005/11/25 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 960 hour)!='2006-01-04 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/25 1:1:1.0 + 2002/1/1 1:1:1.0 2002/2/25 1:1:1.0 + 2003/1/1 1:1:1.0 2003/2/25 1:1:1.0 + 2004/1/1 1:1:1.0 2004/2/25 1:1:1.0 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test019.ksh b/test/sql/ScalarFunction/exp.test019.ksh new file mode 100644 index 00000000..95dedb4f --- /dev/null +++ b/test/sql/ScalarFunction/exp.test019.ksh @@ -0,0 +1,63 @@ +echo Create table t1(f1 timestamp, f2 timestamp); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/25 1:1:1.0 + 2002/1/1 1:1:1.0 2002/2/25 1:1:1.0 + 2003/1/1 1:1:1.0 2003/2/25 1:1:1.0 + 2004/1/1 1:1:1.0 2004/2/25 1:1:1.0 + 2005/1/1 1:1:1.0 2005/11/25 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 244 minute) ='2003-02-25 05:05:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/1 1:1:1.0 2003/2/25 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 244 minute)<='2003-02-25 05:05:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/25 1:1:1.0 + 2002/1/1 1:1:1.0 2002/2/25 1:1:1.0 + 2003/1/1 1:1:1.0 2003/2/25 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 244 minute) >'2003-02-25 05:05:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2004/1/1 1:1:1.0 2004/2/25 1:1:1.0 + 2005/1/1 1:1:1.0 2005/11/25 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 14644 minute) ='2001-02-04 05:05:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/25 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 14644 minute) ='2002-03-07 05:05:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/2/25 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 14644 minute) ='2004-03-06 05:05:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2004/1/1 1:1:1.0 2004/2/25 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 57844 minute) ='2006-01-04 05:05:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2005/1/1 1:1:1.0 2005/11/25 1:1:1.0 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test020.ksh b/test/sql/ScalarFunction/exp.test020.ksh new file mode 100644 index 00000000..aa87ec60 --- /dev/null +++ b/test/sql/ScalarFunction/exp.test020.ksh @@ -0,0 +1,63 @@ +echo Create table t1(f1 timestamp, f2 timestamp); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/25 1:1:1.0 + 2002/1/1 1:1:1.0 2002/2/25 1:1:1.0 + 2003/1/1 1:1:1.0 2003/2/25 1:1:1.0 + 2004/1/1 1:1:1.0 2004/2/25 1:1:1.0 + 2005/1/1 1:1:1.0 2005/11/25 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 14644 second) ='2003-02-25 05:05:05'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/1 1:1:1.0 2003/2/25 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 14644 second)<='2003-02-25 05:05:05'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/25 1:1:1.0 + 2002/1/1 1:1:1.0 2002/2/25 1:1:1.0 + 2003/1/1 1:1:1.0 2003/2/25 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 14644 second) >'2003-02-25 05:05:05'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2004/1/1 1:1:1.0 2004/2/25 1:1:1.0 + 2005/1/1 1:1:1.0 2005/11/25 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 878644 second) ='2001-02-04 05:05:05'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/25 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 878644 second) ='2002-03-07 05:05:05'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/2/25 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 878644 second) ='2004-03-06 05:05:05'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2004/1/1 1:1:1.0 2004/2/25 1:1:1.0 + +echo select * from t1 where timestamp_add(f2 interval 3470644 second) ='2006-01-04 05:05:05'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2005/1/1 1:1:1.0 2005/11/25 1:1:1.0 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test021.ksh b/test/sql/ScalarFunction/exp.test021.ksh new file mode 100644 index 00000000..cd5fb708 --- /dev/null +++ b/test/sql/ScalarFunction/exp.test021.ksh @@ -0,0 +1,48 @@ +echo Create table t1(f1 timestamp, f2 timestamp); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/1 2:1:1.0 + 2002/1/1 1:1:1.0 2001/2/1 1:1:1.0 + 2003/1/1 1:1:1.0 2001/3/1 1:1:1.0 + 2004/1/1 1:1:1.0 2002/4/1 1:1:1.0 + 2005/1/1 1:1:1.0 2002/5/1 1:1:1.0 + +echo select * from t1 where timestamp_sub(f1 interval 5 year) ='1998-01-01 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/1 1:1:1.0 2001/3/1 1:1:1.0 + +echo select * from t1 where timestamp_sub(f1 interval 5 year)<='1998-01-01 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/1 2:1:1.0 + 2002/1/1 1:1:1.0 2001/2/1 1:1:1.0 + 2003/1/1 1:1:1.0 2001/3/1 1:1:1.0 + +echo select * from t1 where timestamp_sub(f1 interval 5 year) >'1998-01-01 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2004/1/1 1:1:1.0 2002/4/1 1:1:1.0 + 2005/1/1 1:1:1.0 2002/5/1 1:1:1.0 + +echo select * from t1 where timestamp_sub(f1 interval 5 year)!='1998-01-01 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/1 2:1:1.0 + 2002/1/1 1:1:1.0 2001/2/1 1:1:1.0 + 2004/1/1 1:1:1.0 2002/4/1 1:1:1.0 + 2005/1/1 1:1:1.0 2002/5/1 1:1:1.0 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test022.ksh b/test/sql/ScalarFunction/exp.test022.ksh new file mode 100644 index 00000000..a3e968c5 --- /dev/null +++ b/test/sql/ScalarFunction/exp.test022.ksh @@ -0,0 +1,78 @@ +echo Create table t1(f1 timestamp, f2 timestamp); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2010/8/1 2:1:1.0 + 2002/1/1 1:1:1.0 2010/9/1 1:1:1.0 + 2003/1/1 1:1:1.0 2010/10/1 1:1:1.0 + 2004/1/1 1:1:1.0 2010/11/1 1:1:1.0 + 2005/1/1 1:1:1.0 2010/12/1 1:1:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 10 month) ='2009-12-01 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/1 1:1:1.0 2010/10/1 1:1:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 10 month)<='2009-12-01 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2010/8/1 2:1:1.0 + 2002/1/1 1:1:1.0 2010/9/1 1:1:1.0 + 2003/1/1 1:1:1.0 2010/10/1 1:1:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 10 month) >'2009-12-01 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2004/1/1 1:1:1.0 2010/11/1 1:1:1.0 + 2005/1/1 1:1:1.0 2010/12/1 1:1:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 10 month)!='2009-12-01 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2010/8/1 2:1:1.0 + 2002/1/1 1:1:1.0 2010/9/1 1:1:1.0 + 2004/1/1 1:1:1.0 2010/11/1 1:1:1.0 + 2005/1/1 1:1:1.0 2010/12/1 1:1:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 130 month) ='1999-12-01 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/1 1:1:1.0 2010/10/1 1:1:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 130 month)<='1999-12-01 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2010/8/1 2:1:1.0 + 2002/1/1 1:1:1.0 2010/9/1 1:1:1.0 + 2003/1/1 1:1:1.0 2010/10/1 1:1:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 130 month) >'1999-12-01 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2004/1/1 1:1:1.0 2010/11/1 1:1:1.0 + 2005/1/1 1:1:1.0 2010/12/1 1:1:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 130 month)!='1999-12-01 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2010/8/1 2:1:1.0 + 2002/1/1 1:1:1.0 2010/9/1 1:1:1.0 + 2004/1/1 1:1:1.0 2010/11/1 1:1:1.0 + 2005/1/1 1:1:1.0 2010/12/1 1:1:1.0 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test023.ksh b/test/sql/ScalarFunction/exp.test023.ksh new file mode 100644 index 00000000..48c021d4 --- /dev/null +++ b/test/sql/ScalarFunction/exp.test023.ksh @@ -0,0 +1,69 @@ +echo Create table t1(f1 timestamp, f2 timestamp); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/5/10 1:1:1.0 + 2002/1/1 1:1:1.0 2002/3/10 1:1:1.0 + 2003/1/1 1:1:1.0 2003/3/10 1:1:1.0 + 2004/1/1 1:1:1.0 2004/3/10 1:1:1.0 + 2005/1/1 1:1:1.0 2005/2/10 1:1:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 15 day) ='2001-04-25 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/5/10 1:1:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 15 day)<='2002-02-23 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/5/10 1:1:1.0 + 2002/1/1 1:1:1.0 2002/3/10 1:1:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 15 day)>='2003-02-23 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/1 1:1:1.0 2003/3/10 1:1:1.0 + 2004/1/1 1:1:1.0 2004/3/10 1:1:1.0 + 2005/1/1 1:1:1.0 2005/2/10 1:1:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 15 day) ='2004-02-24 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2004/1/1 1:1:1.0 2004/3/10 1:1:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 15 day)!='2005-01-26 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/5/10 1:1:1.0 + 2002/1/1 1:1:1.0 2002/3/10 1:1:1.0 + 2003/1/1 1:1:1.0 2003/3/10 1:1:1.0 + 2004/1/1 1:1:1.0 2004/3/10 1:1:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 45 day) ='2004-12-27 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2005/1/1 1:1:1.0 2005/2/10 1:1:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 45 day)!='2004-12-27 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/5/10 1:1:1.0 + 2002/1/1 1:1:1.0 2002/3/10 1:1:1.0 + 2003/1/1 1:1:1.0 2003/3/10 1:1:1.0 + 2004/1/1 1:1:1.0 2004/3/10 1:1:1.0 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test024.ksh b/test/sql/ScalarFunction/exp.test024.ksh new file mode 100644 index 00000000..e940abae --- /dev/null +++ b/test/sql/ScalarFunction/exp.test024.ksh @@ -0,0 +1,96 @@ +echo Create table t1(f1 timestamp, f2 timestamp); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/5/5 5:1:1.0 + 2002/1/1 1:1:1.0 2002/3/5 5:1:1.0 + 2003/1/1 1:1:1.0 2003/3/5 5:1:1.0 + 2004/1/1 1:1:1.0 2004/3/5 5:1:1.0 + 2005/1/1 1:1:1.0 2005/1/5 5:1:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 4 hour) ='2003-03-05 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/1 1:1:1.0 2003/3/5 5:1:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 4 hour)<='2003-03-05 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/5/5 5:1:1.0 + 2002/1/1 1:1:1.0 2002/3/5 5:1:1.0 + 2003/1/1 1:1:1.0 2003/3/5 5:1:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 4 hour) >'2003-03-05 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2004/1/1 1:1:1.0 2004/3/5 5:1:1.0 + 2005/1/1 1:1:1.0 2005/1/5 5:1:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 244 hour) ='2001-04-25 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/5/5 5:1:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 244 hour)>='2001-04-25 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/5/5 5:1:1.0 + 2002/1/1 1:1:1.0 2002/3/5 5:1:1.0 + 2003/1/1 1:1:1.0 2003/3/5 5:1:1.0 + 2004/1/1 1:1:1.0 2004/3/5 5:1:1.0 + 2005/1/1 1:1:1.0 2005/1/5 5:1:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 244 hour) ='2002-02-23 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/3/5 5:1:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 244 hour)<='2002-02-23 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/5/5 5:1:1.0 + 2002/1/1 1:1:1.0 2002/3/5 5:1:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 244 hour) ='2004-02-24 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2004/1/1 1:1:1.0 2004/3/5 5:1:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 244 hour)>='2004-02-24 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2004/1/1 1:1:1.0 2004/3/5 5:1:1.0 + 2005/1/1 1:1:1.0 2005/1/5 5:1:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 960 hour) ='2004-11-26 05:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2005/1/1 1:1:1.0 2005/1/5 5:1:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 960 hour)!='2004-11-26 05:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/5/5 5:1:1.0 + 2002/1/1 1:1:1.0 2002/3/5 5:1:1.0 + 2003/1/1 1:1:1.0 2003/3/5 5:1:1.0 + 2004/1/1 1:1:1.0 2004/3/5 5:1:1.0 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test025.ksh b/test/sql/ScalarFunction/exp.test025.ksh new file mode 100644 index 00000000..68a862d1 --- /dev/null +++ b/test/sql/ScalarFunction/exp.test025.ksh @@ -0,0 +1,68 @@ +echo Create table t1(f1 timestamp, f2 timestamp); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/5/5 5:5:1.0 + 2002/1/1 1:1:1.0 2002/3/5 5:5:1.0 + 2003/1/1 1:1:1.0 2003/3/5 5:5:1.0 + 2004/1/1 1:1:1.0 2004/3/5 5:5:1.0 + 2005/1/1 1:1:1.0 2005/1/5 5:5:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 244 minute) ='2003-03-05 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/1 1:1:1.0 2003/3/5 5:5:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 244 minute)<='2003-03-05 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/5/5 5:5:1.0 + 2002/1/1 1:1:1.0 2002/3/5 5:5:1.0 + 2003/1/1 1:1:1.0 2003/3/5 5:5:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 244 minute) >'2003-03-05 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2004/1/1 1:1:1.0 2004/3/5 5:5:1.0 + 2005/1/1 1:1:1.0 2005/1/5 5:5:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 14400 minute) ='2003-02-23 05:05:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/1 1:1:1.0 2003/3/5 5:5:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 14400 minute)>='2003-02-23 05:05:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/1 1:1:1.0 2003/3/5 5:5:1.0 + 2004/1/1 1:1:1.0 2004/3/5 5:5:1.0 + 2005/1/1 1:1:1.0 2005/1/5 5:5:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 527040 minute) ='2004-01-05 05:05:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2005/1/1 1:1:1.0 2005/1/5 5:5:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 527040 minute)!='2004-01-05 05:05:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/5/5 5:5:1.0 + 2002/1/1 1:1:1.0 2002/3/5 5:5:1.0 + 2003/1/1 1:1:1.0 2003/3/5 5:5:1.0 + 2004/1/1 1:1:1.0 2004/3/5 5:5:1.0 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test026.ksh b/test/sql/ScalarFunction/exp.test026.ksh new file mode 100644 index 00000000..3f4d06fc --- /dev/null +++ b/test/sql/ScalarFunction/exp.test026.ksh @@ -0,0 +1,68 @@ +echo Create table t1(f1 timestamp, f2 timestamp); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/5/5 5:5:1.0 + 2002/1/1 1:1:1.0 2002/3/5 5:5:1.0 + 2003/1/1 1:1:1.0 2003/3/5 5:5:1.0 + 2004/1/1 1:1:1.0 2004/3/5 5:5:1.0 + 2005/1/1 1:1:1.0 2005/1/5 5:5:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 14640 second) ='2003-03-05 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/1 1:1:1.0 2003/3/5 5:5:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 14640 second)<='2003-03-05 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/5/5 5:5:1.0 + 2002/1/1 1:1:1.0 2002/3/5 5:5:1.0 + 2003/1/1 1:1:1.0 2003/3/5 5:5:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 14640 second) >'2003-03-05 01:01:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2004/1/1 1:1:1.0 2004/3/5 5:5:1.0 + 2005/1/1 1:1:1.0 2005/1/5 5:5:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 864000 second) ='2003-02-23 05:05:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/1 1:1:1.0 2003/3/5 5:5:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 864000 second)>='2003-02-23 05:05:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/1 1:1:1.0 2003/3/5 5:5:1.0 + 2004/1/1 1:1:1.0 2004/3/5 5:5:1.0 + 2005/1/1 1:1:1.0 2005/1/5 5:5:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 31622400 second) ='2004-01-05 05:05:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2005/1/1 1:1:1.0 2005/1/5 5:5:1.0 + +echo select * from t1 where timestamp_sub(f2 interval 31622400 second)!='2004-01-05 05:05:01'; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/5/5 5:5:1.0 + 2002/1/1 1:1:1.0 2002/3/5 5:5:1.0 + 2003/1/1 1:1:1.0 2003/3/5 5:5:1.0 + 2004/1/1 1:1:1.0 2004/3/5 5:5:1.0 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test027.ksh b/test/sql/ScalarFunction/exp.test027.ksh new file mode 100644 index 00000000..d084884b --- /dev/null +++ b/test/sql/ScalarFunction/exp.test027.ksh @@ -0,0 +1,59 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/1/1 1:1:1.0 + 2002/1/1 1:1:1.0 2002/2/3 1:1:1.0 + 2002/1/1 1:1:1.0 2002/3/1 1:1:1.0 + 2002/1/1 1:1:1.0 2004/2/1 1:1:1.0 + 2002/1/1 1:1:1.0 2004/3/1 1:1:1.0 + 2001/1/1 1:1:1.0 2002/2/3 1:1:1.0 + 2001/1/1 1:1:1.0 2002/3/1 1:1:1.0 + 2001/1/1 1:1:1.0 2004/2/1 1:1:1.0 + 2001/1/1 1:1:1.0 2004/3/1 1:1:1.0 + +echo select * from t1 where timestamp_diff(year,f1,f2)=0; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/1/1 1:1:1.0 + 2002/1/1 1:1:1.0 2002/2/3 1:1:1.0 + 2002/1/1 1:1:1.0 2002/3/1 1:1:1.0 + +echo select * from t1 where timestamp_diff(year,f2,f1)=2; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2004/2/1 1:1:1.0 + 2002/1/1 1:1:1.0 2004/3/1 1:1:1.0 + +echo select * from t1 where timestamp_diff(year,f2,f1)>2; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2004/2/1 1:1:1.0 + 2001/1/1 1:1:1.0 2004/3/1 1:1:1.0 + +echo select * from t1 where timestamp_diff(year,f2,f1)<=2; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/1/1 1:1:1.0 + 2002/1/1 1:1:1.0 2002/2/3 1:1:1.0 + 2002/1/1 1:1:1.0 2002/3/1 1:1:1.0 + 2002/1/1 1:1:1.0 2004/2/1 1:1:1.0 + 2002/1/1 1:1:1.0 2004/3/1 1:1:1.0 + 2001/1/1 1:1:1.0 2002/2/3 1:1:1.0 + 2001/1/1 1:1:1.0 2002/3/1 1:1:1.0 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test028.ksh b/test/sql/ScalarFunction/exp.test028.ksh new file mode 100644 index 00000000..4bc73ecf --- /dev/null +++ b/test/sql/ScalarFunction/exp.test028.ksh @@ -0,0 +1,67 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/1/1 1:1:1.0 + 2002/1/1 1:1:1.0 2002/2/3 1:1:1.0 + 2002/1/1 1:1:1.0 2002/3/1 1:1:1.0 + 2002/1/1 1:1:1.0 2004/2/1 1:1:1.0 + 2002/1/10 1:1:1.0 2004/2/1 1:1:1.0 + 2002/1/1 1:1:1.0 2004/3/1 1:1:1.0 + 2002/1/10 1:1:1.0 2004/3/1 1:1:1.0 + +echo select * from t1 where timestamp_diff(month,f1,f2)=0; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/1/1 1:1:1.0 + +echo select * from t1 where timestamp_diff(month,f2,f1)<=2; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/1/1 1:1:1.0 + 2002/1/1 1:1:1.0 2002/2/3 1:1:1.0 + 2002/1/1 1:1:1.0 2002/3/1 1:1:1.0 + +echo select * from t1 where timestamp_diff(month,f2,f1)=25; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2004/2/1 1:1:1.0 + 2002/1/10 1:1:1.0 2004/3/1 1:1:1.0 + +echo select * from t1 where timestamp_diff(month,f2,f1)>=25; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2004/2/1 1:1:1.0 + 2002/1/1 1:1:1.0 2004/3/1 1:1:1.0 + 2002/1/10 1:1:1.0 2004/3/1 1:1:1.0 + +echo select * from t1 where timestamp_diff(month,f2,f1)=26; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2004/3/1 1:1:1.0 + +echo select * from t1 where timestamp_diff(month,f2,f1)!=26; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/1/1 1:1:1.0 + 2002/1/1 1:1:1.0 2002/2/3 1:1:1.0 + 2002/1/1 1:1:1.0 2002/3/1 1:1:1.0 + 2002/1/1 1:1:1.0 2004/2/1 1:1:1.0 + 2002/1/10 1:1:1.0 2004/2/1 1:1:1.0 + 2002/1/10 1:1:1.0 2004/3/1 1:1:1.0 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test029.ksh b/test/sql/ScalarFunction/exp.test029.ksh new file mode 100644 index 00000000..a27d2117 --- /dev/null +++ b/test/sql/ScalarFunction/exp.test029.ksh @@ -0,0 +1,80 @@ +echo Create table t1(f1 timestamp, f2 timestamp); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/1/1 1:1:1.0 + 2002/1/1 1:1:1.0 2002/2/3 1:1:1.0 + 2002/1/1 1:1:1.0 2002/3/1 1:1:1.0 + 2004/1/1 1:1:1.0 2004/2/1 1:1:1.0 + 2004/1/1 1:1:1.0 2004/3/1 1:1:1.0 + 2002/1/1 1:1:1.0 2004/3/1 1:1:1.0 + +echo select * from t1 where timestamp_diff(day,f1,f2) =0; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/1/1 1:1:1.0 + +echo select * from t1 where timestamp_diff(day,f2,f1)<=33; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/1/1 1:1:1.0 + 2002/1/1 1:1:1.0 2002/2/3 1:1:1.0 + 2004/1/1 1:1:1.0 2004/2/1 1:1:1.0 + +echo select * from t1 where timestamp_diff(day,f2,f1) =59; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/3/1 1:1:1.0 + +echo select * from t1 where timestamp_diff(day,f2,f1)>=59; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/3/1 1:1:1.0 + 2004/1/1 1:1:1.0 2004/3/1 1:1:1.0 + 2002/1/1 1:1:1.0 2004/3/1 1:1:1.0 + +echo select * from t1 where timestamp_diff(day,f2,f1) =60; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2004/1/1 1:1:1.0 2004/3/1 1:1:1.0 + +echo select * from t1 where timestamp_diff(day,f2,f1)!=60; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/1/1 1:1:1.0 + 2002/1/1 1:1:1.0 2002/2/3 1:1:1.0 + 2002/1/1 1:1:1.0 2002/3/1 1:1:1.0 + 2004/1/1 1:1:1.0 2004/2/1 1:1:1.0 + 2002/1/1 1:1:1.0 2004/3/1 1:1:1.0 + +echo select * from t1 where timestamp_diff(day,f2,f1) =790; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2004/3/1 1:1:1.0 + +echo select * from t1 where timestamp_diff(day,f2,f1)!=790; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/1/1 1:1:1.0 + 2002/1/1 1:1:1.0 2002/2/3 1:1:1.0 + 2002/1/1 1:1:1.0 2002/3/1 1:1:1.0 + 2004/1/1 1:1:1.0 2004/2/1 1:1:1.0 + 2004/1/1 1:1:1.0 2004/3/1 1:1:1.0 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test030.ksh b/test/sql/ScalarFunction/exp.test030.ksh new file mode 100644 index 00000000..0d645259 --- /dev/null +++ b/test/sql/ScalarFunction/exp.test030.ksh @@ -0,0 +1,83 @@ +echo Create table t1(f1 timestamp, f2 timestamp); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/1/1 1:1:1.0 + 2002/1/1 1:1:1.0 2002/2/3 5:1:1.0 + 2002/1/1 1:1:1.0 2002/3/1 5:1:1.0 + 2004/1/1 1:1:1.0 2004/2/1 5:1:1.0 + 2004/1/1 1:1:1.0 2004/3/1 5:1:1.0 + 2002/1/1 1:1:1.0 2004/3/1 5:1:1.0 + +echo select * from t1 where timestamp_diff(hour,f1,f2) =0; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/1/1 1:1:1.0 + +echo select * from t1 where timestamp_diff(hour,f2,f1)<=1420; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/1/1 1:1:1.0 + 2002/1/1 1:1:1.0 2002/2/3 5:1:1.0 + 2002/1/1 1:1:1.0 2002/3/1 5:1:1.0 + 2004/1/1 1:1:1.0 2004/2/1 5:1:1.0 + +echo select * from t1 where timestamp_diff(hour,f2,f1) =748; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2004/1/1 1:1:1.0 2004/2/1 5:1:1.0 + +echo select * from t1 where timestamp_diff(hour,f2,f1)>=748; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/2/3 5:1:1.0 + 2002/1/1 1:1:1.0 2002/3/1 5:1:1.0 + 2004/1/1 1:1:1.0 2004/2/1 5:1:1.0 + 2004/1/1 1:1:1.0 2004/3/1 5:1:1.0 + 2002/1/1 1:1:1.0 2004/3/1 5:1:1.0 + +echo select * from t1 where timestamp_diff(hour,f2,f1) =1444; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2004/1/1 1:1:1.0 2004/3/1 5:1:1.0 + +echo select * from t1 where timestamp_diff(hour,f2,f1)!=1444; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/1/1 1:1:1.0 + 2002/1/1 1:1:1.0 2002/2/3 5:1:1.0 + 2002/1/1 1:1:1.0 2002/3/1 5:1:1.0 + 2004/1/1 1:1:1.0 2004/2/1 5:1:1.0 + 2002/1/1 1:1:1.0 2004/3/1 5:1:1.0 + +echo select * from t1 where timestamp_diff(hour,f2,f1) =18964; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2004/3/1 5:1:1.0 + +echo select * from t1 where timestamp_diff(hour,f2,f1)!=18964; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/1/1 1:1:1.0 + 2002/1/1 1:1:1.0 2002/2/3 5:1:1.0 + 2002/1/1 1:1:1.0 2002/3/1 5:1:1.0 + 2004/1/1 1:1:1.0 2004/2/1 5:1:1.0 + 2004/1/1 1:1:1.0 2004/3/1 5:1:1.0 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test031.ksh b/test/sql/ScalarFunction/exp.test031.ksh new file mode 100644 index 00000000..1865b5c7 --- /dev/null +++ b/test/sql/ScalarFunction/exp.test031.ksh @@ -0,0 +1,100 @@ +echo Create table t1(f1 timestamp, f2 timestamp); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/1/1 1:1:1.0 + 2002/1/1 1:1:1.0 2002/1/1 1:10:1.0 + 2002/1/1 1:1:1.0 2002/1/1 5:10:1.0 + 2002/1/1 1:1:1.0 2002/2/3 5:5:1.0 + 2002/1/1 1:1:1.0 2002/3/1 5:5:1.0 + 2004/1/1 1:1:1.0 2004/2/1 5:5:1.0 + 2004/1/1 1:1:1.0 2004/3/1 5:5:1.0 + 2002/1/1 1:1:1.0 2004/3/1 5:5:1.0 + +echo select * from t1 where timestamp_diff(minute,f1,f2) =0; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/1/1 1:1:1.0 + +echo select * from t1 where timestamp_diff(minute,f2,f1) =9; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/1/1 1:10:1.0 + +echo select * from t1 where timestamp_diff(minute,f2,f1)<=249; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/1/1 1:1:1.0 + 2002/1/1 1:1:1.0 2002/1/1 1:10:1.0 + 2002/1/1 1:1:1.0 2002/1/1 5:10:1.0 + +echo select * from t1 where timestamp_diff(minute,f2,f1) =85204; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/3/1 5:5:1.0 + +echo select * from t1 where timestamp_diff(minute,f2,f1)>=85204; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/3/1 5:5:1.0 + 2004/1/1 1:1:1.0 2004/3/1 5:5:1.0 + 2002/1/1 1:1:1.0 2004/3/1 5:5:1.0 + +echo select * from t1 where timestamp_diff(minute,f2,f1) =44884; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2004/1/1 1:1:1.0 2004/2/1 5:5:1.0 + +echo select * from t1 where timestamp_diff(minute,f2,f1) =86644; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2004/1/1 1:1:1.0 2004/3/1 5:5:1.0 + +echo select * from t1 where timestamp_diff(minute,f2,f1)!=86644; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/1/1 1:1:1.0 + 2002/1/1 1:1:1.0 2002/1/1 1:10:1.0 + 2002/1/1 1:1:1.0 2002/1/1 5:10:1.0 + 2002/1/1 1:1:1.0 2002/2/3 5:5:1.0 + 2002/1/1 1:1:1.0 2002/3/1 5:5:1.0 + 2004/1/1 1:1:1.0 2004/2/1 5:5:1.0 + 2002/1/1 1:1:1.0 2004/3/1 5:5:1.0 + +echo select * from t1 where timestamp_diff(minute,f2,f1) =1137844; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2004/3/1 5:5:1.0 + +echo select * from t1 where timestamp_diff(minute,f2,f1)!=1137844; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/1/1 1:1:1.0 + 2002/1/1 1:1:1.0 2002/1/1 1:10:1.0 + 2002/1/1 1:1:1.0 2002/1/1 5:10:1.0 + 2002/1/1 1:1:1.0 2002/2/3 5:5:1.0 + 2002/1/1 1:1:1.0 2002/3/1 5:5:1.0 + 2004/1/1 1:1:1.0 2004/2/1 5:5:1.0 + 2004/1/1 1:1:1.0 2004/3/1 5:5:1.0 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test032.ksh b/test/sql/ScalarFunction/exp.test032.ksh new file mode 100644 index 00000000..63dda383 --- /dev/null +++ b/test/sql/ScalarFunction/exp.test032.ksh @@ -0,0 +1,86 @@ +echo Create table t1(f1 timestamp, f2 timestamp); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/1/1 1:1:1.0 + 2002/1/1 1:1:1.0 2002/1/1 1:1:5.0 + 2002/1/1 1:1:1.0 2002/1/1 1:5:5.0 + 2002/1/1 1:1:1.0 2002/1/1 5:5:5.0 + 2002/1/1 1:1:1.0 2002/1/3 5:5:5.0 + 2002/1/1 1:1:1.0 2002/3/3 5:5:5.0 + 2002/1/1 1:1:1.0 2004/3/1 5:5:5.0 + +echo select * from t1 where timestamp_diff(second,f1,f2) =0; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/1/1 1:1:1.0 + +echo select * from t1 where timestamp_diff(second,f2,f1) =4; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/1/1 1:1:5.0 + +echo select * from t1 where timestamp_diff(second,f2,f1)<=244; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/1/1 1:1:1.0 + 2002/1/1 1:1:1.0 2002/1/1 1:1:5.0 + 2002/1/1 1:1:1.0 2002/1/1 1:5:5.0 + +echo select * from t1 where timestamp_diff(second,f2,f1) =14644; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/1/1 5:5:5.0 + +echo select * from t1 where timestamp_diff(second,f2,f1)>=14644; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/1/1 5:5:5.0 + 2002/1/1 1:1:1.0 2002/1/3 5:5:5.0 + 2002/1/1 1:1:1.0 2002/3/3 5:5:5.0 + 2002/1/1 1:1:1.0 2004/3/1 5:5:5.0 + +echo select * from t1 where timestamp_diff(second,f2,f1) =187444; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/1/3 5:5:5.0 + +echo select * from t1 where timestamp_diff(second,f2,f1) =5285044; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/3/3 5:5:5.0 + +echo select * from t1 where timestamp_diff(second,f2,f1)!=5285044; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2002/1/1 1:1:1.0 + 2002/1/1 1:1:1.0 2002/1/1 1:1:5.0 + 2002/1/1 1:1:1.0 2002/1/1 1:5:5.0 + 2002/1/1 1:1:1.0 2002/1/1 5:5:5.0 + 2002/1/1 1:1:1.0 2002/1/3 5:5:5.0 + 2002/1/1 1:1:1.0 2004/3/1 5:5:5.0 + +echo select * from t1 where timestamp_diff(second,f2,f1) =68270644; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2002/1/1 1:1:1.0 2004/3/1 5:5:5.0 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test033.ksh b/test/sql/ScalarFunction/exp.test033.ksh new file mode 100644 index 00000000..2d6e49c1 --- /dev/null +++ b/test/sql/ScalarFunction/exp.test033.ksh @@ -0,0 +1,72 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2001/1/1 + 2001/1/1 2001/2/3 + 2001/1/3 2002/3/3 + 2001/1/1 2002/1/4 + 2001/1/1 2003/4/5 + +echo select * from t1 where extract(year from '2001-01-01') = 2001; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2001/1/1 + 2001/1/1 2001/2/3 + 2001/1/3 2002/3/3 + 2001/1/1 2002/1/4 + 2001/1/1 2003/4/5 + +echo select * from t1 where extract(year from f2) = 2002; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/3 2002/3/3 + 2001/1/1 2002/1/4 + +echo select * from t1 where extract(year from f2) < 2002; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2001/1/1 + 2001/1/1 2001/2/3 + +echo select * from t1 where extract(year from f2)<= 2002; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2001/1/1 + 2001/1/1 2001/2/3 + 2001/1/3 2002/3/3 + 2001/1/1 2002/1/4 + +echo select * from t1 where extract(year from f2) > 2002; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2003/4/5 + +echo select * from t1 where extract(year from f2)>= 2002; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/3 2002/3/3 + 2001/1/1 2002/1/4 + 2001/1/1 2003/4/5 + +echo select * from t1 where extract(year from f2)!= 2002; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2001/1/1 + 2001/1/1 2001/2/3 + 2001/1/1 2003/4/5 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test034.ksh b/test/sql/ScalarFunction/exp.test034.ksh new file mode 100644 index 00000000..6c5e8040 --- /dev/null +++ b/test/sql/ScalarFunction/exp.test034.ksh @@ -0,0 +1,62 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2001/1/1 + 2001/1/1 2001/1/3 + 2001/1/3 2002/2/3 + 2001/1/1 2002/2/4 + 2001/1/1 2003/3/5 + +echo select * from t1 where extract(month from f2) = 02; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/3 2002/2/3 + 2001/1/1 2002/2/4 + +echo select * from t1 where extract(month from f2) < 02; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2001/1/1 + 2001/1/1 2001/1/3 + +echo select * from t1 where extract(month from f2)<= 02; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2001/1/1 + 2001/1/1 2001/1/3 + 2001/1/3 2002/2/3 + 2001/1/1 2002/2/4 + +echo select * from t1 where extract(month from f2) > 02; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2003/3/5 + +echo select * from t1 where extract(month from f2)>= 02; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/3 2002/2/3 + 2001/1/1 2002/2/4 + 2001/1/1 2003/3/5 + +echo select * from t1 where extract(month from f2)!= 02; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2001/1/1 + 2001/1/1 2001/1/3 + 2001/1/1 2003/3/5 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test035.ksh b/test/sql/ScalarFunction/exp.test035.ksh new file mode 100644 index 00000000..87446ac0 --- /dev/null +++ b/test/sql/ScalarFunction/exp.test035.ksh @@ -0,0 +1,63 @@ +echo Create table t1(f1 date, f2 date); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2001/1/1 + 2002/1/1 2001/2/1 + 2003/1/3 2002/3/2 + 2004/1/1 2002/4/2 + 2005/1/1 2003/5/3 + +echo select * from t1 where extract(day from f2) = 02; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/3 2002/3/2 + 2004/1/1 2002/4/2 + +echo select * from t1 where extract(day from f2) < 02; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2001/1/1 + 2002/1/1 2001/2/1 + +echo select * from t1 where extract(day from f2)<= 02; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2001/1/1 + 2002/1/1 2001/2/1 + 2003/1/3 2002/3/2 + 2004/1/1 2002/4/2 + +echo select * from t1 where extract(day from f2) > 02; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2005/1/1 2003/5/3 + +echo select * from t1 where extract(day from f2)>= 02; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/3 2002/3/2 + 2004/1/1 2002/4/2 + 2005/1/1 2003/5/3 + +echo select * from t1 where extract(day from f2)!= 02; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 2001/1/1 + 2002/1/1 2001/2/1 + 2005/1/1 2003/5/3 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test036.ksh b/test/sql/ScalarFunction/exp.test036.ksh new file mode 100644 index 00000000..79cec4d7 --- /dev/null +++ b/test/sql/ScalarFunction/exp.test036.ksh @@ -0,0 +1,63 @@ +echo Create table t1(f1 date, f2 time); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 23:59:59.0 + 2002/1/1 22:58:58.0 + 2003/1/3 12:30:30.0 + 2004/1/1 2:2:2.0 + 2005/1/1 1:1:1.0 + +echo select * from t1 where extract(hour from f2) = 12; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/3 12:30:30.0 + +echo select * from t1 where extract(hour from f2) < 12; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2004/1/1 2:2:2.0 + 2005/1/1 1:1:1.0 + +echo select * from t1 where extract(hour from f2)<= 12; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/3 12:30:30.0 + 2004/1/1 2:2:2.0 + 2005/1/1 1:1:1.0 + +echo select * from t1 where extract(hour from f2) > 12; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 23:59:59.0 + 2002/1/1 22:58:58.0 + +echo select * from t1 where extract(hour from f2)>= 12; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 23:59:59.0 + 2002/1/1 22:58:58.0 + 2003/1/3 12:30:30.0 + +echo select * from t1 where extract(hour from f2)!= 12; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 23:59:59.0 + 2002/1/1 22:58:58.0 + 2004/1/1 2:2:2.0 + 2005/1/1 1:1:1.0 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test037.ksh b/test/sql/ScalarFunction/exp.test037.ksh new file mode 100644 index 00000000..a2aa957f --- /dev/null +++ b/test/sql/ScalarFunction/exp.test037.ksh @@ -0,0 +1,63 @@ +echo Create table t1(f1 date, f2 time); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 23:59:59.0 + 2002/1/1 22:58:58.0 + 2003/1/3 12:30:30.0 + 2004/1/1 2:2:2.0 + 2005/1/1 1:1:1.0 + +echo select * from t1 where extract(minute from f2) = 30; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/3 12:30:30.0 + +echo select * from t1 where extract(minute from f2) < 30; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2004/1/1 2:2:2.0 + 2005/1/1 1:1:1.0 + +echo select * from t1 where extract(minute from f2)<= 30; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/3 12:30:30.0 + 2004/1/1 2:2:2.0 + 2005/1/1 1:1:1.0 + +echo select * from t1 where extract(minute from f2) > 30; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 23:59:59.0 + 2002/1/1 22:58:58.0 + +echo select * from t1 where extract(minute from f2)>= 30; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 23:59:59.0 + 2002/1/1 22:58:58.0 + 2003/1/3 12:30:30.0 + +echo select * from t1 where extract(minute from f2)!= 30; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 23:59:59.0 + 2002/1/1 22:58:58.0 + 2004/1/1 2:2:2.0 + 2005/1/1 1:1:1.0 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test038.ksh b/test/sql/ScalarFunction/exp.test038.ksh new file mode 100644 index 00000000..b267a302 --- /dev/null +++ b/test/sql/ScalarFunction/exp.test038.ksh @@ -0,0 +1,63 @@ +echo Create table t1(f1 date, f2 time); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 23:59:59.0 + 2002/1/1 22:58:58.0 + 2003/1/3 12:30:30.0 + 2004/1/1 2:2:2.0 + 2005/1/1 1:1:1.0 + +echo select * from t1 where extract(second from f2) = 30; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/3 12:30:30.0 + +echo select * from t1 where extract(second from f2) < 30; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2004/1/1 2:2:2.0 + 2005/1/1 1:1:1.0 + +echo select * from t1 where extract(second from f2)<= 30; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/3 12:30:30.0 + 2004/1/1 2:2:2.0 + 2005/1/1 1:1:1.0 + +echo select * from t1 where extract(second from f2) > 30; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 23:59:59.0 + 2002/1/1 22:58:58.0 + +echo select * from t1 where extract(second from f2)>= 30; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 23:59:59.0 + 2002/1/1 22:58:58.0 + 2003/1/3 12:30:30.0 + +echo select * from t1 where extract(second from f2)!= 30; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 23:59:59.0 + 2002/1/1 22:58:58.0 + 2004/1/1 2:2:2.0 + 2005/1/1 1:1:1.0 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test039.ksh b/test/sql/ScalarFunction/exp.test039.ksh new file mode 100644 index 00000000..5e0c6973 --- /dev/null +++ b/test/sql/ScalarFunction/exp.test039.ksh @@ -0,0 +1,107 @@ +echo Create table t1(f1 timestamp, f2 timestamp); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/5 1:1:1.0 + 2002/1/1 1:1:1.0 2002/4/10 2:2:2.0 + 2003/1/3 1:1:1.0 2003/7/15 12:30:30.0 + 2004/1/1 1:1:1.0 2004/10/20 22:58:58.0 + 2005/1/1 1:1:1.0 2005/12/25 23:59:59.0 + +echo select * from t1 where extract(year from f2) =2003; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/3 1:1:1.0 2003/7/15 12:30:30.0 + +echo select * from t1 where extract(year from f2)<=2003; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/5 1:1:1.0 + 2002/1/1 1:1:1.0 2002/4/10 2:2:2.0 + 2003/1/3 1:1:1.0 2003/7/15 12:30:30.0 + +echo select * from t1 where extract(year from f2) >2003; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2004/1/1 1:1:1.0 2004/10/20 22:58:58.0 + 2005/1/1 1:1:1.0 2005/12/25 23:59:59.0 + +echo select * from t1 where extract(year from f2)!=2003; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/5 1:1:1.0 + 2002/1/1 1:1:1.0 2002/4/10 2:2:2.0 + 2004/1/1 1:1:1.0 2004/10/20 22:58:58.0 + 2005/1/1 1:1:1.0 2005/12/25 23:59:59.0 + +echo select * from t1 where extract(month from f2) =7; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/3 1:1:1.0 2003/7/15 12:30:30.0 + +echo select * from t1 where extract(month from f2) <7; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/5 1:1:1.0 + 2002/1/1 1:1:1.0 2002/4/10 2:2:2.0 + +echo select * from t1 where extract(month from f2)>=7; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/3 1:1:1.0 2003/7/15 12:30:30.0 + 2004/1/1 1:1:1.0 2004/10/20 22:58:58.0 + 2005/1/1 1:1:1.0 2005/12/25 23:59:59.0 + +echo select * from t1 where extract(month from f2)!=7; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/5 1:1:1.0 + 2002/1/1 1:1:1.0 2002/4/10 2:2:2.0 + 2004/1/1 1:1:1.0 2004/10/20 22:58:58.0 + 2005/1/1 1:1:1.0 2005/12/25 23:59:59.0 + +echo select * from t1 where extract(day from f2) =15; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/3 1:1:1.0 2003/7/15 12:30:30.0 + +echo select * from t1 where extract(day from f2) <15; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/5 1:1:1.0 + 2002/1/1 1:1:1.0 2002/4/10 2:2:2.0 + +echo select * from t1 where extract(day from f2) >15; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2004/1/1 1:1:1.0 2004/10/20 22:58:58.0 + 2005/1/1 1:1:1.0 2005/12/25 23:59:59.0 + +echo select * from t1 where extract(day from f2)<>15; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/5 1:1:1.0 + 2002/1/1 1:1:1.0 2002/4/10 2:2:2.0 + 2004/1/1 1:1:1.0 2004/10/20 22:58:58.0 + 2005/1/1 1:1:1.0 2005/12/25 23:59:59.0 + +Statement Executed diff --git a/test/sql/ScalarFunction/exp.test040.ksh b/test/sql/ScalarFunction/exp.test040.ksh new file mode 100644 index 00000000..8a0cff18 --- /dev/null +++ b/test/sql/ScalarFunction/exp.test040.ksh @@ -0,0 +1,107 @@ +echo Create table t1(f1 timestamp, f2 timestamp); +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select * from t1; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/5 1:1:1.0 + 2002/1/1 1:1:1.0 2002/4/10 2:2:2.0 + 2003/1/3 1:1:1.0 2003/7/15 12:30:30.0 + 2004/1/1 1:1:1.0 2004/10/20 22:58:58.0 + 2005/1/1 1:1:1.0 2005/12/25 23:59:59.0 + +echo select * from t1 where extract(hour from f2) =12; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/3 1:1:1.0 2003/7/15 12:30:30.0 + +echo select * from t1 where extract(hour from f2)<=12; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/5 1:1:1.0 + 2002/1/1 1:1:1.0 2002/4/10 2:2:2.0 + 2003/1/3 1:1:1.0 2003/7/15 12:30:30.0 + +echo select * from t1 where extract(hour from f2) >12; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2004/1/1 1:1:1.0 2004/10/20 22:58:58.0 + 2005/1/1 1:1:1.0 2005/12/25 23:59:59.0 + +echo select * from t1 where extract(hour from f2)!=12; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/5 1:1:1.0 + 2002/1/1 1:1:1.0 2002/4/10 2:2:2.0 + 2004/1/1 1:1:1.0 2004/10/20 22:58:58.0 + 2005/1/1 1:1:1.0 2005/12/25 23:59:59.0 + +echo select * from t1 where extract(minute from f2) =30; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/3 1:1:1.0 2003/7/15 12:30:30.0 + +echo select * from t1 where extract(minute from f2) <30; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/5 1:1:1.0 + 2002/1/1 1:1:1.0 2002/4/10 2:2:2.0 + +echo select * from t1 where extract(minute from f2)>=30; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/3 1:1:1.0 2003/7/15 12:30:30.0 + 2004/1/1 1:1:1.0 2004/10/20 22:58:58.0 + 2005/1/1 1:1:1.0 2005/12/25 23:59:59.0 + +echo select * from t1 where extract(minute from f2)!=30; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/5 1:1:1.0 + 2002/1/1 1:1:1.0 2002/4/10 2:2:2.0 + 2004/1/1 1:1:1.0 2004/10/20 22:58:58.0 + 2005/1/1 1:1:1.0 2005/12/25 23:59:59.0 + +echo select * from t1 where extract(second from f2) =30; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2003/1/3 1:1:1.0 2003/7/15 12:30:30.0 + +echo select * from t1 where extract(second from f2) <30; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/5 1:1:1.0 + 2002/1/1 1:1:1.0 2002/4/10 2:2:2.0 + +echo select * from t1 where extract(second from f2) >30; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2004/1/1 1:1:1.0 2004/10/20 22:58:58.0 + 2005/1/1 1:1:1.0 2005/12/25 23:59:59.0 + +echo select * from t1 where extract(second from f2)<>30; +--------------------------------------------------------- + t1.f1 t1.f2 +--------------------------------------------------------- + 2001/1/1 1:1:1.0 2001/1/5 1:1:1.0 + 2002/1/1 1:1:1.0 2002/4/10 2:2:2.0 + 2004/1/1 1:1:1.0 2004/10/20 22:58:58.0 + 2005/1/1 1:1:1.0 2005/12/25 23:59:59.0 + +Statement Executed diff --git a/test/sql/ScalarFunction/extract_day_from_date.sql b/test/sql/ScalarFunction/extract_day_from_date.sql new file mode 100644 index 00000000..cf07f205 --- /dev/null +++ b/test/sql/ScalarFunction/extract_day_from_date.sql @@ -0,0 +1,21 @@ +echo Create table t1(f1 date, f2 date); +Create table t1(f1 date, f2 date); +insert into t1 values('2001-01-01', '2001-01-01'); +insert into t1 values('2002-01-01', '2001-02-01'); +insert into t1 values('2003-01-03', '2002-03-02'); +insert into t1 values('2004-01-01', '2002-04-02'); +insert into t1 values('2005-01-01', '2003-05-03'); +echo select * from t1; +select * from t1; +echo select * from t1 where extract(day from f2) = 02; +select * from t1 where extract(day from f2) = 02; +echo select * from t1 where extract(day from f2) < 02; +select * from t1 where extract(day from f2) < 02; +echo select * from t1 where extract(day from f2)<= 02; +select * from t1 where extract(day from f2)<= 02; +echo select * from t1 where extract(day from f2) > 02; +select * from t1 where extract(day from f2) > 02; +echo select * from t1 where extract(day from f2)>= 02; +select * from t1 where extract(day from f2)>= 02; +echo select * from t1 where extract(day from f2)!= 02; +select * from t1 where extract(day from f2)!= 02; diff --git a/test/sql/ScalarFunction/extract_hour_from_time.sql b/test/sql/ScalarFunction/extract_hour_from_time.sql new file mode 100644 index 00000000..e17da544 --- /dev/null +++ b/test/sql/ScalarFunction/extract_hour_from_time.sql @@ -0,0 +1,21 @@ +echo Create table t1(f1 date, f2 time); +Create table t1(f1 date, f2 time); +insert into t1 values('2001-01-01', '23:59:59'); +insert into t1 values('2002-01-01', '22:58:58'); +insert into t1 values('2003-01-03', '12:30:30'); +insert into t1 values('2004-01-01', '02:02:02'); +insert into t1 values('2005-01-01', '01:01:01'); +echo select * from t1; +select * from t1; +echo select * from t1 where extract(hour from f2) = 12; +select * from t1 where extract(hour from f2) = 12; +echo select * from t1 where extract(hour from f2) < 12; +select * from t1 where extract(hour from f2) < 12; +echo select * from t1 where extract(hour from f2)<= 12; +select * from t1 where extract(hour from f2)<= 12; +echo select * from t1 where extract(hour from f2) > 12; +select * from t1 where extract(hour from f2) > 12; +echo select * from t1 where extract(hour from f2)>= 12; +select * from t1 where extract(hour from f2)>= 12; +echo select * from t1 where extract(hour from f2)!= 12; +select * from t1 where extract(hour from f2)!= 12; diff --git a/test/sql/ScalarFunction/extract_hourminutesecond_from_timestamp.sql b/test/sql/ScalarFunction/extract_hourminutesecond_from_timestamp.sql new file mode 100644 index 00000000..8ab0acf5 --- /dev/null +++ b/test/sql/ScalarFunction/extract_hourminutesecond_from_timestamp.sql @@ -0,0 +1,33 @@ +echo Create table t1(f1 timestamp, f2 timestamp); +Create table t1(f1 timestamp, f2 timestamp); +insert into t1 values('2001-01-01 01:01:01', '2001-01-05 01:01:01'); +insert into t1 values('2002-01-01 01:01:01', '2002-04-10 02:02:02'); +insert into t1 values('2003-01-03 01:01:01', '2003-07-15 12:30:30'); +insert into t1 values('2004-01-01 01:01:01', '2004-10-20 22:58:58'); +insert into t1 values('2005-01-01 01:01:01', '2005-12-25 23:59:59'); +echo select * from t1; +select * from t1; +echo select * from t1 where extract(hour from f2) =12; +select * from t1 where extract(hour from f2) =12; +echo select * from t1 where extract(hour from f2)<=12; +select * from t1 where extract(hour from f2)<=12; +echo select * from t1 where extract(hour from f2) >12; +select * from t1 where extract(hour from f2) >12; +echo select * from t1 where extract(hour from f2)!=12; +select * from t1 where extract(hour from f2)!=12; +echo select * from t1 where extract(minute from f2) =30; +select * from t1 where extract(minute from f2) =30; +echo select * from t1 where extract(minute from f2) <30; +select * from t1 where extract(minute from f2) <30; +echo select * from t1 where extract(minute from f2)>=30; +select * from t1 where extract(minute from f2)>=30; +echo select * from t1 where extract(minute from f2)!=30; +select * from t1 where extract(minute from f2)!=30; +echo select * from t1 where extract(second from f2) =30; +select * from t1 where extract(second from f2) =30; +echo select * from t1 where extract(second from f2) <30; +select * from t1 where extract(second from f2) <30; +echo select * from t1 where extract(second from f2) >30; +select * from t1 where extract(second from f2) >30; +echo select * from t1 where extract(second from f2)<>30; +select * from t1 where extract(second from f2)<>30; diff --git a/test/sql/ScalarFunction/extract_minute_from_time.sql b/test/sql/ScalarFunction/extract_minute_from_time.sql new file mode 100644 index 00000000..1dc22376 --- /dev/null +++ b/test/sql/ScalarFunction/extract_minute_from_time.sql @@ -0,0 +1,21 @@ +echo Create table t1(f1 date, f2 time); +Create table t1(f1 date, f2 time); +insert into t1 values('2001-01-01', '23:59:59'); +insert into t1 values('2002-01-01', '22:58:58'); +insert into t1 values('2003-01-03', '12:30:30'); +insert into t1 values('2004-01-01', '02:02:02'); +insert into t1 values('2005-01-01', '01:01:01'); +echo select * from t1; +select * from t1; +echo select * from t1 where extract(minute from f2) = 30; +select * from t1 where extract(minute from f2) = 30; +echo select * from t1 where extract(minute from f2) < 30; +select * from t1 where extract(minute from f2) < 30; +echo select * from t1 where extract(minute from f2)<= 30; +select * from t1 where extract(minute from f2)<= 30; +echo select * from t1 where extract(minute from f2) > 30; +select * from t1 where extract(minute from f2) > 30; +echo select * from t1 where extract(minute from f2)>= 30; +select * from t1 where extract(minute from f2)>= 30; +echo select * from t1 where extract(minute from f2)!= 30; +select * from t1 where extract(minute from f2)!= 30; diff --git a/test/sql/ScalarFunction/extract_month_from_date.sql b/test/sql/ScalarFunction/extract_month_from_date.sql new file mode 100644 index 00000000..ea5c691c --- /dev/null +++ b/test/sql/ScalarFunction/extract_month_from_date.sql @@ -0,0 +1,20 @@ +Create table t1(f1 date, f2 date); +insert into t1 values('2001-01-01', '2001-01-01'); +insert into t1 values('2001-01-01', '2001-01-03'); +insert into t1 values('2001-01-03', '2002-02-03'); +insert into t1 values('2001-01-01', '2002-02-04'); +insert into t1 values('2001-01-01', '2003-03-05'); +echo select * from t1; +select * from t1; +echo select * from t1 where extract(month from f2) = 02; +select * from t1 where extract(month from f2) = 02; +echo select * from t1 where extract(month from f2) < 02; +select * from t1 where extract(month from f2) < 02; +echo select * from t1 where extract(month from f2)<= 02; +select * from t1 where extract(month from f2)<= 02; +echo select * from t1 where extract(month from f2) > 02; +select * from t1 where extract(month from f2) > 02; +echo select * from t1 where extract(month from f2)>= 02; +select * from t1 where extract(month from f2)>= 02; +echo select * from t1 where extract(month from f2)!= 02; +select * from t1 where extract(month from f2)!= 02; diff --git a/test/sql/ScalarFunction/extract_second_from_time.sql b/test/sql/ScalarFunction/extract_second_from_time.sql new file mode 100644 index 00000000..fa76ce43 --- /dev/null +++ b/test/sql/ScalarFunction/extract_second_from_time.sql @@ -0,0 +1,21 @@ +echo Create table t1(f1 date, f2 time); +Create table t1(f1 date, f2 time); +insert into t1 values('2001-01-01', '23:59:59'); +insert into t1 values('2002-01-01', '22:58:58'); +insert into t1 values('2003-01-03', '12:30:30'); +insert into t1 values('2004-01-01', '02:02:02'); +insert into t1 values('2005-01-01', '01:01:01'); +echo select * from t1; +select * from t1; +echo select * from t1 where extract(second from f2) = 30; +select * from t1 where extract(second from f2) = 30; +echo select * from t1 where extract(second from f2) < 30; +select * from t1 where extract(second from f2) < 30; +echo select * from t1 where extract(second from f2)<= 30; +select * from t1 where extract(second from f2)<= 30; +echo select * from t1 where extract(second from f2) > 30; +select * from t1 where extract(second from f2) > 30; +echo select * from t1 where extract(second from f2)>= 30; +select * from t1 where extract(second from f2)>= 30; +echo select * from t1 where extract(second from f2)!= 30; +select * from t1 where extract(second from f2)!= 30; diff --git a/test/sql/ScalarFunction/extract_year_from_date.sql b/test/sql/ScalarFunction/extract_year_from_date.sql new file mode 100644 index 00000000..57230939 --- /dev/null +++ b/test/sql/ScalarFunction/extract_year_from_date.sql @@ -0,0 +1,22 @@ +Create table t1(f1 date, f2 date); +insert into t1 values('2001-01-01', '2001-01-01'); +insert into t1 values('2001-01-01', '2001-02-03'); +insert into t1 values('2001-01-03', '2002-03-03'); +insert into t1 values('2001-01-01', '2002-01-04'); +insert into t1 values('2001-01-01', '2003-04-05'); +echo select * from t1; +select * from t1; +echo select * from t1 where extract(year from '2001-01-01') = 2001; +select * from t1 where extract(year from '2001-01-01') = 2001; +echo select * from t1 where extract(year from f2) = 2002; +select * from t1 where extract(year from f2) = 2002; +echo select * from t1 where extract(year from f2) < 2002; +select * from t1 where extract(year from f2) < 2002; +echo select * from t1 where extract(year from f2)<= 2002; +select * from t1 where extract(year from f2)<= 2002; +echo select * from t1 where extract(year from f2) > 2002; +select * from t1 where extract(year from f2) > 2002; +echo select * from t1 where extract(year from f2)>= 2002; +select * from t1 where extract(year from f2)>= 2002; +echo select * from t1 where extract(year from f2)!= 2002; +select * from t1 where extract(year from f2)!= 2002; diff --git a/test/sql/ScalarFunction/extract_yearmonthday_from_timestamp.sql b/test/sql/ScalarFunction/extract_yearmonthday_from_timestamp.sql new file mode 100644 index 00000000..6b3fde3e --- /dev/null +++ b/test/sql/ScalarFunction/extract_yearmonthday_from_timestamp.sql @@ -0,0 +1,33 @@ +echo Create table t1(f1 timestamp, f2 timestamp); +Create table t1(f1 timestamp, f2 timestamp); +insert into t1 values('2001-01-01 01:01:01', '2001-01-05 01:01:01'); +insert into t1 values('2002-01-01 01:01:01', '2002-04-10 02:02:02'); +insert into t1 values('2003-01-03 01:01:01', '2003-07-15 12:30:30'); +insert into t1 values('2004-01-01 01:01:01', '2004-10-20 22:58:58'); +insert into t1 values('2005-01-01 01:01:01', '2005-12-25 23:59:59'); +echo select * from t1; +select * from t1; +echo select * from t1 where extract(year from f2) =2003; +select * from t1 where extract(year from f2) =2003; +echo select * from t1 where extract(year from f2)<=2003; +select * from t1 where extract(year from f2)<=2003; +echo select * from t1 where extract(year from f2) >2003; +select * from t1 where extract(year from f2) >2003; +echo select * from t1 where extract(year from f2)!=2003; +select * from t1 where extract(year from f2)!=2003; +echo select * from t1 where extract(month from f2) =7; +select * from t1 where extract(month from f2) =7; +echo select * from t1 where extract(month from f2) <7; +select * from t1 where extract(month from f2) <7; +echo select * from t1 where extract(month from f2)>=7; +select * from t1 where extract(month from f2)>=7; +echo select * from t1 where extract(month from f2)!=7; +select * from t1 where extract(month from f2)!=7; +echo select * from t1 where extract(day from f2) =15; +select * from t1 where extract(day from f2) =15; +echo select * from t1 where extract(day from f2) <15; +select * from t1 where extract(day from f2) <15; +echo select * from t1 where extract(day from f2) >15; +select * from t1 where extract(day from f2) >15; +echo select * from t1 where extract(day from f2)<>15; +select * from t1 where extract(day from f2)<>15; diff --git a/test/sql/ScalarFunction/test001.ksh b/test/sql/ScalarFunction/test001.ksh new file mode 100755 index 00000000..8a532e93 --- /dev/null +++ b/test/sql/ScalarFunction/test001.ksh @@ -0,0 +1,57 @@ +#!/bin/ksh +# Testing DATE_DIFF function +# Create table t1(f1 date, f2 date); +# insert into t1 values('2001-01-01', '2001-01-03'); +# insert into t1 values('2001-01-01', '2001-02-01'); +# insert into t1 values('2001-01-01', '2001-03-01'); +# insert into t1 values('2001-01-01', '2002-01-01'); +# insert into t1 values('2001-01-01', '2002-02-02'); +# select * from t1; +# select * from t1 where date_diff(f2,f1)=2; +# select * from t1 where date_diff(f1,f2)=2; +# select * from t1 where date_diff(f2,f1)=31; +# select * from t1 where date_diff(f2,f1)=59; +# select * from t1 where date_diff(f2,f1)=365; +# select * from t1 where date_diff(f2,f1)=397; +# select * from t1 where date_diff(f2,f1)<59; +# select * from t1 where date_diff(f2,f1)<=59; +# select * from t1 where date_diff(f2,f1)>59; +# select * from t1 where date_diff(f2,f1)>=59; +# select * from t1 where date_diff(f2,f1)!=59; +# select * from t1 where date_diff(f2,'2001-01-01')=2; +# select * from t1 where date_diff(f2,'2001-01-01')>=59; +# select * from t1 where date_diff(f2,'2001-01-01')!=365; +# select * from t1 where date_diff('2001-01-02','2001-01-01')=1; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/date_diff.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/date_diff.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test002.ksh b/test/sql/ScalarFunction/test002.ksh new file mode 100755 index 00000000..265a7065 --- /dev/null +++ b/test/sql/ScalarFunction/test002.ksh @@ -0,0 +1,56 @@ +#!/bin/ksh +# Testing DATE_DIFF function +# Create table t1(f1 date, f2 date); +# insert into t1 values('01:01:01', '01:01:03'); +# insert into t1 values('01:01:01', '01:02:01'); +# insert into t1 values('01:01:01', '01:03:01'); +# insert into t1 values('01:01:01', '02:01:01'); +# insert into t1 values('01:01:01', '02:02:02'); +# select * from t1 where time_diff(f2,f1)=2; +# select * from t1 where time_diff(f1,f2)=2; +# select * from t1 where time_diff(f2,f1)=60; +# select * from t1 where time_diff(f2,f1)=120; +# select * from t1 where time_diff(f2,f1)=3600; +# select * from t1 where time_diff(f2,f1)=3661; +# select * from t1 where time_diff(f2,f1)<120; +# select * from t1 where time_diff(f2,f1)<=120; +# select * from t1 where time_diff(f2,f1)>120; +# select * from t1 where time_diff(f2,f1)>=120; +# select * from t1 where time_diff(f2,f1)!=120; +# select * from t1 where time_diff(f2,'01:01:01')=2; +# select * from t1 where time_diff(f2,'01:01:01')>=120; +# select * from t1 where time_diff(f2,'01:01:01')!=3600; +# select * from t1 where time_diff('01:01:02','01:01:01')=1; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/time_diff.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/time_diff.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test003.ksh b/test/sql/ScalarFunction/test003.ksh new file mode 100755 index 00000000..f2cfc7b4 --- /dev/null +++ b/test/sql/ScalarFunction/test003.ksh @@ -0,0 +1,47 @@ +#!/bin/ksh +#Testing DATE_ADD function by adding year value +# Create table t1(f1 date, f2 date); +# insert into t1 values('2001-01-01', '2005-01-01'); +# insert into t1 values('2002-01-01', '2006-01-01'); +# insert into t1 values('2003-01-01', '2007-01-01'); +# insert into t1 values('2004-01-01', '2009-01-01'); +# insert into t1 values('2005-01-01', '2010-01-01'); +# select * from t1; +# select * from t1 where date_add(f1 interval 4 year) = '2007-01-01'; +# select * from t1 where date_add(f1 interval 4 year) = f2; +# select * from t1 where date_add(f1 interval 4 year) = f2; +# select * from t1 where date_add(f1 interval 4 year) <= '2007-01-01'; +# select * from t1 where date_add(f1 interval 4 year) > '2007-01-01'; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/date_add_year.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/date_add_year.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test004.ksh b/test/sql/ScalarFunction/test004.ksh new file mode 100755 index 00000000..bf23ec2f --- /dev/null +++ b/test/sql/ScalarFunction/test004.ksh @@ -0,0 +1,45 @@ +#!/bin/ksh +#Testing DATE_ADD function by adding month value +# Create table t1(f1 date, f2 date); +# insert into t1 values('2001-05-01', '2001-05-01'); +# insert into t1 values('2001-06-01', '2001-06-01'); +# insert into t1 values('2001-07-01', '2002-07-01'); +# insert into t1 values('2001-08-01', '2002-08-01'); +# insert into t1 values('2001-09-01', '2002-09-01'); +# select * from t1; +# select * from t1 where date_add(f1 interval 5 month) < '2001-12-01'; +# select * from t1 where date_add(f1 interval 6 month) = '2002-01-01'; +# select * from t1 where date_add(f1 interval 18 month)>= '2003-01-01'; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/date_add_month.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/date_add_month.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test005.ksh b/test/sql/ScalarFunction/test005.ksh new file mode 100755 index 00000000..86811591 --- /dev/null +++ b/test/sql/ScalarFunction/test005.ksh @@ -0,0 +1,49 @@ +#!/bin/ksh +#Testing DATE_ADD function by adding day value +# Create table t1(f1 date, f2 date); +# insert into t1 values('2008-01-20', '2010-01-01'); +# insert into t1 values('2009-04-20', '2011-02-01'); +# insert into t1 values('2010-02-27', '2010-03-01'); +# insert into t1 values('2011-02-28', '2013-02-01'); +# insert into t1 values('2012-02-29', '2014-01-01'); +# select * from t1; +# select * from t1 where date_add(f1 interval 2 day) = '2010-03-01'; +# select * from t1 where date_add(f1 interval 15 day) <= '2008-02-04'; +# select * from t1 where date_add(f1 interval 15 day) >= '2009-05-05'; +# select * from t1 where date_add(f1 interval 40 day) <= '2008-03-01'; +# select * from t1 where date_add(f1 interval 40 day) >= '2009-05-30'; +# select * from t1 where date_add(f1 interval 365 day) <= '2010-04-20'; +# select * from t1 where date_add(f1 interval 366 day) >= '2010-04-21'; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/date_add_day.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/date_add_day.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test006.ksh b/test/sql/ScalarFunction/test006.ksh new file mode 100755 index 00000000..6e748724 --- /dev/null +++ b/test/sql/ScalarFunction/test006.ksh @@ -0,0 +1,46 @@ +#!/bin/ksh +#Testing DATE_SUB function by subtracting year value +# Create table t1(f1 date, f2 date); +# insert into t1 values('2001-01-01', '2001-01-03'); +# insert into t1 values('2001-01-01', '2001-02-01'); +# insert into t1 values('2001-01-01', '2001-03-01'); +# insert into t1 values('2001-01-01', '2002-01-01'); +# insert into t1 values('2001-01-01', '2002-02-02'); +# select * from t1; +# select * from t1 where date_sub(f2, interval 6 year) = '1995-03-01'; +# select * from t1 where date_sub(f2, interval 6 year) <= '1995-03-01'; +# select * from t1 where date_sub(f2, interval 6 year) >= '1995-03-01'; +# select * from t1 where date_sub(f2, interval 6 year) != '1995-03-01'; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/date_sub_year.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/date_sub_year.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test007.ksh b/test/sql/ScalarFunction/test007.ksh new file mode 100755 index 00000000..ce446d06 --- /dev/null +++ b/test/sql/ScalarFunction/test007.ksh @@ -0,0 +1,48 @@ +#!/bin/ksh +#Testing DATE_SUB function by subtracting month value +# Create table t1(f1 date, f2 date); +# insert into t1 values('2001-01-01', '2001-01-01'); +# insert into t1 values('2002-01-01', '2001-02-01'); +# insert into t1 values('2003-01-01', '2001-03-01'); +# insert into t1 values('2004-01-01', '2001-04-01'); +# insert into t1 values('2005-01-01', '2001-05-01'); +# select * from t1; +# select * from t1 where date_sub(f2, interval 6 month) = '2000-09-01'; +# select * from t1 where date_sub(f2, interval 6 month) <= '2000-09-01'; +# select * from t1 where date_sub(f2, interval 6 month) >= '2000-09-01'; +# select * from t1 where date_sub(f2, interval 18 month) = '1999-09-01'; +# select * from t1 where date_sub(f2, interval 18 month) <= '1999-09-01'; +# select * from t1 where date_sub(f2, interval 18 month) >= '1999-09-01'; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/date_sub_month.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/date_sub_month.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test008.ksh b/test/sql/ScalarFunction/test008.ksh new file mode 100755 index 00000000..acb90bc5 --- /dev/null +++ b/test/sql/ScalarFunction/test008.ksh @@ -0,0 +1,50 @@ +#!/bin/ksh +#Testing DATE_SUB function by subtracting day value +# Create table t1(f1 date, f2 date); +# insert into t1 values('2008-01-20', '2010-01-01'); +# insert into t1 values('2009-04-20', '2011-02-01'); +# insert into t1 values('2010-02-27', '2012-03-01'); +# insert into t1 values('2011-02-28', '2013-03-01'); +# insert into t1 values('2012-02-29', '2014-01-01'); +# select * from t1; +# select * from t1 where date_sub(f2, interval 2 day) = '2012-02-28'; +# select * from t1 where date_sub(f2, interval 15 day) <= '2012-02-28'; +# select * from t1 where date_sub(f2, interval 15 day) >= '2012-02-15'; +# select * from t1 where date_sub(f2, interval 40 day) <= '2012-01-21'; +# select * from t1 where date_sub(f2, interval 40 day) != '2012-01-21'; +# select * from t1 where date_sub(f2, interval 365 day) <= '2011-03-02'; +# select * from t1 where date_sub(f2, interval 366 day) >= '2011-03-02'; +# select * from t1 where date_sub(f2, interval 366 day) != '2011-03-02'; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/date_sub_day.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/date_sub_day.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test009.ksh b/test/sql/ScalarFunction/test009.ksh new file mode 100755 index 00000000..a1d339f1 --- /dev/null +++ b/test/sql/ScalarFunction/test009.ksh @@ -0,0 +1,49 @@ +#!/bin/ksh +#Testing TIME_ADD function by adding hour value +# Create table t1(f1 time, f2 time); +# insert into t1 values('01:01:01', '01:30:01'); +# insert into t1 values('02:01:01', '06:30:01'); +# insert into t1 values('03:01:01', '11:30:01'); +# insert into t1 values('04:01:01', '16:30:01'); +# insert into t1 values('05:01:01', '21:30:01'); +# select * from t1; +# select * from t1 where time_add(f2 interval 2 hour) = '13:30:01'; +# select * from t1 where time_add(f2 interval 2 hour) <= '13:30:01'; +# select * from t1 where time_add(f2 interval 2 hour) >= '13:30:01'; +# select * from t1 where time_add(f2 interval 10 hour) = '11:30:01'; +# select * from t1 where time_add(f2 interval 10 hour) <= '11:30:01'; +# select * from t1 where time_add(f2 interval 10 hour) >= '11:30:01'; +# select * from t1 where time_add(f2 interval 10 hour) != '11:30:01'; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/time_add_hour.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/time_add_hour.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test010.ksh b/test/sql/ScalarFunction/test010.ksh new file mode 100755 index 00000000..8ded9dae --- /dev/null +++ b/test/sql/ScalarFunction/test010.ksh @@ -0,0 +1,49 @@ +#!/bin/ksh +#Testing TIME_ADD function by adding minute value +# Create table t1(f1 time, f2 time); +# insert into t1 values('01:01:01', '01:30:01'); +# insert into t1 values('02:01:01', '02:30:01'); +# insert into t1 values('03:01:01', '03:30:01'); +# insert into t1 values('04:01:01', '04:30:01'); +# insert into t1 values('05:01:01', '05:30:01'); +# select * from t1; +# select * from t1 where time_add(f2 interval 30 minute) = '04:00:01'; +# select * from t1 where time_add(f2 interval 30 minute) <= '04:00:01'; +# select * from t1 where time_add(f2 interval 30 minute) >= '04:00:01'; +# select * from t1 where time_add(f2 interval 240 minute) = '07:30:01'; +# select * from t1 where time_add(f2 interval 240 minute) <= '07:30:01'; +# select * from t1 where time_add(f2 interval 1200 minute) >= '21:30:01'; +# select * from t1 where time_add(f2 interval 1200 minute) < '21:30:01'; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/time_add_minute.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/time_add_minute.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test011.ksh b/test/sql/ScalarFunction/test011.ksh new file mode 100755 index 00000000..857206c9 --- /dev/null +++ b/test/sql/ScalarFunction/test011.ksh @@ -0,0 +1,50 @@ +#!/bin/ksh +#Testing TIME_ADD function by adding second value +# Create table t1(f1 time, f2 time); +# insert into t1 values('01:01:01', '01:30:01'); +# insert into t1 values('02:01:01', '02:30:01'); +# insert into t1 values('03:01:01', '03:30:01'); +# insert into t1 values('04:01:01', '04:30:01'); +# insert into t1 values('05:01:01', '05:30:01'); +# select * from t1; +# select * from t1 where time_add(f2 interval 1800 second) = '04:00:01'; +# select * from t1 where time_add(f2 interval 1800 second) <= '04:00:01'; +# select * from t1 where time_add(f2 interval 1800 second) >= '04:00:01'; +# select * from t1 where time_add(f2 interval 14400 second) = '07:30:01'; +# select * from t1 where time_add(f2 interval 14400 second) <= '07:30:01'; +# select * from t1 where time_add(f2 interval 72000 second) >= '21:30:01'; +# select * from t1 where time_add(f2 interval 72000 second) < '21:30:01'; + +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/time_add_second.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/time_add_second.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test012.ksh b/test/sql/ScalarFunction/test012.ksh new file mode 100755 index 00000000..d08537a4 --- /dev/null +++ b/test/sql/ScalarFunction/test012.ksh @@ -0,0 +1,49 @@ +#!/bin/ksh +#Testing TIME_SUB function by adding hour value +# Create table t1(f1 time, f2 time); +# insert into t1 values('01:01:01', '01:30:01'); +# insert into t1 values('02:01:01', '06:30:01'); +# insert into t1 values('03:01:01', '11:30:01'); +# insert into t1 values('04:01:01', '16:30:01'); +# insert into t1 values('05:01:01', '21:30:01'); +# select * from t1; +# select * from t1 where time_sub(f2 interval 2 hour) = '14:30:01'; +# select * from t1 where time_sub(f2 interval 2 hour) <= '14:30:01'; +# select * from t1 where time_sub(f2 interval 2 hour) >= '14:30:01'; +# select * from t1 where time_sub(f2 interval 26 hour) = '14:30:01'; +# select * from t1 where time_sub(f2 interval 26 hour)<= '14:30:01'; +# select * from t1 where time_sub(f2 interval 26 hour)>= '14:30:01'; +# select * from t1 where time_sub(f2 interval 26 hour)!= '14:30:01'; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/time_sub_hour.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/time_sub_hour.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test013.ksh b/test/sql/ScalarFunction/test013.ksh new file mode 100755 index 00000000..e26168b8 --- /dev/null +++ b/test/sql/ScalarFunction/test013.ksh @@ -0,0 +1,49 @@ +#!/bin/ksh +#Testing TIME_SUB function by adding minute value +# Create table t1(f1 time, f2 time); +# insert into t1 values('01:01:01', '01:10:01'); +# insert into t1 values('02:01:01', '01:30:01'); +# insert into t1 values('03:01:01', '01:50:01'); +# insert into t1 values('04:01:01', '13:20:01'); +# insert into t1 values('05:01:01', '13:40:01'); +# select * from t1; +# select * from t1 where time_sub(f2 interval 50 minute) = '01:00:01'; +# select * from t1 where time_sub(f2 interval 50 minute) <= '01:00:01'; +# select * from t1 where time_sub(f2 interval 50 minute) >= '01:00:01'; +# select * from t1 where time_sub(f2 interval 170 minute) = '23:00:01'; +# select * from t1 where time_sub(f2 interval 170 minute)!= '23:00:01'; +# select * from t1 where time_sub(f2 interval 170 minute)<= '23:00:01'; +# select * from t1 where time_sub(f2 interval 170 minute) > '23:00:01'; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/time_sub_minute.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/time_sub_minute.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test014.ksh b/test/sql/ScalarFunction/test014.ksh new file mode 100755 index 00000000..ffdfd052 --- /dev/null +++ b/test/sql/ScalarFunction/test014.ksh @@ -0,0 +1,49 @@ +#!/bin/ksh +#Testing TIME_SUB function by adding second value +# Create table t1(f1 time, f2 time); +# insert into t1 values('01:01:01', '01:10:01'); +# insert into t1 values('02:01:01', '01:30:01'); +# insert into t1 values('03:01:01', '01:50:01'); +# insert into t1 values('04:01:01', '13:20:01'); +# insert into t1 values('05:01:01', '13:40:01'); +# select * from t1; +# select * from t1 where time_sub(f2 interval 3000 second) = '01:00:01'; +# select * from t1 where time_sub(f2 interval 3000 second) <= '01:00:01'; +# select * from t1 where time_sub(f2 interval 3000 second) >= '01:00:01'; +# select * from t1 where time_sub(f2 interval 10200 second) = '23:00:01'; +# select * from t1 where time_sub(f2 interval 10200 second)!= '23:00:01'; +# select * from t1 where time_sub(f2 interval 10200 second)<= '23:00:01'; +# select * from t1 where time_sub(f2 interval 10200 second) > '23:00:01'; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/time_sub_second.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/time_sub_second.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test015.ksh b/test/sql/ScalarFunction/test015.ksh new file mode 100755 index 00000000..963c3000 --- /dev/null +++ b/test/sql/ScalarFunction/test015.ksh @@ -0,0 +1,46 @@ +#!/bin/ksh +#Testing TIMESTAMP_ADD function by adding year value +# Create table t1(f1 timestamp, f2 timestamp); +# insert into t1 values('2001-01-01 01:01:01', '2001-01-01 02:01:01'); +# insert into t1 values('2002-01-01 01:01:01', '2001-02-01 01:01:01'); +# insert into t1 values('2003-01-01 01:01:01', '2001-03-01 01:01:01'); +# insert into t1 values('2004-01-01 01:01:01', '2002-04-01 01:01:01'); +# insert into t1 values('2005-01-01 01:01:01', '2002-05-01 01:01:01'); +# select * from t1; +# select * from t1 where timestamp_add(f1 interval 5 year) ='2008-01-01 01:01:01'; +# select * from t1 where timestamp_add(f1 interval 5 year)<='2008-01-01 01:01:01'; +# select * from t1 where timestamp_add(f1 interval 5 year) >'2008-01-01 01:01:01'; +# select * from t1 where timestamp_add(f1 interval 5 year)!='2008-01-01 01:01:01'; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_add_year.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_add_year.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test016.ksh b/test/sql/ScalarFunction/test016.ksh new file mode 100755 index 00000000..2e515386 --- /dev/null +++ b/test/sql/ScalarFunction/test016.ksh @@ -0,0 +1,50 @@ +#!/bin/ksh +#Testing TIMESTAMP_ADD function by adding month value +# Create table t1(f1 timestamp, f2 timestamp); +# insert into t1 values('2001-01-01 01:01:01', '2001-01-01 02:01:01'); +# insert into t1 values('2002-01-01 01:01:01', '2001-02-01 01:01:01'); +# insert into t1 values('2003-01-01 01:01:01', '2001-03-01 01:01:01'); +# insert into t1 values('2004-01-01 01:01:01', '2001-04-01 01:01:01'); +# insert into t1 values('2005-01-01 01:01:01', '2001-05-01 01:01:01'); +# select * from t1; +# select * from t1 where timestamp_add(f2 interval 10 month) ='2002-01-01 01:01:01'; +# select * from t1 where timestamp_add(f2 interval 10 month)<='2002-01-01 01:01:01'; +# select * from t1 where timestamp_add(f2 interval 10 month) >'2002-01-01 01:01:01'; +# select * from t1 where timestamp_add(f2 interval 10 month)!='2002-01-01 01:01:01'; +# select * from t1 where timestamp_add(f2 interval 130 month) ='2012-01-01 01:01:01'; +# select * from t1 where timestamp_add(f2 interval 130 month)<='2012-01-01 01:01:01'; +# select * from t1 where timestamp_add(f2 interval 130 month) >'2012-01-01 01:01:01'; +# select * from t1 where timestamp_add(f2 interval 130 month)!='2012-01-01 01:01:01'; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_add_month.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_add_month.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test017.ksh b/test/sql/ScalarFunction/test017.ksh new file mode 100755 index 00000000..39cd56fa --- /dev/null +++ b/test/sql/ScalarFunction/test017.ksh @@ -0,0 +1,49 @@ +#!/bin/ksh +#Testing TIMESTAMP_ADD function by adding day value +# Create table t1(f1 timestamp, f2 timestamp); +# insert into t1 values('2001-01-01 01:01:01', '2001-01-20 01:01:01'); +# insert into t1 values('2002-01-01 01:01:01', '2002-02-20 01:01:01'); +# insert into t1 values('2003-01-01 01:01:01', '2003-02-20 01:01:01'); +# insert into t1 values('2004-01-01 01:01:01', '2004-02-20 01:01:01'); +# insert into t1 values('2005-01-01 01:01:01', '2005-11-20 01:01:01'); +# select * from t1; +# select * from t1 where timestamp_add(f2 interval 15 day) ='2001-02-04 01:01:01'; +# select * from t1 where timestamp_add(f2 interval 15 day)<='2002-03-07 01:01:01'; +# select * from t1 where timestamp_add(f2 interval 15 day)>='2003-03-07 01:01:01'; +# select * from t1 where timestamp_add(f2 interval 15 day) ='2004-03-06 01:01:01'; +# select * from t1 where timestamp_add(f2 interval 15 day)!='2005-12-05 01:01:01'; +# select * from t1 where timestamp_add(f2 interval 45 day) ='2006-01-04 01:01:01'; +# select * from t1 where timestamp_add(f2 interval 45 day)!='2006-01-04 01:01:01'; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_add_day.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_add_day.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test018.ksh b/test/sql/ScalarFunction/test018.ksh new file mode 100755 index 00000000..eaa3b07e --- /dev/null +++ b/test/sql/ScalarFunction/test018.ksh @@ -0,0 +1,53 @@ +#!/bin/ksh +#Testing TIMESTAMP_ADD function by adding hour value +# Create table t1(f1 timestamp, f2 timestamp); +# insert into t1 values('2001-01-01 01:01:01', '2001-01-25 01:01:01'); +# insert into t1 values('2002-01-01 01:01:01', '2002-02-25 01:01:01'); +# insert into t1 values('2003-01-01 01:01:01', '2003-02-25 01:01:01'); +# insert into t1 values('2004-01-01 01:01:01', '2004-02-25 01:01:01'); +# insert into t1 values('2005-01-01 01:01:01', '2005-11-25 01:01:01'); +# select * from t1; +# select * from t1 where timestamp_add(f1 interval 4 hour) ='2003-02-25 05:01:01'; +# select * from t1 where timestamp_add(f1 interval 4 hour)<='2003-02-25 05:01:01'; +# select * from t1 where timestamp_add(f1 interval 4 hour) >'2003-02-25 05:01:01'; +# select * from t1 where timestamp_add(f1 interval 244 hour) ='2003-02-04 05:01:01'; +# select * from t1 where timestamp_add(f1 interval 244 hour) <'2003-02-04 05:01:01'; +# select * from t1 where timestamp_add(f1 interval 244 hour) ='2003-03-07 05:01:01'; +# select * from t1 where timestamp_add(f1 interval 244 hour) >'2003-03-07 05:01:01'; +# select * from t1 where timestamp_add(f1 interval 244 hour) ='2003-03-06 05:01:01'; +# select * from t1 where timestamp_add(f1 interval 244 hour)<='2003-03-06 05:01:01'; +# select * from t1 where timestamp_add(f1 interval 960 hour) ='2006-01-04 01:01:01'; +# select * from t1 where timestamp_add(f1 interval 960 hour)!='2006-01-04 01:01:01'; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_add_hour.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_add_hour.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test019.ksh b/test/sql/ScalarFunction/test019.ksh new file mode 100755 index 00000000..aae84018 --- /dev/null +++ b/test/sql/ScalarFunction/test019.ksh @@ -0,0 +1,49 @@ +#!/bin/ksh +#Testing TIMESTAMP_ADD function by adding minute value +# Create table t1(f1 timestamp, f2 timestamp); +# insert into t1 values('2001-01-01 01:01:01', '2001-01-25 01:01:01'); +# insert into t1 values('2002-01-01 01:01:01', '2002-02-25 01:01:01'); +# insert into t1 values('2003-01-01 01:01:01', '2003-02-25 01:01:01'); +# insert into t1 values('2004-01-01 01:01:01', '2004-02-25 01:01:01'); +# insert into t1 values('2005-01-01 01:01:01', '2005-11-25 01:01:01'); +# select * from t1; +# select * from t1 where timestamp_add(f2 interval 244 minute) ='2003-02-25 05:05:01'; +# select * from t1 where timestamp_add(f2 interval 244 minute)<='2003-02-25 05:05:01'; +# select * from t1 where timestamp_add(f2 interval 244 minute) >'2003-02-25 05:05:01'; +# select * from t1 where timestamp_add(f2 interval 14644 minute) ='2001-02-04 05:05:01'; +# select * from t1 where timestamp_add(f2 interval 14644 minute) ='2002-03-07 05:05:01'; +# select * from t1 where timestamp_add(f2 interval 14644 minute) ='2004-03-06 05:05:01'; +# select * from t1 where timestamp_add(f2 interval 57844 minute) ='2006-01-04 05:05:01'; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_add_minute.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_add_minute.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test020.ksh b/test/sql/ScalarFunction/test020.ksh new file mode 100755 index 00000000..2ae532ec --- /dev/null +++ b/test/sql/ScalarFunction/test020.ksh @@ -0,0 +1,49 @@ +#!/bin/ksh +#Testing TIMESTAMP_ADD function by adding second value +# Create table t1(f1 timestamp, f2 timestamp); +# insert into t1 values('2001-01-01 01:01:01', '2001-01-25 01:01:01'); +# insert into t1 values('2002-01-01 01:01:01', '2002-02-25 01:01:01'); +# insert into t1 values('2003-01-01 01:01:01', '2003-02-25 01:01:01'); +# insert into t1 values('2004-01-01 01:01:01', '2004-02-25 01:01:01'); +# insert into t1 values('2005-01-01 01:01:01', '2005-11-25 01:01:01'); +# select * from t1; +# select * from t1 where timestamp_add(f2 interval 14644 second) ='2003-02-25 05:05:05'; +# select * from t1 where timestamp_add(f2 interval 14644 second)<='2003-02-25 05:05:05'; +# select * from t1 where timestamp_add(f2 interval 14644 second) >'2003-02-25 05:05:05'; +# select * from t1 where timestamp_add(f2 interval 878644 second) ='2001-02-04 05:05:05'; +# select * from t1 where timestamp_add(f2 interval 878644 second) ='2002-03-07 05:05:05'; +# select * from t1 where timestamp_add(f2 interval 878644 second) ='2004-03-06 05:05:05'; +# select * from t1 where timestamp_add(f2 interval 3470644 second) ='2006-01-04 05:05:05'; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_add_second.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_add_second.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test021.ksh b/test/sql/ScalarFunction/test021.ksh new file mode 100755 index 00000000..90704dc5 --- /dev/null +++ b/test/sql/ScalarFunction/test021.ksh @@ -0,0 +1,46 @@ +#!/bin/ksh +#Testing TIMESTAMP_SUB function by adding year value +# Create table t1(f1 timestamp, f2 timestamp); +# insert into t1 values('2001-01-01 01:01:01', '2001-01-01 02:01:01'); +# insert into t1 values('2002-01-01 01:01:01', '2001-02-01 01:01:01'); +# insert into t1 values('2003-01-01 01:01:01', '2001-03-01 01:01:01'); +# insert into t1 values('2004-01-01 01:01:01', '2002-04-01 01:01:01'); +# insert into t1 values('2005-01-01 01:01:01', '2002-05-01 01:01:01'); +# select * from t1; +# select * from t1 where timestamp_sub(f1 interval 5 year) ='1998-01-01 01:01:01'; +# select * from t1 where timestamp_sub(f1 interval 5 year)<='1998-01-01 01:01:01'; +# select * from t1 where timestamp_sub(f1 interval 5 year) >'1998-01-01 01:01:01'; +# select * from t1 where timestamp_sub(f1 interval 5 year)!='1998-01-01 01:01:01'; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_sub_year.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_sub_year.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test022.ksh b/test/sql/ScalarFunction/test022.ksh new file mode 100755 index 00000000..275c98fa --- /dev/null +++ b/test/sql/ScalarFunction/test022.ksh @@ -0,0 +1,50 @@ +#!/bin/ksh +#Testing TIMESTAMP_SUB function by adding month value +# Create table t1(f1 timestamp, f2 timestamp); +# insert into t1 values('2001-01-01 01:01:01', '2010-08-01 02:01:01'); +# insert into t1 values('2002-01-01 01:01:01', '2010-09-01 01:01:01'); +# insert into t1 values('2003-01-01 01:01:01', '2010-10-01 01:01:01'); +# insert into t1 values('2004-01-01 01:01:01', '2010-11-01 01:01:01'); +# insert into t1 values('2005-01-01 01:01:01', '2010-12-01 01:01:01'); +# select * from t1; +# select * from t1 where timestamp_sub(f2 interval 10 month) ='2009-12-01 01:01:01'; +# select * from t1 where timestamp_sub(f2 interval 10 month)<='2009-12-01 01:01:01'; +# select * from t1 where timestamp_sub(f2 interval 10 month) >'2009-12-01 01:01:01'; +# select * from t1 where timestamp_sub(f2 interval 10 month)!='2009-12-01 01:01:01'; +# select * from t1 where timestamp_sub(f2 interval 130 month) ='1999-12-01 01:01:01'; +# select * from t1 where timestamp_sub(f2 interval 130 month)<='1999-12-01 01:01:01'; +# select * from t1 where timestamp_sub(f2 interval 130 month) >'1999-12-01 01:01:01'; +# select * from t1 where timestamp_sub(f2 interval 130 month)!='1999-12-01 01:01:01'; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_sub_month.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_sub_month.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test023.ksh b/test/sql/ScalarFunction/test023.ksh new file mode 100755 index 00000000..780ab1a4 --- /dev/null +++ b/test/sql/ScalarFunction/test023.ksh @@ -0,0 +1,49 @@ +#!/bin/ksh +#Testing TIMESTAMP_SUB function by adding day value +# Create table t1(f1 timestamp, f2 timestamp); +# insert into t1 values('2001-01-01 01:01:01', '2001-05-10 01:01:01'); +# insert into t1 values('2002-01-01 01:01:01', '2002-03-10 01:01:01'); +# insert into t1 values('2003-01-01 01:01:01', '2003-03-10 01:01:01'); +# insert into t1 values('2004-01-01 01:01:01', '2004-03-10 01:01:01'); +# insert into t1 values('2005-01-01 01:01:01', '2005-02-10 01:01:01'); +# select * from t1; +# select * from t1 where timestamp_sub(f2 interval 15 day) ='2001-04-25 01:01:01'; +# select * from t1 where timestamp_sub(f2 interval 15 day)<='2002-02-23 01:01:01'; +# select * from t1 where timestamp_sub(f2 interval 15 day)>='2003-02-23 01:01:01'; +# select * from t1 where timestamp_sub(f2 interval 15 day) ='2004-02-24 01:01:01'; +# select * from t1 where timestamp_sub(f2 interval 15 day)!='2005-01-26 01:01:01'; +# select * from t1 where timestamp_sub(f2 interval 45 day) ='2004-12-27 01:01:01'; +# select * from t1 where timestamp_sub(f2 interval 45 day)!='2004-12-27 01:01:01'; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_sub_day.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_sub_day.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test024.ksh b/test/sql/ScalarFunction/test024.ksh new file mode 100755 index 00000000..3a52eb3d --- /dev/null +++ b/test/sql/ScalarFunction/test024.ksh @@ -0,0 +1,53 @@ +#!/bin/ksh +#Testing TIMESTAMP_SUB function by adding hour value +# Create table t1(f1 timestamp, f2 timestamp); +# insert into t1 values('2001-01-01 01:01:01', '2001-05-05 05:01:01'); +# insert into t1 values('2002-01-01 01:01:01', '2002-03-05 05:01:01'); +# insert into t1 values('2003-01-01 01:01:01', '2003-03-05 05:01:01'); +# insert into t1 values('2004-01-01 01:01:01', '2004-03-05 05:01:01'); +# insert into t1 values('2005-01-01 01:01:01', '2005-01-05 05:01:01'); +# select * from t1; +# select * from t1 where timestamp_sub(f2 interval 4 hour) ='2003-03-05 01:01:01'; +# select * from t1 where timestamp_sub(f2 interval 4 hour)<='2003-03-05 01:01:01'; +# select * from t1 where timestamp_sub(f2 interval 4 hour) >'2003-03-05 01:01:01'; +# select * from t1 where timestamp_sub(f2 interval 244 hour) ='2001-04-25 01:01:01'; +# select * from t1 where timestamp_sub(f2 interval 244 hour)>='2001-04-25 01:01:01'; +# select * from t1 where timestamp_sub(f2 interval 244 hour) ='2002-02-23 01:01:01'; +# select * from t1 where timestamp_sub(f2 interval 244 hour)<='2002-02-23 01:01:01'; +# select * from t1 where timestamp_sub(f2 interval 244 hour) ='2004-02-24 01:01:01'; +# select * from t1 where timestamp_sub(f2 interval 244 hour)>='2004-02-24 01:01:01'; +# select * from t1 where timestamp_sub(f2 interval 960 hour) ='2004-11-26 05:01:01'; +# select * from t1 where timestamp_sub(f2 interval 960 hour)!='2004-11-26 05:01:01'; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_sub_hour.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_sub_hour.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test025.ksh b/test/sql/ScalarFunction/test025.ksh new file mode 100755 index 00000000..bbbc059b --- /dev/null +++ b/test/sql/ScalarFunction/test025.ksh @@ -0,0 +1,49 @@ +#!/bin/ksh +#Testing TIMESTAMP_SUB function by adding minute value +# Create table t1(f1 timestamp, f2 timestamp); +# insert into t1 values('2001-01-01 01:01:01', '2001-05-05 05:05:01'); +# insert into t1 values('2002-01-01 01:01:01', '2002-03-05 05:05:01'); +# insert into t1 values('2003-01-01 01:01:01', '2003-03-05 05:05:01'); +# insert into t1 values('2004-01-01 01:01:01', '2004-03-05 05:05:01'); +# insert into t1 values('2005-01-01 01:01:01', '2005-01-05 05:05:01'); +# select * from t1; +# select * from t1 where timestamp_sub(f2 interval 244 minute) ='2003-03-05 01:01:01'; +# select * from t1 where timestamp_sub(f2 interval 244 minute)<='2003-03-05 01:01:01'; +# select * from t1 where timestamp_sub(f2 interval 244 minute) >'2003-03-05 01:01:01'; +# select * from t1 where timestamp_sub(f2 interval 14400 minute) ='2003-02-23 05:05:01'; +# select * from t1 where timestamp_sub(f2 interval 14400 minute)>='2003-02-23 05:05:01'; +# select * from t1 where timestamp_sub(f2 interval 527040 minute) ='2004-01-05 05:05:01'; +# select * from t1 where timestamp_sub(f2 interval 527040 minute)!='2004-01-05 05:05:01'; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_sub_minute.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_sub_minute.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test026.ksh b/test/sql/ScalarFunction/test026.ksh new file mode 100755 index 00000000..abc0ab0e --- /dev/null +++ b/test/sql/ScalarFunction/test026.ksh @@ -0,0 +1,49 @@ +#!/bin/ksh +#Testing TIMESTAMP_SUB function by adding second value +# Create table t1(f1 timestamp, f2 timestamp); +# insert into t1 values('2001-01-01 01:01:01', '2001-05-05 05:05:01'); +# insert into t1 values('2002-01-01 01:01:01', '2002-03-05 05:05:01'); +# insert into t1 values('2003-01-01 01:01:01', '2003-03-05 05:05:01'); +# insert into t1 values('2004-01-01 01:01:01', '2004-03-05 05:05:01'); +# insert into t1 values('2005-01-01 01:01:01', '2005-01-05 05:05:01'); +# select * from t1; +# select * from t1 where timestamp_sub(f2 interval 14640 second) ='2003-03-05 01:01:01'; +# select * from t1 where timestamp_sub(f2 interval 14640 second)<='2003-03-05 01:01:01'; +# select * from t1 where timestamp_sub(f2 interval 14640 second) >'2003-03-05 01:01:01'; +# select * from t1 where timestamp_sub(f2 interval 864000 second) ='2003-02-23 05:05:01'; +# select * from t1 where timestamp_sub(f2 interval 864000 second)>='2003-02-23 05:05:01'; +# select * from t1 where timestamp_sub(f2 interval 31622400 second) ='2004-01-05 05:05:01'; +# select * from t1 where timestamp_sub(f2 interval 31622400 second)!='2004-01-05 05:05:01'; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_sub_second.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_sub_second.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test027.ksh b/test/sql/ScalarFunction/test027.ksh new file mode 100755 index 00000000..b1cd43e4 --- /dev/null +++ b/test/sql/ScalarFunction/test027.ksh @@ -0,0 +1,50 @@ +#!/bin/ksh +#Testing TIMESTAMP_DIFF function using year +# Create table t1(f1 timestamp, f2 timestamp); +# insert into t1 values('2002-01-01 01:01:01', '2002-01-01 01:01:01'); +# insert into t1 values('2002-01-01 01:01:01', '2002-02-03 01:01:01'); +# insert into t1 values('2002-01-01 01:01:01', '2002-03-01 01:01:01'); +# insert into t1 values('2002-01-01 01:01:01', '2004-02-01 01:01:01'); +# insert into t1 values('2002-01-01 01:01:01', '2004-03-01 01:01:01'); +# insert into t1 values('2001-01-01 01:01:01', '2002-02-03 01:01:01'); +# insert into t1 values('2001-01-01 01:01:01', '2002-03-01 01:01:01'); +# insert into t1 values('2001-01-01 01:01:01', '2004-02-01 01:01:01'); +# insert into t1 values('2001-01-01 01:01:01', '2004-03-01 01:01:01'); +# select * from t1; +# select * from t1 where timestamp_diff(year,f1,f2)=0; +# select * from t1 where timestamp_diff(year,f1,f2)=2; +# select * from t1 where timestamp_diff(year,f1,f2)>2; +# select * from t1 where timestamp_diff(year,f1,f2)<=2; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_diff_year.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_diff_year.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test028.ksh b/test/sql/ScalarFunction/test028.ksh new file mode 100755 index 00000000..dd1c5b4e --- /dev/null +++ b/test/sql/ScalarFunction/test028.ksh @@ -0,0 +1,50 @@ +#!/bin/ksh +#Testing TIMESTAMP_DIFF function using month +# Create table t1(f1 timestamp, f2 timestamp); +# insert into t1 values('2002-01-01 01:01:01', '2002-01-01 01:01:01'); +# insert into t1 values('2002-01-01 01:01:01', '2002-02-03 01:01:01'); +# insert into t1 values('2002-01-01 01:01:01', '2002-03-01 01:01:01'); +# insert into t1 values('2002-01-01 01:01:01', '2004-02-01 01:01:01'); +# insert into t1 values('2002-01-10 01:01:01', '2004-02-01 01:01:01'); +# insert into t1 values('2002-01-01 01:01:01', '2004-03-01 01:01:01'); +# insert into t1 values('2002-01-10 01:01:01', '2004-03-01 01:01:01'); +# select * from t1; +# select * from t1 where timestamp_diff(month,f1,f2)=0; +# select * from t1 where timestamp_diff(month,f2,f1)<=2; +# select * from t1 where timestamp_diff(month,f2,f1)=25; +# select * from t1 where timestamp_diff(month,f2,f1)>=25; +# select * from t1 where timestamp_diff(month,f2,f1)=26; +# select * from t1 where timestamp_diff(month,f2,f1)!=26; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_diff_month.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_diff_month.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test029.ksh b/test/sql/ScalarFunction/test029.ksh new file mode 100755 index 00000000..fa7978ea --- /dev/null +++ b/test/sql/ScalarFunction/test029.ksh @@ -0,0 +1,51 @@ +#!/bin/ksh +#Testing TIMESTAMP_DIFF function using day +# Create table t1(f1 timestamp, f2 timestamp); +# insert into t1 values('2002-01-01 01:01:01', '2002-01-01 01:01:01'); +# insert into t1 values('2002-01-01 01:01:01', '2002-02-03 01:01:01'); +# insert into t1 values('2002-01-01 01:01:01', '2002-03-01 01:01:01'); +# insert into t1 values('2004-01-01 01:01:01', '2004-02-01 01:01:01'); +# insert into t1 values('2004-01-01 01:01:01', '2004-03-01 01:01:01'); +# insert into t1 values('2002-01-01 01:01:01', '2004-03-01 01:01:01'); +# select * from t1; +# select * from t1 where timestamp_diff(day,f1,f2) =0; +# select * from t1 where timestamp_diff(day,f2,f1)<=33; +# select * from t1 where timestamp_diff(day,f2,f1) =59; +# select * from t1 where timestamp_diff(day,f2,f1)>=59; +# select * from t1 where timestamp_diff(day,f2,f1) =60; +# select * from t1 where timestamp_diff(day,f2,f1)!=60; +# select * from t1 where timestamp_diff(day,f2,f1) =790; +# select * from t1 where timestamp_diff(day,f2,f1)!=790; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_diff_day.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_diff_day.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test030.ksh b/test/sql/ScalarFunction/test030.ksh new file mode 100755 index 00000000..17304871 --- /dev/null +++ b/test/sql/ScalarFunction/test030.ksh @@ -0,0 +1,51 @@ +#!/bin/ksh +#Testing TIMESTAMP_DIFF function using hour +# Create table t1(f1 timestamp, f2 timestamp); +# insert into t1 values('2002-01-01 01:01:01', '2002-01-01 01:01:01'); +# insert into t1 values('2002-01-01 01:01:01', '2002-02-03 05:01:01'); +# insert into t1 values('2002-01-01 01:01:01', '2002-03-01 05:01:01'); +# insert into t1 values('2004-01-01 01:01:01', '2004-02-01 05:01:01'); +# insert into t1 values('2004-01-01 01:01:01', '2004-03-01 05:01:01'); +# insert into t1 values('2002-01-01 01:01:01', '2004-03-01 05:01:01'); +# select * from t1; +# select * from t1 where timestamp_diff(hour,f1,f2) =0; +# select * from t1 where timestamp_diff(hour,f2,f1)<=1420; +# select * from t1 where timestamp_diff(hour,f2,f1) =748; +# select * from t1 where timestamp_diff(hour,f2,f1)>=748; +# select * from t1 where timestamp_diff(hour,f2,f1) =1444; +# select * from t1 where timestamp_diff(hour,f2,f1)!=1444; +# select * from t1 where timestamp_diff(hour,f2,f1) =18964; +# select * from t1 where timestamp_diff(hour,f2,f1)!=18964; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_diff_hour.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_diff_hour.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test031.ksh b/test/sql/ScalarFunction/test031.ksh new file mode 100755 index 00000000..7e8224c0 --- /dev/null +++ b/test/sql/ScalarFunction/test031.ksh @@ -0,0 +1,55 @@ +#!/bin/ksh +#Testing TIMESTAMP_DIFF function using minute +# Create table t1(f1 timestamp, f2 timestamp); +# insert into t1 values('2002-01-01 01:01:01', '2002-01-01 01:01:01'); +# insert into t1 values('2002-01-01 01:01:01', '2002-01-01 01:10:01'); +# insert into t1 values('2002-01-01 01:01:01', '2002-01-01 05:10:01'); +# insert into t1 values('2002-01-01 01:01:01', '2002-02-03 05:05:01'); +# insert into t1 values('2002-01-01 01:01:01', '2002-03-01 05:05:01'); +# insert into t1 values('2004-01-01 01:01:01', '2004-02-01 05:05:01'); +# insert into t1 values('2004-01-01 01:01:01', '2004-03-01 05:05:01'); +# insert into t1 values('2002-01-01 01:01:01', '2004-03-01 05:05:01'); +# select * from t1; +# select * from t1 where timestamp_diff(minute,f1,f2) =0; +# select * from t1 where timestamp_diff(minute,f2,f1) =9; +# select * from t1 where timestamp_diff(minute,f2,f1)<=249; +# select * from t1 where timestamp_diff(minute,f2,f1) =85204; +# select * from t1 where timestamp_diff(minute,f2,f1)>=85204; +# select * from t1 where timestamp_diff(minute,f2,f1) =44884; +# select * from t1 where timestamp_diff(minute,f2,f1) =86644; +# select * from t1 where timestamp_diff(minute,f2,f1)!=86644; +# select * from t1 where timestamp_diff(minute,f2,f1) =1137844; +# select * from t1 where timestamp_diff(minute,f2,f1)!=1137844; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_diff_minute.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_diff_minute.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test032.ksh b/test/sql/ScalarFunction/test032.ksh new file mode 100755 index 00000000..d685f055 --- /dev/null +++ b/test/sql/ScalarFunction/test032.ksh @@ -0,0 +1,53 @@ +#!/bin/ksh +#Testing TIMESTAMP_DIFF function using second +# Create table t1(f1 timestamp, f2 timestamp); +# insert into t1 values('2002-01-01 01:01:01', '2002-01-01 01:01:01'); +# insert into t1 values('2002-01-01 01:01:01', '2002-01-01 01:01:05'); +# insert into t1 values('2002-01-01 01:01:01', '2002-01-01 01:05:05'); +# insert into t1 values('2002-01-01 01:01:01', '2002-01-01 05:05:05'); +# insert into t1 values('2002-01-01 01:01:01', '2002-01-03 05:05:05'); +# insert into t1 values('2002-01-01 01:01:01', '2002-03-03 05:05:05'); +# insert into t1 values('2002-01-01 01:01:01', '2004-03-01 05:05:05'); +# select * from t1; +# select * from t1 where timestamp_diff(second,f1,f2) =0; +# select * from t1 where timestamp_diff(second,f2,f1) =4; +# select * from t1 where timestamp_diff(second,f2,f1)<=244; +# select * from t1 where timestamp_diff(second,f2,f1) =14644; +# select * from t1 where timestamp_diff(second,f2,f1)>=14644; +# select * from t1 where timestamp_diff(second,f2,f1) =187444; +# select * from t1 where timestamp_diff(second,f2,f1) =5285044; +# select * from t1 where timestamp_diff(second,f2,f1)!=5285044; +# select * from t1 where timestamp_diff(second,f2,f1) =68270644; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_diff_second.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_diff_second.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test033.ksh b/test/sql/ScalarFunction/test033.ksh new file mode 100755 index 00000000..76213205 --- /dev/null +++ b/test/sql/ScalarFunction/test033.ksh @@ -0,0 +1,49 @@ +#!/bin/ksh +#Testing extract year from date +# Create table t1(f1 date, f2 date); +# insert into t1 values('2001-01-01', '2001-01-01'); +# insert into t1 values('2001-01-01', '2001-02-03'); +# insert into t1 values('2001-01-03', '2002-03-03'); +# insert into t1 values('2001-01-01', '2002-01-04'); +# insert into t1 values('2001-01-01', '2003-04-05'); +# select * from t1; +# select * from t1 where extract(year from '2001-01-01') = 2001; +# select * from t1 where extract(year from f2) = 2002; +# select * from t1 where extract(year from f2) < 2002; +# select * from t1 where extract(year from f2)<= 2002; +# select * from t1 where extract(year from f2) > 2002; +# select * from t1 where extract(year from f2)>= 2002; +# select * from t1 where extract(year from f2)!= 2002; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/extract_year_from_date.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/extract_year_from_date.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test034.ksh b/test/sql/ScalarFunction/test034.ksh new file mode 100755 index 00000000..1539cb20 --- /dev/null +++ b/test/sql/ScalarFunction/test034.ksh @@ -0,0 +1,48 @@ +#!/bin/ksh +#Testing extract month from date +# Create table t1(f1 date, f2 date); +# insert into t1 values('2001-01-01', '2001-01-01'); +# insert into t1 values('2001-01-01', '2001-01-03'); +# insert into t1 values('2001-01-03', '2002-02-03'); +# insert into t1 values('2001-01-01', '2002-02-04'); +# insert into t1 values('2001-01-01', '2003-03-05'); +# select * from t1; +# select * from t1 where extract(month from f2) = 02; +# select * from t1 where extract(month from f2) < 02; +# select * from t1 where extract(month from f2)<= 02; +# select * from t1 where extract(month from f2) > 02; +# select * from t1 where extract(month from f2)>= 02; +# select * from t1 where extract(month from f2)!= 02; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/extract_month_from_date.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/extract_month_from_date.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test035.ksh b/test/sql/ScalarFunction/test035.ksh new file mode 100755 index 00000000..c638e692 --- /dev/null +++ b/test/sql/ScalarFunction/test035.ksh @@ -0,0 +1,48 @@ +#!/bin/ksh +#Testing extract day from date +# Create table t1(f1 date, f2 date); +# insert into t1 values('2001-01-01', '2001-01-01'); +# insert into t1 values('2002-01-01', '2001-02-01'); +# insert into t1 values('2003-01-03', '2002-03-02'); +# insert into t1 values('2004-01-01', '2002-04-02'); +# insert into t1 values('2005-01-01', '2003-05-03'); +# select * from t1; +# select * from t1 where extract(day from f2) = 02; +# select * from t1 where extract(day from f2) < 02; +# select * from t1 where extract(day from f2)<= 02; +# select * from t1 where extract(day from f2) > 02; +# select * from t1 where extract(day from f2)>= 02; +# select * from t1 where extract(day from f2)!= 02; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/extract_day_from_date.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/extract_day_from_date.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test036.ksh b/test/sql/ScalarFunction/test036.ksh new file mode 100755 index 00000000..a473e31b --- /dev/null +++ b/test/sql/ScalarFunction/test036.ksh @@ -0,0 +1,48 @@ +#!/bin/ksh +#Testing extract hour from time +# Create table t1(f1 date, f2 time); +# insert into t1 values('2001-01-01', '23:59:59'); +# insert into t1 values('2002-01-01', '22:58:58'); +# insert into t1 values('2003-01-03', '12:30:30'); +# insert into t1 values('2004-01-01', '02:02:02'); +# insert into t1 values('2005-01-01', '01:01:01'); +# select * from t1; +# select * from t1 where extract(hour from f2) = 12; +# select * from t1 where extract(hour from f2) < 12; +# select * from t1 where extract(hour from f2)<= 12; +# select * from t1 where extract(hour from f2) > 12; +# select * from t1 where extract(hour from f2)>= 12; +# select * from t1 where extract(hour from f2)!= 12; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/extract_hour_from_time.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/extract_hour_from_time.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test037.ksh b/test/sql/ScalarFunction/test037.ksh new file mode 100755 index 00000000..f892d47e --- /dev/null +++ b/test/sql/ScalarFunction/test037.ksh @@ -0,0 +1,48 @@ +#!/bin/ksh +#Testing extract minute from time +# Create table t1(f1 date, f2 time); +# insert into t1 values('2001-01-01', '23:59:59'); +# insert into t1 values('2002-01-01', '22:58:58'); +# insert into t1 values('2003-01-03', '12:30:30'); +# insert into t1 values('2004-01-01', '02:02:02'); +# insert into t1 values('2005-01-01', '01:01:01'); +# select * from t1; +# select * from t1 where extract(minute from f2) = 30; +# select * from t1 where extract(minute from f2) < 30; +# select * from t1 where extract(minute from f2)<= 30; +# select * from t1 where extract(minute from f2) > 30; +# select * from t1 where extract(minute from f2)>= 30; +# select * from t1 where extract(minute from f2)!= 30; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/extract_minute_from_time.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/extract_minute_from_time.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test038.ksh b/test/sql/ScalarFunction/test038.ksh new file mode 100755 index 00000000..1fb0b6d7 --- /dev/null +++ b/test/sql/ScalarFunction/test038.ksh @@ -0,0 +1,48 @@ +#!/bin/ksh +#Testing extract second from time +# Create table t1(f1 date, f2 time); +# insert into t1 values('2001-01-01', '23:59:59'); +# insert into t1 values('2002-01-01', '22:58:58'); +# insert into t1 values('2003-01-03', '12:30:30'); +# insert into t1 values('2004-01-01', '02:02:02'); +# insert into t1 values('2005-01-01', '01:01:01'); +# select * from t1; +# select * from t1 where extract(second from f2) = 30; +# select * from t1 where extract(second from f2) < 30; +# select * from t1 where extract(second from f2)<= 30; +# select * from t1 where extract(second from f2) > 30; +# select * from t1 where extract(second from f2)>= 30; +# select * from t1 where extract(second from f2)!= 30; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/extract_second_from_time.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/extract_second_from_time.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test039.ksh b/test/sql/ScalarFunction/test039.ksh new file mode 100755 index 00000000..907206f6 --- /dev/null +++ b/test/sql/ScalarFunction/test039.ksh @@ -0,0 +1,56 @@ +#!/bin/ksh +#Testing extract year,month,day from timestamp +# Create table t1(f1 timestamp, f2 timestamp); +# insert into t1 values('2001-01-01 01:01:01', '2001-10-05 01:01:01'); +# insert into t1 values('2002-01-01 01:01:01', '2002-20-10 02:02:02'); +# insert into t1 values('2003-01-03 01:01:01', '2003-30-15 12:30:30'); +# insert into t1 values('2004-01-01 01:01:01', '2004-40-20 22:58:58'); +# insert into t1 values('2005-01-01 01:01:01', '2005-50-25 23:59:59'); +# select * from t1; +# select * from t1 where extract(year from f2) =2003; +# select * from t1 where extract(year from f2)<=2003; +# select * from t1 where extract(year from f2) >2003; +# select * from t1 where extract(year from f2)!=2003; + +# select * from t1 where extract(month from f2) =30; +# select * from t1 where extract(month from f2) <30; +# select * from t1 where extract(month from f2)>=30; +# select * from t1 where extract(month from f2)!=30; + +# select * from t1 where extract(day from f2) =30; +# select * from t1 where extract(day from f2) <30; +# select * from t1 where extract(day from f2) >30; +# select * from t1 where extract(day from f2)<>30; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/extract_yearmonthday_from_timestamp.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/extract_yearmonthday_from_timestamp.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test040.ksh b/test/sql/ScalarFunction/test040.ksh new file mode 100755 index 00000000..d355b4ec --- /dev/null +++ b/test/sql/ScalarFunction/test040.ksh @@ -0,0 +1,58 @@ +#!/bin/ksh +#Testing extract hour,minute,second from timestamp +# Create table t1(f1 timestamp, f2 timestamp); +# insert into t1 values('2001-01-01 01:01:01', '2001-01-05 01:01:01'); +# insert into t1 values('2002-01-01 01:01:01', '2002-04-10 02:02:02'); +# insert into t1 values('2003-01-03 01:01:01', '2003-07-15 12:30:30'); +# insert into t1 values('2004-01-01 01:01:01', '2004-10-20 22:58:58'); +# insert into t1 values('2005-01-01 01:01:01', '2005-12-25 23:59:59'); +# select * from t1; +# select * from t1 where extract(hour from f2) =12; +# select * from t1 where extract(hour from f2)<=12; +# select * from t1 where extract(hour from f2) >12; +# select * from t1 where extract(hour from f2)!=12; + +# select * from t1 where extract(minute from f2) =30; +# select * from t1 where extract(minute from f2) <30; +# select * from t1 where extract(minute from f2)>=30; +# select * from t1 where extract(minute from f2)!=30; + +# select * from t1 where extract(second from f2) =30; +# select * from t1 where extract(second from f2) <30; +# select * from t1 where extract(second from f2) >30; +# select * from t1 where extract(second from f2)<>30; +# +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/extract_hourminutesecond_from_timestamp.sql + +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/extract_hourminutesecond_from_timestamp.sql + + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 2; +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test041.ksh b/test/sql/ScalarFunction/test041.ksh new file mode 100755 index 00000000..b39fd9c1 --- /dev/null +++ b/test/sql/ScalarFunction/test041.ksh @@ -0,0 +1,47 @@ +#!/bin/ksh +#Testing Now() for Date +#create table t1(f1 int,f2 date); +#insert into t1 values(1,'2003/12/10') +#insert into t1 values(2,'2004/12/10') +#insert into t1 values(3,'2005/12/10') +#insert into t1 values(4,'2006/12/10') +#insert into t1 values(5,now()) +#insert into t1 values(6,'2007/12/10') +#insert into t1 values(7,now()) +#select * from t1; +#select * from t1 where f2<=now(); +#select * from t1 where f2>now(); +#select * from t1; +#update t1 set f2=now() where f1<=2; +#select * from t1; +#update t1 set f2=now(),f1=10 where f2='2007/12/10'; +#select * from t1; +#drop table t1; +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/Date_with_now.sql + +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/Date_with_now.sql + + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test042.ksh b/test/sql/ScalarFunction/test042.ksh new file mode 100755 index 00000000..be40a548 --- /dev/null +++ b/test/sql/ScalarFunction/test042.ksh @@ -0,0 +1,30 @@ +#!/bin/ksh +#Testing Now() for Time +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/time_with_now.sql + +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/time_with_now.sql + + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/test043.ksh b/test/sql/ScalarFunction/test043.ksh new file mode 100755 index 00000000..aaeb6304 --- /dev/null +++ b/test/sql/ScalarFunction/test043.ksh @@ -0,0 +1,30 @@ +#!/bin/ksh +#Testing Now() for Timestamp +CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/ScalarFunction +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_with_now.sql + +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_with_now.sql + + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi + +rm -f ${REL_PATH}/dropt1.sql +exit 0; diff --git a/test/sql/ScalarFunction/time_add_hour.sql b/test/sql/ScalarFunction/time_add_hour.sql new file mode 100644 index 00000000..97141562 --- /dev/null +++ b/test/sql/ScalarFunction/time_add_hour.sql @@ -0,0 +1,23 @@ +echo Create table t1(f1 time, f2 time); +Create table t1(f1 time, f2 time); +insert into t1 values('01:01:01', '01:30:01'); +insert into t1 values('02:01:01', '06:30:01'); +insert into t1 values('03:01:01', '11:30:01'); +insert into t1 values('04:01:01', '16:30:01'); +insert into t1 values('05:01:01', '21:30:01'); +echo select * from t1; +select * from t1; +echo select * from t1 where time_add(f2 interval 2 hour) = '13:30:01'; +select * from t1 where time_add(f2 interval 2 hour) = '13:30:01'; +echo select * from t1 where time_add(f2 interval 2 hour) <= '13:30:01'; +select * from t1 where time_add(f2 interval 2 hour) <= '13:30:01'; +echo select * from t1 where time_add(f2 interval 2 hour) >= '13:30:01'; +select * from t1 where time_add(f2 interval 2 hour) >= '13:30:01'; +echo select * from t1 where time_add(f2 interval 10 hour) = '11:30:01'; +select * from t1 where time_add(f2 interval 10 hour) = '11:30:01'; +echo select * from t1 where time_add(f2 interval 10 hour) <= '11:30:01'; +select * from t1 where time_add(f2 interval 10 hour) <= '11:30:01'; +echo select * from t1 where time_add(f2 interval 10 hour) >= '11:30:01'; +select * from t1 where time_add(f2 interval 10 hour) >= '11:30:01'; +echo select * from t1 where time_add(f2 interval 10 hour) != '11:30:01'; +select * from t1 where time_add(f2 interval 10 hour) != '11:30:01'; diff --git a/test/sql/ScalarFunction/time_add_minute.sql b/test/sql/ScalarFunction/time_add_minute.sql new file mode 100644 index 00000000..c0141945 --- /dev/null +++ b/test/sql/ScalarFunction/time_add_minute.sql @@ -0,0 +1,23 @@ +echo Create table t1(f1 time, f2 time); +Create table t1(f1 time, f2 time); +insert into t1 values('01:01:01', '01:30:01'); +insert into t1 values('02:01:01', '02:30:01'); +insert into t1 values('03:01:01', '03:30:01'); +insert into t1 values('04:01:01', '04:30:01'); +insert into t1 values('05:01:01', '05:30:01'); +echo select * from t1; +select * from t1; +echo select * from t1 where time_add(f2 interval 30 minute) = '04:00:01'; +select * from t1 where time_add(f2 interval 30 minute) = '04:00:01'; +echo select * from t1 where time_add(f2 interval 30 minute) <= '04:00:01'; +select * from t1 where time_add(f2 interval 30 minute) <= '04:00:01'; +echo select * from t1 where time_add(f2 interval 30 minute) >= '04:00:01'; +select * from t1 where time_add(f2 interval 30 minute) >= '04:00:01'; +echo select * from t1 where time_add(f2 interval 240 minute) = '07:30:01'; +select * from t1 where time_add(f2 interval 240 minute) = '07:30:01'; +echo select * from t1 where time_add(f2 interval 240 minute) <= '07:30:01'; +select * from t1 where time_add(f2 interval 240 minute) <= '07:30:01'; +echo select * from t1 where time_add(f2 interval 1200 minute) >= '21:30:01'; +select * from t1 where time_add(f2 interval 1200 minute) >= '21:30:01'; +echo select * from t1 where time_add(f2 interval 1200 minute) < '21:30:01'; +select * from t1 where time_add(f2 interval 1200 minute) < '21:30:01'; diff --git a/test/sql/ScalarFunction/time_add_second.sql b/test/sql/ScalarFunction/time_add_second.sql new file mode 100644 index 00000000..32b1790d --- /dev/null +++ b/test/sql/ScalarFunction/time_add_second.sql @@ -0,0 +1,23 @@ +echo Create table t1(f1 time, f2 time); +Create table t1(f1 time, f2 time); +insert into t1 values('01:01:01', '01:30:01'); +insert into t1 values('02:01:01', '02:30:01'); +insert into t1 values('03:01:01', '03:30:01'); +insert into t1 values('04:01:01', '04:30:01'); +insert into t1 values('05:01:01', '05:30:01'); +echo select * from t1; +select * from t1; +echo select * from t1 where time_add(f2 interval 1800 second) = '04:00:01'; +select * from t1 where time_add(f2 interval 1800 second) = '04:00:01'; +echo select * from t1 where time_add(f2 interval 1800 second) <= '04:00:01'; +select * from t1 where time_add(f2 interval 1800 second) <= '04:00:01'; +echo select * from t1 where time_add(f2 interval 1800 second) >= '04:00:01'; +select * from t1 where time_add(f2 interval 1800 second) >= '04:00:01'; +echo select * from t1 where time_add(f2 interval 14400 second) = '07:30:01'; +select * from t1 where time_add(f2 interval 14400 second) = '07:30:01'; +echo select * from t1 where time_add(f2 interval 14400 second) <= '07:30:01'; +select * from t1 where time_add(f2 interval 14400 second) <= '07:30:01'; +echo select * from t1 where time_add(f2 interval 72000 second) >= '21:30:01'; +select * from t1 where time_add(f2 interval 72000 second) >= '21:30:01'; +echo select * from t1 where time_add(f2 interval 72000 second) < '21:30:01'; +select * from t1 where time_add(f2 interval 72000 second) < '21:30:01'; diff --git a/test/sql/ScalarFunction/time_diff.sql b/test/sql/ScalarFunction/time_diff.sql new file mode 100644 index 00000000..0426f1b1 --- /dev/null +++ b/test/sql/ScalarFunction/time_diff.sql @@ -0,0 +1,39 @@ +echo Create table t1(f1 time, f2 time); +Create table t1(f1 time, f2 time); +insert into t1 values('01:01:01', '01:01:03'); +insert into t1 values('01:01:01', '01:02:01'); +insert into t1 values('01:01:01', '01:03:01'); +insert into t1 values('01:01:01', '02:01:01'); +insert into t1 values('01:01:01', '02:02:02'); +echo select * from t1; +select * from t1; +echo select * from t1 where time_diff(f2,f1)=2; +select * from t1 where time_diff(f2,f1)=2; +echo select * from t1 where time_diff(f1,f2)=2; +select * from t1 where time_diff(f1,f2)=2; +echo select * from t1 where time_diff(f2,f1)=60; +select * from t1 where time_diff(f2,f1)=60; +echo select * from t1 where time_diff(f2,f1)=120; +select * from t1 where time_diff(f2,f1)=120; +echo select * from t1 where time_diff(f2,f1)=3600; +select * from t1 where time_diff(f2,f1)=3600; +echo select * from t1 where time_diff(f2,f1)=3661; +select * from t1 where time_diff(f2,f1)=3661; +echo select * from t1 where time_diff(f2,f1)<120; +select * from t1 where time_diff(f2,f1)<120; +echo select * from t1 where time_diff(f2,f1)<=120; +select * from t1 where time_diff(f2,f1)<=120; +echo select * from t1 where time_diff(f2,f1)>120; +select * from t1 where time_diff(f2,f1)>120; +echo select * from t1 where time_diff(f2,f1)>=120; +select * from t1 where time_diff(f2,f1)>=120; +echo select * from t1 where time_diff(f2,f1)!=120; +select * from t1 where time_diff(f2,f1)!=120; +echo select * from t1 where time_diff(f2,'01:01:01')=2; +select * from t1 where time_diff(f2,'01:01:01')=2; +echo select * from t1 where time_diff(f2,'01:01:01')>=120; +select * from t1 where time_diff(f2,'01:01:01')>=120; +echo select * from t1 where time_diff(f2,'01:01:01')!=3600; +select * from t1 where time_diff(f2,'01:01:01')!=3600; +echo select * from t1 where time_diff('01:01:02','01:01:01')=1; +select * from t1 where time_diff('01:01:02','01:01:01')=1; diff --git a/test/sql/ScalarFunction/time_sub_hour.sql b/test/sql/ScalarFunction/time_sub_hour.sql new file mode 100644 index 00000000..562beb8f --- /dev/null +++ b/test/sql/ScalarFunction/time_sub_hour.sql @@ -0,0 +1,23 @@ +echo Create table t1(f1 time, f2 time); +Create table t1(f1 time, f2 time); +insert into t1 values('01:01:01', '01:30:01'); +insert into t1 values('02:01:01', '06:30:01'); +insert into t1 values('03:01:01', '11:30:01'); +insert into t1 values('04:01:01', '16:30:01'); +insert into t1 values('05:01:01', '21:30:01'); +echo select * from t1; +select * from t1; +echo select * from t1 where time_sub(f2 interval 2 hour) = '14:30:01'; +select * from t1 where time_sub(f2 interval 2 hour) = '14:30:01'; +echo select * from t1 where time_sub(f2 interval 2 hour) <= '14:30:01'; +select * from t1 where time_sub(f2 interval 2 hour) <= '14:30:01'; +echo select * from t1 where time_sub(f2 interval 2 hour) >= '14:30:01'; +select * from t1 where time_sub(f2 interval 2 hour) >= '14:30:01'; +echo select * from t1 where time_sub(f2 interval 26 hour) = '14:30:01'; +select * from t1 where time_sub(f2 interval 26 hour) = '14:30:01'; +echo select * from t1 where time_sub(f2 interval 26 hour)<= '14:30:01'; +select * from t1 where time_sub(f2 interval 26 hour)<= '14:30:01'; +echo select * from t1 where time_sub(f2 interval 26 hour)>= '14:30:01'; +select * from t1 where time_sub(f2 interval 26 hour)>= '14:30:01'; +echo select * from t1 where time_sub(f2 interval 26 hour)!= '14:30:01'; +select * from t1 where time_sub(f2 interval 26 hour)!= '14:30:01'; diff --git a/test/sql/ScalarFunction/time_sub_minute.sql b/test/sql/ScalarFunction/time_sub_minute.sql new file mode 100644 index 00000000..583b78c7 --- /dev/null +++ b/test/sql/ScalarFunction/time_sub_minute.sql @@ -0,0 +1,23 @@ +echo Create table t1(f1 time, f2 time); +Create table t1(f1 time, f2 time); +insert into t1 values('01:01:01', '01:10:01'); +insert into t1 values('02:01:01', '01:30:01'); +insert into t1 values('03:01:01', '01:50:01'); +insert into t1 values('04:01:01', '13:20:01'); +insert into t1 values('05:01:01', '13:40:01'); +echo select * from t1; +select * from t1; +echo select * from t1 where time_sub(f2 interval 50 minute) = '01:00:01'; +select * from t1 where time_sub(f2 interval 50 minute) = '01:00:01'; +echo select * from t1 where time_sub(f2 interval 50 minute) <= '01:00:01'; +select * from t1 where time_sub(f2 interval 50 minute) <= '01:00:01'; +echo select * from t1 where time_sub(f2 interval 50 minute) >= '01:00:01'; +select * from t1 where time_sub(f2 interval 50 minute) >= '01:00:01'; +echo select * from t1 where time_sub(f2 interval 170 minute) = '23:00:01'; +select * from t1 where time_sub(f2 interval 170 minute) = '23:00:01'; +echo select * from t1 where time_sub(f2 interval 170 minute)!= '23:00:01'; +select * from t1 where time_sub(f2 interval 170 minute)!= '23:00:01'; +echo select * from t1 where time_sub(f2 interval 170 minute)<= '23:00:01'; +select * from t1 where time_sub(f2 interval 170 minute)<= '23:00:01'; +echo select * from t1 where time_sub(f2 interval 170 minute) > '23:00:01'; +select * from t1 where time_sub(f2 interval 170 minute) > '23:00:01'; diff --git a/test/sql/ScalarFunction/time_sub_second.sql b/test/sql/ScalarFunction/time_sub_second.sql new file mode 100644 index 00000000..185a9a52 --- /dev/null +++ b/test/sql/ScalarFunction/time_sub_second.sql @@ -0,0 +1,23 @@ +echo Create table t1(f1 time, f2 time); +Create table t1(f1 time, f2 time); +insert into t1 values('01:01:01', '01:10:01'); +insert into t1 values('02:01:01', '01:30:01'); +insert into t1 values('03:01:01', '01:50:01'); +insert into t1 values('04:01:01', '13:20:01'); +insert into t1 values('05:01:01', '13:40:01'); +echo select * from t1; +select * from t1; +echo select * from t1 where time_sub(f2 interval 3000 second) = '01:00:01'; +select * from t1 where time_sub(f2 interval 3000 second) = '01:00:01'; +echo select * from t1 where time_sub(f2 interval 3000 second) <= '01:00:01'; +select * from t1 where time_sub(f2 interval 3000 second) <= '01:00:01'; +echo select * from t1 where time_sub(f2 interval 3000 second) >= '01:00:01'; +select * from t1 where time_sub(f2 interval 3000 second) >= '01:00:01'; +echo select * from t1 where time_sub(f2 interval 10200 second) = '23:00:01'; +select * from t1 where time_sub(f2 interval 10200 second) = '23:00:01'; +echo select * from t1 where time_sub(f2 interval 10200 second)!= '23:00:01'; +select * from t1 where time_sub(f2 interval 10200 second)!= '23:00:01'; +echo select * from t1 where time_sub(f2 interval 10200 second)<= '23:00:01'; +select * from t1 where time_sub(f2 interval 10200 second)<= '23:00:01'; +echo select * from t1 where time_sub(f2 interval 10200 second) > '23:00:01'; +select * from t1 where time_sub(f2 interval 10200 second) > '23:00:01'; diff --git a/test/sql/ScalarFunction/time_with_now.sql b/test/sql/ScalarFunction/time_with_now.sql new file mode 100644 index 00000000..4b3ef795 --- /dev/null +++ b/test/sql/ScalarFunction/time_with_now.sql @@ -0,0 +1,37 @@ +echo create table t1(f1 int,f2 time); +create table t1(f1 int,f2 time); +echo insert into t1 values(1,'10:23:2'); +insert into t1 values(1,'10:23:2'); +echo insert into t1 values(2,'09:12:23'); +insert into t1 values(2,'09:12:23'); +echo insert into t1 values(3,'09:18:23'); +insert into t1 values(3,'09:18:23'); +echo insert into t1 values(4,'06:23:23'); +insert into t1 values(4,'06:23:23'); +echo insert into t1 values(5,now()); +insert into t1 values(5,now()); +echo insert into t1 values(6,'05:34:32'); +insert into t1 values(6,'05:34:32'); +echo insert into t1 values(7,now()); +insert into t1 values(7,now()); +echo select * from t1; +select * from t1; +echo select * from t1 where f2<=now(); +select * from t1 where f2<=now(); +echo select * from t1 where f2>now(); +select * from t1 where f2>now(); +echo select * from t1; +select * from t1; +echo update t1 set f2=now() where f1<=2; +update t1 set f2=now() where f1<=2; +echo select * from t1; +select * from t1; +echo update t1 set f2=now(),f1=10 where f2='05:34:32'; +update t1 set f2=now(),f1=10 where f2='05:34:32'; +echo select * from t1; +select * from t1; +echo drop table t1; +drop table t1; + + + diff --git a/test/sql/ScalarFunction/timestamp_add_day.sql b/test/sql/ScalarFunction/timestamp_add_day.sql new file mode 100644 index 00000000..b78fc512 --- /dev/null +++ b/test/sql/ScalarFunction/timestamp_add_day.sql @@ -0,0 +1,23 @@ +echo Create table t1(f1 timestamp, f2 timestamp); +Create table t1(f1 timestamp, f2 timestamp); +insert into t1 values('2001-01-01 01:01:01', '2001-01-20 01:01:01'); +insert into t1 values('2002-01-01 01:01:01', '2002-02-20 01:01:01'); +insert into t1 values('2003-01-01 01:01:01', '2003-02-20 01:01:01'); +insert into t1 values('2004-01-01 01:01:01', '2004-02-20 01:01:01'); +insert into t1 values('2005-01-01 01:01:01', '2005-11-20 01:01:01'); +echo select * from t1; +select * from t1; +echo select * from t1 where timestamp_add(f2 interval 15 day) ='2001-02-04 01:01:01'; +select * from t1 where timestamp_add(f2 interval 15 day) ='2001-02-04 01:01:01'; +echo select * from t1 where timestamp_add(f2 interval 15 day)<='2002-03-07 01:01:01'; +select * from t1 where timestamp_add(f2 interval 15 day)<='2002-03-07 01:01:01'; +echo select * from t1 where timestamp_add(f2 interval 15 day)>='2003-03-07 01:01:01'; +select * from t1 where timestamp_add(f2 interval 15 day)>='2003-03-07 01:01:01'; +echo select * from t1 where timestamp_add(f2 interval 15 day) ='2004-03-06 01:01:01'; +select * from t1 where timestamp_add(f2 interval 15 day) ='2004-03-06 01:01:01'; +echo select * from t1 where timestamp_add(f2 interval 15 day)!='2005-12-05 01:01:01'; +select * from t1 where timestamp_add(f2 interval 15 day)!='2005-12-05 01:01:01'; +echo select * from t1 where timestamp_add(f2 interval 45 day) ='2006-01-04 01:01:01'; +select * from t1 where timestamp_add(f2 interval 45 day) ='2006-01-04 01:01:01'; +echo select * from t1 where timestamp_add(f2 interval 45 day)!='2006-01-04 01:01:01'; +select * from t1 where timestamp_add(f2 interval 45 day)!='2006-01-04 01:01:01'; diff --git a/test/sql/ScalarFunction/timestamp_add_hour.sql b/test/sql/ScalarFunction/timestamp_add_hour.sql new file mode 100644 index 00000000..d3ac0b21 --- /dev/null +++ b/test/sql/ScalarFunction/timestamp_add_hour.sql @@ -0,0 +1,31 @@ +echo Create table t1(f1 timestamp, f2 timestamp); +Create table t1(f1 timestamp, f2 timestamp); +insert into t1 values('2001-01-01 01:01:01', '2001-01-25 01:01:01'); +insert into t1 values('2002-01-01 01:01:01', '2002-02-25 01:01:01'); +insert into t1 values('2003-01-01 01:01:01', '2003-02-25 01:01:01'); +insert into t1 values('2004-01-01 01:01:01', '2004-02-25 01:01:01'); +insert into t1 values('2005-01-01 01:01:01', '2005-11-25 01:01:01'); +echo select * from t1; +select * from t1; +echo select * from t1 where timestamp_add(f2 interval 4 hour) ='2003-02-25 05:01:01'; +select * from t1 where timestamp_add(f2 interval 4 hour) ='2003-02-25 05:01:01'; +echo select * from t1 where timestamp_add(f2 interval 4 hour)<='2003-02-25 05:01:01'; +select * from t1 where timestamp_add(f2 interval 4 hour)<='2003-02-25 05:01:01'; +echo select * from t1 where timestamp_add(f2 interval 4 hour) >'2003-02-25 05:01:01'; +select * from t1 where timestamp_add(f2 interval 4 hour) >'2003-02-25 05:01:01'; +echo select * from t1 where timestamp_add(f2 interval 244 hour) ='2001-02-04 05:01:01'; +select * from t1 where timestamp_add(f2 interval 244 hour) ='2001-02-04 05:01:01'; +echo select * from t1 where timestamp_add(f2 interval 244 hour)>='2001-02-04 05:01:01'; +select * from t1 where timestamp_add(f2 interval 244 hour)>='2001-02-04 05:01:01'; +echo select * from t1 where timestamp_add(f2 interval 244 hour) ='2002-03-07 05:01:01'; +select * from t1 where timestamp_add(f2 interval 244 hour) ='2002-03-07 05:01:01'; +echo select * from t1 where timestamp_add(f2 interval 244 hour)<='2002-03-07 05:01:01'; +select * from t1 where timestamp_add(f2 interval 244 hour)<='2002-03-07 05:01:01'; +echo select * from t1 where timestamp_add(f2 interval 244 hour) ='2004-03-06 05:01:01'; +select * from t1 where timestamp_add(f2 interval 244 hour) ='2004-03-06 05:01:01'; +echo select * from t1 where timestamp_add(f2 interval 244 hour)>='2004-03-06 05:01:01'; +select * from t1 where timestamp_add(f2 interval 244 hour)>='2004-03-06 05:01:01'; +echo select * from t1 where timestamp_add(f2 interval 960 hour) ='2006-01-04 01:01:01'; +select * from t1 where timestamp_add(f2 interval 960 hour) ='2006-01-04 01:01:01'; +echo select * from t1 where timestamp_add(f2 interval 960 hour)!='2006-01-04 01:01:01'; +select * from t1 where timestamp_add(f2 interval 960 hour)!='2006-01-04 01:01:01'; diff --git a/test/sql/ScalarFunction/timestamp_add_minute.sql b/test/sql/ScalarFunction/timestamp_add_minute.sql new file mode 100644 index 00000000..fc889281 --- /dev/null +++ b/test/sql/ScalarFunction/timestamp_add_minute.sql @@ -0,0 +1,23 @@ +echo Create table t1(f1 timestamp, f2 timestamp); +Create table t1(f1 timestamp, f2 timestamp); +insert into t1 values('2001-01-01 01:01:01', '2001-01-25 01:01:01'); +insert into t1 values('2002-01-01 01:01:01', '2002-02-25 01:01:01'); +insert into t1 values('2003-01-01 01:01:01', '2003-02-25 01:01:01'); +insert into t1 values('2004-01-01 01:01:01', '2004-02-25 01:01:01'); +insert into t1 values('2005-01-01 01:01:01', '2005-11-25 01:01:01'); +echo select * from t1; +select * from t1; +echo select * from t1 where timestamp_add(f2 interval 244 minute) ='2003-02-25 05:05:01'; +select * from t1 where timestamp_add(f2 interval 244 minute) ='2003-02-25 05:05:01'; +echo select * from t1 where timestamp_add(f2 interval 244 minute)<='2003-02-25 05:05:01'; +select * from t1 where timestamp_add(f2 interval 244 minute)<='2003-02-25 05:05:01'; +echo select * from t1 where timestamp_add(f2 interval 244 minute) >'2003-02-25 05:05:01'; +select * from t1 where timestamp_add(f2 interval 244 minute) >'2003-02-25 05:05:01'; +echo select * from t1 where timestamp_add(f2 interval 14644 minute) ='2001-02-04 05:05:01'; +select * from t1 where timestamp_add(f2 interval 14644 minute) ='2001-02-04 05:05:01'; +echo select * from t1 where timestamp_add(f2 interval 14644 minute) ='2002-03-07 05:05:01'; +select * from t1 where timestamp_add(f2 interval 14644 minute) ='2002-03-07 05:05:01'; +echo select * from t1 where timestamp_add(f2 interval 14644 minute) ='2004-03-06 05:05:01'; +select * from t1 where timestamp_add(f2 interval 14644 minute) ='2004-03-06 05:05:01'; +echo select * from t1 where timestamp_add(f2 interval 57844 minute) ='2006-01-04 05:05:01'; +select * from t1 where timestamp_add(f2 interval 57844 minute) ='2006-01-04 05:05:01'; diff --git a/test/sql/ScalarFunction/timestamp_add_month.sql b/test/sql/ScalarFunction/timestamp_add_month.sql new file mode 100644 index 00000000..e6f04a5b --- /dev/null +++ b/test/sql/ScalarFunction/timestamp_add_month.sql @@ -0,0 +1,25 @@ +echo Create table t1(f1 timestamp, f2 timestamp); +Create table t1(f1 timestamp, f2 timestamp); +insert into t1 values('2001-01-01 01:01:01', '2001-01-01 02:01:01'); +insert into t1 values('2002-01-01 01:01:01', '2001-02-01 01:01:01'); +insert into t1 values('2003-01-01 01:01:01', '2001-03-01 01:01:01'); +insert into t1 values('2004-01-01 01:01:01', '2001-04-01 01:01:01'); +insert into t1 values('2005-01-01 01:01:01', '2001-05-01 01:01:01'); +echo select * from t1; +select * from t1; +echo select * from t1 where timestamp_add(f2 interval 10 month) ='2002-01-01 01:01:01'; +select * from t1 where timestamp_add(f2 interval 10 month) ='2002-01-01 01:01:01'; +echo select * from t1 where timestamp_add(f2 interval 10 month)<='2002-01-01 01:01:01'; +select * from t1 where timestamp_add(f2 interval 10 month)<='2002-01-01 01:01:01'; +echo select * from t1 where timestamp_add(f2 interval 10 month) >'2002-01-01 01:01:01'; +select * from t1 where timestamp_add(f2 interval 10 month) >'2002-01-01 01:01:01'; +echo select * from t1 where timestamp_add(f2 interval 10 month)!='2002-01-01 01:01:01'; +select * from t1 where timestamp_add(f2 interval 10 month)!='2002-01-01 01:01:01'; +echo select * from t1 where timestamp_add(f2 interval 130 month) ='2012-01-01 01:01:01'; +select * from t1 where timestamp_add(f2 interval 130 month) ='2012-01-01 01:01:01'; +echo select * from t1 where timestamp_add(f2 interval 130 month)<='2012-01-01 01:01:01'; +select * from t1 where timestamp_add(f2 interval 130 month)<='2012-01-01 01:01:01'; +echo select * from t1 where timestamp_add(f2 interval 130 month) >'2012-01-01 01:01:01'; +select * from t1 where timestamp_add(f2 interval 130 month) >'2012-01-01 01:01:01'; +echo select * from t1 where timestamp_add(f2 interval 130 month)!='2012-01-01 01:01:01'; +select * from t1 where timestamp_add(f2 interval 130 month)!='2012-01-01 01:01:01'; diff --git a/test/sql/ScalarFunction/timestamp_add_second.sql b/test/sql/ScalarFunction/timestamp_add_second.sql new file mode 100644 index 00000000..6d2fdf09 --- /dev/null +++ b/test/sql/ScalarFunction/timestamp_add_second.sql @@ -0,0 +1,23 @@ +echo Create table t1(f1 timestamp, f2 timestamp); +Create table t1(f1 timestamp, f2 timestamp); +insert into t1 values('2001-01-01 01:01:01', '2001-01-25 01:01:01'); +insert into t1 values('2002-01-01 01:01:01', '2002-02-25 01:01:01'); +insert into t1 values('2003-01-01 01:01:01', '2003-02-25 01:01:01'); +insert into t1 values('2004-01-01 01:01:01', '2004-02-25 01:01:01'); +insert into t1 values('2005-01-01 01:01:01', '2005-11-25 01:01:01'); +echo select * from t1; +select * from t1; +echo select * from t1 where timestamp_add(f2 interval 14644 second) ='2003-02-25 05:05:05'; +select * from t1 where timestamp_add(f2 interval 14644 second) ='2003-02-25 05:05:05'; +echo select * from t1 where timestamp_add(f2 interval 14644 second)<='2003-02-25 05:05:05'; +select * from t1 where timestamp_add(f2 interval 14644 second)<='2003-02-25 05:05:05'; +echo select * from t1 where timestamp_add(f2 interval 14644 second) >'2003-02-25 05:05:05'; +select * from t1 where timestamp_add(f2 interval 14644 second) >'2003-02-25 05:05:05'; +echo select * from t1 where timestamp_add(f2 interval 878644 second) ='2001-02-04 05:05:05'; +select * from t1 where timestamp_add(f2 interval 878644 second) ='2001-02-04 05:05:05'; +echo select * from t1 where timestamp_add(f2 interval 878644 second) ='2002-03-07 05:05:05'; +select * from t1 where timestamp_add(f2 interval 878644 second) ='2002-03-07 05:05:05'; +echo select * from t1 where timestamp_add(f2 interval 878644 second) ='2004-03-06 05:05:05'; +select * from t1 where timestamp_add(f2 interval 878644 second) ='2004-03-06 05:05:05'; +echo select * from t1 where timestamp_add(f2 interval 3470644 second) ='2006-01-04 05:05:05'; +select * from t1 where timestamp_add(f2 interval 3470644 second) ='2006-01-04 05:05:05'; diff --git a/test/sql/ScalarFunction/timestamp_add_year.sql b/test/sql/ScalarFunction/timestamp_add_year.sql new file mode 100644 index 00000000..0c025bbb --- /dev/null +++ b/test/sql/ScalarFunction/timestamp_add_year.sql @@ -0,0 +1,17 @@ +echo Create table t1(f1 timestamp, f2 timestamp); +Create table t1(f1 timestamp, f2 timestamp); +insert into t1 values('2001-01-01 01:01:01', '2001-01-01 02:01:01'); +insert into t1 values('2002-01-01 01:01:01', '2001-02-01 01:01:01'); +insert into t1 values('2003-01-01 01:01:01', '2001-03-01 01:01:01'); +insert into t1 values('2004-01-01 01:01:01', '2002-04-01 01:01:01'); +insert into t1 values('2005-01-01 01:01:01', '2002-05-01 01:01:01'); +echo select * from t1; +select * from t1; +echo select * from t1 where timestamp_add(f1 interval 5 year) ='2008-01-01 01:01:01'; +select * from t1 where timestamp_add(f1 interval 5 year) ='2008-01-01 01:01:01'; +echo select * from t1 where timestamp_add(f1 interval 5 year)<='2008-01-01 01:01:01'; +select * from t1 where timestamp_add(f1 interval 5 year)<='2008-01-01 01:01:01'; +echo select * from t1 where timestamp_add(f1 interval 5 year) >'2008-01-01 01:01:01'; +select * from t1 where timestamp_add(f1 interval 5 year) >'2008-01-01 01:01:01'; +echo select * from t1 where timestamp_add(f1 interval 5 year)!='2008-01-01 01:01:01'; +select * from t1 where timestamp_add(f1 interval 5 year)!='2008-01-01 01:01:01'; diff --git a/test/sql/ScalarFunction/timestamp_diff_day.sql b/test/sql/ScalarFunction/timestamp_diff_day.sql new file mode 100644 index 00000000..77308e2d --- /dev/null +++ b/test/sql/ScalarFunction/timestamp_diff_day.sql @@ -0,0 +1,26 @@ +echo Create table t1(f1 timestamp, f2 timestamp); +Create table t1(f1 timestamp, f2 timestamp); +insert into t1 values('2002-01-01 01:01:01', '2002-01-01 01:01:01'); +insert into t1 values('2002-01-01 01:01:01', '2002-02-03 01:01:01'); +insert into t1 values('2002-01-01 01:01:01', '2002-03-01 01:01:01'); +insert into t1 values('2004-01-01 01:01:01', '2004-02-01 01:01:01'); +insert into t1 values('2004-01-01 01:01:01', '2004-03-01 01:01:01'); +insert into t1 values('2002-01-01 01:01:01', '2004-03-01 01:01:01'); +echo select * from t1; +select * from t1; +echo select * from t1 where timestamp_diff(day,f1,f2) =0; +select * from t1 where timestamp_diff(day,f1,f2) =0; +echo select * from t1 where timestamp_diff(day,f2,f1)<=33; +select * from t1 where timestamp_diff(day,f2,f1)<=33; +echo select * from t1 where timestamp_diff(day,f2,f1) =59; +select * from t1 where timestamp_diff(day,f2,f1) =59; +echo select * from t1 where timestamp_diff(day,f2,f1)>=59; +select * from t1 where timestamp_diff(day,f2,f1)>=59; +echo select * from t1 where timestamp_diff(day,f2,f1) =60; +select * from t1 where timestamp_diff(day,f2,f1) =60; +echo select * from t1 where timestamp_diff(day,f2,f1)!=60; +select * from t1 where timestamp_diff(day,f2,f1)!=60; +echo select * from t1 where timestamp_diff(day,f2,f1) =790; +select * from t1 where timestamp_diff(day,f2,f1) =790; +echo select * from t1 where timestamp_diff(day,f2,f1)!=790; +select * from t1 where timestamp_diff(day,f2,f1)!=790; diff --git a/test/sql/ScalarFunction/timestamp_diff_hour.sql b/test/sql/ScalarFunction/timestamp_diff_hour.sql new file mode 100644 index 00000000..71b82469 --- /dev/null +++ b/test/sql/ScalarFunction/timestamp_diff_hour.sql @@ -0,0 +1,26 @@ +echo Create table t1(f1 timestamp, f2 timestamp); +Create table t1(f1 timestamp, f2 timestamp); +insert into t1 values('2002-01-01 01:01:01', '2002-01-01 01:01:01'); +insert into t1 values('2002-01-01 01:01:01', '2002-02-03 05:01:01'); +insert into t1 values('2002-01-01 01:01:01', '2002-03-01 05:01:01'); +insert into t1 values('2004-01-01 01:01:01', '2004-02-01 05:01:01'); +insert into t1 values('2004-01-01 01:01:01', '2004-03-01 05:01:01'); +insert into t1 values('2002-01-01 01:01:01', '2004-03-01 05:01:01'); +echo select * from t1; +select * from t1; +echo select * from t1 where timestamp_diff(hour,f1,f2) =0; +select * from t1 where timestamp_diff(hour,f1,f2) =0; +echo select * from t1 where timestamp_diff(hour,f2,f1)<=1420; +select * from t1 where timestamp_diff(hour,f2,f1)<=1420; +echo select * from t1 where timestamp_diff(hour,f2,f1) =748; +select * from t1 where timestamp_diff(hour,f2,f1) =748; +echo select * from t1 where timestamp_diff(hour,f2,f1)>=748; +select * from t1 where timestamp_diff(hour,f2,f1)>=748; +echo select * from t1 where timestamp_diff(hour,f2,f1) =1444; +select * from t1 where timestamp_diff(hour,f2,f1) =1444; +echo select * from t1 where timestamp_diff(hour,f2,f1)!=1444; +select * from t1 where timestamp_diff(hour,f2,f1)!=1444; +echo select * from t1 where timestamp_diff(hour,f2,f1) =18964; +select * from t1 where timestamp_diff(hour,f2,f1) =18964; +echo select * from t1 where timestamp_diff(hour,f2,f1)!=18964; +select * from t1 where timestamp_diff(hour,f2,f1)!=18964; diff --git a/test/sql/ScalarFunction/timestamp_diff_minute.sql b/test/sql/ScalarFunction/timestamp_diff_minute.sql new file mode 100644 index 00000000..15b904e9 --- /dev/null +++ b/test/sql/ScalarFunction/timestamp_diff_minute.sql @@ -0,0 +1,32 @@ +echo Create table t1(f1 timestamp, f2 timestamp); +Create table t1(f1 timestamp, f2 timestamp); +insert into t1 values('2002-01-01 01:01:01', '2002-01-01 01:01:01'); +insert into t1 values('2002-01-01 01:01:01', '2002-01-01 01:10:01'); +insert into t1 values('2002-01-01 01:01:01', '2002-01-01 05:10:01'); +insert into t1 values('2002-01-01 01:01:01', '2002-02-03 05:05:01'); +insert into t1 values('2002-01-01 01:01:01', '2002-03-01 05:05:01'); +insert into t1 values('2004-01-01 01:01:01', '2004-02-01 05:05:01'); +insert into t1 values('2004-01-01 01:01:01', '2004-03-01 05:05:01'); +insert into t1 values('2002-01-01 01:01:01', '2004-03-01 05:05:01'); +echo select * from t1; +select * from t1; +echo select * from t1 where timestamp_diff(minute,f1,f2) =0; +select * from t1 where timestamp_diff(minute,f1,f2) =0; +echo select * from t1 where timestamp_diff(minute,f2,f1) =9; +select * from t1 where timestamp_diff(minute,f2,f1) =9; +echo select * from t1 where timestamp_diff(minute,f2,f1)<=249; +select * from t1 where timestamp_diff(minute,f2,f1)<=249; +echo select * from t1 where timestamp_diff(minute,f2,f1) =85204; +select * from t1 where timestamp_diff(minute,f2,f1) =85204; +echo select * from t1 where timestamp_diff(minute,f2,f1)>=85204; +select * from t1 where timestamp_diff(minute,f2,f1)>=85204; +echo select * from t1 where timestamp_diff(minute,f2,f1) =44884; +select * from t1 where timestamp_diff(minute,f2,f1) =44884; +echo select * from t1 where timestamp_diff(minute,f2,f1) =86644; +select * from t1 where timestamp_diff(minute,f2,f1) =86644; +echo select * from t1 where timestamp_diff(minute,f2,f1)!=86644; +select * from t1 where timestamp_diff(minute,f2,f1)!=86644; +echo select * from t1 where timestamp_diff(minute,f2,f1) =1137844; +select * from t1 where timestamp_diff(minute,f2,f1) =1137844; +echo select * from t1 where timestamp_diff(minute,f2,f1)!=1137844; +select * from t1 where timestamp_diff(minute,f2,f1)!=1137844; diff --git a/test/sql/ScalarFunction/timestamp_diff_month.sql b/test/sql/ScalarFunction/timestamp_diff_month.sql new file mode 100644 index 00000000..42bc89ce --- /dev/null +++ b/test/sql/ScalarFunction/timestamp_diff_month.sql @@ -0,0 +1,22 @@ +Create table t1(f1 timestamp, f2 timestamp); +insert into t1 values('2002-01-01 01:01:01', '2002-01-01 01:01:01'); +insert into t1 values('2002-01-01 01:01:01', '2002-02-03 01:01:01'); +insert into t1 values('2002-01-01 01:01:01', '2002-03-01 01:01:01'); +insert into t1 values('2002-01-01 01:01:01', '2004-02-01 01:01:01'); +insert into t1 values('2002-01-10 01:01:01', '2004-02-01 01:01:01'); +insert into t1 values('2002-01-01 01:01:01', '2004-03-01 01:01:01'); +insert into t1 values('2002-01-10 01:01:01', '2004-03-01 01:01:01'); +echo select * from t1; +select * from t1; +echo select * from t1 where timestamp_diff(month,f1,f2)=0; +select * from t1 where timestamp_diff(month,f1,f2)=0; +echo select * from t1 where timestamp_diff(month,f2,f1)<=2; +select * from t1 where timestamp_diff(month,f2,f1)<=2; +echo select * from t1 where timestamp_diff(month,f2,f1)=25; +select * from t1 where timestamp_diff(month,f2,f1)=25; +echo select * from t1 where timestamp_diff(month,f2,f1)>=25; +select * from t1 where timestamp_diff(month,f2,f1)>=25; +echo select * from t1 where timestamp_diff(month,f2,f1)=26; +select * from t1 where timestamp_diff(month,f2,f1)=26; +echo select * from t1 where timestamp_diff(month,f2,f1)!=26; +select * from t1 where timestamp_diff(month,f2,f1)!=26; diff --git a/test/sql/ScalarFunction/timestamp_diff_second.sql b/test/sql/ScalarFunction/timestamp_diff_second.sql new file mode 100644 index 00000000..b025791d --- /dev/null +++ b/test/sql/ScalarFunction/timestamp_diff_second.sql @@ -0,0 +1,29 @@ +echo Create table t1(f1 timestamp, f2 timestamp); +Create table t1(f1 timestamp, f2 timestamp); +insert into t1 values('2002-01-01 01:01:01', '2002-01-01 01:01:01'); +insert into t1 values('2002-01-01 01:01:01', '2002-01-01 01:01:05'); +insert into t1 values('2002-01-01 01:01:01', '2002-01-01 01:05:05'); +insert into t1 values('2002-01-01 01:01:01', '2002-01-01 05:05:05'); +insert into t1 values('2002-01-01 01:01:01', '2002-01-03 05:05:05'); +insert into t1 values('2002-01-01 01:01:01', '2002-03-03 05:05:05'); +insert into t1 values('2002-01-01 01:01:01', '2004-03-01 05:05:05'); +echo select * from t1; +select * from t1; +echo select * from t1 where timestamp_diff(second,f1,f2) =0; +select * from t1 where timestamp_diff(second,f1,f2) =0; +echo select * from t1 where timestamp_diff(second,f2,f1) =4; +select * from t1 where timestamp_diff(second,f2,f1) =4; +echo select * from t1 where timestamp_diff(second,f2,f1)<=244; +select * from t1 where timestamp_diff(second,f2,f1)<=244; +echo select * from t1 where timestamp_diff(second,f2,f1) =14644; +select * from t1 where timestamp_diff(second,f2,f1) =14644; +echo select * from t1 where timestamp_diff(second,f2,f1)>=14644; +select * from t1 where timestamp_diff(second,f2,f1)>=14644; +echo select * from t1 where timestamp_diff(second,f2,f1) =187444; +select * from t1 where timestamp_diff(second,f2,f1) =187444; +echo select * from t1 where timestamp_diff(second,f2,f1) =5285044; +select * from t1 where timestamp_diff(second,f2,f1) =5285044; +echo select * from t1 where timestamp_diff(second,f2,f1)!=5285044; +select * from t1 where timestamp_diff(second,f2,f1)!=5285044; +echo select * from t1 where timestamp_diff(second,f2,f1) =68270644; +select * from t1 where timestamp_diff(second,f2,f1) =68270644; diff --git a/test/sql/ScalarFunction/timestamp_diff_year.sql b/test/sql/ScalarFunction/timestamp_diff_year.sql new file mode 100644 index 00000000..9063b590 --- /dev/null +++ b/test/sql/ScalarFunction/timestamp_diff_year.sql @@ -0,0 +1,20 @@ +Create table t1(f1 timestamp, f2 timestamp); +insert into t1 values('2002-01-01 01:01:01', '2002-01-01 01:01:01'); +insert into t1 values('2002-01-01 01:01:01', '2002-02-03 01:01:01'); +insert into t1 values('2002-01-01 01:01:01', '2002-03-01 01:01:01'); +insert into t1 values('2002-01-01 01:01:01', '2004-02-01 01:01:01'); +insert into t1 values('2002-01-01 01:01:01', '2004-03-01 01:01:01'); +insert into t1 values('2001-01-01 01:01:01', '2002-02-03 01:01:01'); +insert into t1 values('2001-01-01 01:01:01', '2002-03-01 01:01:01'); +insert into t1 values('2001-01-01 01:01:01', '2004-02-01 01:01:01'); +insert into t1 values('2001-01-01 01:01:01', '2004-03-01 01:01:01'); +echo select * from t1; +select * from t1; +echo select * from t1 where timestamp_diff(year,f1,f2)=0; +select * from t1 where timestamp_diff(year,f1,f2)=0; +echo select * from t1 where timestamp_diff(year,f2,f1)=2; +select * from t1 where timestamp_diff(year,f2,f1)=2; +echo select * from t1 where timestamp_diff(year,f2,f1)>2; +select * from t1 where timestamp_diff(year,f2,f1)>2; +echo select * from t1 where timestamp_diff(year,f2,f1)<=2; +select * from t1 where timestamp_diff(year,f2,f1)<=2; diff --git a/test/sql/ScalarFunction/timestamp_sub_day.sql b/test/sql/ScalarFunction/timestamp_sub_day.sql new file mode 100644 index 00000000..54ad7710 --- /dev/null +++ b/test/sql/ScalarFunction/timestamp_sub_day.sql @@ -0,0 +1,23 @@ +echo Create table t1(f1 timestamp, f2 timestamp); +Create table t1(f1 timestamp, f2 timestamp); +insert into t1 values('2001-01-01 01:01:01', '2001-05-10 01:01:01'); +insert into t1 values('2002-01-01 01:01:01', '2002-03-10 01:01:01'); +insert into t1 values('2003-01-01 01:01:01', '2003-03-10 01:01:01'); +insert into t1 values('2004-01-01 01:01:01', '2004-03-10 01:01:01'); +insert into t1 values('2005-01-01 01:01:01', '2005-02-10 01:01:01'); +echo select * from t1; +select * from t1; +echo select * from t1 where timestamp_sub(f2 interval 15 day) ='2001-04-25 01:01:01'; +select * from t1 where timestamp_sub(f2 interval 15 day) ='2001-04-25 01:01:01'; +echo select * from t1 where timestamp_sub(f2 interval 15 day)<='2002-02-23 01:01:01'; +select * from t1 where timestamp_sub(f2 interval 15 day)<='2002-02-23 01:01:01'; +echo select * from t1 where timestamp_sub(f2 interval 15 day)>='2003-02-23 01:01:01'; +select * from t1 where timestamp_sub(f2 interval 15 day)>='2003-02-23 01:01:01'; +echo select * from t1 where timestamp_sub(f2 interval 15 day) ='2004-02-24 01:01:01'; +select * from t1 where timestamp_sub(f2 interval 15 day) ='2004-02-24 01:01:01'; +echo select * from t1 where timestamp_sub(f2 interval 15 day)!='2005-01-26 01:01:01'; +select * from t1 where timestamp_sub(f2 interval 15 day)!='2005-01-26 01:01:01'; +echo select * from t1 where timestamp_sub(f2 interval 45 day) ='2004-12-27 01:01:01'; +select * from t1 where timestamp_sub(f2 interval 45 day) ='2004-12-27 01:01:01'; +echo select * from t1 where timestamp_sub(f2 interval 45 day)!='2004-12-27 01:01:01'; +select * from t1 where timestamp_sub(f2 interval 45 day)!='2004-12-27 01:01:01'; diff --git a/test/sql/ScalarFunction/timestamp_sub_hour.sql b/test/sql/ScalarFunction/timestamp_sub_hour.sql new file mode 100644 index 00000000..7c808f24 --- /dev/null +++ b/test/sql/ScalarFunction/timestamp_sub_hour.sql @@ -0,0 +1,31 @@ +echo Create table t1(f1 timestamp, f2 timestamp); +Create table t1(f1 timestamp, f2 timestamp); +insert into t1 values('2001-01-01 01:01:01', '2001-05-05 05:01:01'); +insert into t1 values('2002-01-01 01:01:01', '2002-03-05 05:01:01'); +insert into t1 values('2003-01-01 01:01:01', '2003-03-05 05:01:01'); +insert into t1 values('2004-01-01 01:01:01', '2004-03-05 05:01:01'); +insert into t1 values('2005-01-01 01:01:01', '2005-01-05 05:01:01'); +echo select * from t1; +select * from t1; +echo select * from t1 where timestamp_sub(f2 interval 4 hour) ='2003-03-05 01:01:01'; +select * from t1 where timestamp_sub(f2 interval 4 hour) ='2003-03-05 01:01:01'; +echo select * from t1 where timestamp_sub(f2 interval 4 hour)<='2003-03-05 01:01:01'; +select * from t1 where timestamp_sub(f2 interval 4 hour)<='2003-03-05 01:01:01'; +echo select * from t1 where timestamp_sub(f2 interval 4 hour) >'2003-03-05 01:01:01'; +select * from t1 where timestamp_sub(f2 interval 4 hour) >'2003-03-05 01:01:01'; +echo select * from t1 where timestamp_sub(f2 interval 244 hour) ='2001-04-25 01:01:01'; +select * from t1 where timestamp_sub(f2 interval 244 hour) ='2001-04-25 01:01:01'; +echo select * from t1 where timestamp_sub(f2 interval 244 hour)>='2001-04-25 01:01:01'; +select * from t1 where timestamp_sub(f2 interval 244 hour)>='2001-04-25 01:01:01'; +echo select * from t1 where timestamp_sub(f2 interval 244 hour) ='2002-02-23 01:01:01'; +select * from t1 where timestamp_sub(f2 interval 244 hour) ='2002-02-23 01:01:01'; +echo select * from t1 where timestamp_sub(f2 interval 244 hour)<='2002-02-23 01:01:01'; +select * from t1 where timestamp_sub(f2 interval 244 hour)<='2002-02-23 01:01:01'; +echo select * from t1 where timestamp_sub(f2 interval 244 hour) ='2004-02-24 01:01:01'; +select * from t1 where timestamp_sub(f2 interval 244 hour) ='2004-02-24 01:01:01'; +echo select * from t1 where timestamp_sub(f2 interval 244 hour)>='2004-02-24 01:01:01'; +select * from t1 where timestamp_sub(f2 interval 244 hour)>='2004-02-24 01:01:01'; +echo select * from t1 where timestamp_sub(f2 interval 960 hour) ='2004-11-26 05:01:01'; +select * from t1 where timestamp_sub(f2 interval 960 hour) ='2004-11-26 05:01:01'; +echo select * from t1 where timestamp_sub(f2 interval 960 hour)!='2004-11-26 05:01:01'; +select * from t1 where timestamp_sub(f2 interval 960 hour)!='2004-11-26 05:01:01'; diff --git a/test/sql/ScalarFunction/timestamp_sub_minute.sql b/test/sql/ScalarFunction/timestamp_sub_minute.sql new file mode 100644 index 00000000..0677659f --- /dev/null +++ b/test/sql/ScalarFunction/timestamp_sub_minute.sql @@ -0,0 +1,23 @@ +echo Create table t1(f1 timestamp, f2 timestamp); +Create table t1(f1 timestamp, f2 timestamp); +insert into t1 values('2001-01-01 01:01:01', '2001-05-05 05:05:01'); +insert into t1 values('2002-01-01 01:01:01', '2002-03-05 05:05:01'); +insert into t1 values('2003-01-01 01:01:01', '2003-03-05 05:05:01'); +insert into t1 values('2004-01-01 01:01:01', '2004-03-05 05:05:01'); +insert into t1 values('2005-01-01 01:01:01', '2005-01-05 05:05:01'); +echo select * from t1; +select * from t1; +echo select * from t1 where timestamp_sub(f2 interval 244 minute) ='2003-03-05 01:01:01'; +select * from t1 where timestamp_sub(f2 interval 244 minute) ='2003-03-05 01:01:01'; +echo select * from t1 where timestamp_sub(f2 interval 244 minute)<='2003-03-05 01:01:01'; +select * from t1 where timestamp_sub(f2 interval 244 minute)<='2003-03-05 01:01:01'; +echo select * from t1 where timestamp_sub(f2 interval 244 minute) >'2003-03-05 01:01:01'; +select * from t1 where timestamp_sub(f2 interval 244 minute) >'2003-03-05 01:01:01'; +echo select * from t1 where timestamp_sub(f2 interval 14400 minute) ='2003-02-23 05:05:01'; +select * from t1 where timestamp_sub(f2 interval 14400 minute) ='2003-02-23 05:05:01'; +echo select * from t1 where timestamp_sub(f2 interval 14400 minute)>='2003-02-23 05:05:01'; +select * from t1 where timestamp_sub(f2 interval 14400 minute)>='2003-02-23 05:05:01'; +echo select * from t1 where timestamp_sub(f2 interval 527040 minute) ='2004-01-05 05:05:01'; +select * from t1 where timestamp_sub(f2 interval 527040 minute) ='2004-01-05 05:05:01'; +echo select * from t1 where timestamp_sub(f2 interval 527040 minute)!='2004-01-05 05:05:01'; +select * from t1 where timestamp_sub(f2 interval 527040 minute)!='2004-01-05 05:05:01'; diff --git a/test/sql/ScalarFunction/timestamp_sub_month.sql b/test/sql/ScalarFunction/timestamp_sub_month.sql new file mode 100644 index 00000000..58323b83 --- /dev/null +++ b/test/sql/ScalarFunction/timestamp_sub_month.sql @@ -0,0 +1,25 @@ +echo Create table t1(f1 timestamp, f2 timestamp); +Create table t1(f1 timestamp, f2 timestamp); +insert into t1 values('2001-01-01 01:01:01', '2010-08-01 02:01:01'); +insert into t1 values('2002-01-01 01:01:01', '2010-09-01 01:01:01'); +insert into t1 values('2003-01-01 01:01:01', '2010-10-01 01:01:01'); +insert into t1 values('2004-01-01 01:01:01', '2010-11-01 01:01:01'); +insert into t1 values('2005-01-01 01:01:01', '2010-12-01 01:01:01'); +echo select * from t1; +select * from t1; +echo select * from t1 where timestamp_sub(f2 interval 10 month) ='2009-12-01 01:01:01'; +select * from t1 where timestamp_sub(f2 interval 10 month) ='2009-12-01 01:01:01'; +echo select * from t1 where timestamp_sub(f2 interval 10 month)<='2009-12-01 01:01:01'; +select * from t1 where timestamp_sub(f2 interval 10 month)<='2009-12-01 01:01:01'; +echo select * from t1 where timestamp_sub(f2 interval 10 month) >'2009-12-01 01:01:01'; +select * from t1 where timestamp_sub(f2 interval 10 month) >'2009-12-01 01:01:01'; +echo select * from t1 where timestamp_sub(f2 interval 10 month)!='2009-12-01 01:01:01'; +select * from t1 where timestamp_sub(f2 interval 10 month)!='2009-12-01 01:01:01'; +echo select * from t1 where timestamp_sub(f2 interval 130 month) ='1999-12-01 01:01:01'; +select * from t1 where timestamp_sub(f2 interval 130 month) ='1999-12-01 01:01:01'; +echo select * from t1 where timestamp_sub(f2 interval 130 month)<='1999-12-01 01:01:01'; +select * from t1 where timestamp_sub(f2 interval 130 month)<='1999-12-01 01:01:01'; +echo select * from t1 where timestamp_sub(f2 interval 130 month) >'1999-12-01 01:01:01'; +select * from t1 where timestamp_sub(f2 interval 130 month) >'1999-12-01 01:01:01'; +echo select * from t1 where timestamp_sub(f2 interval 130 month)!='1999-12-01 01:01:01'; +select * from t1 where timestamp_sub(f2 interval 130 month)!='1999-12-01 01:01:01'; diff --git a/test/sql/ScalarFunction/timestamp_sub_second.sql b/test/sql/ScalarFunction/timestamp_sub_second.sql new file mode 100644 index 00000000..f55cf36f --- /dev/null +++ b/test/sql/ScalarFunction/timestamp_sub_second.sql @@ -0,0 +1,23 @@ +echo Create table t1(f1 timestamp, f2 timestamp); +Create table t1(f1 timestamp, f2 timestamp); +insert into t1 values('2001-01-01 01:01:01', '2001-05-05 05:05:01'); +insert into t1 values('2002-01-01 01:01:01', '2002-03-05 05:05:01'); +insert into t1 values('2003-01-01 01:01:01', '2003-03-05 05:05:01'); +insert into t1 values('2004-01-01 01:01:01', '2004-03-05 05:05:01'); +insert into t1 values('2005-01-01 01:01:01', '2005-01-05 05:05:01'); +echo select * from t1; +select * from t1; +echo select * from t1 where timestamp_sub(f2 interval 14640 second) ='2003-03-05 01:01:01'; +select * from t1 where timestamp_sub(f2 interval 14640 second) ='2003-03-05 01:01:01'; +echo select * from t1 where timestamp_sub(f2 interval 14640 second)<='2003-03-05 01:01:01'; +select * from t1 where timestamp_sub(f2 interval 14640 second)<='2003-03-05 01:01:01'; +echo select * from t1 where timestamp_sub(f2 interval 14640 second) >'2003-03-05 01:01:01'; +select * from t1 where timestamp_sub(f2 interval 14640 second) >'2003-03-05 01:01:01'; +echo select * from t1 where timestamp_sub(f2 interval 864000 second) ='2003-02-23 05:05:01'; +select * from t1 where timestamp_sub(f2 interval 864000 second) ='2003-02-23 05:05:01'; +echo select * from t1 where timestamp_sub(f2 interval 864000 second)>='2003-02-23 05:05:01'; +select * from t1 where timestamp_sub(f2 interval 864000 second)>='2003-02-23 05:05:01'; +echo select * from t1 where timestamp_sub(f2 interval 31622400 second) ='2004-01-05 05:05:01'; +select * from t1 where timestamp_sub(f2 interval 31622400 second) ='2004-01-05 05:05:01'; +echo select * from t1 where timestamp_sub(f2 interval 31622400 second)!='2004-01-05 05:05:01'; +select * from t1 where timestamp_sub(f2 interval 31622400 second)!='2004-01-05 05:05:01'; diff --git a/test/sql/ScalarFunction/timestamp_sub_year.sql b/test/sql/ScalarFunction/timestamp_sub_year.sql new file mode 100644 index 00000000..0fb87760 --- /dev/null +++ b/test/sql/ScalarFunction/timestamp_sub_year.sql @@ -0,0 +1,17 @@ +echo Create table t1(f1 timestamp, f2 timestamp); +Create table t1(f1 timestamp, f2 timestamp); +insert into t1 values('2001-01-01 01:01:01', '2001-01-01 02:01:01'); +insert into t1 values('2002-01-01 01:01:01', '2001-02-01 01:01:01'); +insert into t1 values('2003-01-01 01:01:01', '2001-03-01 01:01:01'); +insert into t1 values('2004-01-01 01:01:01', '2002-04-01 01:01:01'); +insert into t1 values('2005-01-01 01:01:01', '2002-05-01 01:01:01'); +echo select * from t1; +select * from t1; +echo select * from t1 where timestamp_sub(f1 interval 5 year) ='1998-01-01 01:01:01'; +select * from t1 where timestamp_sub(f1 interval 5 year) ='1998-01-01 01:01:01'; +echo select * from t1 where timestamp_sub(f1 interval 5 year)<='1998-01-01 01:01:01'; +select * from t1 where timestamp_sub(f1 interval 5 year)<='1998-01-01 01:01:01'; +echo select * from t1 where timestamp_sub(f1 interval 5 year) >'1998-01-01 01:01:01'; +select * from t1 where timestamp_sub(f1 interval 5 year) >'1998-01-01 01:01:01'; +echo select * from t1 where timestamp_sub(f1 interval 5 year)!='1998-01-01 01:01:01'; +select * from t1 where timestamp_sub(f1 interval 5 year)!='1998-01-01 01:01:01'; diff --git a/test/sql/ScalarFunction/timestamp_with_now.sql b/test/sql/ScalarFunction/timestamp_with_now.sql new file mode 100644 index 00000000..bc1c3646 --- /dev/null +++ b/test/sql/ScalarFunction/timestamp_with_now.sql @@ -0,0 +1,37 @@ +echo create table t1(f1 int,f2 timestamp); +create table t1(f1 int,f2 timestamp); +echo insert into t1 values(1,'2003/12/10 10:20:20'); +insert into t1 values(1,'2003/12/10 10:20:20'); +echo insert into t1 values(2,'2004/12/10 12:23:34'); +insert into t1 values(2,'2004/12/10 12:23:34'); +echo insert into t1 values(3,'2005/12/10 01:21:41'); +insert into t1 values(3,'2005/12/10 01:21:41'); +echo insert into t1 values(4,'2006/12/10 04:34:34'); +insert into t1 values(4,'2006/12/10 04:34:34'); +echo insert into t1 values(5,now()); +insert into t1 values(5,now()); +echo insert into t1 values(6,'2007/12/10 04:34:34'); +insert into t1 values(6,'2007/12/10 04:34:34'); +echo insert into t1 values(7,now()); +insert into t1 values(7,now()); +echo select * from t1; +select * from t1; +echo select * from t1 where f2<=now(); +select * from t1 where f2<=now(); +echo select * from t1 where f2>now(); +select * from t1 where f2>now(); +echo select * from t1; +select * from t1; +echo update t1 set f2=now() where f1<=2; +update t1 set f2=now() where f1<=2; +echo select * from t1; +select * from t1; +echo update t1 set f2=now(),f1=10 where f2='2007/12/10 04:34:34'; +update t1 set f2=now(),f1=10 where f2='2007/12/10 04:34:34'; +echo select * from t1; +select * from t1; +echo drop table t1; +drop table t1; + + + diff --git a/test/sql/StmtCache/Makefile b/test/sql/StmtCache/Makefile new file mode 100644 index 00000000..59f888f9 --- /dev/null +++ b/test/sql/StmtCache/Makefile @@ -0,0 +1,69 @@ +OSNAME = $(shell uname -s) +PlatForm=notsupported +ifeq ($(OSNAME), SunOS) + CPlus = CC + CPlusFlags = -O2 -w $(COMPILER_FLAG) + SYSLIBS=-ldl -lnsl -lsocket -lposix4 + PlatForm=supported +endif +ifeq ($(OSNAME), Linux) + CPlus = g++ + CPlusFlags = -g -w + SYSLIBS= -rdynamic -lrt -lpthread -lcrypt + PlatForm=supported +endif +ifeq ($(OSNAME), FreeBSD) + CPlus = g++ + CPlusFlags = -g -w + SYSLIBS= -rdynamic -lrt -lpthread -lcrypt + PlatForm=supported +endif + + + +JAVAC = javac -g:none +INCL= -I$(CSQL_INSTALL_ROOT)/include -I../../include +LIBS= -L$(CSQL_INSTALL_ROOT)/lib -lcsqlodbc -lcsqlsql -lcsqlsqllog -lcsql -lcsqlnw -lcsqlodbcadapter -lcsqlfault + +TARGETS = test002 stmtTest3 test004 stmtTest5 stmtTest6 stmtTest7 stmtTest8 \ + stmtTest9 stmtTest10 stmtTest11 test012 test013 test013a test013b + +ifeq ($(PlatForm), supported) +all: $(TARGETS) +else +all: + echo "CSQL is not supported on $(OSNAME) platform" +endif + +test002: stmtTest2.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +stmtTest3: stmtTest3.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test004: stmtTest4.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +stmtTest5: stmtTest5.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +stmtTest6: stmtTest6.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +stmtTest7: stmtTest7.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +stmtTest8: stmtTest8.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +stmtTest9: stmtTest9.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +stmtTest10: stmtTest10.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +stmtTest11: stmtTest11.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test012: stmtTest12.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test013: stmtTest13.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test013a: stmtTest13a.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test013b: stmtTest13b.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) + +clean: + rm -f $(TARGETS) *.class + diff --git a/test/sql/StmtCache/csql.conf b/test/sql/StmtCache/csql.conf new file mode 100644 index 00000000..0ba4ddbe --- /dev/null +++ b/test/sql/StmtCache/csql.conf @@ -0,0 +1,157 @@ +# CSQL System Configuration File + +#####################################Server Section######################## + +# Site ID for this CSQL server +SITE_ID=1 + +#Important: For Server section parameters, make sure that the value is same for the +# server process and all the csql client process which connects to it. otherwise, +# behavior is undefined + +# Page size. Each database is logically divided into pages and allocation happens +# in this unit of pages. Increasing this value will reduce frequent allocation of pages. +PAGE_SIZE= 8192 + +#Total number of client process which can connect and work with the +# database concurrently +MAX_PROCS = 100 + +# Maximum size of the system database. +MAX_SYS_DB_SIZE=1048576 + +#Maximum size of the user database file. +MAX_DB_SIZE=10485760 + +#Shared memory key to be used by the system to create and locate system database. +SYS_DB_KEY=2222 + +#Shared memory key to be used by the system to create and locate user database. +USER_DB_KEY=3333 + +#Log level 0->no logging 1->Fine 2->Finer 3->Finest +LOG_LEVEL=0 + +#Give full path for the log file where important system actions are stored. +LOG_FILE=/tmp/csql/log/log.out + +#The virtual memory start address at which the shared memory segment +# will be created and attached. +MAP_ADDRESS=400000000 + +# Whether to enable durability +DURABILITY=false + +#checkpoint server interval in seconds +CHECKPOINT_SECS=600 + +#minimum redo log size for checkpoint to be initiated +CHECKPOINT_LOG_SIZE=10485760 + +# Whether to enable memory map architecture for user database +MMAP=true + +# Specifies the durability mode for redo log generation +# Valid values are +# 1 ->uses standard redo logging with O_APPEND mode +# 2 ->uses standard logging with serialization +# 3 ->uses O_SYNC flag +# 4 ->uses O_DIRECT flag + +DURABLE_MODE=1 + +#Give full path for the database file where table and record information will +#be stored for durability +DATABASE_FILE=/tmp/csql/db + +#Important: For Server section parameters, make sure that the value is same for the server process and all the csql client process which connects to it. otherwise, behavior is undefined + +# Give full path for the std error file to store all the errors during database operations +STDERR_FILE=stderr + +#Restarts auxillary servers (SQL, Cache,etc), if they crash +MONITOR_SERVERS=false + +#####################################Client Section######################## + +#Mutex timeout interval seconds +MUTEX_TIMEOUT_SECS=0 +MUTEX_TIMEOUT_USECS=5000 +MUTEX_TIMEOUT_RETRIES=10 + +#Lock timeout interval seconds +LOCK_TIMEOUT_SECS=0 +LOCK_TIMEOUT_USECS=5000 +LOCK_TIMEOUT_RETRIES=10 + +#Statement Cache Size +STMT_CACHE_SIZE=3 + +#Enable statement cache for statements with no parameters +#Only SELECT statement with no date, time, timestamp fields will be cached. +STMT_CACHE_NOPARAM=true + +#####################################Cache Section######################## + +#Whether to enable caching of tables from target database +CACHE_TABLE=false + +#DSN Name to connect to the target database. +#This should be present in ~/odbc.ini file +DSN=myodbc3 + +# Whethere to enable bidirectional updates for cached tables. +ENABLE_BIDIRECTIONAL_CACHE=false + +CACHE_RECEIVER_WAIT_SECS=10 + +#Mode of operation SYNC or ASYNC +CACHE_MODE=SYNC + +##########################SqlNetworkServer Section######################## + +# Whether to enable SqlNetwork server +CSQL_SQL_SERVER=false + +#Set port for Network access +PORT=5678 + +# Max number of seconds that the network layer waits to receive a pkt +NETWORK_RESPONSE_TIMEOUT=3 + +# Max number of seconds that the network layer waits to connect to sql server +NETWORK_CONNECT_TIMEOUT=5 + +#Whether to enable Replication across the sites +REPLICATION=false + +#No of sites to replicate +REPLICATION_SITES=16 + +#Give full path for the file where all the table information is stored +TABLE_CONFIG_FILE=/tmp/csql/csqltable.conf + +#Give full path of the file where all the DSN information is stored +DS_CONFIG_FILE=/tmp/csql/csqlds.conf + +#Give full path for the file where all the peer site information is stored +NETWORK_CONFIG_FILE=/tmp/csql/csqlnw.conf + +# Give full path for conflict Resolution file +CONFL_RESOL_FILE=/tmp/csql/conflResoFile.txt + +# MSGKEY for creating msg queue for MsgQueue Server +MSG_KEY=2525 + +# Maximum message that the message queue server is able to handle for +# asynchronous updates. This value is is default value of 'kernel.msgmax' +# parameter. +ASYNC_MSGMAX=8192 + +# Maximum number of messages that the message queue server will hold for a site +# that is down in the replication group. +MAX_QUEUE_LOGS=100 + +# Shared memory key for id generators +ID_SHM_KEY=1947 +#####################################End Section######################## diff --git a/test/sql/StmtCache/csqlInsert.c b/test/sql/StmtCache/csqlInsert.c new file mode 100644 index 00000000..ea5ec3b0 --- /dev/null +++ b/test/sql/StmtCache/csqlInsert.c @@ -0,0 +1,89 @@ +// This case inserts records in csql every 200 ms based on the random numbers it finds. + +#include +#include +#define TS 1000 +//TS -> micro secs to sleep between transaction + +int main(int argc, char **argv) +{ + DbRetVal rv = OK; + if (argv[1] == NULL) { + fprintf(stderr, "Usage: csqlInsert \n"); + return 1; + } + FILE *fp = fopen(argv[1], "a"); + struct timeval timeout; + struct timeval timeStamp; + char msgBuf[25]; + AbsSqlConnection *con = SqlFactory::createConnection(CSql); + AbsSqlConnection *adCon = SqlFactory::createConnection(CSqlAdapter); + rv = con->connect("root","manager"); + if(rv!=OK)return 1; + rv = adCon->connect("root", "manager"); + if(rv!=OK)return 1; + AbsSqlStatement *stmt = SqlFactory::createStatement(CSql); + AbsSqlStatement *adStmt = SqlFactory::createStatement(CSqlAdapter); + stmt->setConnection(con); + adStmt->setConnection(adCon); + char statement[200]; + int rows = 0; + // insert into table + strcpy(statement,"INSERT INTO soakTable VALUES(1234,?,654323,'LAKSHYA_CSQL');"); + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 4; } + rv = adStmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 4; } + int rnd = 0; + int i = 0; + while (1) { + if (rv == OK) { + timeout.tv_sec = 0; + timeout.tv_usec = TS; + os::select(0, 0, 0, 0, &timeout); + srand(time(0)); + } + /*if (i == 0) rnd = rand() % 16645635; + else if (i == 1) rnd = (rand() / 3) % 16645635; + else if (i == 2) rnd = (rand() / 7) % 16645635; + else if (i == 3) rnd = (rand() / 11) % 16645635; + else if (i == 4) { i = 0; rnd = (rand() / 13) % 16645635; } + */ + i++; + rv = con->beginTrans(); + if (rv != OK) continue; + //stmt->setIntParam(1, rnd); + stmt->setIntParam(1, i); + rv = stmt->execute(rows); + if (rv == ErrUnique) { + printf("Unique Key Violation Error\n"); + con->rollback(); continue; + } else if (rv != OK) { + printError(rv, "Insert failed with ret val %d", rv); + con->rollback(); continue; + } + else con->commit(); + rv = adCon->beginTrans(); + //adStmt->setIntParam(1,rnd); + adStmt->setIntParam(1,i); + rv = adStmt->execute(rows); + if (rv != OK) { + printError(rv, "Adapter:execute failed with rv = %d"); + adCon->rollback(); + continue; + } + else adCon->commit(); + if (i% 10000 == 0) { + os::gettimeofday(&timeStamp); + struct tm *tempTm = os::localtime(&timeStamp.tv_sec); + strftime(msgBuf, 25, "%d/%m/%Y %H:%M:%S", tempTm); + fprintf(fp, "Inserted PK: %8d %s\n", rnd, msgBuf); + fflush(fp); + } + } + fclose(fp); + adStmt->free(); stmt->free(); + adCon->disconnect(); con->disconnect(); + delete adStmt; delete adCon; + delete stmt; delete con; +} diff --git a/test/sql/StmtCache/exp.test001.ksh b/test/sql/StmtCache/exp.test001.ksh new file mode 100644 index 00000000..bdb6f112 --- /dev/null +++ b/test/sql/StmtCache/exp.test001.ksh @@ -0,0 +1,19 @@ +echo create table t1(f1 int, f2 timestamp); +Statement Executed +echo insert into t1 values(1,'now'); +Statement Executed: Rows Affected = 1 +echo select count(*) from t1 where f2 < 'now'; +--------------------------------------------------------- + COUNT(*) +--------------------------------------------------------- + 1 + +echo insert into t1 values(2,'now'); +Statement Executed: Rows Affected = 1 +echo select count(*) from t1 where f2 < 'now'; +--------------------------------------------------------- + COUNT(*) +--------------------------------------------------------- + 2 + +Statement Executed diff --git a/test/sql/StmtCache/exp.test002 b/test/sql/StmtCache/exp.test002 new file mode 100644 index 00000000..226e15b3 --- /dev/null +++ b/test/sql/StmtCache/exp.test002 @@ -0,0 +1,21 @@ +AFTER CREATE TABLE operation +STATEMENT CACHE START +STATEMENT CACHE END +AFTER INSERT PREPARE operation +STATEMENT CACHE START + SQL=INSERT INTO t1 VALUES(1234,?,'CSQL'); hits=0 inuse=1 +STATEMENT CACHE END +AFTER INSERT EXECUTE operation +STATEMENT CACHE START + SQL=INSERT INTO t1 VALUES(1234,?,'CSQL'); hits=0 inuse=1 +STATEMENT CACHE END +AFTER STMT FREE operation +STATEMENT CACHE START + SQL=INSERT INTO t1 VALUES(1234,?,'CSQL'); hits=0 inuse=0 +STATEMENT CACHE END +AFTER DROP TABLE +STATEMENT CACHE START +STATEMENT CACHE END +AFTER disconnect +STATEMENT CACHE START +STATEMENT CACHE END diff --git a/test/sql/StmtCache/exp.test003.ksh b/test/sql/StmtCache/exp.test003.ksh new file mode 100644 index 00000000..842c0967 --- /dev/null +++ b/test/sql/StmtCache/exp.test003.ksh @@ -0,0 +1,43 @@ +AFTER UPDATE PREPARE operation +STATEMENT CACHE START + SQL=UPDATE t1 set f2=? where f1=?; hits=0 inuse=1 +STATEMENT CACHE END +AFTER STMT FREE operation +STATEMENT CACHE START + SQL=UPDATE t1 set f2=? where f1=?; hits=0 inuse=0 +STATEMENT CACHE END +AFTER DELETE PREPARE operation +STATEMENT CACHE START + SQL=UPDATE t1 set f2=? where f1=?; hits=0 inuse=0 + SQL=DELETE from t1 where f2=?; hits=0 inuse=1 +STATEMENT CACHE END +AFTER STMT FREE operation +STATEMENT CACHE START + SQL=UPDATE t1 set f2=? where f1=?; hits=0 inuse=0 + SQL=DELETE from t1 where f2=?; hits=0 inuse=0 +STATEMENT CACHE END +AFTER SELECT PREPARE operation +STATEMENT CACHE START + SQL=UPDATE t1 set f2=? where f1=?; hits=0 inuse=0 + SQL=DELETE from t1 where f2=?; hits=0 inuse=0 + SQL=SELECT f1 from t1 where f2=?; hits=0 inuse=1 +STATEMENT CACHE END +Tuple value 2 +Tuple value 3 +Tuple value 4 +Tuple value 5 +AFTER STMT FREE operation +STATEMENT CACHE START + SQL=UPDATE t1 set f2=? where f1=?; hits=0 inuse=0 + SQL=DELETE from t1 where f2=?; hits=0 inuse=0 + SQL=SELECT f1 from t1 where f2=?; hits=0 inuse=0 +STATEMENT CACHE END +AFTER disconnect +STATEMENT CACHE START +STATEMENT CACHE END +CREATE TABLE t1 (f1 INT NOT NULL , f2 INT , f3 VARCHAR (20)); +CREATE INDEX t1_idx1_Primary on t1 ( f1 ) HASH UNIQUE; +INSERT INTO t1 VALUES(2,1, 'Second'); +INSERT INTO t1 VALUES(3,1, 'Third'); +INSERT INTO t1 VALUES(4,1, 'Fourth'); +INSERT INTO t1 VALUES(5,1, 'Fifth'); diff --git a/test/sql/StmtCache/exp.test004 b/test/sql/StmtCache/exp.test004 new file mode 100644 index 00000000..6f35f9b0 --- /dev/null +++ b/test/sql/StmtCache/exp.test004 @@ -0,0 +1,33 @@ +AFTER CREATE TABLE operation +STATEMENT CACHE START +STATEMENT CACHE END +AFTER INSERT PREPARE operation +STATEMENT CACHE START +STATEMENT CACHE END +AFTER INSERT EXECUTE operation +STATEMENT CACHE START +STATEMENT CACHE END +AFTER STMT FREE operation +STATEMENT CACHE START +STATEMENT CACHE END +AFTER UPDATE PREPARE operation +STATEMENT CACHE START +STATEMENT CACHE END +AFTER STMT FREE operation +STATEMENT CACHE START +STATEMENT CACHE END +AFTER DELETE PREPARE operation +STATEMENT CACHE START +STATEMENT CACHE END +AFTER STMT FREE operation +STATEMENT CACHE START +STATEMENT CACHE END +AFTER SELECT PREPARE operation +STATEMENT CACHE START +STATEMENT CACHE END +AFTER STMT FREE operation +STATEMENT CACHE START +STATEMENT CACHE END +AFTER disconnect +STATEMENT CACHE START +STATEMENT CACHE END diff --git a/test/sql/StmtCache/exp.test005.ksh b/test/sql/StmtCache/exp.test005.ksh new file mode 100644 index 00000000..64c64b06 --- /dev/null +++ b/test/sql/StmtCache/exp.test005.ksh @@ -0,0 +1,12 @@ +AFTER INSERT PREPARE +STATEMENT CACHE START + SQL=INSERT INTO t1 VALUES(1234,?,'CSQL'); hits=0 inuse=1 +STATEMENT CACHE END +CREATE TABLE t1 (f1 INT NOT NULL , f2 INT , f3 VARCHAR (20)); +CREATE INDEX t1_idx1_Primary on t1 ( f1 ) HASH UNIQUE; +INSERT INTO t1 VALUES(1,1, 'First'); +INSERT INTO t1 VALUES(2,1, 'Second'); +INSERT INTO t1 VALUES(3,1, 'Third'); +INSERT INTO t1 VALUES(4,1, 'Fourth'); +INSERT INTO t1 VALUES(5,1, 'Fifth'); +INSERT INTO t1 VALUES(1234,1, 'CSQL'); diff --git a/test/sql/StmtCache/exp.test006.ksh b/test/sql/StmtCache/exp.test006.ksh new file mode 100644 index 00000000..86bbbddb --- /dev/null +++ b/test/sql/StmtCache/exp.test006.ksh @@ -0,0 +1,25 @@ +AFTER INSERT FREE +STATEMENT CACHE START + SQL=INSERT INTO t1 VALUES(?, 1234, 'CSQL'); hits=0 inuse=0 +STATEMENT CACHE END +Dropping table +After drop +STATEMENT CACHE START +STATEMENT CACHE END +After second time prepare +STATEMENT CACHE START + SQL=INSERT INTO t1 VALUES(?, 1234, 'CSQL'); hits=0 inuse=1 +STATEMENT CACHE END +After reusing cached insert stmt +STATEMENT CACHE START + SQL=INSERT INTO t1 VALUES(?, 1234, 'CSQL'); hits=0 inuse=0 +STATEMENT CACHE END +CREATE TABLE t1 (f1 INT NOT NULL , f2 INT , f3 VARCHAR (20)); +CREATE INDEX t1_idx1_Primary on t1 ( f1 ) HASH UNIQUE; +INSERT INTO t1 VALUES(1,1, 'First'); +INSERT INTO t1 VALUES(2,1, 'Second'); +INSERT INTO t1 VALUES(3,1, 'Third'); +INSERT INTO t1 VALUES(4,1, 'Fourth'); +INSERT INTO t1 VALUES(5,1, 'Fifth'); +INSERT INTO t1 VALUES(100,1234, 'CSQL'); +INSERT INTO t1 VALUES(200,1234, 'CSQL'); diff --git a/test/sql/StmtCache/exp.test007.ksh b/test/sql/StmtCache/exp.test007.ksh new file mode 100644 index 00000000..b0ae2208 --- /dev/null +++ b/test/sql/StmtCache/exp.test007.ksh @@ -0,0 +1,35 @@ +AFTER INSERT FREE +STATEMENT CACHE START + SQL=INSERT INTO t1 VALUES(?, 1234, 'CSQL'); hits=0 inuse=0 +STATEMENT CACHE END +creating index +After create index +STATEMENT CACHE START +STATEMENT CACHE END +After second time prepare +STATEMENT CACHE START + SQL=INSERT INTO t1 VALUES(?, 1234, 'CSQL'); hits=0 inuse=1 +STATEMENT CACHE END +After reusing cached insert stmt +STATEMENT CACHE START + SQL=INSERT INTO t1 VALUES(?, 1234, 'CSQL'); hits=0 inuse=0 +STATEMENT CACHE END +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 +--------------------------------------------------------- + 100 1234 CSQL + + + t1 + HashScan + + f1 + Equals + VALUE + + +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 +--------------------------------------------------------- + 200 1234 CSQL + diff --git a/test/sql/StmtCache/exp.test008.ksh b/test/sql/StmtCache/exp.test008.ksh new file mode 100644 index 00000000..2a54ee06 --- /dev/null +++ b/test/sql/StmtCache/exp.test008.ksh @@ -0,0 +1 @@ +wrong output. bug. recreate exp file after the fix diff --git a/test/sql/StmtCache/exp.test009.ksh b/test/sql/StmtCache/exp.test009.ksh new file mode 100644 index 00000000..2a54ee06 --- /dev/null +++ b/test/sql/StmtCache/exp.test009.ksh @@ -0,0 +1 @@ +wrong output. bug. recreate exp file after the fix diff --git a/test/sql/StmtCache/exp.test010.ksh b/test/sql/StmtCache/exp.test010.ksh new file mode 100644 index 00000000..409c0660 --- /dev/null +++ b/test/sql/StmtCache/exp.test010.ksh @@ -0,0 +1,30 @@ +STATEMENT CACHE START + SQL=INSERT INTO t1 VALUES(?, ?, 'CSQL'); hits=0 inuse=0 +STATEMENT CACHE END +dropping index +After drop index +STATEMENT CACHE START +STATEMENT CACHE END +After reusing cached insert stmt +STATEMENT CACHE START + SQL=INSERT INTO t1 VALUES(?, ?, 'CSQL'); hits=0 inuse=0 +STATEMENT CACHE END +CREATE TABLE t1 (f1 INT NOT NULL , f2 INT , f3 VARCHAR (20)); +CREATE INDEX t1_idx1_Primary on t1 ( f1 ) HASH UNIQUE; +INSERT INTO t1 VALUES(1,1, 'First'); +INSERT INTO t1 VALUES(2,1, 'Second'); +INSERT INTO t1 VALUES(3,1, 'Third'); +INSERT INTO t1 VALUES(4,1, 'Fourth'); +INSERT INTO t1 VALUES(5,1, 'Fifth'); +INSERT INTO t1 VALUES(100,100, 'CSQL'); +INSERT INTO t1 VALUES(200,200, 'CSQL'); +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 +--------------------------------------------------------- + 100 100 CSQL + +--------------------------------------------------------- + t1.f1 t1.f2 t1.f3 +--------------------------------------------------------- + 200 200 CSQL + diff --git a/test/sql/StmtCache/exp.test011.ksh b/test/sql/StmtCache/exp.test011.ksh new file mode 100644 index 00000000..2a54ee06 --- /dev/null +++ b/test/sql/StmtCache/exp.test011.ksh @@ -0,0 +1 @@ +wrong output. bug. recreate exp file after the fix diff --git a/test/sql/StmtCache/sel.sql b/test/sql/StmtCache/sel.sql new file mode 100644 index 00000000..5cb2cecd --- /dev/null +++ b/test/sql/StmtCache/sel.sql @@ -0,0 +1,2 @@ +select * from t1 where f2=100; +select * from t1 where f2=200; diff --git a/test/sql/StmtCache/stmtTest10.c b/test/sql/StmtCache/stmtTest10.c new file mode 100644 index 00000000..7f6f7663 --- /dev/null +++ b/test/sql/StmtCache/stmtTest10.c @@ -0,0 +1,62 @@ +#include + +int main(int argc, char **argv) +{ + DbRetVal rv = OK; + struct timeval timeout; + struct timeval timeStamp; + AbsSqlConnection *con = SqlFactory::createConnection(CSql); + rv = con->connect("root","manager"); + if(rv!=OK)return 1; + AbsSqlStatement *stmt = SqlFactory::createStatement(CSql); + stmt->setConnection(con); + AbsSqlStatement *dropstmt = SqlFactory::createStatement(CSql); + dropstmt->setConnection(con); + char statement[200]; + int rows =0; + // insert into table + strcpy(statement,"INSERT INTO t1 VALUES(?, ?, 'CSQL');"); + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 4; } + rv = con->beginTrans(); + stmt->setIntParam(1, 100); + stmt->setIntParam(2, 100); + rv = stmt->execute(rows); + if (rv != OK) { + printError(rv, "Insert failed with ret val %d", rv); + con->rollback(); + } + else con->commit(); + stmt->free(); + con->display(); + printf("dropping index\n"); + strcpy(statement, "drop index idx;"); + rv = dropstmt->prepare(statement); + if (rv != OK) { + printf("drop index on table failed\n"); + con->disconnect();delete stmt; delete con; return -1; + } + dropstmt->execute(rows); + dropstmt->free(); + printf("After drop index \n"); + con->display(); + + strcpy(statement,"INSERT INTO t1 VALUES(?, ?, 'CSQL');"); + rv = stmt->prepare(statement); + rv = con->beginTrans(); + stmt->setIntParam(1, 200); + stmt->setIntParam(2, 200); + rv = stmt->execute(rows); + if (rv != OK) { + printError(rv, "Insert failed with ret val %d", rv); + con->rollback(); + } + else con->commit(); + stmt->free(); + printf("After reusing cached insert stmt\n"); + con->display(); + + con->disconnect(); + delete stmt; + delete con; +} diff --git a/test/sql/StmtCache/stmtTest11.c b/test/sql/StmtCache/stmtTest11.c new file mode 100644 index 00000000..dd2047ba --- /dev/null +++ b/test/sql/StmtCache/stmtTest11.c @@ -0,0 +1,59 @@ +#include + +int main(int argc, char **argv) +{ + DbRetVal rv = OK; + struct timeval timeout; + struct timeval timeStamp; + AbsSqlConnection *con = SqlFactory::createConnection(CSql); + rv = con->connect("root","manager"); + if(rv!=OK)return 1; + AbsSqlStatement *stmt = SqlFactory::createStatement(CSql); + stmt->setConnection(con); + AbsSqlStatement *dropstmt = SqlFactory::createStatement(CSql); + dropstmt->setConnection(con); + char statement[200]; + int rows =0; + // insert into table + strcpy(statement,"INSERT INTO t1 VALUES(?, ?, 'CSQL');"); + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 4; } + rv = con->beginTrans(); + stmt->setIntParam(1, 100); + stmt->setIntParam(2, 100); + rv = stmt->execute(rows); + if (rv != OK) { + printError(rv, "Insert failed with ret val %d", rv); + con->rollback(); + } + else con->commit(); + con->display(); + printf("dropping index\n"); + strcpy(statement, "drop index idx;"); + rv = dropstmt->prepare(statement); + if (rv != OK) { + printf("drop index on table failed\n"); + con->disconnect();delete stmt; delete con; return -1; + } + dropstmt->execute(rows); + dropstmt->free(); + printf("After drop index \n"); + con->display(); + + rv = con->beginTrans(); + stmt->setIntParam(1, 200); + stmt->setIntParam(2, 200); + rv = stmt->execute(rows); + if (rv != OK) { + printError(rv, "Insert failed with ret val %d", rv); + con->rollback(); + } + else con->commit(); + stmt->free(); + printf("After reusing cached insert stmt\n"); + con->display(); + + con->disconnect(); + delete stmt; + delete con; +} diff --git a/test/sql/StmtCache/stmtTest12.c b/test/sql/StmtCache/stmtTest12.c new file mode 100644 index 00000000..11ea0a44 --- /dev/null +++ b/test/sql/StmtCache/stmtTest12.c @@ -0,0 +1,64 @@ +#include + +int main(int argc, char **argv) +{ + DbRetVal rv = OK; + struct timeval timeout; + struct timeval timeStamp; + AbsSqlConnection *con = SqlFactory::createConnection(CSql); + rv = con->connect("root","manager"); + if(rv!=OK)return 1; + AbsSqlStatement *stmt = SqlFactory::createStatement(CSql); + stmt->setConnection(con); + char statement[200]; + strcpy(statement, "CREATE TABLE t1 (f1 int, f2 int, f3 char(20), primary key (f2));"); + int rows =0; + rv = stmt->prepare(statement); + if (rv != OK) {delete stmt; delete con; return -1; } + rv = stmt->execute(rows); + if (rv != OK) {delete stmt; delete con; return -1; } + stmt->free(); + + // insert into table + strcpy(statement,"INSERT INTO t1 VALUES(1234,?,'CSQL');"); + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 4; } + printf("AFTER INSERT PREPARE operation\n"); + int rnd = 0; + int i = 0; + if (1) { + i++; + rv = con->beginTrans(); + stmt->setIntParam(1, i); + rv = stmt->execute(rows); + if (rv == ErrUnique) { + printf("Unique Key Violation Error\n"); + con->rollback(); + } else if (rv != OK) { + printError(rv, "Insert failed with ret val %d", rv); + con->rollback(); + } + else con->commit(); + } + stmt->free(); + + printf("TRUNCATE TABLE\n"); + strcpy(statement, "TRUNCATE TABLE t1"); + rv = stmt->prepare(statement); + if (rv != OK) {con->disconnect();delete stmt; delete con; return -1; } + rv = con->beginTrans(); + stmt->execute(rows); + con->commit(); + con->display(); + stmt->free(); + + strcpy(statement, "DROP TABLE t1"); + rv = stmt->prepare(statement); + if (rv != OK) {con->disconnect();delete stmt; delete con; return -1; } + stmt->execute(rows); + stmt->free(); + + con->disconnect(); + delete stmt; + delete con; +} diff --git a/test/sql/StmtCache/stmtTest13.c b/test/sql/StmtCache/stmtTest13.c new file mode 100644 index 00000000..db343873 --- /dev/null +++ b/test/sql/StmtCache/stmtTest13.c @@ -0,0 +1,84 @@ +#include + +int main(int argc, char **argv) +{ + DbRetVal rv = OK; + struct timeval timeout; + struct timeval timeStamp; + AbsSqlConnection *con = SqlFactory::createConnection(CSql); + rv = con->connect("root","manager"); + if(rv!=OK)return 1; + AbsSqlStatement *stmt = SqlFactory::createStatement(CSql); + stmt->setConnection(con); + char statement[200]; + strcpy(statement, "CREATE TABLE t1 (f1 int, f2 int, f3 char(20), primary key (f2));"); + int rows =0; + rv = stmt->prepare(statement); + if (rv != OK) {delete stmt; delete con; return -1; } + rv = stmt->execute(rows); + if (rv != OK) {delete stmt; delete con; return -1; } + stmt->free(); + + // insert into table + strcpy(statement,"INSERT INTO t1 VALUES(1234,?,'CSQL');"); + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 4; } + printf("AFTER INSERT PREPARE operation\n"); + int rnd = 0; + int i = 0; + if (1) { + i++; + rv = con->beginTrans(); + stmt->setIntParam(1, i); + rv = stmt->execute(rows); + if (rv == ErrUnique) { + printf("Unique Key Violation Error\n"); + con->rollback(); + } else if (rv != OK) { + printError(rv, "Insert failed with ret val %d", rv); + con->rollback(); + } + else con->commit(); + } + stmt->free(); + + printf("rename TABLE\n"); + strcpy(statement, "rename TABLE t1 to t2"); + rv = stmt->prepare(statement); + if (rv != OK) {con->disconnect();delete stmt; delete con; return -1; } + rv = con->beginTrans(); + stmt->execute(rows); + con->commit(); + con->display(); + + strcpy(statement,"INSERT INTO t1 VALUES(1234,?,'CSQL');"); + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 4; } + printf("AFTER INSERT PREPARE operation\n"); + i = 1000; + if (1) { + i++; + rv = con->beginTrans(); + stmt->setIntParam(1, i); + rv = stmt->execute(rows); + if (rv == ErrUnique) { + printf("Unique Key Violation Error\n"); + con->rollback(); + } else if (rv != OK) { + printError(rv, "Insert failed with ret val %d", rv); + con->rollback(); + } + else con->commit(); + } + stmt->free(); + system("csqldump"); + strcpy(statement, "drop TABLE t2"); + rv = stmt->prepare(statement); + if (rv != OK) {con->disconnect();delete stmt; delete con; return -1; } + stmt->execute(rows); + stmt->free(); + + con->disconnect(); + delete stmt; + delete con; +} diff --git a/test/sql/StmtCache/stmtTest13a.c b/test/sql/StmtCache/stmtTest13a.c new file mode 100644 index 00000000..57d8ea20 --- /dev/null +++ b/test/sql/StmtCache/stmtTest13a.c @@ -0,0 +1,84 @@ +#include + +int main(int argc, char **argv) +{ + DbRetVal rv = OK; + struct timeval timeout; + struct timeval timeStamp; + AbsSqlConnection *con = SqlFactory::createConnection(CSql); + rv = con->connect("root","manager"); + if(rv!=OK)return 1; + AbsSqlStatement *stmt = SqlFactory::createStatement(CSql); + stmt->setConnection(con); + char statement[200]; + strcpy(statement, "CREATE TABLE t1 (f1 int, f2 int, f3 char(20), primary key (f2));"); + int rows =0; + rv = stmt->prepare(statement); + if (rv != OK) {delete stmt; delete con; return -1; } + rv = stmt->execute(rows); + if (rv != OK) {delete stmt; delete con; return -1; } + stmt->free(); + + // insert into table + strcpy(statement,"INSERT INTO t1 VALUES(1234,?,'CSQL');"); + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 4; } + printf("AFTER INSERT PREPARE operation\n"); + int rnd = 0; + int i = 0; + if (1) { + i++; + rv = con->beginTrans(); + stmt->setIntParam(1, i); + rv = stmt->execute(rows); + if (rv == ErrUnique) { + printf("Unique Key Violation Error\n"); + con->rollback(); + } else if (rv != OK) { + printError(rv, "Insert failed with ret val %d", rv); + con->rollback(); + } + else con->commit(); + } + stmt->free(); + + printf("rename TABLE\n"); + strcpy(statement, "rename TABLE t1 to t2"); + rv = stmt->prepare(statement); + if (rv != OK) {con->disconnect();delete stmt; delete con; return -1; } + rv = con->beginTrans(); + stmt->execute(rows); + con->commit(); + con->display(); + + strcpy(statement,"INSERT INTO t2 VALUES(1234,?,'CSQL');"); + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 4; } + printf("AFTER INSERT PREPARE operation\n"); + i = 1000; + if (1) { + i++; + rv = con->beginTrans(); + stmt->setIntParam(1, i); + rv = stmt->execute(rows); + if (rv == ErrUnique) { + printf("Unique Key Violation Error\n"); + con->rollback(); + } else if (rv != OK) { + printError(rv, "Insert failed with ret val %d", rv); + con->rollback(); + } + else con->commit(); + } + stmt->free(); + system("csqldump"); + strcpy(statement, "drop TABLE t2"); + rv = stmt->prepare(statement); + if (rv != OK) {con->disconnect();delete stmt; delete con; return -1; } + stmt->execute(rows); + stmt->free(); + + con->disconnect(); + delete stmt; + delete con; +} diff --git a/test/sql/StmtCache/stmtTest13b.c b/test/sql/StmtCache/stmtTest13b.c new file mode 100644 index 00000000..501b333c --- /dev/null +++ b/test/sql/StmtCache/stmtTest13b.c @@ -0,0 +1,84 @@ +#include + +int main(int argc, char **argv) +{ + DbRetVal rv = OK; + struct timeval timeout; + struct timeval timeStamp; + AbsSqlConnection *con = SqlFactory::createConnection(CSql); + rv = con->connect("root","manager"); + if(rv!=OK)return 1; + AbsSqlStatement *stmt = SqlFactory::createStatement(CSql); + stmt->setConnection(con); + char statement[200]; + strcpy(statement, "CREATE TABLE t1 (f1 int, f2 int, f3 char(20), primary key (f2));"); + int rows =0; + rv = stmt->prepare(statement); + if (rv != OK) {delete stmt; delete con; return -1; } + rv = stmt->execute(rows); + if (rv != OK) {delete stmt; delete con; return -1; } + stmt->free(); + + // insert into table + strcpy(statement,"INSERT INTO t1(f1, f2, f3) VALUES(1234,?,'CSQL');"); + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 4; } + printf("AFTER INSERT PREPARE operation\n"); + int rnd = 0; + int i = 0; + if (1) { + i++; + rv = con->beginTrans(); + stmt->setIntParam(1, i); + rv = stmt->execute(rows); + if (rv == ErrUnique) { + printf("Unique Key Violation Error\n"); + con->rollback(); + } else if (rv != OK) { + printError(rv, "Insert failed with ret val %d", rv); + con->rollback(); + } + else con->commit(); + } + stmt->free(); + + printf("alter TABLE\n"); + strcpy(statement, "alter table t1 drop column f3"); + rv = stmt->prepare(statement); + if (rv != OK) {con->disconnect();delete stmt; delete con; return -1; } + rv = con->beginTrans(); + stmt->execute(rows); + con->commit(); + con->display(); + + strcpy(statement,"INSERT INTO t1(f1, f2, f3) VALUES(1234,?,'CSQL');"); + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 4; } + printf("AFTER INSERT PREPARE operation\n"); + i = 1000; + if (1) { + i++; + rv = con->beginTrans(); + stmt->setIntParam(1, i); + rv = stmt->execute(rows); + if (rv == ErrUnique) { + printf("Unique Key Violation Error\n"); + con->rollback(); + } else if (rv != OK) { + printError(rv, "Insert failed with ret val %d", rv); + con->rollback(); + } + else con->commit(); + } + stmt->free(); + system("csqldump"); + strcpy(statement, "drop TABLE t2"); + rv = stmt->prepare(statement); + if (rv != OK) {con->disconnect();delete stmt; delete con; return -1; } + stmt->execute(rows); + stmt->free(); + + con->disconnect(); + delete stmt; + delete con; +} diff --git a/test/sql/StmtCache/stmtTest2.c b/test/sql/StmtCache/stmtTest2.c new file mode 100644 index 00000000..37677c73 --- /dev/null +++ b/test/sql/StmtCache/stmtTest2.c @@ -0,0 +1,65 @@ +#include + +int main(int argc, char **argv) +{ + DbRetVal rv = OK; + struct timeval timeout; + struct timeval timeStamp; + AbsSqlConnection *con = SqlFactory::createConnection(CSql); + rv = con->connect("root","manager"); + if(rv!=OK)return 1; + AbsSqlStatement *stmt = SqlFactory::createStatement(CSql); + stmt->setConnection(con); + char statement[200]; + strcpy(statement, "CREATE TABLE t1 (f1 int, f2 int, f3 char(20), primary key (f2));"); + int rows =0; + rv = stmt->prepare(statement); + if (rv != OK) {delete stmt; delete con; return -1; } + rv = stmt->execute(rows); + if (rv != OK) {delete stmt; delete con; return -1; } + stmt->free(); + printf("AFTER CREATE TABLE operation\n"); + con->display(); + + // insert into table + strcpy(statement,"INSERT INTO t1 VALUES(1234,?,'CSQL');"); + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 4; } + printf("AFTER INSERT PREPARE operation\n"); + con->display(); + int rnd = 0; + int i = 0; + if (1) { + i++; + rv = con->beginTrans(); + //stmt->setIntParam(1, rnd); + stmt->setIntParam(1, i); + rv = stmt->execute(rows); + if (rv == ErrUnique) { + printf("Unique Key Violation Error\n"); + con->rollback(); + } else if (rv != OK) { + printError(rv, "Insert failed with ret val %d", rv); + con->rollback(); + } + else con->commit(); + } + printf("AFTER INSERT EXECUTE operation\n"); + con->display(); + stmt->free(); + printf("AFTER STMT FREE operation\n"); + con->display(); + + printf("AFTER DROP TABLE\n"); + strcpy(statement, "DROP TABLE t1"); + rv = stmt->prepare(statement); + if (rv != OK) {con->disconnect();delete stmt; delete con; return -1; } + stmt->execute(rows); + con->display(); + + con->disconnect(); + printf("AFTER disconnect\n"); + con->display(); + delete stmt; + delete con; +} diff --git a/test/sql/StmtCache/stmtTest3.c b/test/sql/StmtCache/stmtTest3.c new file mode 100644 index 00000000..f4a8177e --- /dev/null +++ b/test/sql/StmtCache/stmtTest3.c @@ -0,0 +1,77 @@ +#include + +int main(int argc, char **argv) +{ + DbRetVal rv = OK; + struct timeval timeout; + struct timeval timeStamp; + AbsSqlConnection *con = SqlFactory::createConnection(CSql); + rv = con->connect("root","manager"); + if(rv!=OK)return 1; + AbsSqlStatement *stmt = SqlFactory::createStatement(CSql); + stmt->setConnection(con); + char statement[200]; + strcpy(statement, "UPDATE t1 set f2=? where f1=?;"); + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 4; } + printf("AFTER UPDATE PREPARE operation\n"); + con->display(); + int i = 1; + int rows=0; + rv = con->beginTrans(); + stmt->setIntParam(1, 100); + stmt->setIntParam(2, i); + rv = stmt->execute(rows); + if (rv != OK) { + printError(rv, "Update failed with ret val %d", rv); + con->rollback(); + } + else con->commit(); + stmt->free(); + printf("AFTER STMT FREE operation\n"); + con->display(); + + strcpy(statement, "DELETE from t1 where f2=?;"); + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 4; } + printf("AFTER DELETE PREPARE operation\n"); + con->display(); + rv = con->beginTrans(); + stmt->setIntParam(1, 100); + rv = stmt->execute(rows); + if (rv != OK) { + printError(rv, "Update failed with ret val %d", rv); + con->rollback(); + } + else con->commit(); + stmt->free(); + printf("AFTER STMT FREE operation\n"); + con->display(); + + + strcpy(statement, "SELECT f1 from t1 where f2=?;"); + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 4; } + printf("AFTER SELECT PREPARE operation\n"); + con->display(); + rv = con->beginTrans(); + int val =0; + stmt->bindField(1, &val); + stmt->setIntParam(1, 1); + rv = stmt->execute(rows); + while (stmt->fetch()!= NULL) + { + printf("Tuple value %d\n", val); + } + con->commit(); + stmt->free(); + printf("AFTER STMT FREE operation\n"); + con->display(); + + + con->disconnect(); + printf("AFTER disconnect\n"); + con->display(); + delete stmt; + delete con; +} diff --git a/test/sql/StmtCache/stmtTest4.c b/test/sql/StmtCache/stmtTest4.c new file mode 100644 index 00000000..a4ef6215 --- /dev/null +++ b/test/sql/StmtCache/stmtTest4.c @@ -0,0 +1,106 @@ +#include + +int main(int argc, char **argv) +{ + DbRetVal rv = OK; + struct timeval timeout; + struct timeval timeStamp; + AbsSqlConnection *con = SqlFactory::createConnection(CSql); + rv = con->connect("root","manager"); + if(rv!=OK)return 1; + AbsSqlStatement *stmt = SqlFactory::createStatement(CSql); + stmt->setConnection(con); + char statement[200]; + strcpy(statement, "CREATE TABLE t1 (f1 int, f2 int, f3 char(20), primary key (f1));"); + int rows =0; + rv = stmt->prepare(statement); + if (rv != OK) {delete stmt; delete con; return -1; } + rv = stmt->execute(rows); + if (rv != OK) {delete stmt; delete con; return -1; } + stmt->free(); + printf("AFTER CREATE TABLE operation\n"); + con->display(); + + // insert into table + strcpy(statement,"INSERT INTO t1 VALUES(1234,5,'CSQL');"); + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 4; } + printf("AFTER INSERT PREPARE operation\n"); + con->display(); + int rnd = 0; + rv = con->beginTrans(); + rv = stmt->execute(rows); + if (rv != OK) { + printError(rv, "Insert failed with ret val %d", rv); + con->rollback(); + } + else con->commit(); + printf("AFTER INSERT EXECUTE operation\n"); + con->display(); + stmt->free(); + printf("AFTER STMT FREE operation\n"); + con->display(); + + strcpy(statement, "UPDATE t1 set f2=10 where f1=1234;"); + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 4; } + printf("AFTER UPDATE PREPARE operation\n"); + con->display(); + rv = con->beginTrans(); + rv = stmt->execute(rows); + if (rv != OK) { + printError(rv, "Update failed with ret val %d", rv); + con->rollback(); + } + else con->commit(); + stmt->free(); + printf("AFTER STMT FREE operation\n"); + con->display(); + + strcpy(statement, "DELETE from t1 where f2=10;"); + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 4; } + printf("AFTER DELETE PREPARE operation\n"); + con->display(); + rv = con->beginTrans(); + rv = stmt->execute(rows); + if (rv != OK) { + printError(rv, "Delete failed with ret val %d", rv); + con->rollback(); + } + else con->commit(); + stmt->free(); + printf("AFTER STMT FREE operation\n"); + con->display(); + + strcpy(statement, "SELECT f1 from t1 where f2=1;"); + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 4; } + printf("AFTER SELECT PREPARE operation\n"); + con->display(); + rv = con->beginTrans(); + int val =0; + stmt->bindField(1, &val); + rv = stmt->execute(rows); + while (stmt->fetch() != NULL) + { + printf("Tuple value %d\n", val); + } + con->commit(); + stmt->free(); + printf("AFTER STMT FREE operation\n"); + con->display(); + + strcpy(statement, "DROP TABLE t1"); + rv = stmt->prepare(statement); + if (rv != OK) {con->disconnect();delete stmt; delete con; return -1; } + stmt->execute(rows); + stmt->free(); + + + con->disconnect(); + printf("AFTER disconnect\n"); + con->display(); + delete stmt; + delete con; +} diff --git a/test/sql/StmtCache/stmtTest5.c b/test/sql/StmtCache/stmtTest5.c new file mode 100644 index 00000000..79e45904 --- /dev/null +++ b/test/sql/StmtCache/stmtTest5.c @@ -0,0 +1,46 @@ +#include + +int main(int argc, char **argv) +{ + DbRetVal rv = OK; + struct timeval timeout; + struct timeval timeStamp; + AbsSqlConnection *con = SqlFactory::createConnection(CSql); + rv = con->connect("root","manager"); + if(rv!=OK)return 1; + AbsSqlStatement *stmt = SqlFactory::createStatement(CSql); + stmt->setConnection(con); + AbsSqlStatement *dropstmt = SqlFactory::createStatement(CSql); + dropstmt->setConnection(con); + char statement[200]; + int rows =0; + // insert into table + strcpy(statement,"INSERT INTO t1 VALUES(1234,?,'CSQL');"); + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 4; } + printf("AFTER INSERT PREPARE\n"); + con->display(); + + strcpy(statement, "DROP TABLE t2"); + rv = dropstmt->prepare(statement); + if (rv != OK) { + printf("DROP table failed\n"); + con->disconnect();delete stmt; delete con; return -1; + } + dropstmt->execute(rows); + dropstmt->free(); + + rv = con->beginTrans(); + stmt->setIntParam(1, 1); + rv = stmt->execute(rows); + if (rv != OK) { + printError(rv, "Insert failed with ret val %d", rv); + con->rollback(); + } + else con->commit(); + stmt->free(); + + con->disconnect(); + delete stmt; + delete con; +} diff --git a/test/sql/StmtCache/stmtTest6.c b/test/sql/StmtCache/stmtTest6.c new file mode 100644 index 00000000..500f8f16 --- /dev/null +++ b/test/sql/StmtCache/stmtTest6.c @@ -0,0 +1,63 @@ +#include + +int main(int argc, char **argv) +{ + DbRetVal rv = OK; + struct timeval timeout; + struct timeval timeStamp; + AbsSqlConnection *con = SqlFactory::createConnection(CSql); + rv = con->connect("root","manager"); + if(rv!=OK)return 1; + AbsSqlStatement *stmt = SqlFactory::createStatement(CSql); + stmt->setConnection(con); + AbsSqlStatement *dropstmt = SqlFactory::createStatement(CSql); + dropstmt->setConnection(con); + char statement[200]; + int rows =0; + // insert into table + strcpy(statement,"INSERT INTO t1 VALUES(?, 1234, 'CSQL');"); + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 4; } + rv = con->beginTrans(); + stmt->setIntParam(1, 100); + rv = stmt->execute(rows); + if (rv != OK) { + printError(rv, "Insert failed with ret val %d", rv); + con->rollback(); + } + else con->commit(); + stmt->free(); + printf("AFTER INSERT FREE\n"); + con->display(); + printf("Dropping table\n"); + strcpy(statement, "DROP TABLE t2"); + rv = dropstmt->prepare(statement); + if (rv != OK) { + printf("DROP table failed\n"); + con->disconnect();delete stmt; delete con; return -1; + } + dropstmt->execute(rows); + dropstmt->free(); + printf("After drop \n"); + con->display(); + + strcpy(statement,"INSERT INTO t1 VALUES(?, 1234, 'CSQL');"); + rv = stmt->prepare(statement); + printf("After second time prepare \n"); + con->display(); + rv = con->beginTrans(); + stmt->setIntParam(1, 200); + rv = stmt->execute(rows); + if (rv != OK) { + printError(rv, "Insert failed with ret val %d", rv); + con->rollback(); + } + else con->commit(); + stmt->free(); + printf("After reusing cached insert stmt\n"); + con->display(); + + con->disconnect(); + delete stmt; + delete con; +} diff --git a/test/sql/StmtCache/stmtTest7.c b/test/sql/StmtCache/stmtTest7.c new file mode 100644 index 00000000..12114855 --- /dev/null +++ b/test/sql/StmtCache/stmtTest7.c @@ -0,0 +1,63 @@ +#include + +int main(int argc, char **argv) +{ + DbRetVal rv = OK; + struct timeval timeout; + struct timeval timeStamp; + AbsSqlConnection *con = SqlFactory::createConnection(CSql); + rv = con->connect("root","manager"); + if(rv!=OK)return 1; + AbsSqlStatement *stmt = SqlFactory::createStatement(CSql); + stmt->setConnection(con); + AbsSqlStatement *dropstmt = SqlFactory::createStatement(CSql); + dropstmt->setConnection(con); + char statement[200]; + int rows =0; + // insert into table + strcpy(statement,"INSERT INTO t1 VALUES(?, 1234, 'CSQL');"); + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 4; } + rv = con->beginTrans(); + stmt->setIntParam(1, 100); + rv = stmt->execute(rows); + if (rv != OK) { + printError(rv, "Insert failed with ret val %d", rv); + con->rollback(); + } + else con->commit(); + stmt->free(); + printf("AFTER INSERT FREE\n"); + con->display(); + printf("creating index\n"); + strcpy(statement, "create index idx1 on t1(f2);"); + rv = dropstmt->prepare(statement); + if (rv != OK) { + printf("DROP table failed\n"); + con->disconnect();delete stmt; delete con; return -1; + } + dropstmt->execute(rows); + dropstmt->free(); + printf("After create index \n"); + con->display(); + + strcpy(statement,"INSERT INTO t1 VALUES(?, 1234, 'CSQL');"); + rv = stmt->prepare(statement); + printf("After second time prepare \n"); + con->display(); + rv = con->beginTrans(); + stmt->setIntParam(1, 200); + rv = stmt->execute(rows); + if (rv != OK) { + printError(rv, "Insert failed with ret val %d", rv); + con->rollback(); + } + else con->commit(); + stmt->free(); + printf("After reusing cached insert stmt\n"); + con->display(); + + con->disconnect(); + delete stmt; + delete con; +} diff --git a/test/sql/StmtCache/stmtTest8.c b/test/sql/StmtCache/stmtTest8.c new file mode 100644 index 00000000..e3d07993 --- /dev/null +++ b/test/sql/StmtCache/stmtTest8.c @@ -0,0 +1,59 @@ +#include + +int main(int argc, char **argv) +{ + DbRetVal rv = OK; + struct timeval timeout; + struct timeval timeStamp; + AbsSqlConnection *con = SqlFactory::createConnection(CSql); + rv = con->connect("root","manager"); + if(rv!=OK)return 1; + AbsSqlStatement *stmt = SqlFactory::createStatement(CSql); + stmt->setConnection(con); + AbsSqlStatement *dropstmt = SqlFactory::createStatement(CSql); + dropstmt->setConnection(con); + char statement[200]; + int rows =0; + // insert into table + strcpy(statement,"INSERT INTO t1 VALUES(?, ?, 'CSQL');"); + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 4; } + rv = con->beginTrans(); + stmt->setIntParam(1, 100); + stmt->setIntParam(2, 100); + rv = stmt->execute(rows); + if (rv != OK) { + printError(rv, "Insert failed with ret val %d", rv); + con->rollback(); + } + else con->commit(); + con->display(); + printf("creating index\n"); + strcpy(statement, "create index idx1 on t1(f2);"); + rv = dropstmt->prepare(statement); + if (rv != OK) { + printf("create index on table failed\n"); + con->disconnect();delete stmt; delete con; return -1; + } + dropstmt->execute(rows); + dropstmt->free(); + printf("After create index \n"); + con->display(); + + rv = con->beginTrans(); + stmt->setIntParam(1, 200); + stmt->setIntParam(2, 200); + rv = stmt->execute(rows); + if (rv != OK) { + printError(rv, "Insert failed with ret val %d", rv); + con->rollback(); + } + else con->commit(); + stmt->free(); + printf("After reusing cached insert stmt\n"); + con->display(); + + con->disconnect(); + delete stmt; + delete con; +} diff --git a/test/sql/StmtCache/stmtTest9.c b/test/sql/StmtCache/stmtTest9.c new file mode 100644 index 00000000..1ef060d0 --- /dev/null +++ b/test/sql/StmtCache/stmtTest9.c @@ -0,0 +1,71 @@ +#include + +int main(int argc, char **argv) +{ + DbRetVal rv = OK; + struct timeval timeout; + struct timeval timeStamp; + AbsSqlConnection *con = SqlFactory::createConnection(CSql); + rv = con->connect("root","manager"); + if(rv!=OK)return 1; + AbsSqlStatement *stmt = SqlFactory::createStatement(CSql); + stmt->setConnection(con); + AbsSqlStatement *dropstmt = SqlFactory::createStatement(CSql); + dropstmt->setConnection(con); + char statement[200]; + int rows =0; + // insert into table + strcpy(statement,"INSERT INTO t1 VALUES(?, ?, 'CSQL');"); + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 4; } + rv = con->beginTrans(); + stmt->setIntParam(1, 100); + stmt->setIntParam(2, 100); + rv = stmt->execute(rows); + if (rv != OK) { + printError(rv, "Insert failed with ret val %d", rv); + con->rollback(); + } + else con->commit(); + con->display(); + printf("creating index\n"); + strcpy(statement, "create index idx1 on t1(f2);"); + rv = dropstmt->prepare(statement); + if (rv != OK) { + printf("create index on table failed\n"); + con->disconnect();delete stmt; delete con; return -1; + } + dropstmt->execute(rows); + dropstmt->free(); + printf("After create index \n"); + con->display(); + + rv = con->beginTrans(); + stmt->setIntParam(1, 200); + stmt->setIntParam(2, 200); + rv = stmt->execute(rows); + if (rv != OK) { + printError(rv, "Insert failed with ret val %d", rv); + con->rollback(); + } + else con->commit(); + stmt->free(); + printf("After reusing cached insert stmt\n"); + con->display(); + strcpy(statement,"INSERT INTO t1 VALUES(?, ?, 'CSQL');"); + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 4; } + rv = con->beginTrans(); + stmt->setIntParam(1, 300); + stmt->setIntParam(2, 300); + rv = stmt->execute(rows); + if (rv != OK) { + printError(rv, "Insert failed with ret val %d", rv); + con->rollback(); + } + else con->commit(); + + con->disconnect(); + delete stmt; + delete con; +} diff --git a/test/sql/StmtCache/t1.sql b/test/sql/StmtCache/t1.sql new file mode 100644 index 00000000..539dc22b --- /dev/null +++ b/test/sql/StmtCache/t1.sql @@ -0,0 +1,6 @@ +create table t1( f1 int, f2 int, f3 varchar(20), primary key (f1)); +insert into t1 values (1,1,'First'); +insert into t1 values (2,1,'Second'); +insert into t1 values (3,1,'Third'); +insert into t1 values (4,1,'Fourth'); +insert into t1 values (5,1,'Fifth'); diff --git a/test/sql/StmtCache/t1idx.sql b/test/sql/StmtCache/t1idx.sql new file mode 100644 index 00000000..2b8872cb --- /dev/null +++ b/test/sql/StmtCache/t1idx.sql @@ -0,0 +1,7 @@ +create table t1( f1 int, f2 int, f3 varchar(20), primary key (f1)); +create index idx on t1(f2); +insert into t1 values (1,1,'First'); +insert into t1 values (2,1,'Second'); +insert into t1 values (3,1,'Third'); +insert into t1 values (4,1,'Fourth'); +insert into t1 values (5,1,'Fifth'); diff --git a/test/sql/StmtCache/t2.sql b/test/sql/StmtCache/t2.sql new file mode 100644 index 00000000..2aa3031e --- /dev/null +++ b/test/sql/StmtCache/t2.sql @@ -0,0 +1,6 @@ +create table t2( f1 int, f2 int, f3 varchar(20), primary key (f1)); +insert into t2 values (1,1,'First'); +insert into t2 values (2,1,'Second'); +insert into t2 values (3,1,'Third'); +insert into t2 values (4,1,'Fourth'); +insert into t2 values (5,1,'Fifth'); diff --git a/test/sql/StmtCache/test001.ksh b/test/sql/StmtCache/test001.ksh new file mode 100755 index 00000000..0f70907c --- /dev/null +++ b/test/sql/StmtCache/test001.ksh @@ -0,0 +1,98 @@ +#!/bin/ksh +# Statement Caching test with now in timestamp field +# create a table say t1(f1 int, f2 timestamp) +# insert a record say (1,'now') +# select count(*) from t1 where f2 < 'now'; This should display 1 +# insert a record say (2,'now') +# select count(*) from t1 where f2 < 'now'; This should display 2 +CREATEFILE=${PWD}/sql/StmtCache/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/StmtCache +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 + +echo "echo create table t1(f1 int, f2 timestamp);" >${REL_PATH}/stmtcache1.sql +echo "create table t1(f1 int, f2 timestamp);" >>${REL_PATH}/stmtcache1.sql +echo "echo insert into t1 values(1,'now');" >>${REL_PATH}/stmtcache1.sql +echo "insert into t1 values(1,'now');" >>${REL_PATH}/stmtcache1.sql + +echo "echo select count(*) from t1 where f2 < 'now';" >${REL_PATH}/stmtcache2.sql +echo "select count(*) from t1 where f2 < 'now';" >>${REL_PATH}/stmtcache2.sql + +echo "echo insert into t1 values(2,'now');" >${REL_PATH}/stmtcache3.sql +echo "insert into t1 values(2,'now');" >>${REL_PATH}/stmtcache3.sql + +echo "echo select count(*) from t1 where f2 < 'now';" >${REL_PATH}/stmtcache4.sql +echo "select count(*) from t1 where f2 < 'now';" >>${REL_PATH}/stmtcache4.sql + +sleep 1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/stmtcache1.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/stmtcache1.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql ${REL_PATH}/stmtcache1.sql ${REL_PATH}/stmtcache2.sql ${REL_PATH}/stmtcache3.sql ${REL_PATH}/stmtcache4.sql + exit 1; + fi +fi +sleep 1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/stmtcache2.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/stmtcache2.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql ${REL_PATH}/stmtcache1.sql ${REL_PATH}/stmtcache2.sql ${REL_PATH}/stmtcache3.sql ${REL_PATH}/stmtcache4.sql + exit 1; + fi +fi +sleep 1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/stmtcache3.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/stmtcache3.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql ${REL_PATH}/stmtcache1.sql ${REL_PATH}/stmtcache2.sql ${REL_PATH}/stmtcache3.sql ${REL_PATH}/stmtcache4.sql + exit 3; + fi +fi + +sleep 1 + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/stmtcache4.sql +else + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/stmtcache4.sql + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql ${REL_PATH}/stmtcache1.sql ${REL_PATH}/stmtcache2.sql ${REL_PATH}/stmtcache3.sql ${REL_PATH}/stmtcache4.sql + exit 4; + fi +fi + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql +if [ $? -ne 0 ] +then + exit 5; +fi + +rm -f ${REL_PATH}/dropt1.sql ${REL_PATH}/stmtcache1.sql ${REL_PATH}/stmtcache2.sql ${REL_PATH}/stmtcache3.sql ${REL_PATH}/stmtcache4.sql +exit 0; diff --git a/test/sql/StmtCache/test003.ksh b/test/sql/StmtCache/test003.ksh new file mode 100755 index 00000000..25f64728 --- /dev/null +++ b/test/sql/StmtCache/test003.ksh @@ -0,0 +1,32 @@ +#!/bin/ksh +# Update and Delete statement with one parameter should be cached +CREATEFILE=${PWD}/sql/StmtCache/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/StmtCache +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/t1.sql >/dev/null 2>&1 + + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $REL_PATH/stmtTest3 +else + $REL_PATH/stmtTest3 + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi +$CSQL_INSTALL_ROOT/bin/csqldump +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 +rm -f ${REL_PATH}/dropt1.sql + +exit 0; diff --git a/test/sql/StmtCache/test005.ksh b/test/sql/StmtCache/test005.ksh new file mode 100755 index 00000000..6c702ffa --- /dev/null +++ b/test/sql/StmtCache/test005.ksh @@ -0,0 +1,35 @@ +#!/bin/ksh +# drop table on one table should not affect already prepared stmt +# on another table +CREATEFILE=${PWD}/sql/StmtCache/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/StmtCache +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql +echo "drop table t2;" >>${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/t1.sql >/dev/null 2>&1 +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/t2.sql >/dev/null 2>&1 + + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $REL_PATH/stmtTest5 +else + $REL_PATH/stmtTest5 + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi +$CSQL_INSTALL_ROOT/bin/csqldump +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 +rm -f ${REL_PATH}/dropt1.sql + +exit 0; diff --git a/test/sql/StmtCache/test006.ksh b/test/sql/StmtCache/test006.ksh new file mode 100755 index 00000000..762b6ea5 --- /dev/null +++ b/test/sql/StmtCache/test006.ksh @@ -0,0 +1,34 @@ +#!/bin/ksh +# drop table should remove all the cached statements which are not in use +CREATEFILE=${PWD}/sql/StmtCache/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/StmtCache +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql +echo "drop table t2;" >>${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/t1.sql >/dev/null 2>&1 +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/t2.sql >/dev/null 2>&1 + + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $REL_PATH/stmtTest6 +else + $REL_PATH/stmtTest6 + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi +$CSQL_INSTALL_ROOT/bin/csqldump +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 +rm -f ${REL_PATH}/dropt1.sql + +exit 0; diff --git a/test/sql/StmtCache/test007.ksh b/test/sql/StmtCache/test007.ksh new file mode 100755 index 00000000..0015d6f3 --- /dev/null +++ b/test/sql/StmtCache/test007.ksh @@ -0,0 +1,35 @@ +#!/bin/ksh +# create index statement should remove all the cached statements which are not in use +CREATEFILE=${PWD}/sql/StmtCache/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/StmtCache +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/t1.sql >/dev/null 2>&1 + + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $REL_PATH/stmtTest7 +else + $REL_PATH/stmtTest7 + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi +echo "select * from t1 where f1=100;" >${REL_PATH}/sel.sql +echo "explain plan select * from t1 where f1=200;" >>${REL_PATH}/sel.sql +echo "select * from t1 where f1=200;" >>${REL_PATH}/sel.sql +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/sel.sql +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 +rm -f ${REL_PATH}/dropt1.sql + +exit 0; diff --git a/test/sql/StmtCache/test008.ksh b/test/sql/StmtCache/test008.ksh new file mode 100755 index 00000000..34d8672d --- /dev/null +++ b/test/sql/StmtCache/test008.ksh @@ -0,0 +1,39 @@ +#!/bin/ksh +# create index statement should remove all the cached statements which are not in use +# For inuse stmts, it should not delete underlying objects as it dumps core +# when any method on that stmt is called after that +# Verify this by keeping open insert prepared stmt, then create index and then insert again. +# Both the values inserted should be present through index lookup +CREATEFILE=${PWD}/sql/StmtCache/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/StmtCache +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/t1.sql >/dev/null 2>&1 + + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $REL_PATH/stmtTest8 +else + $REL_PATH/stmtTest8 + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi +echo "select * from t1 where f2=100;" >${REL_PATH}/sel.sql +echo "select * from t1 where f2=200;" >>${REL_PATH}/sel.sql +$CSQL_INSTALL_ROOT/bin/csqldump +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/sel.sql +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 +rm -f ${REL_PATH}/dropt1.sql + +exit 0; diff --git a/test/sql/StmtCache/test009.ksh b/test/sql/StmtCache/test009.ksh new file mode 100755 index 00000000..afb43a48 --- /dev/null +++ b/test/sql/StmtCache/test009.ksh @@ -0,0 +1,38 @@ +#!/bin/ksh +# For cached stmts, after create index statement, all the inserts of the cached statement should go into the index structure +# After free and reprepare for INSERT statement, inserts should go to index structures also + +CREATEFILE=${PWD}/sql/StmtCache/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/StmtCache +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/t1.sql >/dev/null 2>&1 + + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $REL_PATH/stmtTest9 +else + $REL_PATH/stmtTest9 + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi +echo "select * from t1 where f2=100;" >${REL_PATH}/sel.sql +echo "select * from t1 where f2=200;" >>${REL_PATH}/sel.sql +echo "select * from t1 where f2=300;" >>${REL_PATH}/sel.sql +$CSQL_INSTALL_ROOT/bin/csqldump +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/sel.sql +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 +rm -f ${REL_PATH}/dropt1.sql + +exit 0; diff --git a/test/sql/StmtCache/test010.ksh b/test/sql/StmtCache/test010.ksh new file mode 100755 index 00000000..9c89070d --- /dev/null +++ b/test/sql/StmtCache/test010.ksh @@ -0,0 +1,39 @@ +#!/bin/ksh +# drop index statement should remove all the cached statements which are not in use +# insert prepare, execute, free +# drop index. +# insert prepare, execute, free +# Both the values inserted should be present through index lookup +CREATEFILE=${PWD}/sql/StmtCache/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/StmtCache +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/t1idx.sql >/dev/null 2>&1 + + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $REL_PATH/stmtTest10 +else + $REL_PATH/stmtTest10 + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi +echo "select * from t1 where f2=100;" >${REL_PATH}/sel.sql +echo "select * from t1 where f2=200;" >>${REL_PATH}/sel.sql +$CSQL_INSTALL_ROOT/bin/csqldump +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/sel.sql +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 +rm -f ${REL_PATH}/dropt1.sql + +exit 0; diff --git a/test/sql/StmtCache/test011.ksh b/test/sql/StmtCache/test011.ksh new file mode 100755 index 00000000..4458f9dd --- /dev/null +++ b/test/sql/StmtCache/test011.ksh @@ -0,0 +1,39 @@ +#!/bin/ksh +# drop index statement should remove all the cached statements which are not in use +# insert prepare, execute +# drop index. +# execute already prepared stmt, free +# Both the values inserted should be present through index lookup +CREATEFILE=${PWD}/sql/StmtCache/csql.conf +REL_PATH=. +if [ -s "$CREATEFILE" ] +then + REL_PATH=`pwd`/sql/StmtCache +fi + +echo "drop table t1;" >${REL_PATH}/dropt1.sql + +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/t1idx.sql >/dev/null 2>&1 + + +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full $REL_PATH/stmtTest11 +else + $REL_PATH/stmtTest11 + if [ $? -ne 0 ] + then + $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql + rm -f ${REL_PATH}/dropt1.sql + exit 1; + fi +fi +echo "select * from t1 where f2=100;" >${REL_PATH}/sel.sql +echo "select * from t1 where f2=200;" >>${REL_PATH}/sel.sql +$CSQL_INSTALL_ROOT/bin/csqldump +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/sel.sql +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1 +rm -f ${REL_PATH}/dropt1.sql + +exit 0; -- 2.11.4.GIT