mirror of
https://github.com/tursodatabase/libsql.git
synced 2024-12-13 12:28:30 +00:00
ad79ef48a2
* add tests * add bench
101 lines
3.1 KiB
Plaintext
101 lines
3.1 KiB
Plaintext
|
|
DROP TABLE IF EXISTS t1;
|
|
DROP TABLE IF EXISTS t2;
|
|
CREATE TABLE t1(x); INSERT INTO t1 VALUES(1);
|
|
CREATE TABLE t2(y,z); INSERT INTO t2 VALUES(2,3);
|
|
CREATE INDEX t2y ON t2(y);
|
|
SELECT * FROM t1,(SELECT * FROM t2 WHERE y=2 ORDER BY y,z);
|
|
|
|
|
|
SELECT * FROM t1,(SELECT * FROM t2 WHERE y=2 ORDER BY y,z LIMIT 4);
|
|
|
|
|
|
SELECT * FROM t1,(SELECT * FROM t2 WHERE y=2
|
|
UNION ALL SELECT * FROM t2 WHERE y=3 ORDER BY y,z LIMIT 4);
|
|
|
|
|
|
DROP TABLE IF EXISTS t1;
|
|
DROP TABLE IF EXISTS t2;
|
|
CREATE TABLE t1(c);
|
|
CREATE TABLE t2(x PRIMARY KEY, y);
|
|
INSERT INTO t1(c) VALUES(123);
|
|
INSERT INTO t2(x) VALUES(123);
|
|
SELECT x FROM t2, t1 WHERE x BETWEEN c AND null OR x AND
|
|
x IN ((SELECT x FROM (SELECT x FROM t2, t1
|
|
WHERE x BETWEEN (SELECT x FROM (SELECT x COLLATE rtrim
|
|
FROM t2, t1 WHERE x BETWEEN c AND null
|
|
OR x AND x IN (c)), t1 WHERE x BETWEEN c AND null
|
|
OR x AND x IN (c)) AND null
|
|
OR NOT EXISTS(SELECT -4.81 FROM t1, t2 WHERE x BETWEEN c AND null
|
|
OR x AND x IN ((SELECT x FROM (SELECT x FROM t2, t1
|
|
WHERE x BETWEEN (SELECT x FROM (SELECT x BETWEEN c AND null
|
|
OR x AND x IN (c)), t1 WHERE x BETWEEN c AND null
|
|
OR x AND x IN (c)) AND null
|
|
OR x AND x IN (c)), t1 WHERE x BETWEEN c AND null
|
|
OR x AND x IN (c)))) AND x IN (c)
|
|
), t1 WHERE x BETWEEN c AND null
|
|
OR x AND x IN (c)));
|
|
|
|
|
|
DROP TABLE IF EXISTS t1;
|
|
DROP TABLE IF EXISTS t2;
|
|
CREATE TABLE t1(c);
|
|
CREATE TABLE t2(x PRIMARY KEY, y);
|
|
INSERT INTO t1(c) VALUES(123);
|
|
INSERT INTO t2(x) VALUES(123);
|
|
SELECT x FROM t2, t1 WHERE x BETWEEN c AND (c+1) OR x AND
|
|
x IN ((SELECT x FROM (SELECT x FROM t2, t1
|
|
WHERE x BETWEEN (SELECT x FROM (SELECT x COLLATE rtrim
|
|
FROM t2, t1 WHERE x BETWEEN c AND (c+1)
|
|
OR x AND x IN (c)), t1 WHERE x BETWEEN c AND (c+1)
|
|
OR x AND x IN (c)) AND (c+1)
|
|
OR NOT EXISTS(SELECT -4.81 FROM t1, t2 WHERE x BETWEEN c AND (c+1)
|
|
OR x AND x IN ((SELECT x FROM (SELECT x FROM t2, t1
|
|
WHERE x BETWEEN (SELECT x FROM (SELECT x BETWEEN c AND (c+1)
|
|
OR x AND x IN (c)), t1 WHERE x BETWEEN c AND (c+1)
|
|
OR x AND x IN (c)) AND (c+1)
|
|
OR x AND x IN (c)), t1 WHERE x BETWEEN c AND (c+1)
|
|
OR x AND x IN (c)))) AND x IN (c)
|
|
), t1 WHERE x BETWEEN c AND (c+1)
|
|
OR x AND x IN (c)));
|
|
|
|
|
|
SELECT 1 FROM t1 WHERE (
|
|
SELECT 2 FROM t2 WHERE (
|
|
SELECT 3 FROM (
|
|
SELECT x FROM t2 WHERE x=c OR x=(SELECT x FROM (VALUES(0)))
|
|
) WHERE x>c OR x=c
|
|
)
|
|
);
|
|
|
|
|
|
SELECT 1 FROM t1, t2 WHERE (
|
|
SELECT 3 FROM (
|
|
SELECT x FROM t2 WHERE x=c OR x=(SELECT x FROM (VALUES(0)))
|
|
) WHERE x>c OR x=c
|
|
);
|
|
|
|
|
|
DROP TABLE IF EXISTS t1;
|
|
CREATE TABLE t1(x);
|
|
|
|
|
|
CREATE TABLE t1 (
|
|
a INTEGER PRIMARY KEY,
|
|
b AS('Y') UNIQUE
|
|
);
|
|
INSERT INTO t1(a) VALUES (10);
|
|
SELECT * FROM t1 JOIN t1 USING(a,b)
|
|
WHERE ((SELECT t1.a FROM t1 AS x GROUP BY b) AND b=0)
|
|
OR a = 10;
|
|
|
|
|
|
SELECT ifnull(a, max((SELECT 123))), count(a) FROM t1 ;
|
|
|
|
|
|
CREATE TABLE t1(a IMTEGES PRIMARY KEY,R);
|
|
CREATE TABLE t2(x UNIQUE);
|
|
CREATE VIEW v1a(z,y) AS SELECT x IS NULL, x FROM t2;
|
|
SELECT a,(+a)b,(+a)b,(+a)b,NOT EXISTS(SELECT null FROM t2),CASE z WHEN 487 THEN 992 WHEN 391 THEN 203 WHEN 10 THEN '?k<D Q' END,'' FROM t1 LEFT JOIN v1a ON z=b;
|
|
|