man () - Select data from database.

NAME - Select data from database.

SYNOPSIS help [-cdv] [table=string] [database=string] [driver=string] [sql=string] [fs=string] [vs=string] [nv=string] [input=filename]


do not include column names in output
describe query only (don't run it)
vertical output (instead of horizontal)


Table name, select all from this table
database name
driver name Options: dbf,odbc,pg,mysql,ogr
SQL select statement, for example: 'select * from rybniky where kapri = 'hodne'
output field separator Default: |
output vertical record separator
null value indicator
filename with sql statement

DESCRIPTION prints result of selection from database based on SQL statement read from input file or from standard input to standard output.


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.


echo "select * from roads" |

or cat file.sql |

or sql=file.sql

Example: Select all from table roads -c driver=odbc database=g51test table=roads sql=file.sql > result.csv

Example: Select some string attribute, exclude others:

echo "SELECT * FROM archsites WHERE str1 'No Name'" |

Example: Select some string attribute with ZERO length:

echo "SELECT * FROM archsites WHERE str1 IS NULL" |

Example: Select coordinates from PostGIS table:

echo "SELECT x(geo),y(geo) FROM localizzazione" |


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



Modifications: Radim Blazek, ITC-Irst, Trento, Italy

Last changed: $Date: 2005/05/10 08:34:23 $

Help Index