数据库中有一个表格customers,其中表格中有company的值为Smithson Corp.的一条记录,现在想要通过LIKE查询该记录,但是无法查到,下面是两个查询的语句:
第一个是使用%查询:
select company, credit_limit
from customers
where company like '%mithson Corp.';
注:如果是将%放置放置Smithson Corp.末尾是可以查询的。
第二个是使用_查询:
select company, credit_limit
from customers
where company like 'mithson Cor_.';
第一个是使用%查询:
select company, credit_limit
from customers
where company like '%mithson Corp.';
注:如果是将%放置放置Smithson Corp.末尾是可以查询的。
第二个是使用_查询:
select company, credit_limit
from customers
where company like 'mithson Cor_.';
你可用length('Smithson Corp.')和length(company)看下两者大小是否相等,按你说的肯定后面的大,可能是其他字符而实际你看不出来_匹配一个字符