首页数据库数据库题库,软考数据库工程师历年真题

数据库题库,软考数据库工程师历年真题

编程之家2026-05-24939次浏览

各位老铁们,大家好,今天由我来为大家分享数据库题库,以及软考数据库工程师历年真题的相关问题知识,希望对大家有所帮助。如果可以帮助到大家,还望关注收藏下本站,您的支持是我们最大的动力,谢谢大家了哈,下面我们开始吧!

数据库题库,软考数据库工程师历年真题

数据库题目求答案

1.创建表department。该表有三个字段:department_id(char,10)不允许为空、department_name(nchar,8)不允许为空、department_header(nchar,5)。

create table department(xx char(10) not null, xxname nchar(8) not null, xxheader nchar(5))

2.创建表book。该表有三个字段:book_id(int)主键、book_name(nvarchar,10)、author_name(nchar,5)。

create table book(id int Primary Key, aname nchar(5))

忘了怎么写了,你从SQL表点右键-》生成表SQL,就有了。

3.将表book的book_name字段的长度改为15

数据库题库,软考数据库工程师历年真题

alter table book alter book_name varChar(15) not null

4.将表book增加两个字段:book_copy_no(char,10),publish_date(smalldatetime)

alter table book add copy_no char(10), dPublish smalldatetime

5.将表book的新增加的两个字段book_copy_no,publish_date删除

alter table remove book_copy_no, dPublish

这里有个问题,要是以前有约束,要先drop掉约束才行。

数据库题库,软考数据库工程师历年真题

6.向department表中插入一行数据,具体数据如下:

department_id:dep04,department_name:管理系,department_header:张三。

insert into department(id, name, head) values('dep04','管理系','张三')

7.将6插入的一行数据中department_name由“管理系”改为“计算机系”。

update biao set xxname='计算机系' where xxname='管理系'

这里也有个问题,一个表里应该有一个主键,这样做是不合适的。

8.将6插入的数据从department表中删除掉。

delete from department where xxname='计算机系'

应该是where主键=XX最好

9.为department表中的department_id+ department_name添加一个主键约束。

alter table department add CONSTRAINT [pk_myself](depaid, depName) on [Primary]

10.为表Department中的department_header列添加一个UNIQUE约束。

不会

11.为表book的book_id字段创建一个检查约束,使得book_id的值在10000-50000之间。

不会,从企业管理器里很容易,哈哈。

12.创建表bookborrow。该表有三个字段:book_id(int)主键、reader_id(int)、borrow_date(datetime)。

跟前边差不多,自己看看。

为bookborrow表中的书号列(book_id)添加一个与book表中的主键book_id进行关联的FOREIGN KEY约束。

SQL数据库试题求解

------------------------------------------------------

create table students(st_id varchar(20),st_name varchar(50),sex varchar(10))

insert into students(st_id,st_name,sex)

select'st001','张杰','男' union all

select'st002','公孙燕飞','男' union all

select'st003','王楠','女' union all

select'st004','王伟','男' union all

select'st005','李燕纹','女' union all

select'st006','孙武','男'

select*

from students

create table teachers(t_id varchar(20),t_name varchar(50),t_lesson varchar(50))

insert into teachers

select't001','张老师','数学' union all

select't002','李老师','英语'

delete from results

create table results(r_id varchar(20),r_fenshu int,r_stid varchar(50),r_tid varchar(50))

insert into results

select'r001','90','st001','t002' union all

select'r002','68','st005','t001' union all

select'r003','92','st003','t001' union all

select'r004','82','st006','t002' union all

select'r005','70','st002','t002' union all

select'r006','86','st002','t001' union all

select'r007','57','st003','t002' union all

select'r008','76','st006','t001' union all

select'r009','55','st001','t001' union all

select'r010','77','st004','t002' union all

select'r011','58','st005','t002'

----------------------------------------------------------

1.

select st_id

from students

where st_name='王伟'

2.select st_id,st_name

from students

where st_name like'__燕%'

3 select st_name,len(st_name) as名字长度

from students

where sex='男'

4 select min(r_fenshu) as最低分数

from teachers t inner join results r on t.t_id=r.r_tid

where t_lesson='数学'--这个是不考虑成绩中有null值的

5 select s.st_id as学生编号,r_fenshu as分数,r_tid as课目号

from students s inner join results r on s.st_id=r.r_stid

where s.sex='女'

--如果还要课目的名称的话请用下面的

select s.st_id as学生编号,r.r_fenshu as分数,r.r_tid as课目号,t.t_lesson as课目名称

from students s inner join results r on s.st_id=r.r_stid

inner join teachers t on r.r_tid= t.t_id

where s.sex='女'

6 select avg(r.r_fenshu)

from results r inner join teachers t on r.r_tid= t.t_id

where t.t_lesson='英语'

7.select*

