用SQL语句完成下列操作要求 10
1.在表一中(表一名为stuinfo)插入记录:2015121226,张三,男,白族,15计算机网络,云南大理2.删除表二中课程名为“foxpro应用基础”的课程3.查询...
1.在表一中(表一名为stuinfo)插入记录:2015121226,张三,男,白族,15计算机网络,云南大理2.删除表二中课程名为“foxpro应用基础”的课程3.查询年满20岁的学生姓名、年龄、班级4.查询所有课程的最高分的学生学号及姓名5.查询所有学生的成绩,要求显示学号、姓名、课程名称和成绩6.查询张三的老乡7.利用用身份证号码信息获取各学生的年龄,要求显示姓名和年龄8.创建存储过程(stmax)用于查询所有课程最高分9.创建触发器完成成绩录入后检查是否有不及格,如果有,输出姓名课程和成绩10.设计程序完成随机点名11.将表二中课程名为“数据库原理”的课程改为“数据库原理与应用”12.查询所有姓张的学生信息13.查询所有少数民族学生信息14.查询各门课程的平均分
展开
展开全部
1.insert into stuinfo(stuid,stname,sex,nation,class,address) values(2015121226,张三,男,白族,15计算机网络,云南大理);
2.delete course where cname='foxpro应用基础';
3.select stname as 姓名,round(to_number(to_char(sysdate,'yyyy')-to_char(birthdate,'yyyy'))) as 年龄,class as 班级 from stuinfo where round(to_number(to_char(sysdate,'yyyy')-to_char(birthdate,'yyyy')))>=20;
4.select st.stuid as 学号,st.stname as 姓名 from stuinfo st inner join course c on c.cid=st.stuid inner join score sc on sc.cid=c.cid where sc.score in (select max(score) from score);
5.select st.stuid as 学号,st.stname as 姓名,c.cname as 课程名称,sc.score as 成绩 from stuinfo st inner join course c on c.cid=st.stuid inner join score sc on sc.cid=c.cid;
6.select st.stname as 姓名 from stuinfo where address in (select address from stuinfo where stname='张三');
7.select stname as 姓名,to_char(sysdate,'yyyy')-to_char(substr(zjh,7,4)) as 年龄 from stuinfo
8.create or replace procedure stmax
as
fs nvarchar2(200);
mz nvarchar2(200);
begin
select c.cname into mz,sc.score into fs from course c inner join score sc on sc.cid=c.cid group by c.cname;
DBMS_OUTPUT.put_line(mz||':'||fs);
end;
9.触发器略过
10.略
11.update course set cname='数据库原理与应用' where cname='数据库原理';
12.select * from stuinfo where stname like '张%';
13.select * from stuinfo where nation !='汉族';
14.select c.cname,AVG(sc.score) from course c inner join score sc on sc.cid=c.cid group by c.cname;
累死,望采纳
2.delete course where cname='foxpro应用基础';
3.select stname as 姓名,round(to_number(to_char(sysdate,'yyyy')-to_char(birthdate,'yyyy'))) as 年龄,class as 班级 from stuinfo where round(to_number(to_char(sysdate,'yyyy')-to_char(birthdate,'yyyy')))>=20;
4.select st.stuid as 学号,st.stname as 姓名 from stuinfo st inner join course c on c.cid=st.stuid inner join score sc on sc.cid=c.cid where sc.score in (select max(score) from score);
5.select st.stuid as 学号,st.stname as 姓名,c.cname as 课程名称,sc.score as 成绩 from stuinfo st inner join course c on c.cid=st.stuid inner join score sc on sc.cid=c.cid;
6.select st.stname as 姓名 from stuinfo where address in (select address from stuinfo where stname='张三');
7.select stname as 姓名,to_char(sysdate,'yyyy')-to_char(substr(zjh,7,4)) as 年龄 from stuinfo
8.create or replace procedure stmax
as
fs nvarchar2(200);
mz nvarchar2(200);
begin
select c.cname into mz,sc.score into fs from course c inner join score sc on sc.cid=c.cid group by c.cname;
DBMS_OUTPUT.put_line(mz||':'||fs);
end;
9.触发器略过
10.略
11.update course set cname='数据库原理与应用' where cname='数据库原理';
12.select * from stuinfo where stname like '张%';
13.select * from stuinfo where nation !='汉族';
14.select c.cname,AVG(sc.score) from course c inner join score sc on sc.cid=c.cid group by c.cname;
累死,望采纳
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询