数据库实验四:SQL数据查询 下载本文

内容发布更新时间 : 2024/4/26 18:03:21星期一 下面是文章的全部内容请认真阅读。

(4)使用多个条件(AND关系)的查询 select 工资 from 教师

where 工资>200 and 工资<500

(5)使用多个条件(OR关系)的查询

select 工资 from 教师

where 工资<200 or 工资>500

(6)使用多个条件(混合AND和OR关系)的查询 select * from 学生

where (院系='2' and 生源='淮南') or (院系='6' and 生源='淮北')

(7)使用带NOT运算的查询 select * from 学生 where not (生源='合肥')

(8)使用BETWEEN???AND???的查询 select * from 选课

where 成绩 between 86 and 93

(9)使用NOT???BETWEEN???AND???的查询 select * from 选课

where 成绩 not between 76 and 93

(10)使用LIKE运算符的字符串匹配查询。 select * from 课程

where 课程性质 like '专业__'

(11)使用LIKE运算符的模板匹配查询。 select * from 院系 where 办公地点 like '4_1'

(12)查询空值和非空值的 select * from 教师 where 工资 is null

select * from 教师 where 工资 is not null

(13)结果要求排序的查询 select * from 选课 --升序 order by 成绩