-- ============================模糊查询====================================
-- like结合 % 或 _
-- % : 代表0到任意个字符
-- _ : 代表一个字符
-- 查询姓张的同学
select studentno,studentname from student where studentname like '张%';
-- 查询姓张的同学,名字后面只有一个字的
select studentno,studentname from student where studentname like '张_';
-- 查询姓张的同学,名字后面只有俩个字的
select studentno,studentname from student where studentname like '张__';
-- 查询名字中间带五的同学
where studentname like '%五%';
-- ============================in====================================
-- 查询 1001、1002、1003号学员
select studentno,studentname from student where studentno in (1001,1002,1003);
-- 查询在北京的学生
-- select studentno,studentname from student where address in ('北京%'); in是具体的值,模糊查询只能和like使用
select studentno ,studentname from student where address in ('福建福州','北京朝阳');
-- ============================null \ not null===================================
-- 查询地址为空的学生 null ''
select studentno ,studentname from student where address = '' or address is null;
-- 查询有邮箱的同学 不为空
select studentno ,studentname,email from student where email is not null;
-- 查询没有邮箱的同学 为空
select studentno ,studentname,email from student where email is null;