GRASS logo

DBF driver in GRASS

Creating a DBF table

Usually DBF tables are created by GRASS when generating a vector map with attribute (and using DBF as default attribute driver).

If a DBF table has to be created manually, db.execute can be used or a spreadsheet application. Also db.copy is sometimes useful.

Supported SQL commands by DBF driver

  ALTER TABLE table ADD [COLUMN] columndef
  CREATE TABLE table ( columndefs )
  DROP TABLE table
  SELECT columns FROM table
  SELECT columns FROM table WHERE condition
  DELETE FROM table WHERE condition
  INSERT INTO table VALUES (value1[,value2,...])
  INSERT INTO table ( column1[,column2,...] ) VALUES (value1[,value2,...])
  UPDATE table SET assignment1[,assignment2,...]
  UPDATE table SET assignment1[,assignment2,...] WHERE condition

Operators available in conditions

  "="  : equal
  "<"  : smaller than
  "<=" : smaller/equal than
  ">"  : larger than
  ">=" : larger/equal than
  "<>" : not equal
  "~"  : Substring matching

Arithmetic expressions using constants and field values are allowed in condition clauses and in the RHS of assignments. Usual precedence rules and bracketing (using '(' and ')') are supported. Type conversion is performed if necessary (experimental).

Aggregate functions (sum, count, min, max,...) are NOT currently supported in SELECT clauses.

Mathematic functions (sin, cos, exp, log,...) are NOT currently supported in expressions.

Conditions allow boolean expressions using the AND, OR and NOT operators, with the usual precedence rules.

NULLs can be tested by 'colname IS NULL' in conditions. The negation is 'colname NOT NULL'.


SQL support in GRASS GIS

Last changed: $Date: 2006/08/24 19:11:36 $

Help Index