4.2 条件查询
常用的查询条件 (3)字符匹配 LIKE 和 NOT LIKE
统配符 % _ [ ] [^ ]
例:’a%’, ’abc_’, ’%love%’, ’%[love]’, ’%[^love]’
③查询姓王的或姓陈的同学的信息 select * from student where sname like '[王陈]%‘
4.2 条件查询
常用的查询条件 (4)空值比较 IS NULL 和 IS NOT NULL 空值指的是不确定或没有填的值,空值的比较不能使用普
通的比较运算符(>,<,=或其组合) 空字符串不等于空值,0不等于空值
Teacher(tno, tname, tsex, tage, prof, dept) ②查询年龄不确定的教师信息 select * from teacher where tage is null;
4.2 条件查询
Score(Sno,Cno,Degree)
3 查询成绩等于85、86、90的记录 select * from score where degree = 85 or degree = 86 or degree = 90
4 查询课程号是’3-245’的所有记录 select * from score where cno = ‘3-245’
4.2 条件查询
Score(Sno,Cno,Degree)
1 查询成绩大于85的记录 select * from score where degree > 85
2 查询成绩在85-90之间的记录 select * from score where degree >= 85 and degree <= 90