*************************************************************
1. OR / OUTRANGE
select * from nzplaces where latitude outrange -47.26,-34.15  OR longitude outrange 166.45,178.53
	order by latitude, longitude, id

id                   name                easting    northing  desc_code district  sheet  latitude longitude 
------ -------------------------------- ---------- ---------- --------- -------- ------- -------- --------- 
60334         North East Island         2432995.77 6785389.48   ISLD       AK     null    -34.13   172.15   
58061         Cape Morton Jones         2434243.49 6785614.19    PNT       AK     null    -34.13   172.16   
127070          North West Bay          2431300.00 6783750.00    BAY       AK     null    -34.14   172.13   
46244           Tunanui Stream          2999203.30 6374400.70   STRM       GS      Z14    -37.69   178.54   
46364             East Cape             2999698.40 6375097.20    PNT       GS      Z14    -37.69   178.55   
46366  East Island (Whangaokeno Island) 3002062.00 6374875.10   ISLD       GS      Z14    -37.69   178.57   
2             Five Fingers Point        1999082.20 5475821.00    PNT       IN    A44,A45  -45.74   166.42   
3                Dusky Sound            2000460.40 5472149.10    BAY       IN    A44,A45  -45.77   166.44   
41               South Point            2001259.90 5468066.30    PNT       IN    A44,A45  -45.81   166.44   
42                West Cape             1999318.70 5457689.80    PNT       IN    A44,A45  -45.90   166.41   
1655            Flour Cask Bay          2092184.80 5311720.20    BAY       IN    C50,D50  -47.27   167.48   
1661           Kaninihi Island          2099648.40 5312329.70   ISLD       IN    C50,D50  -47.27   167.57   
1665            Wilsons Point           2101035.40 5312840.50    PNT       IN    C50,D50  -47.27   167.59   
125870    South West Cape/Puhiwaero     2089505.10 5310799.60    PNT       IN    C50,D50  -47.28   167.44   
1660            Kaninihi Point          2099371.10 5311753.40    PNT       IN    C50,D50  -47.28   167.57   
1642            Murphy Island           2093902.80 5310298.70   ISLD       IN    C50,D50  -47.29   167.50   
125869        South Cape/Whiore         2096529.00 5310195.80    PNT       IN    C50,D50  -47.29   167.53   
*************************************************************
2. AND / INRANGE
select * from nzplaces where latitude inrange -47.5,-47.2 and longitude inrange 167.6,167.64

id               name            easting    northing  desc_code district  sheet  latitude longitude 
------ ------------------------ ---------- ---------- --------- -------- ------- -------- --------- 
1666          Broad Head        2103874.80 5313371.90    PNT       IN    C50,D50  -47.26   167.63   
1671         Nelly Island       2102687.20 5316734.50   ISLD       IN    C50,D50  -47.23   167.62   
1674          South Arm         2101183.50 5317337.40    BAY       IN    C50,D50  -47.23   167.60   
1675     Disappointment Cove    2102051.40 5317400.90    BAY       IN    C50,D50  -47.23   167.61   
1676         Fright Cove        2103398.70 5317038.00    BAY       IN    C50,D50  -47.23   167.63   
1683       Sheathknife Bay      2104170.40 5318800.70    BAY       IN    C50,D50  -47.22   167.64   
127791   Proclamation Islets    2101000.00 5319200.00   ISLD       IN     null    -47.21   167.60   
1644         Hebe Island        2103775.40 5318885.80   ISLD       IN    C50,D50  -47.21   167.63   
1646         Dryad Island       2102647.60 5319221.60   ISLD       IN    C50,D50  -47.21   167.62   
1677      Shipbuilders Cove     2101122.70 5319017.90    BAY       IN    C50,D50  -47.21   167.60   
1678         Evening Cove       2102311.70 5319015.70    BAY       IN    C50,D50  -47.21   167.62   
1680   Micrometer Rock and Reef 2102456.30 5319007.70   MRFM       IN    C50,D50  -47.21   167.62   
1682          Kelp Point        2103107.10 5319470.00    PNT       IN    C50,D50  -47.21   167.63   
1568         Evening Cove       2102621.80 5320054.70    BAY       IN    C49,D49  -47.20   167.62   
1569          Islet Cove        2103777.00 5320761.20    BAY       IN    C49,D49  -47.20   167.64   
*************************************************************
3. OR
select * from nzplaces where longitude outrange 166.45,178.53 OR longitude is null 
	order by latitude, longitude, id

