'nzplaces' has these fields:
 1. id
 2. name
 3. easting
 4. northing
 5. desc_code
 6. district
 7. sheet
 8. latitude
 9. longitude
Indexed fields:
  desc_code  (standard,  alpha order,  3 levels)
  id  (standard,  alpha order,  3 levels)
  latitude  (standard,  num order,  3 levels)
  longitude  (standard,  num order,  3 levels)
  name  (standard,  alpha order,  3 levels)
*************************************************************
1.
select id, name from nzplaces where id = 1000 

id      name    
---- ---------- 
1000 Lake Hilda 
*************************************************************
2. field name aliases
select id (as snum), name (as placename) from nzplaces where id = 8252 

snum  placename   
---- ------------ 
8252 Halfway Rock 
*************************************************************
2a. field name aliases using =
select id = snum, name = placename from nzplaces where id = 8252 

snum  placename   
---- ------------ 
8252 Halfway Rock 
*************************************************************
3. 
select id, name from nzplaces where id = 3 

id    name     
-- ----------- 
3  Dusky Sound 
*************************************************************
4. first entry in id.1 index
select id, name from nzplaces where id = 10 

id     name      
-- ------------- 
10 Pigeon Island 
*************************************************************
4a. before first entry in id.1 index - no rows returned
select id, name from nzplaces where id = 0 

id name 
-- ---- 
*************************************************************
5. last entry in id.1 index
select id, name from nzplaces where id = 9999 

id      name     
---- ----------- 
9999 Totara Peak 
*************************************************************
5a. beyond last entry in id.1 index - no rows returned
select id, name from nzplaces where id = 99999 

id name 
-- ---- 
*************************************************************
6. like w/ wildcard
select name from nzplaces where name like 'had*' order by name

name          
------------- 
Haddington    
Haddon        
Hadlea        
Hadleigh      
Hadleigh      
Hadleigh      
Hadlow        
Hadlow        
Hadlow Corner 
Hadlow Downs  
Hadlow Grange 
*************************************************************
7. like w/ entire entry
select name from nzplaces where name like 'halfway rock' order by name

name         
------------ 
Halfway Rock 
*************************************************************
8. like w/ long entry
select name from nzplaces where name like 'Pyke Big Bay Route' order by name

name               
------------------ 
Pyke Big Bay Route 
Pyke Big Bay Route 
Pyke Big Bay Route 
Pyke Big Bay Route 
*************************************************************
10. first entry in name.1 index
select id, name from nzplaces where name like '"opua*' order by name, id

id               name             
----- --------------------------- 
29824 "Opua" shipwreck Oct. 1926. 
*************************************************************
11. last entry in name.1 index
select id, name from nzplaces where name like 'zurbrig*' order by name, id

id         name       
---- ---------------- 
9527 Zurbriggen Ridge 
*************************************************************
12. = null
select * from nzplaces where 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    
274   Shelter Cove   2046336.90 5521592.10   null       IN     B43    null     null    
275    Snug Cove     2031945.40 5523109.80   null       IN     B43    null     null    
*************************************************************
13. like null
select * from nzplaces where desc_code like 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    
*************************************************************
14. is null
select * from nzplaces where name like 'shelter*' and desc_code is null order by name, id

id      name      easting    northing  desc_code district sheet latitude longitude 
--- ------------ ---------- ---------- --------- -------- ----- -------- --------- 
274 Shelter Cove 2046336.90 5521592.10   null       IN     B43    null     null    
*************************************************************
15. isnot null
select * from nzplaces where name like 'shelter*' and desc_code isnot null order by name, id

