mirror of
https://github.com/tursodatabase/libsql.git
synced 2024-12-12 15:33:44 +00:00
ad79ef48a2
* add tests * add bench
39 lines
960 B
Plaintext
39 lines
960 B
Plaintext
|
|
CREATE TABLE t1(a INTEGER PRIMARY KEY,b,c,d);
|
|
INSERT INTO t1(a,b,c,d) VALUES
|
|
(1,1,2,3),
|
|
(2,2,3,4),
|
|
(3,1,2,4),
|
|
(4,2,3,5),
|
|
(5,3,4,6),
|
|
(6,4,5,9);
|
|
SELECT a, CASE (b,c) WHEN (1,2) THEN 'aleph'
|
|
WHEN (2,3) THEN 'bet'
|
|
WHEN (3,4) THEN 'gimel'
|
|
ELSE '-' END,
|
|
'|'
|
|
FROM t1
|
|
ORDER BY a;
|
|
|
|
|
|
SELECT a, CASE (b,c,d) WHEN (1,2,3) THEN 'aleph'
|
|
WHEN (2,3,4) THEN 'bet'
|
|
WHEN (3,4,6) THEN 'gimel'
|
|
ELSE '-' END,
|
|
'|'
|
|
FROM t1
|
|
ORDER BY a;
|
|
|
|
|
|
CREATE TABLE t2(x INTEGER PRIMARY KEY, y);
|
|
INSERT INTO t2(x,y) VALUES(1,6),(2,5),(3,4),(4,3),(5,2),(6,1);
|
|
SELECT x, CASE (SELECT b,c FROM t1 WHERE a=y)
|
|
WHEN (1,2) THEN 'aleph'
|
|
WHEN (2,3) THEN 'bet'
|
|
WHEN (3,4) THEN 'gimel'
|
|
ELSE '-' END,
|
|
'|'
|
|
FROM t2
|
|
ORDER BY +x;
|
|
|