Lines Matching refs:count

12 # focus of this file is testing "SELECT count(*)" statements.
20 # count-0.*: Make sure count(*) works on an empty database. (Ticket #3774)
22 # count-1.*: Test that the OP_Count instruction appears to work on both
29 do_test count-0.1 {
31 SELECT count(*) FROM sqlite_master;
42 do_test count-1.$iTest.1 {
48 execsql { SELECT count(*) FROM t1 }
51 do_test count-1.$iTest.2 {
55 SELECT count(*) FROM t1;
59 do_test count-1.$iTest.3 {
68 SELECT count(*) FROM t1;
72 do_test count-1.$iTest.4 {
78 SELECT count(*) FROM t1;
82 do_test count-1.$iTest.5 {
90 SELECT count(*) FROM t1;
102 do_test count-2.1 {
106 uses_op_count {SELECT count(*) FROM t2}
108 do_test count-2.2 {
109 catchsql {SELECT count(DISTINCT *) FROM t2}
111 do_test count-2.3 {
112 uses_op_count {SELECT count(DISTINCT a) FROM t2}
114 do_test count-2.4 {
115 uses_op_count {SELECT count(a) FROM t2}
117 do_test count-2.5 {
118 uses_op_count {SELECT count() FROM t2}
120 do_test count-2.6 {
121 catchsql {SELECT count(DISTINCT) FROM t2}
123 do_test count-2.7 {
124 uses_op_count {SELECT count(*)+1 FROM t2}
126 do_test count-2.8 {
127 uses_op_count {SELECT count(*) FROM t2 WHERE a IS NOT NULL}
129 do_execsql_test count-2.9a {
130 SELECT count(*) FROM t2 HAVING count(*)>1;
132 do_execsql_test count-2.9b {
133 SELECT count(*) FROM t2 HAVING count(*)<10;
135 do_test count-2.10 {
136 uses_op_count {SELECT count(*) FROM (SELECT 1)}
138 do_test count-2.11 {
140 uses_op_count {SELECT count(*) FROM v1}
142 do_test count-2.12 {
143 uses_op_count {SELECT count(*), max(a) FROM t2}
145 do_test count-2.13 {
146 uses_op_count {SELECT count(*) FROM t1, t2}
151 do_test count-2.14 {
153 uses_op_count {SELECT count(*) FROM techo}
157 do_test count-3.1 {
160 SELECT a FROM (SELECT count(*) AS a FROM t3) WHERE a==0;
163 do_test count-3.2 {
165 SELECT a FROM (SELECT count(*) AS a FROM t3) WHERE a==1;
169 do_test count-4.1 {
174 SELECT count(*) FROM t4;
177 do_test count-4.2 {
180 SELECT count(*) FROM t4;
183 do_test count-4.3 {
187 SELECT count(*) FROM t4;
191 do_execsql_test count-5.1 {
194 SELECT count(*) FROM t5;
197 do_catchsql_test count-6.1 {
199 SELECT count(DISTINCT) FROM t6 GROUP BY x;
203 # The count() optimization should honor the NOT INDEXED clause
206 do_execsql_test count-7.1 {
209 INSERT INTO t1(a,b,c) values(1,2,'count.test cases for NOT INDEXED');
214 do_eqp_test count-7.2 {
215 SELECT count(1) FROM t1;
220 do_eqp_test count-7.3 {
221 SELECT count(1) FROM t1 NOT INDEXED
226 do_eqp_test count-7.3 {
227 SELECT count(*) FROM t1;
232 do_eqp_test count-7.4 {
233 SELECT count(*) FROM t1 NOT INDEXED
239 do_execsql_test count-8.0 {
244 do_catchsql_test count-8.1 {
246 SELECT count(t8.b), count(*) FROM t7 AS ra0 ORDER BY count(*)
248 } {1 {misuse of aggregate: count()}}