|The PostgreSQL 9.0 Reference Manual - Volume 1A - SQL Language Reference
by The PostgreSQL Global Development Group
Paperback (6"x9"), 454 pages
RRP £14.95 ($19.95)
Sales of this book support the PostgreSQL project! Get a printed copy>>>
5.3.1 Select-List Items
The simplest kind of select list is
emits all columns that the table expression produces. Otherwise,
a select list is a comma-separated list of value expressions (as
defined in section 2.2 Value Expressions). For instance, it
could be a list of column names:
SELECT a, b, c FROM ...
The columns names
are either the actual names of the columns of tables referenced
FROM clause, or the aliases given to them as
explained in section 188.8.131.52 Table and Column Aliases. The name
space available in the select list is the same as in the
WHERE clause, unless grouping is used, in which case
it is the same as in the
If more than one table has a column of the same name, the table name must also be given, as in:
SELECT tbl1.a, tbl2.a, tbl1.b FROM ...
When working with multiple tables, it can also be useful to ask for all the columns of a particular table:
SELECT tbl1.*, tbl2.a FROM ...
(See also section 5.2.2 The WHERE Clause.)
If an arbitrary value expression is used in the select list, it
conceptually adds a new virtual column to the returned table. The
value expression is evaluated once for each result row, with
the row's values substituted for any column references. But the
expressions in the select list do not have to reference any
columns in the table expression of the
they can be constant arithmetic expressions, for instance.
|ISBN 9781906966041||The PostgreSQL 9.0 Reference Manual - Volume 1A - SQL Language Reference||See the print edition|