sqlite语句中的通配符怎么用
展开全部
# _代表一个字符
select * from user where username like '_';
select * from user where username like '______';
select * from user where username like 'huxia_';
select * from user where username like 'h_xiao';
# 如果我就真的要查%或者_,怎么办呢?使用escape,转义字符后面的%或_就不作为通配符了,注意前面没有转义字符的%和_仍然起通配符作用
select username from gg_user where username like '%xiao\_%' escape '\';
select username from gg_user where username like '%xiao\%%' escape '\';
select * from user where username like '_';
select * from user where username like '______';
select * from user where username like 'huxia_';
select * from user where username like 'h_xiao';
# 如果我就真的要查%或者_,怎么办呢?使用escape,转义字符后面的%或_就不作为通配符了,注意前面没有转义字符的%和_仍然起通配符作用
select username from gg_user where username like '%xiao\_%' escape '\';
select username from gg_user where username like '%xiao\%%' escape '\';
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询