6
-- awk '{print $3;}' onek.data | sort -n | uniq
8
SELECT DISTINCT two FROM tmp ORDER BY 1;
11
-- awk '{print $5;}' onek.data | sort -n | uniq
13
SELECT DISTINCT ten FROM tmp ORDER BY 1;
16
-- awk '{print $16;}' onek.data | sort -d | uniq
18
SELECT DISTINCT string4 FROM tmp ORDER BY 1;
21
-- awk '{print $3,$16,$5;}' onek.data | sort -d | uniq |
22
-- sort +0n -1 +1d -2 +2n -3
24
SELECT DISTINCT two, string4, ten
26
ORDER BY two using <, string4 using <, ten using <;
29
-- awk '{print $2;}' person.data |
30
-- awk '{if(NF!=1){print $2;}else{print;}}' - emp.data |
31
-- awk '{if(NF!=1){print $2;}else{print;}}' - student.data |
32
-- awk 'BEGIN{FS=" ";}{if(NF!=1){print $5;}else{print;}}' - stud_emp.data |
35
SELECT DISTINCT p.age FROM person* p ORDER BY age using >;
38
-- Also, some tests of IS DISTINCT FROM, which doesn't quite deserve its
39
-- very own regression file.
42
CREATE TEMP TABLE disttable (f1 integer);
43
INSERT INTO DISTTABLE VALUES(1);
44
INSERT INTO DISTTABLE VALUES(2);
45
INSERT INTO DISTTABLE VALUES(3);
46
INSERT INTO DISTTABLE VALUES(NULL);
49
SELECT f1, f1 IS DISTINCT FROM 2 as "not 2" FROM disttable;
50
SELECT f1, f1 IS DISTINCT FROM NULL as "not null" FROM disttable;
51
SELECT f1, f1 IS DISTINCT FROM f1 as "false" FROM disttable;
52
SELECT f1, f1 IS DISTINCT FROM f1+1 as "not null" FROM disttable;
54
-- check that optimizer constant-folds it properly
55
SELECT 1 IS DISTINCT FROM 2 as "yes";
56
SELECT 2 IS DISTINCT FROM 2 as "no";
57
SELECT 2 IS DISTINCT FROM null as "yes";
58
SELECT null IS DISTINCT FROM null as "no";
61
SELECT 1 IS NOT DISTINCT FROM 2 as "no";
62
SELECT 2 IS NOT DISTINCT FROM 2 as "yes";
63
SELECT 2 IS NOT DISTINCT FROM null as "no";
64
SELECT null IS NOT DISTINCT FROM null as "yes";