等 <条件表达式> 查询条件 谓词 比较 =、>,<,>=,<=,!=,<>, 确定范围 BETWEEN AND、NOT BETWEEN AND 确定集合 IN、NOT IN 字符匹配 LIKE(“%”匹配任何长度,“_”匹配一个字符)、NOT LIKE 空值 IS NULL、IS NOT NULL 子查询 ANY、ALL、EXISTS 集合查询 UNION(并)、INTERSECT(交)、MINUS(差) 多重条件 AND、OR、NOT <GROUP BY 列名> 对查询结果分组 [HAVING <条件表达式>] 分组筛选条件 [ORDER BY 列名 [ASC | DESC> 对查询结果排序;ASC:升序 DESC:降序 例1: select student.sno as
学号
, student.name as 姓名, course as 课程名, score as 成绩 from score,student where student.sid=score.sid and score.sid=:sid 例2:select student.sno as 学号, student.name as 姓名,AVG(score) as 平均分 from score,student where student.sid=score.sid and student.class=:class and (term=5 or term=6) group by student.sno, student.name having count(*)>0
order by
平均分 DESC 例3:select * from score where sid like '9634' 例4:select * from student where class in (select class from student where name='杨全')
我想和你有个家
2026-08-07 20:29:43
查找所有字段的值:select * from tbl 根据某个条件查找所有字段的值:select * from tbl where 字段=条件(字符型就加英文的单引号如:字段=‘条件’) 查找某个字段的值:select 字段 from tbl 查找某些字段的值:select 字段1,字段2,字段3,…… from tbl 有条件的话 后面就加where就行 跟前面的一样