id           name         easting    northing  desc_code district  sheet  latitude longitude 
----- ------------------ ---------- ---------- --------- -------- ------- -------- --------- 
20       Shelter Cove    2008325.80 5470601.50    BAY       IN    A44,A45  -45.79   166.54   
9777    Shelter Hollow   2259809.90 5708909.60   GORG       HK      H37    -43.78   169.89   
219    Shelter Islands   2030509.80 5531088.00   ISLD       IN      B42    -45.26   166.88   
1485    Shelter Point    2077354.50 5466284.10    PNT       IN      C45    -45.88   167.42   
1853    Shelter Point    2099789.50 5553357.40    PNT       IN      D42    -45.11   167.78   
4794    Shelter Point    2146927.20 5335074.20    PNT       IN      E49    -47.09   168.22   
5382    Shelter Ravine   2192679.90 5670389.20   GORG       HK      F38    -44.10   169.03   
49880 Shelter Rock Basin 2451105.00 5980536.00    BSN       NN      M27    -41.38   172.29   
3792   Shelter Rock Hut  2153354.90 5617855.40    HUT       DN      E40    -44.56   168.50   
20537  Shelterdale Farm  2416379.80 5739239.10   HSTD       CH      L36    -43.55   171.84   
35277   Sheltered Bay    2643967.90 6627250.60    BAY       AK    Q06,R06  -35.54   174.46   
*************************************************************
16. compound
select * from nzplaces where name like 'shelter*' and desc_code != 'PNT' order by name, id

id           name         easting    northing  desc_code district  sheet  latitude longitude 
----- ------------------ ---------- ---------- --------- -------- ------- -------- --------- 
20       Shelter Cove    2008325.80 5470601.50    BAY       IN    A44,A45  -45.79   166.54   
274      Shelter Cove    2046336.90 5521592.10   null       IN      B43     null     null    
9777    Shelter Hollow   2259809.90 5708909.60   GORG       HK      H37    -43.78   169.89   
219    Shelter Islands   2030509.80 5531088.00   ISLD       IN      B42    -45.26   166.88   
5382    Shelter Ravine   2192679.90 5670389.20   GORG       HK      F38    -44.10   169.03   
49880 Shelter Rock Basin 2451105.00 5980536.00    BSN       NN      M27    -41.38   172.29   
3792   Shelter Rock Hut  2153354.90 5617855.40    HUT       DN      E40    -44.56   168.50   
20537  Shelterdale Farm  2416379.80 5739239.10   HSTD       CH      L36    -43.55   171.84   
35277   Sheltered Bay    2643967.90 6627250.60    BAY       AK    Q06,R06  -35.54   174.46   
*************************************************************
17. !like
select * from nzplaces where name like 'shelter*' and name !like '*point' order by name, id

id           name         easting    northing  desc_code district  sheet  latitude longitude 
----- ------------------ ---------- ---------- --------- -------- ------- -------- --------- 
20       Shelter Cove    2008325.80 5470601.50    BAY       IN    A44,A45  -45.79   166.54   
274      Shelter Cove    2046336.90 5521592.10   null       IN      B43     null     null    
9777    Shelter Hollow   2259809.90 5708909.60   GORG       HK      H37    -43.78   169.89   
219    Shelter Islands   2030509.80 5531088.00   ISLD       IN      B42    -45.26   166.88   
5382    Shelter Ravine   2192679.90 5670389.20   GORG       HK      F38    -44.10   169.03   
49880 Shelter Rock Basin 2451105.00 5980536.00    BSN       NN      M27    -41.38   172.29   
3792   Shelter Rock Hut  2153354.90 5617855.40    HUT       DN      E40    -44.56   168.50   
20537  Shelterdale Farm  2416379.80 5739239.10   HSTD       CH      L36    -43.55   171.84   
35277   Sheltered Bay    2643967.90 6627250.60    BAY       AK    Q06,R06  -35.54   174.46   
*************************************************************
18. !like
select * from nzplaces where name like 'shelter*' and name !like '*point' order by name, id

