Difference between revisions of "Like"
From SQLZOO
| (One intermediate revision by one user not shown) | |||
| Line 1: | Line 1: | ||
How do I use LIKE in a sql SELECT statement. | How do I use LIKE in a sql SELECT statement. | ||
<div class='ht'> | <div class='ht'> | ||
| + | <div class=params>schema:gisq</div> | ||
<div> | <div> | ||
The LIKE command allows "Wild cards". | The LIKE command allows "Wild cards". | ||
| Line 9: | Line 10: | ||
The country Zambia matches because ambia matches with the %. | The country Zambia matches because ambia matches with the %. | ||
</div> | </div> | ||
| − | <source lang=sql class='tidy'> | + | <source lang=sql class='tidy'></source> |
| − | + | <source lang=sql class='setup'></source> | |
| − | + | ||
| − | </source> | + | |
<source lang='sql' class='def e-access'>SELECT name FROM bbc | <source lang='sql' class='def e-access'>SELECT name FROM bbc | ||
WHERE name LIKE 'Z*'</source> | WHERE name LIKE 'Z*'</source> | ||
Latest revision as of 14:08, 12 July 2012
How do I use LIKE in a sql SELECT statement.
schema:gisq
The LIKE command allows "Wild cards". A % may be used to match and string, _ will match any single character.
The example shows countries begining with Z. The country Zambia matches because ambia matches with the %.
SELECT name FROM bbc WHERE name LIKE 'Z*'
SELECT name FROM bbc WHERE name LIKE 'Z%'