• Login

DataSoft Corporation

SELECT

Retrieves specified information from a database. A SELECT statement creates a temporary view.
Syntax
query-specification [ [ UNION [ ALL ] query-specification ]...
[ ORDER BY order-by-expression [ , order-by-expression ]... ] [ FOR UPDATE ]

query-specification ::= ( query-specification )
| SELECT [ ALL | DISTINCT ] [ top-clause ] select-list
FROM table-reference [ , table-reference ]...
[ WHERE search-condition ]
[ GROUP BY expression [ , expression ]...
[ HAVING search-condition ] ]

order-by-expression ::= expression [ CASE (string) | COLLATE collation-name ] [ ASC | DESC ]

top-clause ::= TOP number

select-list ::= * | select-item [ , select-item ]...

select-item ::= expression [ [ AS ] alias-name ] | table-name . *

table-reference ::= { OJ outer-join-definition }
| [db-name.]table-name [ [ AS ] alias-name ] [ WITH (table-hint ) ]
| [db-name.]view-name [ [ AS ] alias-name ]
| dbo.fsytem-catalog-function-name [ [ AS ] alias-name ]
| join-definition
| ( join-definition )
| ( table-subquery )[ AS ] alias-name [ (column-name [ , column-name ]... ) ]

outer-join-definition ::= table-reference outer-join-type JOIN table-reference
ON search-condition

outer-join-type ::= LEFT [ OUTER ] | RIGHT [ OUTER ] | FULL [ OUTER ]

table-hint ::= INDEX ( index-value [ , index-value ]... )

index-value ::= 0 | index-name

index-name ::= user-defined-name

join-definition ::= table-reference [ join-type ] JOIN table-reference ON search-condition
| table-reference CROSS JOIN table-reference
| outer-join-definition

join-type ::= INNER | LEFT [ OUTER ] | RIGHT [ OUTER ] | FULL [ OUTER ]

table-subquery ::= query-specification [ [ UNION [ ALL ]
query-specification ]... ][ ORDER BY order-by-expression [ , order-by-expression ]... ]

search-condition ::= search-condition AND search-condition
| search-condition OR search-condition
| NOT search-condition
| ( search-condition )
| predicate

predicate ::= expression [ NOT ] BETWEEN expression AND expression
| expression-or-subquery comparison-operator expression-or-subquery
| expression [ NOT ] IN ( query-specification )
| expression [ NOT ] IN ( value [ , value ]... )
| expression [ NOT ] LIKE value
| expression IS [ NOT ] NULL
| expression comparison-operator ANY ( query-specification )
| expression comparison-operator ALL ( query-specification )
| [ NOT ] EXISTS ( query-specification )

comparison-operator ::= < | > | <= | >= | = | <> | !=

expression-or-subquery ::= expression | ( query-specification )

value ::= literal | USER | ?

expression ::= expression - expression
| expression + expression
| expression * expression
| expression / expression
| expression & expression
| expression | expression
| expression ^ expression
| ( expression )
| -expression
| +expression
| column-name
| ?
| literal
| set-function
| scalar-function
| { fn scalar-function }
| CASE case_value_expression WHEN when_expression THEN then_expression [...] [ ELSE else_expression ] END
| COALESCE (expression, expression[,...])
| IF ( search-condition , expression , expression )
| SQLSTATE
| subquery-expression
| NULL
| : user-defined-name
| USER
| @:IDENTITY
| @:ROWCOUNT
| @@IDENTITY
| @@ROWCOUNT
| @@SPID

case_value_expression when_expression, then_expression else_expression ::= see CASE (expression)
subquery-expression ::= ( query-specification )

set-function ::= COUNT (*)
| COUNT ( [ DISTINCT | ALL ] expression )
| SUM ( [ DISTINCT | ALL ] expression )
| AVG ( [ DISTINCT | ALL ] expression )
| MIN ( [ DISTINCT | ALL ] expression )
| MAX ( [ DISTINCT | ALL ] expression )
| STDEV ( [ DISTINCT | ALL ] expression )
Thursday, 18 April 2019 Posted in Pervasive SQL Command
 DataSoft Store  Knowledgebase  Contact Us
 Sitemap  Privacy Policy
    Customer Service


Copyright © 2019 DataSoft Corporation All rights reserved.