id           name         easting    northing  desc_code district  sheet  latitude longitude 
----- ------------------ ---------- ---------- --------- -------- ------- -------- --------- 
20       Shelter Cove    2008325.80 5470601.50    BAY       IN    A44,A45  -45.79   166.54   
274      Shelter Cove    2046336.90 5521592.10   null       IN      B43     null     null    
9777    Shelter Hollow   2259809.90 5708909.60   GORG       HK      H37    -43.78   169.89   
219    Shelter Islands   2030509.80 5531088.00   ISLD       IN      B42    -45.26   166.88   
5382    Shelter Ravine   2192679.90 5670389.20   GORG       HK      F38    -44.10   169.03   
49880 Shelter Rock Basin 2451105.00 5980536.00    BSN       NN      M27    -41.38   172.29   
3792   Shelter Rock Hut  2153354.90 5617855.40    HUT       DN      E40    -44.56   168.50   
20537  Shelterdale Farm  2416379.80 5739239.10   HSTD       CH      L36    -43.55   171.84   
35277   Sheltered Bay    2643967.90 6627250.60    BAY       AK    Q06,R06  -35.54   174.46   
*************************************************************
19. !like null
select * from nzplaces where name like 'shelter*' and desc_code !like null order by name, id

id           name         easting    northing  desc_code district  sheet  latitude longitude 
----- ------------------ ---------- ---------- --------- -------- ------- -------- --------- 
20       Shelter Cove    2008325.80 5470601.50    BAY       IN    A44,A45  -45.79   166.54   
9777    Shelter Hollow   2259809.90 5708909.60   GORG       HK      H37    -43.78   169.89   
219    Shelter Islands   2030509.80 5531088.00   ISLD       IN      B42    -45.26   166.88   
1485    Shelter Point    2077354.50 5466284.10    PNT       IN      C45    -45.88   167.42   
1853    Shelter Point    2099789.50 5553357.40    PNT       IN      D42    -45.11   167.78   
4794    Shelter Point    2146927.20 5335074.20    PNT       IN      E49    -47.09   168.22   
5382    Shelter Ravine   2192679.90 5670389.20   GORG       HK      F38    -44.10   169.03   
49880 Shelter Rock Basin 2451105.00 5980536.00    BSN       NN      M27    -41.38   172.29   
3792   Shelter Rock Hut  2153354.90 5617855.40    HUT       DN      E40    -44.56   168.50   
20537  Shelterdale Farm  2416379.80 5739239.10   HSTD       CH      L36    -43.55   171.84   
35277   Sheltered Bay    2643967.90 6627250.60    BAY       AK    Q06,R06  -35.54   174.46   
*************************************************************
20. in
select * from nzplaces where desc_code in 'UNIV,WELL' 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   
45988         Minerva Oil Bore         2931329.20 6304022.60   WELL       GS     Y17   -38.36   177.82   
23444         Saint Ronans Well        2500727.20 5918289.20   WELL       NN     N30   -41.94   172.88   
45987      South Pacific Oil Bore      2939045.50 6302850.60   WELL       GS     Y17   -38.37   177.91   
45985         Waitangi Oil Bore        2937986.00 6306817.60   WELL       GS     Y17   -38.33   177.89   
*************************************************************
20a. in, w/ constant list having embedded spaces
select * from nzplaces where name in 'Pigeon Creek,Lost Valley Creek' order by name, id

id          name         easting    northing  desc_code district  sheet  latitude longitude 
----- ----------------- ---------- ---------- --------- -------- ------- -------- --------- 
49970 Lost Valley Creek 2457862.40 5977607.20   STRM       NN      M28    -41.40   172.37   
16272   Pigeon Creek    2333397.80 5533557.80   STRM       DN    J42,J43  -45.38   170.74   
16617   Pigeon Creek    2389995.00 5919428.60   STRM       NN      K30    -41.92   171.55   
16996   Pigeon Creek    2377487.90 5843652.50   STRM       HK      K32    -42.60   171.38   
19271   Pigeon Creek    2445637.50 5918724.60   STRM       NN      L30    -41.93   172.22   
21198   Pigeon Creek    2470411.00 5915816.80   STRM       NN      M30    -41.96   172.52   
48966   Pigeon Creek    2444660.40 5984891.10   STRM       NN      L27    -41.34   172.21   
50679   Pigeon Creek    2512761.30 5979384.10   STRM       NN      N28    -41.39   173.03   
7853    Pigeon Creek    2217209.70 5577430.30   STRM       DN      G41    -44.95   169.28   
*************************************************************
21. in null
select * from nzplaces where desc_code in 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    
*************************************************************
22. in UNIV,null
select * from nzplaces where desc_code in 'UNIV,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   
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   
274             Shelter Cove           2046336.90 5521592.10   null       IN     B43    null     null    
275               Snug Cove            2031945.40 5523109.80   null       IN     B43    null     null    
*************************************************************
23. !in
select * from nzplaces where name like 'shelter*' and desc_code !in 'PNT,BAY' order by name, id

id           name         easting    northing  desc_code district sheet latitude longitude 
----- ------------------ ---------- ---------- --------- -------- ----- -------- --------- 
274      Shelter Cove    2046336.90 5521592.10   null       IN     B43    null     null    
9777    Shelter Hollow   2259809.90 5708909.60   GORG       HK     H37   -43.78   169.89   
219    Shelter Islands   2030509.80 5531088.00   ISLD       IN     B42   -45.26   166.88   
5382    Shelter Ravine   2192679.90 5670389.20   GORG       HK     F38   -44.10   169.03   
49880 Shelter Rock Basin 2451105.00 5980536.00    BSN       NN     M27   -41.38   172.29   
3792   Shelter Rock Hut  2153354.90 5617855.40    HUT       DN     E40   -44.56   168.50   
20537  Shelterdale Farm  2416379.80 5739239.10   HSTD       CH     L36   -43.55   171.84   
*************************************************************
24. inlike
select * from nzplaces where name inlike 'gru*,bub*' order by name, id

id        name       easting    northing  desc_code district sheet latitude longitude 
----- ------------- ---------- ---------- --------- -------- ----- -------- --------- 
9187  Bubble Creek  2261874.80 5711460.20   STRM       HK     H36   -43.76   169.91   
49323 Grueby Creek  2478538.60 6043144.10   STRM       NN     M25   -40.81   172.62   
56009   Gruinard    2836696.70 6149399.80   HSTD       NA     V22   -39.79   176.81   
36999 Grundy Stream 2652049.00 6467493.50   STRM       AK     R11   -36.98   174.59   
*************************************************************
25. inlike UN*,null
select * from nzplaces where desc_code inlike 'UN*,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   
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   
274             Shelter Cove           2046336.90 5521592.10   null       IN     B43    null     null    
275               Snug Cove            2031945.40 5523109.80   null       IN     B43    null     null    
*************************************************************
26. !inlike
select * from nzplaces where name like 'shelter*' and name !inlike '*point,*cove'  order by name, id

id           name         easting    northing  desc_code district  sheet  latitude longitude 
----- ------------------ ---------- ---------- --------- -------- ------- -------- --------- 
9777    Shelter Hollow   2259809.90 5708909.60   GORG       HK      H37    -43.78   169.89   
219    Shelter Islands   2030509.80 5531088.00   ISLD       IN      B42    -45.26   166.88   
5382    Shelter Ravine   2192679.90 5670389.20   GORG       HK      F38    -44.10   169.03   
49880 Shelter Rock Basin 2451105.00 5980536.00    BSN       NN      M27    -41.38   172.29   
3792   Shelter Rock Hut  2153354.90 5617855.40    HUT       DN      E40    -44.56   168.50   
20537  Shelterdale Farm  2416379.80 5739239.10   HSTD       CH      L36    -43.55   171.84   
35277   Sheltered Bay    2643967.90 6627250.60    BAY       AK    Q06,R06  -35.54   174.46   
*************************************************************
27. !inlike UN*,null
select * from nzplaces where name like 'shelter*' and desc_code !inlike 'UN*,null'  order by name, id

