mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-25 12:04:21 +01:00
53 lines
1.1 KiB
Tcl
53 lines
1.1 KiB
Tcl
#!/usr/bin/env tclsh
|
|
|
|
set testdir [file dirname $argv0]
|
|
source $testdir/tester.tcl
|
|
|
|
do_execsql_test basic-order-by {
|
|
select * from products order by price;
|
|
} {9|boots|1.0
|
|
3|shirt|18.0
|
|
4|sweater|25.0
|
|
10|coat|33.0
|
|
6|shorts|70.0
|
|
5|sweatshirt|74.0
|
|
7|jeans|78.0
|
|
1|hat|79.0
|
|
11|accessories|81.0
|
|
2|cap|82.0
|
|
8|sneakers|82.0}
|
|
|
|
do_execsql_test basic-order-by-and-limit {
|
|
select * from products order by name limit 5;
|
|
} {11|accessories|81.0
|
|
9|boots|1.0
|
|
2|cap|82.0
|
|
10|coat|33.0
|
|
1|hat|79.0}
|
|
|
|
do_execsql_test basic-order-by-and-limit-2 {
|
|
select id, name from products order by name limit 5;
|
|
} {11|accessories
|
|
9|boots
|
|
2|cap
|
|
10|coat
|
|
1|hat}
|
|
|
|
do_execsql_test basic-order-by-and-limit-3 {
|
|
select price, name from products where price > 70 order by name;
|
|
} {81.0|accessories
|
|
82.0|cap
|
|
79.0|hat
|
|
78.0|jeans
|
|
82.0|sneakers
|
|
74.0|sweatshirt}
|
|
|
|
do_execsql_test order-by-qualified {
|
|
select u.first_name from users u order by u.first_name limit 1;
|
|
} {Aaron}
|
|
|
|
do_execsql_test order-by-column-number {
|
|
select first_name, last_name, age from users order by 3,2 limit 2;
|
|
} {Teresa|Allen|1
|
|
David|Baker|1}
|