软件测试-常见数据库笔试题

一、

让客户满意是我们工作的目标,不断超越客户的期望值来自于我们对这个行业的热爱。我们立志把好的技术通过有效、简单的方式提供给客户,将通过不懈努力成为客户在信息化领域值得信任、有价值的长期合作伙伴,公司提供的服务项目有:主机域名、网页空间、营销软件、网站建设、赤峰网站维护、网站推广。

1.新建表 test

id varchar2(20)
name varchar2(20)
addr varchar2(50)
score number

create table test
(id varchar2(20),
name varchar2(20),
addr varchar2(50),
score number
)

2.给id增加主键约束
alter table test add constraint pk_id primary key(id)
3.查询出分数大于60分的人员,并按分数降序进行排列

select * from test where score>60 order by score desc
4.新增数据 001 zhangsan shenzhen 80
insert into test(id,name,addr,score) values ('001','zhansgan','shenzhen','80')

  1. 将zhangsan的分数修改成60
    update test set score=60 where name='zhangsan'

7.删除zhangsan的信息

delete from test where name='zhangsan'

二、

Student(S#,Sname,Sage,Ssex) 学生表
Course(C#,Cname,T#) 课程表
SC(S#,C#,score) 成绩表
Teacher(T#,Tname) 教师表

问题:

1、查询平均成绩大于60分的同学的学号和平均成绩; avg

select s#,avg(score) from sc where (select avg(score) from sc)>60 group by s# ;

select s#,avg(score) from sc where group by s# having avg(score)>60;

2、查询所有同学的学号、姓名、选课数、总成绩;

select Student.s#,sname,count(C#),sum(score) from Student inner join sc on Student.s#=sc.s# group by Student.s#,sname

3、查询姓“李”的老师的个数;

select count(*) from teacher where tname like'李%'

4、查询没学过“叶平”老师课的同学的学号、姓名;

select S#,Sname from Student where s# in (select S# from sc where c# not in (select c# from Course where T#=(select T# from teacher where Tname='叶平' ))

5、查询所有课程成绩小于60分的同学的学号、姓名;

select S#,Sname from Student where s# not in (select S# from sc where score>60)

新闻标题:软件测试-常见数据库笔试题
文章来源:https://www.cdcxhl.com/article20/pdpdco.html

成都网站建设公司_创新互联,为您提供网站改版外贸建站网站收录动态网站App设计

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

成都定制网站建设