5 -- awk '{print $3;}' onek.data | sort -n | uniq
7 SELECT DISTINCT two FROM tmp ORDER BY 1;
15 -- awk '{print $5;}' onek.data | sort -n | uniq
17 SELECT DISTINCT ten FROM tmp ORDER BY 1;
33 -- awk '{print $16;}' onek.data | sort -d | uniq
35 SELECT DISTINCT string4 FROM tmp ORDER BY 1;
45 -- awk '{print $3,$16,$5;}' onek.data | sort -d | uniq |
46 -- sort +0n -1 +1d -2 +2n -3
48 SELECT DISTINCT two, string4, ten
50 ORDER BY two using <, string4 using <, ten using <;
96 -- awk '{print $2;}' person.data |
97 -- awk '{if(NF!=1){print $2;}else{print;}}' - emp.data |
98 -- awk '{if(NF!=1){print $2;}else{print;}}' - student.data |
99 -- awk 'BEGIN{FS=" ";}{if(NF!=1){print $5;}else{print;}}' - stud_emp.data |
102 SELECT DISTINCT p.age FROM person* p ORDER BY age using >;
128 -- Also, some tests of IS DISTINCT FROM, which doesn't quite deserve its
129 -- very own regression file.
131 CREATE TEMP TABLE disttable (f1 integer);
132 INSERT INTO DISTTABLE VALUES(1);
133 INSERT INTO DISTTABLE VALUES(2);
134 INSERT INTO DISTTABLE VALUES(3);
135 INSERT INTO DISTTABLE VALUES(NULL);
137 SELECT f1, f1 IS DISTINCT FROM 2 as "not 2" FROM disttable;
146 SELECT f1, f1 IS DISTINCT FROM NULL as "not null" FROM disttable;
155 SELECT f1, f1 IS DISTINCT FROM f1 as "false" FROM disttable;
164 SELECT f1, f1 IS DISTINCT FROM f1+1 as "not null" FROM disttable;
173 -- check that optimizer constant-folds it properly
174 SELECT 1 IS DISTINCT FROM 2 as "yes";
180 SELECT 2 IS DISTINCT FROM 2 as "no";
186 SELECT 2 IS DISTINCT FROM null as "yes";
192 SELECT null IS DISTINCT FROM null as "no";
198 -- ANSI SQL 2003 form
199 SELECT 1 IS NOT DISTINCT FROM 2 as "no";
205 SELECT 2 IS NOT DISTINCT FROM 2 as "yes";
211 SELECT 2 IS NOT DISTINCT FROM null as "no";
217 SELECT null IS NOT DISTINCT FROM null as "yes";