数据库之十:谓词

1、比较谓词:

=、<、>、<>


2、like:
模糊查询 _代表一个字符,%代表0个或者多个字符:

select * from student where sid like '_1%'

表示sid的第二个字符是1的所有数据


3、between:

select * from student where sage between 19 and 21

范围查询,包含端点的值


4、is nullis not null:
用来判断空值情况的

select * from student where ssex is not null

5、in:

select * from student where sid in(select sid from student where ssex='')

查询所有性别为男性的信息(语句不需要这么写,只是为了说明in谓词),同样的有not in


6、exists:
判断是否存在满足某种条件的记录,exist谓词的主语是记录;
EXIST只关心记录是否存在,返回哪些列都没有关系
对应的是not exist

尽管很渺小,但终究会变得伟大
原文地址:https://www.cnblogs.com/chenbao1012/p/11838423.html