• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1create table t1(
2  ts BIG INT,
3  dur BIG INT,
4  a BIG INT,
5  PRIMARY KEY (ts)
6) without rowid;
7
8create table t2(
9  ts BIG INT,
10  dur BIG INT,
11  b BIG INT,
12  PRIMARY KEY (ts)
13) without rowid;
14
15-- Then insert some rows into t1 in part 1, 3, 4 and 5.
16INSERT INTO t1(ts, dur, a)
17VALUES
18(100, 400, 111),
19(500, 50, 222),
20(600, 100, 333),
21(900, 100, 444);
22
23-- Insert a row into t2 which should be split up by t1's first row.
24INSERT INTO t2(ts, dur, b) VALUES (50, 200, 111);
25
26-- Insert a row into t2 should should be completely covered by t1's first row.
27INSERT INTO t2(ts, dur, b) VALUES (300, 100, 222);
28
29-- Insert a row into t2 which should span between t1's first and second rows.
30INSERT INTO t2(ts, dur, b) VALUES (400, 250, 333);
31
32create virtual table sp using span_left_join(t1, t2);
33
34select * from sp;
35