(1)关键字and or > < = >= <= between ….and not between…and
select sname
from Student
where studentno='2017151'
(2)属性 in(A,B,C,……)–>属性 = A or 属性=B or 属性= C……
select sname ,studentno
from Student
where point in(777,789,799)
(3)like:只用于文本匹配查询
select sname --查询姓刘的学生,%为任意个数的字
from Student
where sname like '刘%'
select sname --查询刘aa,名字为两个字,_为一个字
from Student
where sname like '刘__'
如在匹配中遇到_或%,则需要在前面加/转义
(4)条件查询中如果某一属性为空,用 is NULL
select studentno,sname,classno
from student
where email is null
(5)聚集函数
COUNT:统计一列中值的个数
SUM:计算一列值的总和
AVG:平均值
MAX:最大值
MIN:最小值
select MIN(point) MIN,MAX(point)
from student
(6)group by
select MIN(point) MIN,MAX(point) MAX
from student
group by classno
(7)HAVING作用对象为组,跟在GROUP BY 后
select studentno
from score
group by studentno
having COUNT(courseno)>=3