• 博客(0)
  • 资源 (1)

空空如也

学生信息SQL

数据库1、查询"01"课程比"02"课程成绩高的学生的信息及课程分数 (ˇˍˇ) 想~ select distinct s.S# 学号,s.Sname 学生姓名,s.Ssex 性别 ,convert(date,s.Sage) 出生日期,sc.score 分数 from Student s,SC sc,SC ss where s.S#=sc.S# and sc.S#='01' and ss.S#='02' and sc.score>ss.score --1.1、查询同时存在"01"课程和"02"课程的情况 select s.Sname 姓名,s.Ssex 性别,convert(date,s.Sage) 出生日期,sc.score from Student s,SC sc,SC ss where s.S#=sc.S# and s.S#=ss.S# and sc.C#='01' and ss.C#='02' --1.2、查询同时存在"01"课程和"02"课程的情况和存在"01"课程但可能不存在"02"课程的情况 ---(不存在时显示为null)(以下存在相同内容时不再解释) select s.Sname 姓名,s.Ssex 性别,convert(date,s.Sage) 出生日期,sc.score 分数 from Student s,SC sc,SC ss where s.S#=sc.S# and s.S#=ss.S# and sc.C#='01' and ss.C#='02' and sc.score>ISNULL(ss.score,0) --select 课程=case Cname --when '语文' then 'null' else Cname end from Course --where exists(select S# from SC where C# in(select C# from Course where C#='01' and T#='02')) --查询存在’01‘不存在’02‘是为'null'

2014-10-10

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除