导航菜单
首页 >  » 正文

数据库题,设有一个学生—课程数据库,其中包括三个表 数据库完整性的定义一般由SQL的()语句来实现。 是DDL还是DML

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

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的()语句来实现。 是DDL还是DML

此题答案为DDL。
数据库模式定义语言DDL(Data Definition Language),是用于描述数据库中要存储的现实世界实体的语言。一个数据库模式包含该数据库中所有实体的描述定义。这些定义包括结构定义、操作方法定义等。
DML = Data Manipulation Language,数据操纵语言,命令使用户能够查询数据库以及操作已有数据库中的数据的计算机语言。具体是指是UPDATE更新、INSERT插入、DELETE删除。
DML(Data Manipulation Language)数据操纵语言,SQL的分类之一,此外还有DDL(Data Definition Language)数据定义语言和DCL(Data Control Language)数据控制语言。DML包括:INSERT、UPDATE、DELETE。注意,select语句属于DQL(Data Query Language)。1

Oracle题:创建一个函数,以员工号为参数,返回该员工所在部门的平均工资。

以员工号为参数,返回该员工所在部门的平均工资
create or replace function fun_sal(p_empno emp.empno%type)
return emp.sal%type
as v_sal emp.sal%type;
begin
select avg(sal) into v_sal from emp where deptno=
(select deptno from emp where empno=p_empno);
return v_sal;
end
begin
dbms_output.put_line (fun_sal (7844));
end;

扩展资料
例1:创建一个存储过程,以员工号为参数,输出该员工的工资。
create or replace procedure showsal(p_empno emp.empno%type) as v_sal emp.sal%type; begin 
select sal into v_sal from emp where empno=p_empno;  dbms_output.put_line(v_sal); end; begin  showsal(7844); end;
例2:创建一个函数,以部门号为参数,返回该部门的平均工资;
create or replace function fun_avgsal(p_deptno emp.deptno%type) return emp.sal%type as v_sal emp.sal%type; begin
select avg(sal) into v_sal from emp where deptno=p_deptno;  return v_sal; end; begin  dbms_output.put_line (fun_avgsal(10));  end;

18、 在EXCEL中,下面关于分类汇总的叙述错误的是

你好!
分类字段只能是一个,答案B是正确的。
叙述错误是是:A、C、D。
如有疑问,请追问。

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

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

在excel中,对数据库分类汇总之前,首先要进行的操作是( )

在excel中,对数据库分类汇总之前,首先要进行的操作是“排序”,排序的目的是使相同字段的记录(数据行)排列在一起,以便进行分类汇总。
操作方法:
1、首先选中需要进行分类汇总操作的数据单元格。

2、点击排序按钮选择“升序”或者“降序”排列,将相同数据排在一起。

3、然后点击“数据”中的“分类汇总”选项。

4、在打开的对话框中选择需要分类汇总的项目,并点击“确定”。

5、选中的单元格区域即可根据选择的项目进行分类汇总展示。

相关推荐: