Selecting rows containg a string of specified value length - Mysql Views : 349
Tagged in : Mysql
0 0
Send mail
Lets consider a employee table with name as a column in it.

If we need to select and see only employees with name have five letters we can use wither of the following option

Using LENGTH function:

select * from employees where LENGTH(name) = 5;


Using Regular Expression:

select * from employees where name like '______';

In the above query we have used 5 "_" (underscores).
Each underscore points to one character

By rajesh, On - 2009-10-31



    Login to add Comments .