Books
in black and white
Main menu
Share a book About us Home
Books
Biology Business Chemistry Computers Culture Economics Fiction Games Guide History Management Mathematical Medicine Mental Fitnes Physics Psychology Scince Sport Technics
Ads

Teradata RDBMS forUNIX SQL Reference - NCR

NCR Teradata RDBMS forUNIX SQL Reference - NCR, 1997. - 913 p.
Download (direct link): teradataforunix1997.pdf
Previous << 1 .. 86 87 88 89 90 91 < 92 > 93 94 95 96 97 98 .. 241 >> Next

single_table the name of table participating in join.

Derived Tables

The derived table option allows the FROM list to specify a spool file, comprised of selected data from an underlying table(s). The derived table acts like a viewed table. This is an extension of a current functionality. It is a full ANSI SQL feature.

(subquery) nested SELECT statements.
AS an introductory clause to derived table name. Optional.

7-4

Teradata RDBMS for UNIX SQL Reference
Queries: The SELECT Statement

SELECT

Syntax Element . . . Specifies . . .
derived_tname the name of derived table.
col_name the column name. The col_name field is for the columnname only; forms such as Databasename.Tablename.Columnname, or Tablename.Columnname should not be used.
WHERE an introduction to the search condition in the SELECT statement.
search_cond a conditional search expression that must be satisfied by the row(s) returned by the statement.
GROUP BY an introduction to a reference to one or more expressions in the select expression list.
col_name a group for which an aggregate operation is specified in the expr-list. Col_name specifies the name(s) of columns used in the GROUP BY clause in the SELECT statement.
col_pos the numeric position of the column(s) used in the GROUP BY clause.
expr the expression(s) used in the GROUP BY clause.
HAVING an introduction to the conditional clause in the SELECT statement.
cond one or more conditional expressions that must be satisfied by the result rows. Aggregate operators may be used with HAVING. HAVING cond selects rows from a single group defined in the select expr-list that has only aggregate results, or it selects rows from the group or groups defined in a GROUP BY clause.
ORDER BY the order in which result rows are to be sorted.
col_name specifies the name(s) of columns used in the ORDER BY clause in the SELECT statement. These can be ascending or descending.
col_pos specifies the numeric position of the column(s) used in the ORDER BY clause. This can be ascending or descending.
expr refers to an expression in the SELECT expr-list, either by name, or by means of a constant that specifies the numeric position of the expression in the expression list. If the sort field is a character string, the expr used in the ORDER BY phrase can include a type modifier to force the sort to be either CASESPECIFIC or NOT CASESPECIFIC. See “Specifying Case for Character Data” of Chapter 5, “Data Definition.”

Teradata RDBMS for UNIX SQL Reference

7-5
Queries: The SELECT Statement

SELECT

Syntax Element . . . Specifies . . .
ASC DESC either an ascending or a descending sort order. The default order is ASC. ASC specifies ascending order; DESC specifies descending order. If a sort option is not given, result values are sorted in ascending order according to the client system’s collating sequence. If ORDER BY is not specified, rows are returned unsorted.
WITH expr1 WITH is a keyword introducing the condition to be fulfilled by the SELECT statement. Specifies a summary line (such as a total) for the values in a column (expr) of the select result. Expr1 may contain one or more aggregate expressions that are applied to column values.
BY expr2 specifies one or more result columns (expressions) for which expr1 is provided. BY is valid only when used with WITH. * Expr2 may refer to an expression in the select expression list either by name or by means of a constant that specifies the numeric position of the expression in the expr-list.
ASC DESC either an ascending or a descending sort order. The default order is ASC. ASC specifies ascending order; DESC specifies descending order. If a sort option is not given, result values are sorted in ascending order according to the client system’s collating sequence. If the BY clause is not specified, at that level, there is no ordering of the result.

Note: WITH is a Teradata RDBMS extension to ANSI SQL.

Note: The syntax shown specifies the ANSI SQL ordering of options FROM, WHERE, GROUP BY, HAVING, and ORDER BY. Teradata RDBMS does not enforce this ordering, but it is recommended for ANSI compliance.

To select data from a table, the user must have SELECT privilege on pITvilegG Restrictions that table. To select data through a view, the user must have the

SELECT privilege on that view. Also, the immediate owner of the view (that is, the database in which the view resides) must have SELECT WITH GRANT OPTION privileges on all tables or views referenced in the view.

A select operation sets a Read lock on the tables or rows referenced REAd lOcK °n Tables, in the SELECT statement. If the SELECT statement references a

Rows Referenced view, then a Read lock is placed on the underlying tables.

7-6

Teradata RDBMS for UNIX SQL Reference
Queries: The SELECT Statement

SELECT

Only SELECT Uses Set Operators (Query Expressions)

Joins

Success Response Indicates Returned Rows

Uses of the SELECT Statement
Previous << 1 .. 86 87 88 89 90 91 < 92 > 93 94 95 96 97 98 .. 241 >> Next