Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I would like a mysql query. All the fields which contain a capital letter

Tags:

mysql

I have a little trouble with this query and google is not my friend today

I all the results of a table that contains one or more capital letters. Something like this:

SELECT * FROM personal_urls WHERE CONTAINS_UPCASE(vanity_url)

Somebody knows an easy solution for this?

Thanks!

like image 373
Michael Koper Avatar asked Mar 11 '11 09:03

Michael Koper


2 Answers

try

        SELECT * 
        FROM personal_urls 
        WHERE CAST(vanity_url  AS BINARY) RLIKE '[A-Z]';
like image 94
diEcho Avatar answered Oct 18 '22 02:10

diEcho


I think RLIKE string function can help. We may use regexp [A-Z] to test string for capital letters.

like image 34
heximal Avatar answered Oct 18 '22 03:10

heximal