按下列要求创建“学生选课数据库XX”数据库(XX为学生的学号),并为数据库创建三个基本表结构

按下列要求创建“学生选课数据库XX”数据库(XX为学生的学号),并为数据库创建三个基本表结构,第1张

(1)、select 学号,姓名,年龄 from Student order by 年龄 desc

(2)、select (select 课程名 from Course c where c.课程号=s.课程号) 课程名称, s.分数 from sc s

where s.学号=(select st.学号 from Student where 姓名='张三')

(3)、select 姓名 from Student where 学号 in ( select distinct 学号 from SC where 分数>=60 )

(4)、select Avg(年龄) from Student st where st.学号 in( select sc.学号 from sc sc where sc.课程号 in (select 课程号 from Course c where 课程名='101'))

and 性别='女'

(5)、select (select 姓名 from Student st where st.学号=sc1.学号) 学生姓名,sc1.分数 from SC sc1

where sc1.分数 in (select max(分数) from sc sc where sc.课程号 in (select 课程号 from Course c where c. 任课老师='张青'))

and sc.课程号 in (select 课程号 from Course c where c. 任课老师='张青')

(6)delete from SC s where s.分数<60

(7)update SC set 分数=avg(select 分数 from sc where 课程号='203') where 学号='105' and 课程号='203'

(8)create view over80 as

select sc1.学号,(select 姓名 from Student st where st. 学号=sc1.学号) 姓名,

sc1.课程号,(select 课程名 from Course c where c. 课程号=sc1.课程号) 课程名,(select 任课老师 from Course c where c. 课程号=sc1.课程号) 任课老师,

sc1.分数

from sc sc1 where sc1.分数>80

1、select * from Student

2、select * from Student where stuname like '张% '

3、select stuname as '姓名',stuno as '学号' from Student

先写出前3条,后面的有空再给你写。

1、select * from student where not exists(select * from studentcourse where studentno=student.studentno

2、select * from course where not exists(select * from studentcourse where courseno=course.courseno and score<60)


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/6775864.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-03-28
下一篇 2023-03-28

发表评论

登录后才能评论

评论列表(0条)

保存