Difference between revisions 424708587 and 424709186 on enwiki{{Unreferenced|date=April 2007}} 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 should be used to limit the number of rows affected by a SQL DML statement or returned by a query. ==Overview== <code>WHERE</code> is an [[SQL:2003|SQL]] reserved word. The <code>WHERE</code> clause is used in conjunction with SQL DML statements, and takes the following general form: <source lang="sql"> SQL-DML-Statement FROM table_name WHERE predicate </source>DELETE all rows for which the predicate in the <code>WHERE</code> clause is True are affected (or returned) by the SQL DML statement or query. Rows for which the predicate evaluates to False or Unknown ([[Null (SQL)|NULL]]) are unaffected by the DML statement or query.⏎ ⏎ (DELETE) The following query returns only those rows from table ''mytable'' where the value in column ''mycol'' is greater than 100. <source lang="sql"> SELECT * FROM mytable WHERE mycol > 100 </source>⏎ ⏎ TDELETE the following [[Delete (SQL)|<code>DELETE</code> statement]] removes only those rows from table ''mytable'' where the column ''mycol'' is either NULL or has a value that is equal to 100. <source lang="sql"> DELETE FROM mytable WHERE mycol IS NULL OR mycol = 100 </source>delete == Predicates == Simple predicates use one of the operators <code>=</code>, <code><></code>, <code>></code>, <code>>=</code>, <code><</code>, <code><=</code>, <code>IN</code>, <code>BETWEEN</code>, <code>LIKE</code>, <code>IS NULL</code> or <code>IS NOT NULL</code>. (contracted; show full) {{DEFAULTSORT:Where (Sql)}} [[Category:SQL keywords]] Delete [[no:Where (SQL)]] [[ru:Where (SQL)]] [[sq:Where (SQL)]] [[uk:Where (SQL)]] All content in the above text box is licensed under the Creative Commons Attribution-ShareAlike license Version 4 and was originally sourced from https://en.wikipedia.org/w/index.php?diff=prev&oldid=424709186.
![]() ![]() This site is not affiliated with or endorsed in any way by the Wikimedia Foundation or any of its affiliates. In fact, we fucking despise them.
|