📄 where.test
字号:
}} {1 100 4 2 99 9 3 98 16 sort}do_test where-6.4 { cksort { SELECT * FROM t3 WHERE a<10 ORDER BY a LIMIT 3 }} {1 100 4 2 99 9 3 98 16 nosort}do_test where-6.5 { cksort { SELECT * FROM t3 WHERE a>0 AND a<10 ORDER BY a LIMIT 3 }} {1 100 4 2 99 9 3 98 16 nosort}do_test where-6.6 { cksort { SELECT * FROM t3 WHERE a>0 ORDER BY a LIMIT 3 }} {1 100 4 2 99 9 3 98 16 nosort}do_test where-6.7 { cksort { SELECT * FROM t3 WHERE b>0 ORDER BY a LIMIT 3 }} {1 100 4 2 99 9 3 98 16 sort}ifcapable subquery { do_test where-6.8 { cksort { SELECT * FROM t3 WHERE a IN (3,5,7,1,9,4,2) ORDER BY a LIMIT 3 } } {1 100 4 2 99 9 3 98 16 sort}}do_test where-6.9.1 { cksort { SELECT * FROM t3 WHERE a=1 AND c>0 ORDER BY a LIMIT 3 }} {1 100 4 nosort}do_test where-6.9.1.1 { cksort { SELECT * FROM t3 WHERE a>=1 AND a=1 AND c>0 ORDER BY a LIMIT 3 }} {1 100 4 nosort}do_test where-6.9.1.2 { cksort { SELECT * FROM t3 WHERE a<2 AND a=1 AND c>0 ORDER BY a LIMIT 3 }} {1 100 4 nosort}do_test where-6.9.2 { cksort { SELECT * FROM t3 WHERE a=1 AND c>0 ORDER BY a,c LIMIT 3 }} {1 100 4 nosort}do_test where-6.9.3 { cksort { SELECT * FROM t3 WHERE a=1 AND c>0 ORDER BY c LIMIT 3 }} {1 100 4 nosort}do_test where-6.9.4 { cksort { SELECT * FROM t3 WHERE a=1 AND c>0 ORDER BY a DESC LIMIT 3 }} {1 100 4 nosort}do_test where-6.9.5 { cksort { SELECT * FROM t3 WHERE a=1 AND c>0 ORDER BY a DESC, c DESC LIMIT 3 }} {1 100 4 nosort}do_test where-6.9.6 { cksort { SELECT * FROM t3 WHERE a=1 AND c>0 ORDER BY c DESC LIMIT 3 }} {1 100 4 nosort}do_test where-6.9.7 { cksort { SELECT * FROM t3 WHERE a=1 AND c>0 ORDER BY c,a LIMIT 3 }} {1 100 4 sort}do_test where-6.9.8 { cksort { SELECT * FROM t3 WHERE a=1 AND c>0 ORDER BY a DESC, c ASC LIMIT 3 }} {1 100 4 nosort}do_test where-6.9.9 { cksort { SELECT * FROM t3 WHERE a=1 AND c>0 ORDER BY a ASC, c DESC LIMIT 3 }} {1 100 4 nosort}do_test where-6.10 { cksort { SELECT * FROM t3 WHERE a=1 AND c>0 ORDER BY a LIMIT 3 }} {1 100 4 nosort}do_test where-6.11 { cksort { SELECT * FROM t3 WHERE a=1 AND c>0 ORDER BY a,c LIMIT 3 }} {1 100 4 nosort}do_test where-6.12 { cksort { SELECT * FROM t3 WHERE a=1 AND c>0 ORDER BY a,c,b LIMIT 3 }} {1 100 4 nosort}do_test where-6.13 { cksort { SELECT * FROM t3 WHERE a>0 ORDER BY a DESC LIMIT 3 }} {100 1 10201 99 2 10000 98 3 9801 nosort}do_test where-6.13.1 { cksort { SELECT * FROM t3 WHERE a>0 ORDER BY -a LIMIT 3 }} {100 1 10201 99 2 10000 98 3 9801 sort}do_test where-6.14 { cksort { SELECT * FROM t3 ORDER BY b LIMIT 3 }} {100 1 10201 99 2 10000 98 3 9801 nosort}do_test where-6.15 { cksort { SELECT t3.a, t1.x FROM t3, t1 WHERE t3.a=t1.w ORDER BY t3.a LIMIT 3 }} {1 0 2 1 3 1 nosort}do_test where-6.16 { cksort { SELECT t3.a, t1.x FROM t3, t1 WHERE t3.a=t1.w ORDER BY t1.x, t3.a LIMIT 3 }} {1 0 2 1 3 1 sort}do_test where-6.19 { cksort { SELECT y FROM t1 ORDER BY w LIMIT 3; }} {4 9 16 nosort}do_test where-6.20 { cksort { SELECT y FROM t1 ORDER BY rowid LIMIT 3; }} {4 9 16 nosort}do_test where-6.21 { cksort { SELECT y FROM t1 ORDER BY rowid, y LIMIT 3; }} {4 9 16 nosort}do_test where-6.22 { cksort { SELECT y FROM t1 ORDER BY rowid, y DESC LIMIT 3; }} {4 9 16 nosort}do_test where-6.23 { cksort { SELECT y FROM t1 WHERE y>4 ORDER BY rowid, w, x LIMIT 3; }} {9 16 25 nosort}do_test where-6.24 { cksort { SELECT y FROM t1 WHERE y>=9 ORDER BY rowid, x DESC, w LIMIT 3; }} {9 16 25 nosort}do_test where-6.25 { cksort { SELECT y FROM t1 WHERE y>4 AND y<25 ORDER BY rowid; }} {9 16 nosort}do_test where-6.26 { cksort { SELECT y FROM t1 WHERE y>=4 AND y<=25 ORDER BY oid; }} {4 9 16 25 nosort}do_test where-6.27 { cksort { SELECT y FROM t1 WHERE y<=25 ORDER BY _rowid_, w+y; }} {4 9 16 25 nosort}# Tests for reverse-order sorting.#do_test where-7.1 { cksort { SELECT w FROM t1 WHERE x=3 ORDER BY y; }} {8 9 10 11 12 13 14 15 nosort}do_test where-7.2 { cksort { SELECT w FROM t1 WHERE x=3 ORDER BY y DESC; }} {15 14 13 12 11 10 9 8 nosort}do_test where-7.3 { cksort { SELECT w FROM t1 WHERE x=3 AND y>100 ORDER BY y LIMIT 3; }} {10 11 12 nosort}do_test where-7.4 { cksort { SELECT w FROM t1 WHERE x=3 AND y>100 ORDER BY y DESC LIMIT 3; }} {15 14 13 nosort}do_test where-7.5 { cksort { SELECT w FROM t1 WHERE x=3 AND y>121 ORDER BY y DESC; }} {15 14 13 12 11 nosort}do_test where-7.6 { cksort { SELECT w FROM t1 WHERE x=3 AND y>=121 ORDER BY y DESC; }} {15 14 13 12 11 10 nosort}do_test where-7.7 { cksort { SELECT w FROM t1 WHERE x=3 AND y>=121 AND y<196 ORDER BY y DESC; }} {12 11 10 nosort}do_test where-7.8 { cksort { SELECT w FROM t1 WHERE x=3 AND y>=121 AND y<=196 ORDER BY y DESC; }} {13 12 11 10 nosort}do_test where-7.9 { cksort { SELECT w FROM t1 WHERE x=3 AND y>121 AND y<=196 ORDER BY y DESC; }} {13 12 11 nosort}do_test where-7.10 { cksort { SELECT w FROM t1 WHERE x=3 AND y>100 AND y<196 ORDER BY y DESC; }} {12 11 10 nosort}do_test where-7.11 { cksort { SELECT w FROM t1 WHERE x=3 AND y>=121 AND y<196 ORDER BY y; }} {10 11 12 nosort}do_test where-7.12 { cksort { SELECT w FROM t1 WHERE x=3 AND y>=121 AND y<=196 ORDER BY y; }} {10 11 12 13 nosort}do_test where-7.13 { cksort { SELECT w FROM t1 WHERE x=3 AND y>121 AND y<=196 ORDER BY y; }} {11 12 13 nosort}do_test where-7.14 { cksort { SELECT w FROM t1 WHERE x=3 AND y>100 AND y<196 ORDER BY y; }} {10 11 12 nosort}do_test where-7.15 { cksort { SELECT w FROM t1 WHERE x=3 AND y<81 ORDER BY y; }} {nosort}do_test where-7.16 { cksort { SELECT w FROM t1 WHERE x=3 AND y<=81 ORDER BY y; }} {8 nosort}do_test where-7.17 { cksort { SELECT w FROM t1 WHERE x=3 AND y>256 ORDER BY y; }} {nosort}do_test where-7.18 { cksort { SELECT w FROM t1 WHERE x=3 AND y>=256 ORDER BY y; }} {15 nosort}do_test where-7.19 { cksort { SELECT w FROM t1 WHERE x=3 AND y<81 ORDER BY y DESC; }} {nosort}do_test where-7.20 { cksort { SELECT w FROM t1 WHERE x=3 AND y<=81 ORDER BY y DESC; }} {8 nosort}do_test where-7.21 { cksort { SELECT w FROM t1 WHERE x=3 AND y>256 ORDER BY y DESC; }} {nosort}do_test where-7.22 { cksort { SELECT w FROM t1 WHERE x=3 AND y>=256 ORDER BY y DESC; }} {15 nosort}do_test where-7.23 { cksort { SELECT w FROM t1 WHERE x=0 AND y<4 ORDER BY y; }} {nosort}do_test where-7.24 { cksort { SELECT w FROM t1 WHERE x=0 AND y<=4 ORDER BY y; }} {1 nosort}do_test where-7.25 { cksort { SELECT w FROM t1 WHERE x=6 AND y>10201 ORDER BY y; }} {nosort}do_test where-7.26 { cksort { SELECT w FROM t1 WHERE x=6 AND y>=10201 ORDER BY y; }} {100 nosort}do_test where-7.27 { cksort { SELECT w FROM t1 WHERE x=0 AND y<4 ORDER BY y DESC; }} {nosort}do_test where-7.28 { cksort { SELECT w FROM t1 WHERE x=0 AND y<=4 ORDER BY y DESC; }} {1 nosort}do_test where-7.29 { cksort { SELECT w FROM t1 WHERE x=6 AND y>10201 ORDER BY y DESC; }} {nosort}do_test where-7.30 { cksort { SELECT w FROM t1 WHERE x=6 AND y>=10201 ORDER BY y DESC; }} {100 nosort}do_test where-7.31 { cksort { SELECT y FROM t1 ORDER BY rowid DESC LIMIT 3 }} {10201 10000 9801 nosort}do_test where-7.32 { cksort { SELECT y FROM t1 WHERE y<25 ORDER BY rowid DESC, x }} {16 9 4 nosort}do_test where-7.33 { cksort { SELECT y FROM t1 WHERE y<=25 ORDER BY rowid DESC, x }} {25 16 9 4 nosort}do_test where-7.34 { cksort { SELECT y FROM t1 WHERE y<25 AND y>4 ORDER BY rowid DESC, y DESC }} {16 9 nosort}do_test where-7.35 { cksort { SELECT y FROM t1 WHERE y<25 AND y>=4 ORDER BY rowid DESC }} {16 9 4 nosort}do_test where-8.1 { execsql { CREATE TABLE t4 AS SELECT * FROM t1; CREATE INDEX i4xy ON t4(x,y); } cksort { SELECT w FROM t4 WHERE x=4 and y<1000 ORDER BY y DESC limit 3; }} {30 29 28 nosort}do_test where-8.2 { execsql { DELETE FROM t4; } cksort { SELECT w FROM t4 WHERE x=4 and y<1000 ORDER BY y DESC limit 3; }} {nosort}# Make sure searches with an index work with an empty table.#do_test where-9.1 { execsql { CREATE TABLE t5(x PRIMARY KEY); SELECT * FROM t5 WHERE x<10; }} {}do_test where-9.2 { execsql { SELECT * FROM t5 WHERE x<10 ORDER BY x DESC; }} {}do_test where-9.3 { execsql { SELECT * FROM t5 WHERE x=10; }} {}do_test where-10.1 { execsql { SELECT 1 WHERE abs(random())<0 }} {}do_test where-10.2 { proc tclvar_func {vname} {return [set ::$vname]} db function tclvar tclvar_func set ::v1 0 execsql { SELECT count(*) FROM t1 WHERE tclvar('v1'); }} {0}do_test where-10.3 { set ::v1 1 execsql { SELECT count(*) FROM t1 WHERE tclvar('v1'); }} {100}do_test where-10.4 { set ::v1 1 proc tclvar_func {vname} { upvar #0 $vname v set v [expr {!$v}] return $v } execsql { SELECT count(*) FROM t1 WHERE tclvar('v1'); }} {50}integrity_check {where-99.0}finish_test
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -