① 用sql语句完成下列问题。
1、第一题,是查询总和,总和在SQL中使用sum,如:select sum(成绩) from 表名
2、第二题,查询平均值,SQl:select 学号,Avg(sum(成绩)) from 表名 group by 学号
3、第三题,查询每课程学生人数,SQL : select 课程名称,count(学号) from 表名 group by 课程名称
4、第四题,查询最高分,也就是最大值,select max(成绩),学号 from 表名 group by 学号
5、第五题,查询每科的最高分,SQL:select max(成绩),课程 from 表名 group by 课程 最低分 select min(成绩),课程 from 表名 group by 课程 平均分 select Avg(sum(成绩)),课程 from 表名 group by 课程
6、第六题 显示综合大于250分的信息 SQL: select 学生ID,sum(成绩) 总分 from 表名 where sum(成绩)>250 group by 学生ID
7、第七题 显示平均分 SQL:select 学生ID,Avg(sum(成绩)),课名 from 表名 where sum(成绩)>250 group by 学生ID,课名 order by Avg(sum(成绩)) asc
8、第八题 查询人数 SQL:select 课程ID,sum(学生ID) from 表名 where sum(学生ID)>=30 group by 课程ID
9、第九题 查询最高分 SQL:select max(成绩),课程,学生名字 from 表名 where max(成绩)>=90 group by 课程,学生名字
10、第十题 成绩>=60,平均分>85 SQL:select 学生 from 表名 where avg(sum(成绩))>85 and min(成绩)>=60 order by avg(sum(成绩)) desc
好辛苦,望采纳
② 使用SQL语句完成 下列题;
1. delete 表名 where 列名=列的值
2.update 表名 set 列名=列的值 where 列名=列的值
3. insert into 表名(列名) values (列的值)
4. select * from 表名
5. select 系的列名 from 表名 where 姓名的列名=张三'
6. select 课程的列名 from 表名 where 姓名的列名=李四'
7. select 学生姓名的列名 from 表名 where 年龄的列名>18 and 年龄的列名<22
8.select * from 表名
最基本的用法可以在:我的博客上看 http://blog.csdn.net/wangganggang90/article/details/6925847
③ 用SQL语句完成下列操作要求
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 procere 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;
累死,望采纳
④ 请求解题 要求用SQL语句完成下列题目
按图中问题和需求,以下会使用mysql环境的sql进行解答。
第一题: 考察主键和外键的创建表语句,以及基本的创建语句格式。这里提供两种,其余可以查阅相关资料。
mysql 插入数据
⑤ 用sql语言完成下列问题
第一题:
use stu
go
create table Student(
学号 int,
姓名 varchar(10),
性别 varchar(2),
年龄 varchar(3),
所属系 varchar(20)
)
第二题:
use stu
go
select 学号 from SG where 成绩<60
第三题:
use stu
go
select 姓名,年龄,性别 from Student where 姓名 like ' 张%' and 性别 = '男' and 所在系='计算机系'
第四题:
use stu
go
insert into Student
values
(05020,'姓名','高平','女','19岁','经济管理系')
⑥ 用SQL语句完成以下操作。
1
insert into 学生.DBF(学号,姓名,性别) values('10359999','张三','男')
2
update 学生成绩.DBF set 成绩=null where 课程.DBF.课程编号=学生成绩.DBF.课程编号 and 课程.DBF.课程名称='计算机' and 学生成绩.DBF.成绩<60
3
update 学生成绩.DBF set 成绩=成绩 + 20 where 课程编号='01'
4
select 学号,姓名,年龄 from 学生.DBF where DateDiff('yyyy',出生日期,getDate())=22
⑦ 用SQL语言完成下面四个问题,谢谢大家了!
1 select 职员号 from 订单 group by 职员号 having count(职员号)>3 and avg(金额)>200
2 select 职员号,姓名 from 职员 where 职员号 not in (select 职员号 from 订单)
3 delete from 订单 where 客户号=1001
4 update from 订单 set 金额=169 where 订单号='0060'