
select count([学号]) as [总人数]
from Studentclass
--2、查询选修了3号课程的学生姓名
select [姓名] from Student
where [学号] in (select [学号] from Studentclass where [课程号] = 3)
--3、查询学生“张三”的学号,姓名,选修课程名,成绩(第二张表的学分应该是成绩吧)
select a.[学号],a.[姓名],c.[课程名],b.[成绩]
from Student a,Studentclass b,Class c
where a.[学号] = b.[学号] and b.[课程号] = c.[课程号] and a.[姓名] = N'张三'
--4、查询选修课程“人工智能”的学生的学号,姓名
select a.[学号],a.[姓名]
from Student a
left join Studentclass b
on a.[学号] = b.[学号]
left join Class c
on b.[课程号] = c.[课程号]
where c.[课程名] = N'人工智能'
--5、查询选修1号课程的最高分是多少是哪个学生获得的
select [姓名]
from Studentclass
where [学号] in (select [学号] from Studentclass where [成绩] = (select max([成绩]) from Studentclass where [课程号] = 1))
--6、查询姓名中第二个字为“三”的学生列表
select [姓名] from Student where [姓名] like N'_三%'
--7、统计每个课程号对应的选课人数是多少
select [课程号],count([学号]) as [选课人数] from Studentclass group by [课程号]
--8、查询选修3号课程且成绩在70分以上的学生信息
select * from Student
where [学号] in (select [学号] from Studentclass where [课程号] = 3 and [成绩] >= 70)
--9、查询“化学系”的学生来自哪些省市
select [省区] from Student
where [系别] = N'化学系'
--10、查询全体学生情况,结果按所在系升序排列,同一系再按年龄降序排列
select * from Student order by [系别],[年龄] desc
--11、查询选修了4号课程的平均成绩
select avg([成绩]) from Studentclass group by [课程号] having [课程号] = 4
--12、把3号课程学分<60分的数据更新为60
update Studentclass
set [学分] = 60
where [学分] <60 and [课程号] = 3
我有可能做的不对奥:1)select, where , from
2)列 as 列标题, 列标题 = 列
3)
4)where,having,group By
5)
6)#, Tempdb
第3个和第5个真心不会, 我这干了两年.net了, 发现你这题当真恶心啊
出这题的人, 也是很专业的研究学术啊, 考试就应该考实际应用的啊, 弄这个题真心醉了.
1.DISTINCT、top2.convert
3.查询、更新、管理
4.主键、外键
5.ROLLBACK TRAN、COMMIT TRAN
6.sp_renamedb
8.identity
9.插入数据的列数必须和表中列数相等
10.空
12.truncate
14.原子性、一致性、隔离性、永久性
16.count、avg、len、substring
17.cast
18.windows
19.物理数据表
20.<>、!=
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)