from students s inner join results r on s.st_id=r.r_stid

inner join teachers t on r.r_tid= t.t_id

where s.st_id in(select top 2 st_id from students order by st_id desc)

order by s.st_id desc

8 select sum(r.r_fenshu) as总分

from results r inner join students s on r.r_stid=s.st_id

where s.st_name='王楠'

9.select distinct s.st_id,s.st_name

from students s inner join results r on s.st_id= r.r_stid

where st_id not in(select r_stid from results where r_fenshu<60) and st_id not in(select r_stid from results where r_fenshu>=90)

10 update results

set r_fenshu= r_fenshu+ 10

--如果分数不可能大于100请用这句 set r_fenshu= case when r_fenshu+ 10<=100 then r_fenshu+ 10 else 100 end

where r_stid in(select st_id from students where sex='女')

1进阶题

select t.t_name,count(*)

from students s,teachers t,results r

where r.r_tid= t.t_id

and s.st_id=r.r_stid

and r.r_fenshu>= 60

and t.t_id in(select t_id from teachers where t_lesson='数学')

--and t_lesson='数学'

group by t.t_name

2

select top 1 sum(r_fenshu) as总分,t.t_lesson,t_id,t_name

from results r,teachers t

where r.r_tid= t.t_id

group by t.t_lesson,t_id,t_name

order by总分 desc

3. delete from results where r_stid in(select r_stid from results group by r_stid having count(r_tid)= 1)

1选做题

select d.name from sysobjects d where d.xtype='U'

2.select top 5* from students order by newid()

求数据库题目答案

81.对于分布式数据库,可以简单归纳为( A)

A.数据逻辑上分散,物理上统一 B.数据物理上分散,逻辑上统一

C.数据在逻辑上、物理上都是分散的 D.数据在逻辑上、物理上都是统一的

82.子模式DDL用来描述( A)

A.数据库的总体逻辑结构B.数据库的局部逻辑结构

C.数据库的物理存储结构D.数据库的概念结构

83.在DBS中,DBMS和OS之间的关系是( B)

A.相互调用 B. DBMS调用OS

C. OS调用DBMS D.并发运行

84.在关系R与关系S进行自然连接时,只把R中原该舍弃的元组保存到新关系中,这种操作称为( C)

A.外连接 B.内连接 C.左外连接 D.右外连接

85.在SQL中使用FOREIGN KEY时,与之配合的语句是( D)

A.EXISTS B.EXCEPT C.TABLE D.REFERENCES

86.在数据库设计中,将ER图转换成关系数据模型的过程属于( C)

A.需求分析阶段 B.逻辑设计阶段 C.概念设计阶段 D.物理设计阶段

87.定义片段以及全局关系与片段之间映像的模式是( D)

A.外模式 B.概念模式 C.分片模式 D.分配模式

88.在数据库技术中,未提交的随后又被撤消的数据称为( D)

A.错误数据 B.冗余数据 C.过期数据 D.脏数据

89.下述各项中,属于数据库系统的特点的是( C)

A.存储量大 B.存取速度快 C.数据独立性 D.操作方便

91. SQL的全局约束是指基于元组的检查子句和(B)

A.非空值约束 B.域约束子句

C.断言 D.外键子句

92.分布式数据库系统中分片模式和分配模式均是( C)

A.全局的 B.局部的

C.分布的 D.集中的

93.在数据库系统中,视图可以提供数据的(A)

A.完整性 B.并发性 C.安全性 D.可恢复性

94.在分布式数据库中,数据的垂直分片是对全局关系的(B)

A.选择操作 B.投影操作

C.自然联接操作 D.半联接操作

95.在关系数据库中,表与表之间的联系是通过( D)实现的。

A.实体完整性规则B.参照完整性规则

C.用户自定义的完整性规则D.主键

96.以下操作中,不能用DML实现的是( B)

A.数据查询B.定义数据库的三级结构

C.数据插入D.数据删除

97.如果关系R和S进行自然连接时,只把S中原该舍弃的元组保存到新关系中,这种操作称为( D)

A.外连接B.内联接 C.左连接D.右外连接

98.在关系中,能唯一标识组的属性集称为关系模式的( B)

A.候选键 B.主键 C.外键 D.超键

99.能够消除多值依赖引起的冗余的范式是( C)

A.2NF B.3NF C.4NF D.BCNF

100.在面向对象的模型中,表示实体中的每个属性时,使用( A)

A.两个变量,一个消息 B.两个变量,两个消息

C.一个变量,两个消息 D.一个变量,一个消息

老长时间不看了不干保证全队…………

文章分享结束,数据库题库和软考数据库工程师历年真题的答案你都知道了吗?欢迎再次光临本站哦!

php后缀的网站骗局?php后缀的文件怎么打开精美网页源码网站?优秀的网页设计网站