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

NAME

6       db.select  - Select data from database.
7

KEYWORDS

9       database, SQL
10

SYNOPSIS

12       db.select
13       db.select help
14       db.select  [-cdv]  [table=string]   [database=string]   [driver=string]
15       [sql=string]   [fs=string]   [vs=string]    [nv=string]    [input=file‐
16       name]
17
18   Flags:
19       -c  do not include column names in output
20
21       -d  describe query only (don't run it)
22
23       -v  vertical output (instead of horizontal)
24
25   Parameters:
26       table=string
27           Table name, select all from this table
28
29       database=string
30           database name
31
32       driver=string
33           driver name Options: dbf,mysql,ogr,pg,sqlite,mesql,odbc
34
35       sql=string
36           SQL  select  statement,  for  example: 'select * from rybniky where
37           kapri = 'hodne'
38
39       fs=string
40           output field separator Default: |
41
42       vs=string
43           output vertical record separator
44
45       nv=string
46           null value indicator
47
48       input=filename
49           filename with sql statement
50

DESCRIPTION

52       db.select prints result of selection from database based on SQL  state‐
53       ment read from input file or from standard input to standard output.
54

NOTE

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

EXAMPLES

61
62       echo "select * from roads" | db.select
63       or
64        cat file.sql | db.select
65       or
66        db.select input=file.sql
67
68
69       Select all from table roads
70
71       db.select  -c driver=odbc database=g51test table=roads input=file.sql >
72       result.csv
73
74
75       Select some string attribute, exclude others:
76
77       echo "SELECT * FROM archsites WHERE str1 <> 'No Name'" | db.select
78
79
80       Select some string attribute with ZERO length:
81
82       echo "SELECT * FROM archsites WHERE str1 IS NULL" | db.select
83
84
85       Select coordinates from PostGIS table:
86
87       echo "SELECT x(geo),y(geo) FROM localizzazione" | db.select
88
89

SEE ALSO

91       GRASS SQL interface, db.connect, db.describe, db.drivers, db.droptable,
92       db.execute, db.login, db.tables
93

AUTHOR

95       ?
96       Modifications: Radim Blazek, ITC-Irst, Trento, Italy
97
98       Last changed: $Date: 2006/09/21 06:14:49 $
99
100       Full index
101
102
103
104GRASS 6.2.2                                                       db.select(1)
Impressum