检查mysql查询中的大写字母

dev*_*per 1 php mysql sql

我有一个包含一些电子邮件字段的表.有些电子邮件记录是大写字母,有些是骆驼案例.现在我必须将所有带大写字母的电子邮件转换为小写字母.我可以通过PHP脚本获取每个记录,然后检查任何大写字母,然后如果找到任何大写字母将其转换为小写.

在Mysql中有什么方法我们只能获得那些包含大写字母的记录,而不是全部?这样我就可以通过执行每一条记录来幸免.我在Mysql中寻找一种方法,我们可以在查询中检查记录中的大写字母.有什么建议??

Cod*_*ter 5

将排序规则更改为区分大小写的排序规则.

但实际上,这个查询需要多长时间?

update `table` set email = lower(email)
Run Code Online (Sandbox Code Playgroud)

编辑:仅更新不仅包含小写电子邮件的记录:

update 
    `table`
set
    email = lower(email) 
where
    email <> lower(email)
collate
    latin1_general_cs
Run Code Online (Sandbox Code Playgroud)

您可以先选择它们来测试它:

select 
    *
from
    `table`
where
    email <> lower(email)
collate
    latin1_general_cs
limit 
    10
Run Code Online (Sandbox Code Playgroud)