MYSQL谓词的使用

in//使用IN谓词将一个值与其他几个值进行比较

select * from users where id in(1,2,5);相当于select * from users where id=1 or id=2 or id=5;

between//将单一值与一个范围内的值比较

select * from users where id between 2 and 4;相当于select * from users where id>=2 and id<=4;

like//搜索具有某些模式的字符串。通过百分号和下划线指定模式。

exists//测试某个条件的行的存在性

表达式>ALL//表达式大于由全查询返回的每个单值

表达式>ANY//表达式至少大于由全查询返回的值之一

猜你喜欢

转载自www.cnblogs.com/Mr-Wenyan/p/8876500.html