数据库知识自我检测(题目)

QUESTION

1.自我检测问题

1.什么是数据库?
2.数据库的特点?
3.哪几种数据类型
4.数据库有几种语句?具体包含哪些?
5.SQL规范
6.何时存放图片到数据库?
7.什么是自链接,内连接?
8.什么是左外连接,右外连接?
9.什么是多行子表?单行子表?
10.什么是分页?如何?
11.如何插入百万数据?
12.如何删除重复的记录?
13.like中 -,%的作用?
14.order by..asc/desc?
15.几种约束条件?
16.”与null的区别?
17.alter的使用?
18.如何备份和恢复?
19.如何备份表?
20.pc一共多少端口?具体有哪些?

21.什么是JDBC?什么是ODBC?
22.Statement和PreparedStatement区别
23.java操作具体代码?
24.group by, having作用?其余还有哪些知识点?
25.组合键的使用
26.什么是聚合函数?
27.exists是什么?
28.删除语句?
29.SQL操作符有哪些?

2.实例检测

2.1

Student(Sid,Sname,Sage,Ssex) 学生表 学号,姓名,年龄,性别
Course(Cid,Cname,Tid) 课程表 课号,课程名字,教师编号
Score(Sid,Cid,Score) 成绩表 学号,课号,成绩
Teacher(Tid,Tname) 教师表 教师编号,名字

问题:
题号Content
1、查询“001”课程比“002”课程成绩高的所有学生的学号;
2、查询平均成绩大于60分的同学的学号和平均成绩;
3、查询所有同学的学号、姓名、选课数、总成绩;
4、查询姓“李”的老师的个数;
5、查询没学过“冒晓燕”老师课的同学的学号、姓名;
6、查询学过“001”并且也学过编号“002”课程的同学的学号、姓名
ANSWER:
1.
-- 1.
select t1.Sid from (select * from Score where score.cid = '001') t1 , (select * from Score where score.cid = '002') t2
where (t1.Sid = t2.Sid)and(t1.scr>t2.scr)
2.
-- 2.
select sid,AVG(scr) from score group by sid having AVG(scr)>60
3.
-- 3. 第一种正确,第二种错误,分析原因。理解left join
select student.sid, student.sname,count(score.cid),SUM(score.scr) 
from student left join score on student.sid = score.sid group by student.sid, sname

select student.sid, student.sname count(score.cid),SUM(score.scr) 
from score left join student on student.sid = score.sid group by student.sid, student.sname
4.
select tname from teacher where teacher.tname like '李%'
5.
select distinct student.sid, student.sname from student 
where student.sid not in 
(select score.sid from score, course, teacher where teacher.tname = '冒晓燕' and teacher.tid=course.tid and course.cid=score.cid)
6.
select student.sid, student.sname from student , score a ,score b group by b.cid,a.cid,a.sid,b.sid,student.sid,student.sname 
having (b.sid=student.sid and a.sid=student.sid and a.cid = '001' and b.cid='002')
---方法二,使用exists
select Student.Sid,Student.Sname from Student,Score 
where Student.Sid=Sscore.Sid and Score.Cid='001'and 
exists( Select * from Score as Score2 where Score2.Sid=Score.Sid and Score2.Cid='002');

2.2面试题151207

1.

自动编号 学号 姓名 课程编号 课程名称 分数
1 2005001 张三 0001 数学 69
2 2005002 李四 0001 数学 89
3 2005001 张三 0001 数学 69
删除除了自动编号不同, 其他都相同的学生冗余信息

2.

一个叫 team 的表,里面只有一个字段name, 一共有4 条纪录,分别是a,b,c,d, 对应四个球对,现在四个球对进行比赛,用一条sql 语句显示所有可能的比赛组合.

2.2-answer

1.

delete from mytable where 自动编号 not in(select min(自动编号) from mytable group by 学号,姓名,课程编号,课程名称,分数)

2.要注意a b和b a是相等的

select * from team t1, team t2 where t1.name < t2.name

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

猎羽

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值