--
-- SELECT
--

-- btree index
-- awk '{if($1<10){print;}else{next;}}' onek.data | sort +0n -1
--
SELECT onek.* WHERE onek.unique1 < 10
   ORDER BY onek.unique1;

--
-- awk '{if($1<20){print $1,$14;}else{next;}}' onek.data | sort +0nr -1
--
SELECT onek.unique1, onek.stringu1
   WHERE onek.unique1 < 20 
   ORDER BY unique1 using >;

--
-- awk '{if($1>980){print $1,$14;}else{next;}}' onek.data | sort +1d -2
--
SELECT onek.unique1, onek.stringu1
   WHERE onek.unique1 > 980 
   ORDER BY stringu1 using <;
	
--
-- awk '{if($1>980){print $1,$16;}else{next;}}' onek.data |
-- sort +1d -2 +0nr -1
--
SELECT onek.unique1, onek.string4
   WHERE onek.unique1 > 980 
   ORDER BY string4 using <, unique1 using >;
	
--
-- awk '{if($1>980){print $1,$16;}else{next;}}' onek.data |
-- sort +1dr -2 +0n -1
--
SELECT onek.unique1, onek.string4
   WHERE onek.unique1 > 980
   ORDER BY string4 using >, unique1 using <;
	
--
-- awk '{if($1<20){print $1,$16;}else{next;}}' onek.data |
-- sort +0nr -1 +1d -2
--
SELECT onek.unique1, onek.string4
   WHERE onek.unique1 < 20
   ORDER BY unique1 using >, string4 using <;

--
-- awk '{if($1<20){print $1,$16;}else{next;}}' onek.data |
-- sort +0n -1 +1dr -2
--
SELECT onek.unique1, onek.string4
   WHERE onek.unique1 < 20 
   ORDER BY unique1 using <, string4 using >;

--
-- test partial btree indexes
--
-- As of 7.2, planner probably won't pick an indexscan without stats,
-- so ANALYZE first.
--
ANALYZE onek2;

--
-- awk '{if($1<10){print $0;}else{next;}}' onek.data | sort +0n -1
--
SELECT onek2.* WHERE onek2.unique1 < 10;

--
-- awk '{if($1<20){print $1,$14;}else{next;}}' onek.data | sort +0nr -1
--
SELECT onek2.unique1, onek2.stringu1
    WHERE onek2.unique1 < 20 
    ORDER BY unique1 using >;

--
-- awk '{if($1>980){print $1,$14;}else{next;}}' onek.data | sort +1d -2
--
SELECT onek2.unique1, onek2.stringu1
   WHERE onek2.unique1 > 980;


SELECT two, stringu1, ten, string4
   INTO TABLE tmp
   FROM onek;

--
-- awk '{print $1,$2;}' person.data |
-- awk '{if(NF!=2){print $3,$2;}else{print;}}' - emp.data |
-- awk '{if(NF!=2){print $3,$2;}else{print;}}' - student.data |
-- awk 'BEGIN{FS="      ";}{if(NF!=2){print $4,$5;}else{print;}}' - stud_emp.data
--
-- SELECT name, age FROM person*; ??? check if different
SELECT p.name, p.age FROM person* p;

--
-- awk '{print $1,$2;}' person.data |
-- awk '{if(NF!=2){print $3,$2;}else{print;}}' - emp.data |
-- awk '{if(NF!=2){print $3,$2;}else{print;}}' - student.data |
-- awk 'BEGIN{FS="      ";}{if(NF!=1){print $4,$5;}else{print;}}' - stud_emp.data |
-- sort +1nr -2
--
SELECT p.name, p.age FROM person* p ORDER BY age using >, name;

-- 
-- Test between syntax
--
SELECT 2 BETWEEN 1 AND 3;
SELECT 2 BETWEEN 3 AND 1;
SELECT 2 BETWEEN ASYMMETRIC 1 AND 3;
SELECT 2 BETWEEN ASYMMETRIC 3 AND 1;
SELECT 2 BETWEEN SYMMETRIC 1 AND 3;
SELECT 2 BETWEEN SYMMETRIC 3 AND 1;
SELECT 2 NOT BETWEEN 1 AND 3;
SELECT 2 NOT BETWEEN 3 AND 1;
SELECT 2 NOT BETWEEN ASYMMETRIC 1 AND 3;
SELECT 2 NOT BETWEEN ASYMMETRIC 3 AND 1;
SELECT 2 NOT BETWEEN SYMMETRIC 1 AND 3;
SELECT 2 NOT BETWEEN SYMMETRIC 3 AND 1;
SELECT -4 BETWEEN -1 AND -3;
SELECT -4 BETWEEN -3 AND -1;
SELECT -4 BETWEEN ASYMMETRIC -1 AND -3;
SELECT -4 BETWEEN ASYMMETRIC -3 AND -1;
SELECT -4 BETWEEN SYMMETRIC -1 AND -3;
SELECT -4 BETWEEN SYMMETRIC -3 AND -1;
SELECT -4 NOT BETWEEN -1 AND -3;
SELECT -4 NOT BETWEEN -3 AND -1;
SELECT -4 NOT BETWEEN ASYMMETRIC -1 AND -3;
SELECT -4 NOT BETWEEN ASYMMETRIC -3 AND -1;
SELECT -4 NOT BETWEEN SYMMETRIC -1 AND -3;
SELECT -4 NOT BETWEEN SYMMETRIC -3 AND -1;

