导航菜单
首页 >  » 正文

下列用于定义字段的SQL 语句中,错误的是 数据库试题

数据库试题

二、选择题 1、B 2、B 3、D 4、C 5、D 6、C 7、D 8、C 9、A 10、D 三、判断题 1、对 2、对 3、错,数据文件只能有一个,日志可以有多个 4、错 5、错,float(24)最多7位 6、对 7、对 8、对 9、错 10、对 11、对 12、对 13、对 14、对 15、错 做完了,也检查过了。

SQL关系代数,求至少选修了两门以上课的学生的学号,用关系代数写出来。

study(sno,cno,score)查询至少选修了两门课程的学生学号:π1(σ(1=4Λ2!=5)(study x study))

数据库试题

二、选择题
1、B
2、B
3、D
4、C
5、D
6、C
7、D
8、C
9、A
10、D
三、判断题
1、对
2、对
3、错,数据文件只能有一个,日志可以有多个
4、错
5、错,float(24)最多7位
6、对
7、对
8、对
9、错
10、对
11、对
12、对
13、对
14、对
15、错
做完了,也检查过了。

使用SQL语句删除没有学生选修的课程记录

这个我也答了
delete from 课程 where 课程号 not in(select 课程号 from 选课)

数据库题,设有一个学生—课程数据库,其中包括三个表

1.查询所有学生的学号、姓名、所在系
Select sno,sname,sdept
From student
2.查询全体学生的学号、姓名、性别,年龄,系别的信息
Select *
From student
3.查询全体学生的姓名及其出生年份
Select sname,datadiff(year,sage,2010) as 出生年份
From student
4.查询信息工程系全体学生的名单
Select sname
From student
Where sdept=’信息工程系’
5.查询所有年龄在20岁以下的学生姓名以及年龄
Select sname,sage
From student
Where sage<20
6.查询考试成绩不及格的学生的学号
Select sno
From score
Where grade<60
7.查询年龄在20-25(包括20、25)之间的学生的姓名、系别和年龄
Select sname,sdept,sage
From student
Where sage>=20 and sage<=25
8.查询不在软件系、网络系、也不在外语系学生的姓名和性别
select sname,sex
from student
where sdept <>软件系、网络系、外语系
9.查询所有姓李且全名为三个汉字的学生的姓名、学号、和性别
select sname,sno,sex
from student
where sname like 李_ _
10.查询姓名中第二个字为阳字的学生的姓名
select sname
from student
where sname like _阳%
11.查询信息工程系年龄在20岁以下的学生的姓名
select sname
from student
where sage<20 and sdept=信息工程系
12.查询选修了3号课程的学生的学号及其成绩,查询结果按分数的降序排列
select sno,grade
from score
where cno=3
order by grade desc
13.查询全体学生的学号、姓名等情况,结果按照所在系的升序排序,同一系的按年龄降序排列
select sno,sname
from student
order by sdept asc,sage desc
14.统计学生总人数
select count(*) as 人数
from student
15.查询选修课课程的学生人数
select count(*) as 人数
from score
16.计算1号课程的学生平均分数
select avg(grade) 均分
from score
where cno=1
17.查询选修了1号课程的学生最高分数
select max(grade) 最高分
from score
where cno=1
18.求各课程号及相应的选修课人数
select cno,distinct(sno)
from score
group by cno
19.查询选修了3门以上课程的学生号
select sno
from score
group by sno
having count(cno)>3
20.查询选修2学分的课程且该课程的成绩在90分以上的所有学生的姓名
select sname
from student,course,score
where student.sno=score.sno and course.cno=score.cno and ccredit=2 and grade>90
21.查询每个学生的学号、姓名、选修的课程号和成绩
select student.sno,sname,cno,grade
from student,score,course
where student.sno=score.sno and score.cno=course.cno
22.查询所有选修了1号课程的学生姓名
select sname
from student,score
where student.sno=score.sno and score.cno=1
23.查询选修了课程名为“计算机信息管理”的学生的学号和姓名
select sno,sname
from student,course,score
where student.sno=score.sno and course.cno=score.cno
and cname=计算机信息管理
希望能给你帮助 差不多一样

用sql语句查询选修了3门及以上课程的学生学号,姓名,选修的课程数

SELECT学号FROM选课表GROUPBY学号HAVINGCOUNT(*)>=3
【拓展】
1. SQL即结构化查询语言(Structured Query Language),是一种特殊目的的编程语言,是一种数据库查询和程序设计语言,用于存取数据以及查询、更新和管理关系数据库系统;同时也是数据库脚本文件的扩展名。
2. SQL语句无论是种类还是数量都是繁多的,很多语句也是经常要用到的,SQL查询语句就是一个典型的例子,无论是高级查询还是低级查询,SQL查询语句的需求是最频繁的。
3. 基本语句 数据记录筛选:
4. sql="select * from 数据表 where字段名=字段值 order by字段名[desc]"(按某个字段值降序排列。默认升序ASC)
5. sql="select * from 数据表 where字段名like %字段值% order by 字段名 [desc]"
6. sql="select top 10 * from 数据表 where字段名=字段值 order by 字段名 [desc]"
7. sql="select top 10 * from 数据表 order by 字段名 [desc]"
8. sql="select * from 数据表 where字段名in (值1,值2,值3)"
9. sql="select * from 数据表 where字段名between 值1 and 值2"

相关推荐: