浏览代码

SQL related manual entries: update some SQL examples to NC; fix db.select table calls (trunk, https://trac.osgeo.org/grass/changeset/67206)

git-svn-id: https://svn.osgeo.org/grass/grass/branches/releasebranch_7_0@67207 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Neteler 9 年之前
父节点
当前提交
11f02861c3

+ 23 - 8
lib/db/sqlp/sql.html

@@ -85,16 +85,30 @@ and <i>extensive trapping</i> (brackets are superfluous in this
 example):
 
 <div class="code"><pre>
-d.vect trapping_sites_points fcol=black icon=basic/diamond col=white size=13 \
-    where="valley &lt;&gt; 'LAMAR' OR (valley = 'LAMAR' AND description = 'extensive trapping')"
+g.region vector=schools_wake -p
+d.mon wx0
+d.vect roadsmajor
+
+# all schools
+d.vect schools_wake fcol=black icon=basic/diamond col=white size=13
+
+# numerical selection: show schools with capacity of above 1000 kids:
+d.vect schools_wake fcol=blue icon=basic/diamond col=white size=13 \
+    where="CAPACITYTO &gt; 1000"
+
+# string selection: all schools outside of Raleigh 
+#   along with higher level schools in Raleigh
+d.vect schools_wake fcol=red icon=basic/diamond col=white size=13 \
+    where="ADDRCITY &lt;&gt; 'Raleigh' OR (ADDRCITY = 'Raleigh' AND GLEVEL = 'H')"
 </pre></div>
 
 <p>
-Select all attributes from table where <i>str1</i> column values are not 'No
-Name':
+Select all attributes from table where <i>CORECAPACI</i> column values are
+smaller than 200 (children):
 
 <div class="code"><pre>
-echo "SELECT * FROM archsites WHERE str1 &lt;&gt; 'No Name'" | db.select
+# must be run from the mapset which contains the table
+echo "SELECT * FROM schools_wake WHERE CORECAPACI &lt; 200" | db.select input=-
 </pre></div>
 <p>
 
@@ -102,7 +116,7 @@ echo "SELECT * FROM archsites WHERE str1 &lt;&gt; 'No Name'" | db.select
 Example of subquery expressions from a list (not supported for DBF driver):
 
 <div class="code"><pre>
-v.db.select mysites where="id IN ('P04', 'P05')"
+v.db.select schools_wake where="ADDRCITY IN ('Apex', 'Wendell')"
 </pre></div>
 
 <h3>Example of pattern matching</h3>
@@ -110,9 +124,10 @@ v.db.select mysites where="id IN ('P04', 'P05')"
 <div class="code"><pre>
 # field contains string:
 #  for DBF driver:
-v.extract rivers out=rivers_noce where="DES LIKE 'NOCE'"
+v.extract schools_wake out=elementary_schools where="NAMELONG LIKE 'ELEM'"
 #  for SQLite driver:
-v.extract rivers out=rivers_noce where="DES LIKE '%NOCE%'"
+v.extract schools_wake out=rivers_noce where="DES LIKE '%NOCE%'"
+v.extract schools_wake out=elementary_schools where="NAMELONG LIKE '%ELEM%'"
 
 # match exactly number of characters (here: 2), does not work for DBF driver:
 v.db.select mysites where="id LIKE 'P__'"

+ 3 - 2
scripts/db.in.ogr/db.in.ogr.html

@@ -17,7 +17,7 @@ columns through a descriptive file with same name as the CSV file, but .csvt ext
 <div class="code"><pre>
 # NOTE: create koeppen_gridcode.csvt first for automated type recognition
 db.in.ogr input=koeppen_gridcode.csv output=koeppen_gridcode
-db.select koeppen_gridcode
+db.select table=koeppen_gridcode
 </pre></div>
 
 <h3>Import DBF table</h3>
@@ -43,7 +43,7 @@ table, set the environmental variable PG_LIST_ALL_TABLES to YES before importing
 
 db.in.ogr input="PG:host=localhost dbname=ecad user=neteler" \
           db_table=ecad_verona_tmean output=ecad_verona_tmean
-db.select ecad_verona_tmean
+db.select table=ecad_verona_tmean
 db.describe -c ecad_verona_tmean
 </pre></div>
 
@@ -61,6 +61,7 @@ db.in.ogr input=address.xls db_table=address_data
 <h2>SEE ALSO</h2>
 
 <em>
+<a href="db.select.html">db.select</a>,
 <a href="v.in.ogr.html">v.in.ogr</a>,
 <a href="v.in.db.html">v.in.db</a>
 </em>

+ 3 - 2
scripts/v.db.join/v.db.join.html

@@ -73,8 +73,8 @@ cat|label
 ...
 
 # look at legend
-db.select soils_legend
-db.select soils_legend | head -7
+db.select table=soils_legend
+db.select table=soils_legend | head -7
 id|shortname|longname
 0|no data|no data
 0|AaB|Alice fine sandy loam, 0 to 6
@@ -103,6 +103,7 @@ cat|label|id|shortname|longname
 <em>
 <a href="db.execute.html">db.execute</a>,
 <a href="db.in.ogr.html">db.in.ogr</a>,
+<a href="db.select.html">db.select</a>,
 <a href="v.db.update.html">v.db.update</a><br>
 <a href="sql.html">GRASS SQL interface</a>
 </em>

+ 1 - 1
vector/v.lrs/v.lrs.create/v.lrs.create.html

@@ -133,7 +133,7 @@ be shown:
 
 <div class="code"><pre>
 # show LRS table
-db.select route_lrs
+db.select table=route_lrs
 
 d.vect route_lrs col=blue width=2
 </pre></div>

+ 1 - 1
vector/v.lrs/v.lrs.segment/v.lrs.segment.html

@@ -34,7 +34,7 @@ d.erase
 d.vect route_lrs
 d.vect busstops disp=attr attr=cat size=10 bg=white lcol=blue yref=bottom
 d.vect busstops icon=basic/circle fcol=blue
-db.select route_lrs
+db.select table=route_lrs
 
 # show modified map
 d.vect route_lrs_new col=red