1.exists的用法
select *
from b_user_info a
where 1=1
and not exists(
select 1 from b_class_info b
where b.id=a.class_id
)
;
此命令查询出来的是

只查询class_id != 1的数据
2.between的用法
select *
from b_user_info a
where a.id between 8 and 9
;
from b_user_info a
where a.id between 8 and 9
;
前后都包括。
在where条件中,and优先级要高于or