.TH db.select 1grass "" "GRASS 6.4.2" "Grass User's Manual" .SH NAME \fI\fBdb.select\fR\fR - Selects data from attribute table (performs SQL query statement(s)). .SH KEYWORDS database, attribute table, SQL .SH SYNOPSIS \fBdb.select\fR .br \fBdb.select help\fR .br \fBdb.select\fR [-\fBcdvt\fR] [\fBtable\fR=\fIname\fR] [\fBdatabase\fR=\fIname\fR] [\fBdriver\fR=\fIname\fR] [\fBsql\fR=\fIstring\fR] [\fBinput\fR=\fIname\fR] [\fBfs\fR=\fIcharacter\fR] [\fBvs\fR=\fIcharacter\fR] [\fBnv\fR=\fIstring\fR] [\fBoutput\fR=\fIname\fR] [--\fBverbose\fR] [--\fBquiet\fR] .SS Flags: .IP "\fB-c\fR" 4m .br Do not include column names in output .IP "\fB-d\fR" 4m .br Describe query only (don't run it) .IP "\fB-v\fR" 4m .br Vertical output (instead of horizontal) .IP "\fB-t\fR" 4m .br Only test query, do not execute .IP "\fB--verbose\fR" 4m .br Verbose module output .IP "\fB--quiet\fR" 4m .br Quiet module output .PP .SS Parameters: .IP "\fBtable\fR=\fIname\fR" 4m .br Table name .IP "\fBdatabase\fR=\fIname\fR" 4m .br Database name .br Default: \fI$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/\fR .IP "\fBdriver\fR=\fIname\fR" 4m .br Driver name .br Options: \fIpg,dbf,ogr,odbc,mysql,sqlite\fR .br Default: \fIdbf\fR .IP "\fBsql\fR=\fIstring\fR" 4m .br SQL select statement .br For example: 'select * from rybniky where kapri = 'hodne' .IP "\fBinput\fR=\fIname\fR" 4m .br Name of file with sql statement .IP "\fBfs\fR=\fIcharacter\fR" 4m .br Output field separator .br Default: \fI|\fR .IP "\fBvs\fR=\fIcharacter\fR" 4m .br Output vertical record separator .IP "\fBnv\fR=\fIstring\fR" 4m .br Null value indicator .IP "\fBoutput\fR=\fIname\fR" 4m .br Name for output file (if omitted or "-" output to stdout) .PP .SH DESCRIPTION \fIdb.select\fR prints result of selection from database based on SQL statement read from input file or from standard input to standard output. .SH NOTE If parameters for database connection are already set with db.connect, 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. .SH EXAMPLES \fC .DS .br echo "select * from roads" | db.select .br or .br cat file.sql | db.select .br or .br db.select input=file.sql .br .DE \fR .PP \fISelect all from table roads\fR .br \fC .DS .br db.select -c driver=odbc database=g51test table=roads input=file.sql > result.csv .br .DE \fR .PP \fISelect some string attribute, exclude others:\fR .br \fC .DS .br echo "SELECT * FROM archsites WHERE str1 <> 'No Name'" | db.select .br .DE \fR .PP \fISelect some string attribute with ZERO length:\fR .br \fC .DS .br echo "SELECT * FROM archsites WHERE str1 IS NULL" | db.select .br .DE \fR .PP \fISelect coordinates from PostGIS table:\fR .br \fC .DS .br echo "SELECT x(geo),y(geo) FROM localizzazione" | db.select .br .DE \fR .SH SEE ALSO \fIGRASS SQL interface, db.connect, db.describe, db.drivers, db.droptable, db.execute, db.login, db.tables\fR .SH AUTHOR ? .br Modifications: Radim Blazek, ITC-Irst, Trento, Italy .PP \fILast changed: $Date: 2011-11-08 10:42:51 +0100 (Tue, 08 Nov 2011) $\fR .PP Full index .PP © 2003-2011 GRASS Development Team