Difference between revisions 555492110 and 563015718 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 can be used to limit the number of rows affected by a SQL DML statement or returned by a query. ==Overview== (contracted; show full)</source> All rows match the predicate if their value is between 'value1' and 'value2', inclusive. === LIKE === <code>LIKE</code> will find a string fitting a certain description. *Ending [[Wildcard character|Wildcard]] **Find any string that begins with the letter 'S' <source lang="sql"> SELECT ename FROM emp WHERE ename LIKE 'S%'; </source> *Leading Wildcard **Find any string that ends with the letter 'S' <source lang="sql"> SELECT ename FROM emp WHERE ename LIKE '%S'; </source> *Multiple Wildcards **Find any string that contains, anywhere, the letter 'S' <source lang="sql"> SELECT ename FROM emp WHERE ename LIKE '%S%'; </source> *Single Character Wildcard **Find any string that contains the letter 'A' followed by any single character followed by the letter 'E' <source lang="sql"> SELECT ename FROM emp WHERE ename LIKE '%A_E%'; </source> SQL programmers need to be aware that the LIKE predicate typically performs a search without the normal performance benefit of indexes. Using '=', '<>', etc.. instead will increase performance. Users of the LIKE predicate should be aware that case sensitivity (e.g., 'S' versus 's') may be different based upon database product or configuration. == 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. == References == <references /> {{SQL}} {{DEFAULTSORT:Where (Sql)}} [[Category:SQL keywords]] 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=563015718.
![]() ![]() 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.
|