File: queries.sql

package info (click to toggle)
prefix 1.1.1-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 648 kB
  • sloc: ansic: 1,314; sql: 367; makefile: 60
file content (29 lines) | stat: -rw-r--r-- 1,181 bytes parent folder | download | duplicates (2)
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
select a, b,
   a <= b as "<=", a < b as "<", a = b as "=", a <> b as "<>", a >= b as ">=", a > b as ">",
   a @> b as "@>", a <@ b as "<@", a && b as "&&"
from  (select a::prefix_range, b::prefix_range
         from (values('123', '123'),
                     ('123', '124'),
                     ('123', '123[4-5]'),
                     ('123[4-5]', '123[2-7]'),
                     ('123', '[2-3]')) as t(a, b)
      ) as x;

select a, b, c, a <= b as "a <= b", b <= c as "b <= c", a <= c as "a <= c"
from  (select a::prefix_range, b::prefix_range, c::prefix_range
         from (values('123', '123', '123'),
                     ('123', '124', '125'),
                     ('123', '123[4-5]', '123[4-6]'),
                     ('123[4-5]', '123[2-7]', '123[1-8]'),
                     ('123', '[2-3]', '4')) as t(a, b, c)
      ) as x;

select a, b, a | b as union, a & b as intersect
  from  (select a::prefix_range, b::prefix_range
           from (values('123', '123'),
                       ('123', '124'),
                       ('123', '123[4-5]'),
                       ('123[4-5]', '123[2-7]'),
                       ('123', '[2-3]')) as t(a, b)
        ) as x;