mirror of
https://github.com/tursodatabase/libsql.git
synced 2024-12-15 22:39:05 +00:00
ad79ef48a2
* add tests * add bench
55 lines
1.2 KiB
Plaintext
55 lines
1.2 KiB
Plaintext
|
|
EXPLAIN QUERY PLAN SELECT 5 UNION ALL SELECT 3 ORDER BY 1
|
|
|
|
|
|
SELECT 5 UNION ALL SELECT 3 ORDER BY 1
|
|
|
|
|
|
SELECT 986 AS x GROUP BY X ORDER BY X
|
|
|
|
|
|
CREATE TABLE abc(a, b, c);
|
|
INSERT INTO abc VALUES(1, 2, 3);
|
|
INSERT INTO abc VALUES(4, 5, 6);
|
|
INSERT INTO abc VALUES(7, 8, 9);
|
|
SELECT (
|
|
SELECT 'hardware' FROM (
|
|
SELECT 'software' ORDER BY 'firmware' ASC, 'sportswear' DESC
|
|
) GROUP BY 1 HAVING length(b)
|
|
)
|
|
FROM abc;
|
|
|
|
|
|
CREATE TABLE t7(a,b);
|
|
CREATE INDEX t7a ON t7(a);
|
|
CREATE INDEX t7ab ON t7(a,b);
|
|
EXPLAIN QUERY PLAN
|
|
SELECT * FROM t7 WHERE a=?1 ORDER BY rowid;
|
|
|
|
|
|
PRAGMA cache_size = 5;
|
|
CREATE TABLE t1(a, b);
|
|
CREATE INDEX i1 ON t1(a);
|
|
|
|
|
|
WITH cnt(i) AS (
|
|
SELECT 1 UNION ALL SELECT i+1 FROM cnt WHERE i<10000
|
|
)
|
|
INSERT INTO t1 SELECT i%2, randomblob(500) FROM cnt;
|
|
|
|
|
|
DROP TABLE IF EXISTS t1;
|
|
CREATE TABLE t1(x INTEGER PRIMARY KEY);
|
|
INSERT INTO t1 VALUES(1),(2);
|
|
DROP TABLE IF EXISTS t2;
|
|
CREATE TABLE t2(y);
|
|
INSERT INTO t2 VALUES(9),(8),(3),(4);
|
|
SELECT (SELECT x||y FROM t2, t1 ORDER BY x, y);
|
|
|
|
|
|
CREATE TABLE t10(a,b);
|
|
INSERT INTO t10 VALUES(1,2),(8,9),(3,4),(5,4),(0,7);
|
|
CREATE INDEX t10b ON t10(b);
|
|
SELECT b, rowid, '^' FROM t10 ORDER BY b, a LIMIT 4;
|
|
|