Monday, December 11, 2006

SELECT

SELECT is one of the data manipulation language (DML) commands. It is used to extract data from a database table. The results of the selected are returned in a result table which can also be called the result-set.

Syntax: SELECT [DISTINCT] column_list FROM table [WHERE condition ][;]

The 'DISTINCT' command is used to return only distinct elements, or rows, in the result-set.

column_list :: * | column_name[, column_name]

column_name :: I am not sure at this point what defines a valid column name.

table :: this table can also be a result-set from some operation.

condition :: column_name operator_value [ conditional column_name operator ]
column ::

operator_value :: [= | <> | > | < | >= | <= | != ] value or [BETWEEN b_value | LIKE pattern| IN i_value ]

The '!=' may not be standard SQL.

b_value :: value AND value

pattern :: '[% | letter]+'

i_value ::
The semicolon is not required. Some SQL engines require it but SQL 2000 does not.

How truly portable is SQL code?

No comments: