实验目的
1.掌握SELECT语句的基本语法和查询条件表示方法;
2.掌握查询条件表达式和使用方法;
3.掌握GROUP BY 子句的作用和使用方法;
4.掌握HAVING子句的作用和使用方法;
5.掌握ORDER BY子句的作用和使用方法。
1.列出所有不姓刘的所有学生;
select *
from student
where sname not like '刘%'
2.列出姓“沈”且全名为3个汉字的学生;
select *
from student
where sname like '沈%' and LEN(sname)=3
3.显示在1985年以后出生的学生的基本信息;
select * from student
where year(getdate())-sage>1985
4.查询出课程名含有“数据”字串的所有课程基本信息;
select * from course
where cname like '数据%'
5.显示学号第八位或者第九位是1、2、3、4或者9的学生的学号、姓名、性别、年龄及院系;
select * from student
where sno like '_______[12349]%'
and sno like '________[12349]%'
6.列出选修了‘1’课程的学生,按成绩的降序排列;
select sno,grade from sc
where c