This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | |||
|
dev:sql:select [2009/12/01 03:48] tdo |
— (current) | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | {{page>:top_add&nofooter&noeditbtn}} | ||
| - | <html><div align="center"><span style="color:red">DRAFT</span></div></html> | ||
| - | ====== Omnidex SQL: SELECT ====== | ||
| - | |||
| - | |||
| - | ===== Description ===== | ||
| - | ===== Syntax ===== | ||
| - | |||
| - | SELECT expression_list | ||
| - | FROM data_source | ||
| - | [ WHERE predicates ] | ||
| - | [ GROUP BY expression_list ] | ||
| - | [ HAVING predicates ] | ||
| - | [ ORDER BY expression_list ] | ||
| - | [ ON [ CURSOR ] cursor_no ] | [ INSTANCE instance_no ] | ||
| - | [ WITH options ] | ||
| - | |||
| - | expression_list | ||
| - | [ < TOP (n) | ||
| - | [ SKIP(n) | EVERY(n) | RANDOM (n [, seed] ) ] ] | ||
| - | [ < DISTINCT column | ALL >] | ||
| - | [ SAMPLE(‘control_break’ [, ’qualifier’]) ] | ||
| - | [ UNION [ALL] | INTERSECT | EXCEPT ] | ||
| - | [ * ] | [ table.]column [column_alias] [, table.column ... ] | ||
| - | [ (subquery) ] | ||
| - | [ aggregate_function( [table.]column ) ] | ||
| - | [ $uniquekey | $odxid ] | ||
| - | |||
| - | FROM table1 [ table_alias ] [, table2 [ table_alias ] [ $omnidex ] ] | ||
| - | [ LFET | RIGHT ] | ||
| - | [ OUTER ] | ||
| - | [ JOIN ] | ||
| - | [ , table2 ] | ||
| - | [ ON table1.linkfield = table2.linkfield ] | ||
| - | |||
| - | WHERE | ||
| - | [ EXISTS (subquery) ] | ||
| - | [ IN (subquery) ] | ||
| - | |||
| - | GROUP BY | ||
| - | |||
| - | HAVING [ left_operand operator subquery ] | ||
| - | [ left_operaand IN (subquery) ] | ||
| - | |||
| - | ORDER BY [column | position ] [, column | position ] | ||
| - | ===== Discussion ===== | ||
| - | SELECT | ||
| - | [<TOP n [SKIP n] | EVERY n | RANDOM (n [,seed]) | SAMPLE('columns' [, 'qualifier'])] | ||
| - | [<DISTINCT | ALL>] | ||
| - | select_item [, select_item ...] | ||
| - | [INTO table] | ||
| - | FROM table_list | ||
| - | [WHERE where_clause] | ||
| - | [GROUP BY expression_list] | ||
| - | [HAVING predicates ] | ||
| - | [ORDER BY expression_list] | ||
| - | [ON [CURSOR] cursor_no] | [INSTANCE instance_no] | ||
| - | [WITH options] | ||
| - | |||
| - | select_item | ||
| - | |||
| - | One of the following: | ||
| - | |||
| - | * All columns for the named tables using a syntax of: | ||
| - | [[[environment.]database.]table.]* | ||
| - | |||
| - | column A column, optionally qualified by a table, optionally with an alias | ||
| - | using a syntax of [[[environment.]database.]table.]column [[AS] column_alias] | ||
| - | |||
| - | (subquery) A nested subquery that returns a single select item | ||
| - | |||
| - | expression An standard SQL or Omnidex-specific function | ||
| - | |||
| - | |||
| - | | ||
| - | |||
| - | table_list | ||
| - | |||
| - | table_spec [join_syntax | ||
| - | | ||
| - | One of the following: | ||
| - | |||
| - | table A table using a syntax of: | ||
| - | [[[environment.]database.]table | ||
| - | |||
| - | |||
| - | $OMNIDEX A dummy table consisting of one row and one column. | ||
| - | | ||
| - | (subquery) A nested subquery | ||
| - | | ||
| - | |||
| - | join_syntax | ||
| - | [<LEFT | RIGHT> [OUTER]] JOIN [[[environment.]database.]table | ||
| - | ON join_predicate [<AND | OR> NOT] join_predicate] | ||
| - | |||
| - | join_predicate | ||
| - | [[[environment.]database.]table.column = [[[environment.]database.]table.column | ||
| - | |||
| - | |||
| - | == FROM data_source == | ||
| - | == WHERE Clause == | ||
| - | == GROUP BY Clause == | ||
| - | == HAVING Clause == | ||
| - | == ORDER BY Clause == | ||
| - | == WITH options == | ||
| - | |||
| - | ===== Examples ===== | ||
| - | |||
| - | ==== Simple ==== | ||
| - | |||
| - | > select * from mytable | ||
| - | |||
| - | ==== select columns ==== | ||
| - | |||
| - | > select company, contact from mytable | ||
| - | {{page>:bottom_add&nofooter&noeditbtn}} | ||