id                  name                easting    northing  desc_code district  sheet  latitude longitude 
----- -------------------------------- ---------- ---------- --------- -------- ------- -------- --------- 
273           Lake Chamberlain         2045176.10 5519308.00   null       IN      B43     null     null    
274             Shelter Cove           2046336.90 5521592.10   null       IN      B43     null     null    
275              Snug Cove             2031945.40 5523109.80   null       IN      B43     null     null    
276              First Arm             2034308.10 5524164.70   null       IN      B43     null     null    
46244          Tunanui Stream          2999203.30 6374400.70   STRM       GS      Z14    -37.69   178.54   
46364            East Cape             2999698.40 6375097.20    PNT       GS      Z14    -37.69   178.55   
46366 East Island (Whangaokeno Island) 3002062.00 6374875.10   ISLD       GS      Z14    -37.69   178.57   
2            Five Fingers Point        1999082.20 5475821.00    PNT       IN    A44,A45  -45.74   166.42   
3               Dusky Sound            2000460.40 5472149.10    BAY       IN    A44,A45  -45.77   166.44   
41              South Point            2001259.90 5468066.30    PNT       IN    A44,A45  -45.81   166.44   
42               West Cape             1999318.70 5457689.80    PNT       IN    A44,A45  -45.90   166.41   
*************************************************************
4. OR
select * from nzplaces where desc_code is null OR longitude is null order by name, id

id        name        easting    northing  desc_code district sheet latitude longitude 
--- ---------------- ---------- ---------- --------- -------- ----- -------- --------- 
276    First Arm     2034308.10 5524164.70   null       IN     B43    null     null    
273 Lake Chamberlain 2045176.10 5519308.00   null       IN     B43    null     null    
274   Shelter Cove   2046336.90 5521592.10   null       IN     B43    null     null    
275    Snug Cove     2031945.40 5523109.80   null       IN     B43    null     null    
*************************************************************
5. OR: duplicate OR terms
select * from nzplaces where desc_code like 'UNI*' OR desc_code like 'UNI*' order by name, id

id                  name                easting    northing  desc_code district sheet latitude longitude 
------ ------------------------------- ---------- ---------- --------- -------- ----- -------- --------- 
125885       Lincoln University        2466300.00 5729400.00   UNIV       CH     M36   -43.64   172.45   
31585         Massey University        2732669.30 6087797.90   UNIV       WN     T24   -40.38   175.62   
36674  Massey University Albany Campus 2661733.30 6494920.20   UNIV       AK     R10   -36.73   174.69   
*************************************************************
6. OR: one OR term contains AND terms
select * from nzplaces where desc_code like 'uni*' and district in 'ch,ak' OR desc_code = null 
	order by name, id

id                  name                easting    northing  desc_code district sheet latitude longitude 
------ ------------------------------- ---------- ---------- --------- -------- ----- -------- --------- 
276               First Arm            2034308.10 5524164.70   null       IN     B43    null     null    
273           Lake Chamberlain         2045176.10 5519308.00   null       IN     B43    null     null    
125885       Lincoln University        2466300.00 5729400.00   UNIV       CH     M36   -43.64   172.45   
36674  Massey University Albany Campus 2661733.30 6494920.20   UNIV       AK     R10   -36.73   174.69   
274             Shelter Cove           2046336.90 5521592.10   null       IN     B43    null     null    
275               Snug Cove            2031945.40 5523109.80   null       IN     B43    null     null    