id           name         easting    northing  desc_code district  sheet  latitude longitude 
----- ------------------ ---------- ---------- --------- -------- ------- -------- --------- 
20       Shelter Cove    2008325.80 5470601.50    BAY       IN    A44,A45  -45.79   166.54   
9777    Shelter Hollow   2259809.90 5708909.60   GORG       HK      H37    -43.78   169.89   
219    Shelter Islands   2030509.80 5531088.00   ISLD       IN      B42    -45.26   166.88   
1485    Shelter Point    2077354.50 5466284.10    PNT       IN      C45    -45.88   167.42   
1853    Shelter Point    2099789.50 5553357.40    PNT       IN      D42    -45.11   167.78   
4794    Shelter Point    2146927.20 5335074.20    PNT       IN      E49    -47.09   168.22   
5382    Shelter Ravine   2192679.90 5670389.20   GORG       HK      F38    -44.10   169.03   
49880 Shelter Rock Basin 2451105.00 5980536.00    BSN       NN      M27    -41.38   172.29   
3792   Shelter Rock Hut  2153354.90 5617855.40    HUT       DN      E40    -44.56   168.50   
20537  Shelterdale Farm  2416379.80 5739239.10   HSTD       CH      L36    -43.55   171.84   
35277   Sheltered Bay    2643967.90 6627250.60    BAY       AK    Q06,R06  -35.54   174.46   
*************************************************************
30. inrange
select * from nzplaces where latitude inrange -44.34,-44.32 and longitude inrange 170.2,170.4 order by name, id

id           name          easting    northing  desc_code district sheet latitude longitude 
----- ------------------- ---------- ---------- --------- -------- ----- -------- --------- 
12118     Grays Hills     2301013.70 5650268.20   HSTD       CH     I38   -44.32   170.37   
10000 Haldon Boat Harbour 2288232.60 5647372.10   MPLA       CH     H39   -44.34   170.21   
12231     Little Pass     2298530.50 5649526.30   RDRF       CH     I39   -44.33   170.34   
9959     Tekapo River     2287319.40 5649040.20   STRM       CH     H39   -44.33   170.20   
*************************************************************
31. outrange
select * from nzplaces where latitude outrange -47.26,-34.15  order by name, id

id               name             easting    northing  desc_code district  sheet  latitude longitude 
------ ------------------------- ---------- ---------- --------- -------- ------- -------- --------- 
58061      Cape Morton Jones     2434243.49 6785614.19    PNT       AK     null    -34.13   172.16   
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   
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   
60334      North East Island     2432995.77 6785389.48   ISLD       AK     null    -34.13   172.15   
127070      North West Bay       2431300.00 6783750.00    BAY       AK     null    -34.14   172.13   
125869     South Cape/Whiore     2096529.00 5310195.80    PNT       IN    C50,D50  -47.29   167.53   
125870 South West Cape/Puhiwaero 2089505.10 5310799.60    PNT       IN    C50,D50  -47.28   167.44   
1665         Wilsons Point       2101035.40 5312840.50    PNT       IN    C50,D50  -47.27   167.59   
*************************************************************
32. < 
select * from nzplaces where latitude < -47.26  order by name, id

id               name             easting    northing  desc_code district  sheet  latitude longitude 
------ ------------------------- ---------- ---------- --------- -------- ------- -------- --------- 
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   
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   
125870 South West Cape/Puhiwaero 2089505.10 5310799.60    PNT       IN    C50,D50  -47.28   167.44   
1665         Wilsons Point       2101035.40 5312840.50    PNT       IN    C50,D50  -47.27   167.59   
*************************************************************
33. > 
select * from nzplaces where latitude > -34.15  order by name, id

