SQL Reference

Data types of result columns

Each column of the result of SELECT acquires a data type from the expression from which it is derived.
When the expression is ... The data type of the result column is ...
the name of any numeric column the same as the data type of the column, with the same precision and scale for DECIMAL columns.
an integer constant INTEGER
a decimal constant DECIMAL, with the precision and scale of the constant
a floating-point constant DOUBLE
the name of any numeric variable the same as the data type of the variable, with the same precision and scale for DECIMAL variables.
an expression For a description of data type attributes, see Expressions.
any function (see "Functions" to determine the data type of the result.)
a hexadecimal constant representing n bytes VARCHAR(n). The codepage is the database codepage.
the name of any string column the same as the data type of the column, with the same length attribute.
the name of any string variable the same as the data type of the variable, with the same length attribute. If the data type of the variable is not identical to an SQL data type (for example, a NUL-terminated string in C), the result column is a varying-length string.
a character string constant of length n VARCHAR(n)
a graphic string constant of length n VARGRAPHIC(n)
the name of a datetime column the same as the data type of the column.
the name of a user-defined type column the same as the data type of the column
the name of a reference type column the same as the data type of the column

from-clause

         .-,------------------.
         V                    |
>>-FROM-----table-reference---+--------------------------------><
 

The FROM clause specifies an intermediate result table.

If one table-reference is specified, the intermediate result table is simply the result of that table-reference. If more than one table-reference is specified, the intermediate result table consists of all possible combinations of the rows of the specified table-references (the Cartesian product). Each row of the result is a row from the first table-reference concatenated with a row from the second table-reference, concatenated in turn with a row from the third, and so on. The number of rows in the result is the product of the number of rows in all the individual table-references. For a description of table-reference, see table-reference.


[ Top of Page | Previous Page | Next Page ]