Difference between revisions 856344596 and 858457478 on enwiki

{{Refimprove|date=September 2014}}
A <code>WHERE</code> clause in [[SQL]] specifies that a SQL [[Data Manipulation Language|Data Manipulation Language (DML)]] statement should only affect rows that meet specified criteria. The criteria are expressed in the form of predicates. <code>WHERE</code> clauses are not mandatory clauses of SQL DML statements, but can be used to limit the number of rows affected by a SQL DML statement or returned by a query. In brief SQL WHERE clause is used t(contracted; show full)FROM   mytable
WHERE  mycol > 100 AND item = 'Hammer'
</source>

=== IN ===
<code>IN</code> will find any values existing in a set of candidates.
<source lang="sql" start="1">
SELECT ename WHERE ename IN ('Montreal', 
'Quebec')
</source>
All rows match the predicate if their value is one of the candidate set of values. This is the same behavior as
<source lang="sql">
SELECT ename WHERE ename='value1' OR ename='value2'
</source>
except that the latter could allow comparison of several columns, which each <code>IN</code> clause does not. For a larger number of candidates, <code>IN</code> is less verbose.

(contracted; show full)<references />

== External links ==
* [http://www.psoug.org/reference/conditions.html PSOUG Home Puget Sound Oracle Users Group] gives several examples of SELECT statements with WHERE clauses.

{{SQL}}

[[Category:SQL keywords]]