谓词

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 null\is 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

posted @ 2023-02-28 16:58  Carllll  阅读(43)  评论(0编辑  收藏  举报