导航菜单
首页 >  » 正文

1.假设学生—课程数据库关系模式如下: S(Sno,Sname,Sage,Ssex) C(Cno 设有学生 课程关系数据库,它由三个关系组成。它们的模式是:学生S(学号S#,姓名SN,所在系SD,年龄SA)、

1.假设学生—课程数据库关系模式如下: S(Sno,Sname,Sage,Ssex) C(Cno

1 select * from S
2 select sname, 2014-Sage from S
3 select sname, sage from S where sage between 20 and 22
4 select * from S order by sdept asc, sage desc
5 select S.sno, sname from S, C, SC where S.sno=SC.sno and SC.cno=C.cno and Cname=数据库

设有学生 课程关系数据库,它由三个关系组成。它们的模式是:学生S(学号S#,姓名SN,所在系SD,年龄SA)、

select distinct Sn
from S,C,SC
where S.S#=SC.S#
and C.C#=SC.C#
and Cn in(select Cn from S,C,SC
where S.S#=SC.S#
and C.C#=SC.C#
and S.S#=s5)

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

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

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

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=计算机信息管理
希望能给你帮助 差不多一样

有一个[学生课程]数据库,数据库中包括三个表:

1
create table student(
sno varchar(5) not null primary key,
sname varchar(10),
ssex char(2),
sage int,
sdept varchar(20))
2
alter table student add scome datetime
3
select sno,grade from sg where cno=5 order by grade desc
4
select max(grade) as 最高成绩,avg(grade) as 平均成绩 from sg where cno=1
5
delete from student where sno=05019

有一个“学生-课程”数据库,数据库中包括三个表: (1) “学生”表S由学号(Sno)、姓名(Sname)、性别

1)查出“计算机系”选课有“数据库基础与应用”学生的学号,姓名,成绩,按照学号升序显示
2)“信息工程系”学生的(avg)平均年龄,并打印结果。其中WHERE Sno= @S_Sno条件,没有定义@S_Sno怎么就给这个学号赋值了呢?
3)s=13
x=21
4)窗体加载时,Check1应该是一个控件名,当他的calue为0的时候。DataGrid数据控件允许删除功能,可以添加新信息(AllowAddNew不太确定,没有见过)

6. 有一个“学生-课程”数据库,数据库中包括三个表: (1) “学生”表Student由学号、姓名、性别、年龄、所在系五个属性组成,记为: Student(学号,姓名,性别,年龄,所在系) ,学号为关键字。

1. create table Student ( 学号 varchar(10) primary key, 姓名 varchar(20), 性别 char(2), 年龄 int, 所在系 varchar(10) ) 2. select * from Student where 所在系=计算机 order by 学号 desc 3.select Student.学号,Student.姓名,Student.性别 from Student join 学生选课表 on 学生学号表.学号=Student.学号 join 课程表 on 课程表.课程号=学生选课表.课程号 where 课程表.学分>5 and 学生选课表.成绩>60

相关推荐: