Jump to content

Talk:Where (SQL)

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Move this (very helpful) page to Wikibooks, surely?

[edit]

cf [1] etc. — Preceding unsigned comment added by 91.206.0.43 (talk) 09:57, 29 November 2011 (UTC)[reply]

Started

[edit]

Revised quite a bit of the stub that was here. Will look at adding more later. A couple of points: SQL is a declarative language, and we use statements, clauses, predicates, etc. This is intentionally differentiated from "commands", etc., that are used to define procedural languages like VB or C++. Also WHERE is not a statement itself, but an optional clause used in conjunction with DML statements. Will come back and make more mods and add sources (ISO/IEC standard is as good as it gets) when I have time.SqlPac 16:07, 17 April 2007 (UTC)[reply]

POLICY DEBATE: Use of source code and other examples in articles

[edit]

Someone started a policy debate concerning the use of source code in articles, that seems to directly impact this (and possibly other Database articles). See below for details:

I have opened a debate on the use of source code and other examples in Wikipedia articles. It seems that many pieces of example source code etc. currently in Wikipedia violate Wikipedia policy, so we need to either clarify or change the situation. Depending on the result of the discussion, this may result in a number of source code examples being summarily removed from computing articles!

Please reply there, not here, if you wish to contribute.—greenrd 10:50, 18 May 2007 (UTC)[reply]

Thanks.SqlPac 15:11, 18 May 2007 (UTC)[reply]

Syntax

[edit]

Should we include a short section describing the (standard) syntax for WHERE expressions? I had in mind something like the following simplified BNF syntax:

Expr:
    AndExpr
    AndExpr OR Expr

AndExpr:
    NotExpr
    NotExpr AND AndExpr

NotExpr:
    RelExpr
    NOT NotExpr

RelExpr:
    MulExpr
    MulExpr = MulExpr
    MulExpr <> MulExpr
    MulExpr > MulExpr
    MulExpr >= MulExpr
    MulExpr < MulExpr
    MulExpr <= MulExpr
    MulExpr IS NULL MulExpr
    MulExpr LIKE MulExpr
    MulExpr CONTAINS MulExpr
    MulExpr BETWEEN MulExpr AND MulExpr
    MulExpr IN ( Expr [, Expr]... )

MulExpr:
    AddExpr
    AddExpr * MulExpr
    AddExpr / MulExpr
 
AddExpr:
    UnaryExpr
    UnaryExpr + AddExpr
    UnaryExpr - AddExpr
    UnaryExpr || AddExpr

UnaryExpr:
    Term
    + UnaryExpr
    - UnaryExpr

Term:
    ( Expr )
    NameExpr
    NameExpr ( Expr [, Expr]... )
    number
    string

NameExpr:
    name
    name . NameExpr

Loadmaster 19:19, 6 August 2007 (UTC)[reply]