Search for names of a certain length
Suppose if we want to find the names that contain exactly five characters, we use a special character "_"(underscore). The following query will list all the five letter names from the table employees.
select * from employees where firstname like '_____';
select * from employees where firstname like '_____';
Labels: search by length

1 Comments:
You could also use:
select *
from employees
where LENGTH(firstname) = 5;
Which is most inefficient is debatable. ;-)
By
Lee, At
July 23, 2009 11:50 AM
Post a Comment
<< Home