Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1556
News FAQ
Search Home


next up previous contents
Next: Examples Up: NOTE 199 - Table Query Language Previous: Creating a new table


Calculations on a table

TaQL can be used to get derived values from a table by means of an expression. The expression can result in any data type and value type. For example, if the expression uses an array column, the result might be a vector of arrays (an array for each row). If the expression uses a scalar column, the result might be a vector of scalars or even a single scalar if a reduction function like SUM is used.

The exact syntax is:

  CALC [FROM table_list CALC] expression
The part in square brackets can be omitted if no column is (directly) used in the expression. The examples will make clear what that means.

  CALC 1+2
is a simple expression not using a table. It shows how the CALC command can be used as a desk calculator.

  CALC FROM mytable CALC mean(column1+column2)
gives a vector of scalars containing the mean per row.

  CALC sum([SELECT FROM mytable GIVING [mean(column1+column2)]])
gives a single scalar giving the sum of the means in each row. Note that in this command the CALC command does not need the FROM clause, because it does not use a column itself. Columns are only used in the nested query which has a FROM clause itself.


next up previous contents
Next: Examples Up: NOTE 199 - Table Query Language Previous: Creating a new table   Contents
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-10-15