dbf | DBF files. Data are stored in DBF files. | http://shapelib.maptools.org/dbf_api.html |
sqlite | SQLite embedded database. | http://sqlite.org/ |
pg | PostgreSQL RDBMS. | http://postgresql.org/ |
mysql | MySQL RDBMS. | http://mysql.org/ |
mesql | MySQL embedded database. | http://mysql.org/ |
odbc | UnixODBC. (PostgreSQL, Oracle, etc.) | http://www.unixodbc.org/ |
d.vect map where="individual='juvenile' and area='beach'"
d.vect trapping_sites_points fcol=black icon=basic/diamond col=white size=13 \ where="valley <> 'LAMAR' OR (valley = 'LAMAR' AND description = 'extensive trapping')"
Select all attributes from table where str1 column values are not 'No Name':
echo "SELECT * FROM archsites WHERE str1 <> 'No Name'" | db.select
Example of subquery expressions from a list (does not work for DBF driver):
v.db.select mysites where="id IN ('P04', 'P05')"
Example of pattern matching:
# match exactly number of characters (here: 2), does not work for DBF driver: v.db.select mysites where="id LIKE 'P__'" #define wildcard: v.db.select mysites where="id LIKE 'P%'"
Example of null handling:
v.db.addcol map=roads col="nulltest int" v.db.update map=roads col=nulltest value=1 where="cat > 2" d.vect roads where="nulltest is null" v.db.update map=roads col=nulltest value=2 where="cat <= 2"
Examples of complex expressions in updates (using v.db.* modules):
v.db.addcol map=roads col="exprtest double precision" v.db.update map=roads col=exprtest value=cat/nulltest v.db.update map=roads col=exprtest value=cat/nulltest+cat where=cat=1
Examples of complex expressions in updates (using db.* modules):
echo "UPDATE roads SET exprtest=null" echo "UPDATE roads SET exprtest=cat/2" | db.execute echo "UPDATE roads SET exprtest=cat/2+cat/3" | db.execute echo "UPDATE roads SET exprtest=NULL WHERE cat>2" | db.execute echo "UPDATE roads SET exprtest=cat/3*(cat+1) WHERE exprtest IS NULL" | db.execute"
Instead of creating and updating new columns with an expression, you can use the expression directly in a command:
d.vect roads where="(cat/3*(cat+1))>8" d.vect roads where="cat>exprtest"
Last changed: $Date: 2008-02-23 19:23:32 -0800 (Sat, 23 Feb 2008) $
© 2008 GRASS Development Team