id           name         easting    northing  desc_code district sheet latitude longitude 
------ ----------------- ---------- ---------- --------- -------- ----- -------- --------- 
58061  Cape Morton Jones 2434243.49 6785614.19    PNT       AK    null   -34.13   172.16   
60334  North East Island 2432995.77 6785389.48   ISLD       AK    null   -34.13   172.15   
127070  North West Bay   2431300.00 6783750.00    BAY       AK    null   -34.14   172.13   
*************************************************************
34. null, numeric field
select * from nzplaces where latitude = 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    
*************************************************************
35. null, numeric field
select * from nzplaces where name like 'shelter*' and latitude is null order by name, id

id      name      easting    northing  desc_code district sheet latitude longitude 
--- ------------ ---------- ---------- --------- -------- ----- -------- --------- 
274 Shelter Cove 2046336.90 5521592.10   null       IN     B43    null     null    
*************************************************************
36. isnot null, numeric field
select * from nzplaces where name like 'shelter*' and latitude isnot null order by name, id

id           name         easting    northing  desc_code district  sheet  latitude longitude 
----- ------------------ ---------- ---------- --------- -------- ------- -------- --------- 
20       Shelter Cove    2008325.80 5470601.50    BAY       IN    A44,A45  -45.79   166.54   
9777    Shelter Hollow   2259809.90 5708909.60   GORG       HK      H37    -43.78   169.89   
219    Shelter Islands   2030509.80 5531088.00   ISLD       IN      B42    -45.26   166.88   
1485    Shelter Point    2077354.50 5466284.10    PNT       IN      C45    -45.88   167.42   
1853    Shelter Point    2099789.50 5553357.40    PNT       IN      D42    -45.11   167.78   
4794    Shelter Point    2146927.20 5335074.20    PNT       IN      E49    -47.09   168.22   
5382    Shelter Ravine   2192679.90 5670389.20   GORG       HK      F38    -44.10   169.03   
49880 Shelter Rock Basin 2451105.00 5980536.00    BSN       NN      M27    -41.38   172.29   
3792   Shelter Rock Hut  2153354.90 5617855.40    HUT       DN      E40    -44.56   168.50   
20537  Shelterdale Farm  2416379.80 5739239.10   HSTD       CH      L36    -43.55   171.84   
35277   Sheltered Bay    2643967.90 6627250.60    BAY       AK    Q06,R06  -35.54   174.46   
*************************************************************
40. no rows found
select * from nzplaces where name like 'hhh*'  order by name, id

id name easting northing desc_code district sheet latitude longitude 
-- ---- ------- -------- --------- -------- ----- -------- --------- 
*************************************************************
41. no rows found
select * from nzplaces where name like 'hhh*' order by desc_code, name, id

id name easting northing desc_code district sheet latitude longitude 
-- ---- ------- -------- --------- -------- ----- -------- --------- 
*************************************************************
42. no rows found
select * from nzplaces where name like 'hhh*' order by name, id limit 30, 50 

id name easting northing desc_code district sheet latitude longitude 
-- ---- ------- -------- --------- -------- ----- -------- --------- 
*************************************************************
43. no rows found
select desc_code, count(*) from nzplaces group by desc_code where name like 'hhh*'

desc_code __rowcount 
--------- ---------- 
*************************************************************
50. select distinct
select distinct name from nzplaces where name like 'had*' order by name, id

name          
------------- 
Haddington    
Haddon        
Hadlea        
Hadleigh      
Hadlow        
Hadlow Corner 
Hadlow Downs  
Hadlow Grange 
*************************************************************
51. select distinct
select distinct name from nzplaces where name like 'halfway rock' order by name, id

name         
------------ 
Halfway Rock 
*************************************************************
52. limit
select * from nzplaces where name inlike 'jone*,joan*,john*' order by name, id limit 10

