13.08.2012 Views

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>ACTIONSCRIPT</strong> 3.0 DEVELOPER’S GUIDE<br />

SQL support in local databases<br />

Wh<strong>en</strong> a SELECT appears within an expression but is not the right operand of an IN operator, th<strong>en</strong> the first row of the<br />

result of the SELECT becomes the value used in the expression. If the SELECT yields more than one result row, all rows<br />

after the first are ignored. If the SELECT yields no rows, th<strong>en</strong> the value of the SELECT is NULL.<br />

CAST expression<br />

A CAST expression changes the data type of the value specified to the one giv<strong>en</strong>. The type specified can be any nonempty<br />

type name that is valid for the type in a column definition of a CREATE TABLE statem<strong>en</strong>t. See Data type<br />

support for details.<br />

Additional expression elem<strong>en</strong>ts<br />

The following SQL elem<strong>en</strong>ts can also be used in expressions:<br />

Built-in functions: Aggregate functions, Scalar functions, and Date and time formatting functions<br />

Operators<br />

Parameters<br />

Built-in functions<br />

The built-in functions fall into three main categories:<br />

Aggregate functions<br />

Scalar functions<br />

Date and time functions<br />

In addition to these functions, there is a special function RAISE() that is used to provide notification of an error in the<br />

execution of a trigger. This function can only be used within the body of a CREATE TRIGGER statem<strong>en</strong>t. For<br />

information on the RAISE() function, see CREATE TRIGGER > RAISE().<br />

Like all keywords in SQL, function names are not case s<strong>en</strong>sitive.<br />

Aggregate functions<br />

Aggregate functions perform operations on values from multiple rows. These functions are primarily used in SELECT<br />

statem<strong>en</strong>ts in conjunction with the GROUP BY clause.<br />

AVG(X) Returns the average value of all non-NULL X within a group. String and BLOB values that do not<br />

look like numbers are interpreted as 0. The result of AVG() is always a floating point value ev<strong>en</strong><br />

if all inputs are integers.<br />

COUNT(X) The first form returns a count of the number of times that X is not NULL in a group. The second<br />

COUNT(*) form (with the * argum<strong>en</strong>t) returns the total number of rows in the group.<br />

MAX(X) Returns the maximum value of all values in the group. The usual sort order is used to determine<br />

the maximum.<br />

MIN(X) Returns the minimum non-NULL value of all values in the group. The usual sort order is used<br />

to determine the minimum. If all values in the group are NULL, NULL is returned.<br />

SUM(X)<br />

Returns the numeric sum of all non-NULL values in the group. If all of the values are NULL th<strong>en</strong><br />

SUM() returns NULL, and TOTAL() returns 0.0. The result of TOTAL() is always a floating point<br />

TOTAL(X)<br />

value. The result of SUM() is an integer value if all non-NULL inputs are integers. If any input to<br />

SUM() is not an integer and not NULL th<strong>en</strong> SUM() returns a floating point value. This value<br />

might be an approximation to the true sum.<br />

In any of the preceding aggregate functions that take a single argum<strong>en</strong>t, that argum<strong>en</strong>t can be preceded by the keyword<br />

DISTINCT. In that case, duplicate elem<strong>en</strong>ts are filtered before being passed into the aggregate function. For example,<br />

the function call COUNT(DISTINCT x) returns the number of distinct values of column X instead of the total number<br />

of non-NULL values in column x.<br />

Last updated 6/6/2012<br />

1108

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!