SQL语句,实验二,实验三,数据库数据定义和查询1、掌握使用SQL语句创建和删除数据表,创建各种完整性约束。2、掌握使用SQL语句修改表的结构。3、掌握查询语句的使用方法,重点掌握连接查询和嵌套查询。数据更新与视图1、掌握数据更新语句的使用;2、掌握视图操作的基本方法和应用,理解基于视图的查询和数据更新操作的过程。
group by sno
Order by 总成绩 desc;
(7)查询总成绩超过200分的学生,要求列出学号和总成绩。
Select sno,sum(grade)
From SC
group by sno
having SUM(grade)>=200;
(8)查询姓名为余丹妮的学生所学课程的课程名与学分。
Select cname ,credit
From C
Where cno in(
Select cno
From SC
Where sno in(
Select sno
From S
Where sname='余丹妮'
)
)
(91)查询选修课程号为“C02”或“C07”的学生的学号。
Select distinct s1.Sno
From SC s1,SC s2
Where s1.sno=s2.sno and (o='C02' or o='C07');
(9)查询选修课程号为“C02”或“C07”的学生的学号。
Select distinct sno
From SC
Where cno='C02' or cno='C07';
(10)查询选修了课程号为“C02”和“C07”的学生的学号。
Select s1.Sno
From SC S1,SC S2
Where s1.sno=s2.sno and o='C02' and o='C07';
(11)查询学习全部课程的学生姓名。
Select sname
From S
Where sno in(
Select sno
From SC
Group by sno
Having count(cno)=8
)
(12)查询1992年1月1日以前出生的学生的姓名和专业。

