1db.select(1)                  Grass User's Manual                 db.select(1)
2
3
4

NAME

6       db.select  - Selects data from table.
7

KEYWORDS

9       database, SQL
10

SYNOPSIS

12       db.select
13       db.select help
14       db.select   [-cdvt]    [table=name]    [database=name]    [driver=name]
15       [sql=string]      [fs=character]       [vs=character]       [nv=string]
16       [input=name]   [--verbose]  [--quiet]
17
18   Flags:
19       -c
20           Do not include column names in output
21
22       -d
23           Describe query only (don't run it)
24
25       -v
26           Vertical output (instead of horizontal)
27
28       -t
29           Only test query, do not execute
30
31       --verbose
32           Verbose module output
33
34       --quiet
35           Quiet module output
36
37   Parameters:
38       table=name
39           Table name
40
41       database=name
42           Database name
43           Default: $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/
44
45       driver=name
46           Driver name
47           Options: ogr,dbf,odbc,pg,mysql,sqlite,mesql
48           Default: dbf
49
50       sql=string
51           SQL select statement
52           For example: 'select * from rybniky where kapri = 'hodne'
53
54       fs=character
55           Output field separator
56           Default: |
57
58       vs=character
59           Output vertical record separator
60
61       nv=string
62           Null value indicator
63
64       input=name
65           Name of file with sql statement
66

DESCRIPTION

68       db.select  prints result of selection from database based on SQL state‐
69       ment read from input file or from standard input to standard output.
70

NOTE

72       If parameters for database connection are already set with  db.connect,
73       they  are  taken  as default values and do not need to be spcified each
74       time. Output will be displayed to stdout or can be directed to a file.
75

EXAMPLES

77
78       echo "select * from roads" | db.select
79       or
80        cat file.sql | db.select
81       or
82        db.select input=file.sql
83
84
85       Select all from table roads
86
87       db.select -c driver=odbc database=g51test table=roads input=file.sql  >
88       result.csv
89
90
91       Select some string attribute, exclude others:
92
93       echo "SELECT * FROM archsites WHERE str1 <> 'No Name'" | db.select
94
95
96       Select some string attribute with ZERO length:
97
98       echo "SELECT * FROM archsites WHERE str1 IS NULL" | db.select
99
100
101       Select coordinates from PostGIS table:
102
103       echo "SELECT x(geo),y(geo) FROM localizzazione" | db.select
104
105

SEE ALSO

107       GRASS SQL interface, db.connect, db.describe, db.drivers, db.droptable,
108       db.execute, db.login, db.tables
109

AUTHOR

111       ?
112       Modifications: Radim Blazek, ITC-Irst, Trento, Italy
113
114       Last changed: $Date: 2006-09-21 06:31:01 +0200 (Thu, 21 Sep 2006) $
115
116       Full index
117
118       © 2003-2008 GRASS Development Team
119
120
121
122GRASS 6.3.0                                                       db.select(1)
Impressum