SQL SELECT LIKE(不区分大小写) [英] SQL SELECT LIKE (Insensitive casing)

查看:720
本文介绍了SQL SELECT LIKE(不区分大小写)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试执行sql查询:

I am trying to execute the sql query:

select * from table where column like '%value%';

但是数据被保存为值"(V为大写).

But the data is saved as 'Value' ( V is capital ).

当我执行此查询时,我没有任何行. 我该如何进行呼叫,以便无论字符大小写如何都寻找值"?

When I execute this query i don't get any rows. How do i make the call such that, it looks for 'value' irrespective of the casing of the characters ?

推荐答案

在列和搜索词中均使用LOWER函数.这样做,可以确保即使查询中的内容类似于%VaLuE%,也没关系

use LOWER Function in both (column and search word(s)). Doing it so, you assure that the even if in the query is something like %VaLuE%, it wont matter

select qt.*
from query_table qt
where LOWER(column_name) LIKE LOWER('%vAlUe%');

这篇关于SQL SELECT LIKE(不区分大小写)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