• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1create table t1(
2  a1 STRING,
3  a2 BIG INT,
4  dur BIG INT,
5  a3 BIG INT,
6  ts BIG INT PRIMARY KEY
7) without rowid;
8
9INSERT INTO t1(a1, a2, dur, a3, ts)
10VALUES
11("A", 1, 10, 100, 0),
12("B", 2, 90, 101, 10),
13("C", 3, 1, 102, 100);
14
15create table t2(
16  b1 STRING,
17  ts BIG INT,
18  b2 BIG INT,
19  part BIG INT,
20  dur BIG INT,
21  b3 BIG INT,
22  PRIMARY KEY (part, ts)
23) without rowid;
24
25INSERT INTO t2(b1, ts, b2, part, dur, b3)
26VALUES
27("A", 10, 10, 0, 90, 100),
28("B", 100, 90, 0, 10, 200),
29("C", 110, 1, 0, 5, 300),
30("A", 5, 10, 1, 45, 100),
31("B", 50, 90, 1, 40, 200),
32("C", 90, 1, 1, 100, 300);
33
34create virtual table sp using span_join(t2 PARTITIONED part, t1);
35
36select ts,dur,part,b1,b2,b3,a1,a2,a3 from sp;
37