1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
<h2>DESCRIPTION</h2>
<em>db.select</em> prints result of selection from database
based on SQL statement read from input file or from standard input
to standard output.
<h2>NOTE</h2>
If parameters for database connection are already set with
<a HREF="db.connect.html">db.connect</a>, they are taken as default values and
do not need to be spcified each time. Output will be displayed to stdout or can
be directed to a file.
<h2>EXAMPLES</h2>
<tt>echo "select * from roads" | db.select</tt>
<br>or<br>
<tt>cat file.sql | db.select</tt>
<br>or<br>
<tt>db.select sql=file.sql</tt>
<p>
<em>Example: Select all from table roads</em><br>
<b>db.select -c driver</b><em>=odbc</em> <b>database=</b><em>g51test</em>
<b>table=</b><em>roads</em> <b>sql=</b><em>file.sql</em> > <em>result.csv</em>
<P>
<em>Example: Select some string attribute, exclude others:</em><br>
<tt>echo "SELECT * FROM archsites WHERE str1 <> 'No Name'" |</tt> <b>db.select</b>
<P>
<em>Example: Select some string attribute with ZERO length:</em><br>
<tt>echo "SELECT * FROM archsites WHERE str1 IS NULL" |</tt> <b>db.select</b>
<P>
<em>Example: Select coordinates from PostGIS table:</em><br>
<tt>echo "SELECT x(geo),y(geo) FROM localizzazione" |</tt> <b>db.select</b>
<h2>SEE ALSO</h2>
<em><a HREF="sql.html">GRASS SQL interface</a>,
<a HREF="db.connect.html">db.connect</a>,
<a HREF="db.describe.html">db.describe</a>,
<a HREF="db.drivers.html">db.drivers</a>,
<a HREF="db.droptable.html">db.droptable</a>,
<a HREF="db.execute.html">db.execute</a>,
<a HREF="db.login.html">db.login</a>,
<a HREF="db.tables.html">db.tables</a></em>
<h2>AUTHOR</h2>
?<br>
Modifications: Radim Blazek, ITC-Irst, Trento, Italy
<p><i>Last changed: $Date: 2005/05/10 08:34:23 $</i>
|