0
0
mirror of https://github.com/tursodatabase/libsql.git synced 2024-12-12 15:33:44 +00:00
ad hoc ad79ef48a2
libsql wal tests (#1408)
* add tests

* add bench
2024-05-24 13:59:17 +00:00

73 lines
1.7 KiB
Plaintext

CREATE TABLE t4(a, b);
CREATE TABLE t5(a, b);
INSERT INTO t5 VALUES(3, 5);
INSERT INTO t4 VALUES(1, 1);
INSERT INTO t4 VALUES(2, 3);
INSERT INTO t4 VALUES(3, 6);
INSERT INTO t4 VALUES(4, 10);
INSERT INTO t4 VALUES(5, 15);
SELECT *
FROM (SELECT * FROM t4 ORDER BY a LIMIT -1 OFFSET 1)
LIMIT (SELECT a FROM t5)
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE TABLE t1 (id INTEGER PRIMARY KEY, data TEXT);
INSERT INTO t1(id,data) VALUES(9,'nine-a');
INSERT INTO t1(id,data) VALUES(10,'ten-a');
INSERT INTO t1(id,data) VALUES(11,'eleven-a');
CREATE TABLE t2 (id INTEGER PRIMARY KEY, data TEXT);
INSERT INTO t2(id,data) VALUES(9,'nine-b');
INSERT INTO t2(id,data) VALUES(10,'ten-b');
INSERT INTO t2(id,data) VALUES(11,'eleven-b');
SELECT id FROM (
SELECT id,data FROM (
SELECT * FROM t1 UNION ALL SELECT * FROM t2
)
WHERE id=10 ORDER BY data
);
SELECT data FROM (
SELECT 'dummy', data FROM (
SELECT data FROM t1 UNION ALL SELECT data FROM t1
) ORDER BY data
);
DROP TABLE IF EXISTS t3;
DROP TABLE IF EXISTS t4;
CREATE TABLE t3(id INTEGER, data TEXT);
CREATE TABLE t4(id INTEGER, data TEXT);
INSERT INTO t3 VALUES(4, 'a'),(2,'c');
INSERT INTO t4 VALUES(3, 'b'),(1,'d');
SELECT data, id FROM (
SELECT id, data FROM (
SELECT * FROM t3 UNION ALL SELECT * FROM t4
) ORDER BY data
);
CREATE TABLE t6(x);
CREATE TABLE t1(x);
INSERT INTO t1 VALUES('ALFKI');
INSERT INTO t1 VALUES('ANATR');
CREATE TABLE t2(y, z);
CREATE INDEX t2y ON t2 (y);
INSERT INTO t2 VALUES('ANATR', '1997-08-08 00:00:00');
INSERT INTO t2 VALUES('ALFKI', '1997-08-25 00:00:00');
SELECT ( SELECT y FROM t2 WHERE x = y ORDER BY y, z) FROM t1;