id           name          easting    northing  desc_code district  sheet  latitude longitude 
----- ------------------- ---------- ---------- --------- -------- ------- -------- --------- 
19388     Joan Creek      2423534.40 5891714.20   STRM       NN      L30    -42.17   171.95   
9786   John Browns Grave  2277847.40 5704412.70    CEM       CH      H37    -43.83   170.11   
24028  John Browns Tomb   2527448.10 5806960.00    CEM       CH      N33    -42.94   173.21   
7855    John Bull Creek   2215425.70 5572294.40   STRM       DN      G41    -44.99   169.26   
27203   John Coull Hut    2675029.00 6217320.00    HUT       NP      R20    -39.23   174.91   
2950      John Creek      2160490.10 5669263.10   STRM       HK    E37,E38  -44.10   168.63   
36530     John Creek      2658649.00 6506013.30   STRM       AK      R10    -36.63   174.65   
5017      John Gully      2201037.50 5680224.00   GORG       HK      F37    -44.02   169.14   
3193  John Inglis Glacier 2145300.80 5631455.60   GLCR       DN      E39    -44.43   168.41   
3577  John Inglis Valley  2144730.10 5630395.10   GORG       DN      E39    -44.44   168.40   
*************************************************************
53. order by alpha, limit 10
select district, name from nzplaces where name inlike 'jone*,joan*,john*' order by district, name limit 10

district       name        
-------- ----------------- 
AK          John Creek     
AK          John Stream    
AK           Jones Bay     
AK          Jones Point    
AK         Jones Stream    
BM         Johnson Creek   
BM         Johnston Peak   
CH       John Browns Grave 
CH       John Browns Tomb  
CH       John Lloyds Grave 
*************************************************************
54. order by alpha, descending
select district, name from nzplaces where name inlike 'jone*,joan*,john*' order by district descending, name limit 10

district         name         
-------- -------------------- 
WN           Johnsonville     
WN          Johnston Creek    
WN          Johnstons Hill    
WN           Jones Island     
WN            Jones Pool      
NP          John Coull Hut    
NN            Joan Creek      
NN          John Reid Hut     
NN          John Tait Hut     
NN       Johnnie Walker Creek 
*************************************************************
55. order by numeric
select name, longitude from nzplaces where name inlike 'jone*,joan*,john*' order by longitude num, name limit 10

name                longitude 
------------------- --------- 
John Islands         166.80   
John o'Groats River  167.84   
John o'Groats River  167.89   
John Point           168.15   
John Inglis Valley   168.40   
John Inglis Glacier  168.41   
Jones Saddle         168.61   
Jones Creek          168.62   
Jones Flat           168.62   
John Creek           168.63   
*************************************************************
56. order by numeric, descending
select name, longitude from nzplaces where name inlike 'jone*,joan*,john*' order by longitude num descending, name limit 10

name            longitude 
--------------- --------- 
Jones Pool       175.79   
Jones Island     175.77   
Johnston Stream  175.60   
Johnston Creek   175.43   
John Coull Hut   174.91   
Jones Bay        174.82   
Johnsonville     174.79   
Johnstons Hill   174.73   
John Creek       174.65   
Jones Stream     174.52   
*************************************************************
57. limit range
select name, longitude from nzplaces where name inlike 'jone*,joan*,john*' order by longitude num descending, name limit 20, 35

name                 longitude 
-------------------- --------- 
Johnston Creek        172.46   
Johnston Creek        172.45   
Johnson Creek         172.41   
Johnson Creek         172.29   
Johnson Hut           172.27   
JOHNSON RIDGE         172.25   
Johnson River         172.24   
Johnson Track         172.24   
Jones Creek           172.17   
Jones Gully           172.15   
Jones Creek           172.10   
Johnny Cake Creek     172.05   
Joan Creek            171.95   
Johnnie Walker Creek  171.90   
Jones Creek           171.82   
Jones Creek           171.78   
*************************************************************
60. select count(*)
select count(*) from nzplaces where name like 'pige*'

