#!/bin/sh
#
# select commands using OR, on nzplaces
#

SHSQL="shsql -echo -n"



echo "*************************************************************"
echo "1. OR / OUTRANGE"
$SHSQL "select * from nzplaces where latitude outrange -47.26,-34.15  OR longitude outrange 166.45,178.53
	order by latitude, longitude, id" 2>&1

echo "*************************************************************"
echo "2. AND / INRANGE"
$SHSQL "select * from nzplaces where latitude inrange -47.5,-47.2 and longitude inrange 167.6,167.64"

echo "*************************************************************"
echo "3. OR"
$SHSQL "select * from nzplaces where longitude outrange 166.45,178.53 OR longitude is null 
	order by latitude, longitude, id" 2>&1

echo "*************************************************************"
echo "4. OR"
$SHSQL "select * from nzplaces where desc_code is null OR longitude is null order by name, id" 2>&1

echo "*************************************************************"
echo "5. OR: duplicate OR terms"
$SHSQL "select * from nzplaces where desc_code like 'UNI*' OR desc_code like 'UNI*' order by name, id" 2>&1

echo "*************************************************************"
echo "6. OR: one OR term contains AND terms"
$SHSQL "select * from nzplaces where desc_code like 'uni*' and district in 'ch,ak' OR desc_code = null 
	order by name, id" 2>&1

