1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
QUERY: create table foo (x int4, y int4, z int4);
QUERY: create table bar (x int4, y int4, z int4);
QUERY: create table baz (a int4, b int4);
QUERY: insert into foo values (1, 2, 3);
QUERY: insert into foo values (4, 5, 6);
QUERY: insert into foo values (7, 8, 9);
QUERY: insert into bar values (11, 12, 13);
QUERY: insert into bar values (14, 15, 16);
QUERY: insert into bar values (17, 18, 19);
QUERY: insert into baz values (99, 88);
QUERY: insert into baz values (77, 66);
QUERY: select * from foo f where f.x = 4;
x y z
-- -- --
4 5 6
QUERY: select * from foo f, foo where f.x > foo.x;
x y z x y z
-- -- -- -- -- --
4 5 6 1 2 3
7 8 9 1 2 3
7 8 9 4 5 6
QUERY: select * from foo f, foo where f.x = 1 and foo.z > f.z;
x y z x y z
-- -- -- -- -- --
1 2 3 4 5 6
1 2 3 7 8 9
QUERY: select y as a, z as b from foo order by a;
a b
-- --
2 3
5 6
8 9
QUERY: select foo.y as a, foo.z as b from foo order by b;
a b
-- --
2 3
5 6
8 9
QUERY: select foo.*, bar.z, baz.* from foo, bar, baz;
x y z z a b
-- -- -- --- --- ---
1 2 3 13 99 88
4 5 6 13 99 88
7 8 9 13 99 88
1 2 3 16 99 88
4 5 6 16 99 88
7 8 9 16 99 88
1 2 3 19 99 88
4 5 6 19 99 88
7 8 9 19 99 88
1 2 3 13 77 66
4 5 6 13 77 66
7 8 9 13 77 66
1 2 3 16 77 66
4 5 6 16 77 66
7 8 9 16 77 66
1 2 3 19 77 66
4 5 6 19 77 66
7 8 9 19 77 66
QUERY: drop table foo, bar, baz;
|