__rowcount 
---------- 
27         
*************************************************************
62. group by
select desc_code, count(*) from nzplaces group by desc_code where name like 'pige*' 

desc_code __rowcount 
--------- ---------- 
BAY           2      
FRST          1      
HILL          5      
HSTD          1      
ISLD          2      
LOC           3      
PASS          1      
PNT           1      
ROCK          2      
STRM          9      
*************************************************************
63. aggregate functions
select desc_code, 
	'count=', count(*), 
	'sum=', sum( latitude ), 
	'min=', min( latitude ), 
	'max=', max( latitude ), 
	'avg=', avg( latitude ) 
	from nzplaces group by desc_code where name like 'pige*' 

desc_code _QS01  __rowcount _QS02 latitude__sum _QS03 latitude__min _QS04 latitude__max _QS05 latitude__avg 
--------- ------ ---------- ----- ------------- ----- ------------- ----- ------------- ----- ------------- 
BAY       count=     2      sum=     -84.63     min=     -43.65     max=     -40.98     avg=     -42.315    
FRST      count=     1      sum=     -43.08     min=     -43.08     max=     -43.08     avg=     -43.08     
HILL      count=     5      sum=     -211.43    min=      -45.8     max=     -36.89     avg=     -42.286    
HSTD      count=     1      sum=     -41.15     min=     -41.15     max=     -41.15     avg=     -41.15     
ISLD      count=     2      sum=     -90.62     min=      -45.7     max=     -44.92     avg=     -45.31     
LOC       count=     3      sum=     -130.62    min=     -45.79     max=     -41.15     avg=     -43.54     
PASS      count=     1      sum=     -40.83     min=     -40.83     max=     -40.83     avg=     -40.83     
PNT       count=     1      sum=     -43.62     min=     -43.62     max=     -43.62     avg=     -43.62     
ROCK      count=     2      sum=     -92.44     min=     -47.22     max=     -45.22     avg=     -46.22     
STRM      count=     9      sum=     -385.17    min=     -45.38     max=     -41.34     avg=    -42.7967    
*************************************************************
70. select into tmp table
select * into $tmp1 from nzplaces where latitude inrange -44.34,-44.32 
	and longitude inrange 170.2,170.4 order by name, id

id name easting northing desc_code district sheet latitude longitude 
-- ---- ------- -------- --------- -------- ----- -------- --------- 
*************************************************************
71. retrieve from the tmp table
select * from $tmp1 where name like 'tek*'

id       name      easting    northing  desc_code district sheet latitude longitude 
---- ------------ ---------- ---------- --------- -------- ----- -------- --------- 
9959 Tekapo River 2287319.40 5649040.20   STRM       CH     H39   -44.33   170.20   
*************************************************************
72. select into ordinary file
select * into /tmp/shsql_tmp1 from nzplaces where latitude inrange -44.34,-44.32 
	and longitude inrange 170.2,170.4 order by name, id

id name easting northing desc_code district sheet latitude longitude 
-- ---- ------- -------- --------- -------- ----- -------- --------- 
*************************************************************
73. select from ordinary file
select * from /tmp/shsql_tmp1 order by latitude num descending , name, id

id           name          easting    northing  desc_code district sheet latitude longitude 
----- ------------------- ---------- ---------- --------- -------- ----- -------- --------- 
12118     Grays Hills     2301013.70 5650268.20   HSTD       CH     I38   -44.32   170.37   
12231     Little Pass     2298530.50 5649526.30   RDRF       CH     I39   -44.33   170.34   
9959     Tekapo River     2287319.40 5649040.20   STRM       CH     H39   -44.33   170.20   
10000 Haldon Boat Harbour 2288232.60 5647372.10   MPLA       CH     H39   -44.34   170.21   
