文档库 最新最全的文档下载
当前位置:文档库 › 山东大学数据库实验答案

山东大学数据库实验答案

山东大学数据库实验答案
山东大学数据库实验答案

数据库实验(一)

1、create table test1_teacher(

tid char(6) primary key,name varchar(10) not null,

sex char(2),age int, dname varchar(10) )

create index index_table1 on test1_teacher(name);

insert into test1_teacher values('100101','张老师','男',44,'计算机

学院');

insert into test1_teacher values('100102','李老师','女',45,'软件学

院');

insert into test1_teacher values('100103','马老师','男',46,'计算机

学院');

2、create table test1_student(

sid char(12) primary key, name varchar(10) not null,sex char(2),

age int, birthday date, dname varchar(10),class varchar(10))

create index index_table2 on test1_student(name);

insert into test1_student values('200800020101','王欣','女',19,

to_date('19940202','yyyymmdd'),'

计算机学院','2010');

insert into test1_student values('200800020102','李华','女',20,

to_date('19950303','yyyymmdd'),'

软件学院','2009');

insert into test1_student values('200800020103','赵岩','男',18,

to_date('19960404','yyyymmdd'),'

软件学院','2009');

3、create table test1_course( cid char(6) primary key, name varchar(10) not null,

fcid char(6),credit numeric(2,1) )

create index index_table3 on test1_course(name);

insert into test1_course values('300001','数据结构','',2);

insert into test1_course values('300002','数据库','300001',2.5);

insert into test1_course values('300003','操作系统','300001',4);

4、 create table test1_student_course(

sid char(12) , cid char(6) , score numeric(5,1), tid char(6), primary key(sid,cid),

FOREIGN KEY (sid) REFERENCES test1_student(sid),

FOREIGN KEY (cid) REFERENCES test1_course(cid),

FOREIGN KEY (tid) REFERENCES test1_teacher(tid) )

insert into test1_student_course

values('200800020101','300001',91.5,'100101');

insert into test1_student_course

values('200800020101','300002',92.6,'100102');

insert into test1_student_course

values('200800020101','300003',93.7,'100103');

5、create table test1_teacher_course( tid char(6) , cid char(6) , primary key(tid,cid),

FOREIGN KEY (tid) REFERENCES test1_teacher(tid),

FOREIGN KEY (cid) REFERENCES test1_course(cid) )

insert into test1_teacher_course values('100101','300001');

insert into test1_teacher_course values('100102','300002');

insert into test1_teacher_course values('100103','300003');

数据库实验(二)检索查询

1、create table test2_01 as select sid ,name

from pub.student

where sid not in(select sid from pub.student_course)

2、create table test2_02 as select distinct student.sid,name

from pub.student, pub.student_course

where student_course.sid = student.sid and student_course.cid in (select cid from pub.student_course where sid='200900130417')

3、create table test2_03 as select distinct student.sid,name

from pub.student, pub.student_course

where student_course.sid = student.sid and student_course.cid in (select cid from pub.course where fcid='300002')

4、create table test2_04 as select sid,name

from pub.student

where sid in

(select sid

from pub.student_course,pub.course

where student_course.cid=course.cid and name ='操作系统')

and sid in

(select sid

from pub.student_course,pub.course

where student_course.cid=course.cid

and name ='数据结构')

5.create table test2_05 as select student.sid,name,

cast(avg(score) as numeric(5,0)) avg_score,sum(score) sum_score

from pub.student,pub.student_course

where student.sid = student_course.sid and age ='20'

group by student.sid,name

使用CAST: CAST ( expression AS data_type )

使用CONVERT: CONVERT (data_type[(length)], expression [, style])

6、create table test2_06 as select sid,max(score) max_score

from pub.student_course

group by cid

7.create table test2_07 as select sid,name

from pub.student

where name not in

(select name

from pub.student

where name like '张%' or name like '李%' or name like '王%')

8、create table test2_08 as select substr(name,1,1) second_name,count(*) p_count

from pub.student

group by substr(name,1,1)

SUBSTR(string,start,count)取子字符串,从start开始(如果start是负数,从尾部开始),取count个.上述就是PL/SQL函数的解释,从中可以看出,是1开始从左开始取数;如果是负值,那么就从右开始取数。

9、create table test2_09 as select student.sid,https://www.wendangku.net/doc/155322675.html,,score

from pub.student,pub.student_course

where student.sid = student_course.sid and cid ='300003'

10、create table test2_10 as select sid,cid

from pub.student_course

where score is not null

实验三

1.create table test3_01 as select * from pub.student_31;delete from test3_01 where not regexp_like(sid,'^[[:digit:]]+$')

2.create table test3_02 as select * from pub.student_31;delete from test3_02 where sid not in(select sid from test3_02 where age=2012-extract(year from birthday))

3.create table test3_03 as select * from pub.student_31;delete from test3_03 where sid not in(select sid from test3_03 where sex='男'or sex='女'or sex is null)

4.create table test3_04 as select * from pub.student_31;delete from test3_04 where sid in(select sid from test3_04 where dname is null or length(dname)<3 or dname like'% %')

5.create table test3_05 as select * from pub.student_31;delete from test3_05 where sid not in(select sid from test3_05 where class not like'%级' and length(class)=4)

6.

7.create table test3_07 as select * from pub.Student_course_32;delete from test3_07 where sid not in(select pub.Student.sid from pub.student,pub.Student_course_32 where pub.student.sid=pub.Student_course_32.sid)

8-.create table test3_08 as select * from pub.Student_course_32;delete from test3_08 where sid in(select pub.Student_course_32.sid from pub.teacher_course,pub.Student_course_32 where pub.teacher_course.tid=pub.Student_course_32.tid and pub.teacher_course.cid=pub.Student_course_32.cid)

9.create table test3_09 as select * from pub.Student_course_32 where score between 0 and 100

10.create table test3_10 as select sid,pub.Student_course_32.cid,score,pub.Student_course_32.tid from pub.Student_course_32,pub.teacher_course where pub.Student_course_32.cid = pub.teacher_course.cid and pub.Student_course_32.tid = pub.teacher_course.tid

delete from test3_10 where sid not in(select sid from test3_10 where score between 0 and 100)

delete from test3_10 where sid not in(select pub.student.sid from pub.student,pub.student_course_32 where pub.student.sid=pub.student_course_32.sid)

delete from test3_10 where sid not in(select sid from pub.course,pub.student_course_32 where pub.course.cid=pub.student_course_32.cid)

delete from test3_10 where sid not in(select sid from pub.teacher,pub.student_course_32 where pub.teacher.tid=pub.student_course_32.tid

实验4.

1.create table test4_01 as select * from pub.student_41

alter table test4_01 add(sum_score int,avg_score numeric(5,1),sum_credit int,did varchar(2))

update test4_01 set sum_score=(select sum(score) from pub.student_course where pub.student_course.sid=test4_01.sid group by pub.student_course.sid )

2.create table test4_02 as select * from pub.student_41

alter table test4_02 add(sum_score int,avg_score numeric(5,1),sum_credit int,did varchar(2))

update test4_02 set avg_score=(select avg(score) from pub.student_course where pub.student_course.sid=test4_02.sid group by pub.student_course.sid )

3.create table test4_03 as select * from pub.student_41

alter table test4_03 add(sum_score int,avg_score numeric(5,1),sum_credit int,did varchar(2))

update test4_03 set sum_credit=(select sum(credit) from pub.student_course,pub.course where pub.student_course.cid=pub.course.cid and pub.student_course.sid=test4_03.sid group by pub.student_course.sid)

4.create table test4_04 as select * from pub.student_41

alter table test4_04 add(sum_score int,avg_score numeric(5,1),sum_credit int,did varchar(2)) create table temp as select * from pub.department union select * from pub.department_41 update test4_04 set did=(select did from temp where temp.dname=test4_04.dname)

update test4_04 set did='00' where did is null

drop table temp

5.create table test4_05 as select * from pub.student_41

alter table test4_05 add(sum_score int,avg_score numeric(5,1),sum_credit int,did varchar(2))

update test4_05 set sum_score=(select sum(score) from pub.student_course where pub.student_course.sid=test4_05.sid group by pub.student_course.sid )

update test4_05 set avg_score=(select avg(score) from pub.student_course where pub.student_course.sid=test4_05.sid group by pub.student_course.sid )

update test4_05 set sum_credit=(select sum(credit) from pub.student_course,pub.course where pub.student_course.cid=pub.course.cid and pub.student_course.sid=test4_05.sid group by pub.student_course.sid)

create table temp as select * from pub.department union select * from pub.department_41 update test4_05 set did=(select did from temp where temp.dname=test4_05.dname)

update test4_05 set did='00' where did is null

drop table temp

6.create table test4_06 as select * from pub.student_42

update test4_06 set name=replace(name,' ','')

7.create table test4_07 as select * from pub.student_42

update test4_07 set sex=substr(sex,1,1) where sex like'_性'

update test4_07 set sex=replace(sex,' ','')

8.create table test4_08 as select * from pub.student_42

update test4_08 set class=substr(class,1,4) where class like '____级'

9.create table test4_09 as select * from pub.student_42

update test4_09 set age=2012-extract(year from birthday) where age is null

10.create table test4_10 as select * from pub.student_42

update test4_10 set name=replace(name,' ','')

update test4_10 set dname=replace(dname,' ','')

update test4_10 set sex=substr(sex,1,1) where sex like'_性'

update test4_10 set sex=replace(sex,' ','')

update test4_10 set class=substr(class,1,4) where class like '____级'

update test4_10 set age=2012-extract(year from birthday) where age is null

实验六

1.create view test6_01 as select sid,name,dname from pub.student where age<20 and

dname='物理学院' order by sid

2.create view test6_02 as select pub.student.sid,name,sum(score) sum_score from pub.student,pub.student_course where pub.student_course.sid=pub.student.sid and dname='软件学院' and class='2009' group by pub.student.sid,https://www.wendangku.net/doc/155322675.html,

3.create view test6_03 as select pub.student.sid,https://www.wendangku.net/doc/155322675.html,,score from pub.student,pub.student_course,pub.course where pub.student_course.sid=pub.student.sid and pub.student_course.cid=pub.course.cid and dname='计算机科学与技术学院' and class='2010' and https://www.wendangku.net/doc/155322675.html,='操作系统'

4.create view test6_04 as select pub.student.sid,https://www.wendangku.net/doc/155322675.html, from pub.student,pub.student_course,pub.course where pub.student_course.sid=pub.student.sid and pub.student_course.cid=pub.course.cid and https://www.wendangku.net/doc/155322675.html,='数据库系统' and score>90

5.create view test6_05 as select pub.student.sid,pub.course.cid,https://www.wendangku.net/doc/155322675.html,,score from pub.student,pub.student_course,pub.course where pub.student_course.sid=pub.student.sid and pub.student_course.cid=pub.course.cid and https://www.wendangku.net/doc/155322675.html,='李龙'

6.create view test6_06 as select sid from pub.student_course where pub.student_course.cid =all(select cid from pub.course) group by sid

7.create view test6_07 as select pub.student.sid,https://www.wendangku.net/doc/155322675.html, from pub.student where pub.student.sid in(select sid from pub.student_course)

8.create view test6_08 as select a1.cid,https://www.wendangku.net/doc/155322675.html, from pub.course

a1,pub.course a2 where a1.fcid =a2.cid and a2.credit=2

9.create view test6_09 as select pub.student.sid,https://www.wendangku.net/doc/155322675.html,,sum(credit) sum_credit from pub.student,pub.student_course,pub.course where pub.student_course.sid=pub.student.sid and pub.student_course.cid=pub.course.cid and pub.student.class='2010' and pub.student.dname='化学与化工学院' and score>=60 group by pub.student.sid,https://www.wendangku.net/doc/155322675.html,

10.create view test6_10 as select a1.cid,https://www.wendangku.net/doc/155322675.html, from pub.course a1,pub.course a2 where a1.fcid =a2.cid and a2.fcid is not nul

实验七.综合查询

1.

create view a as select SUBSTR(name,2,2) as First_name from pub.student

create view b as select First_name,count(First_name) as frequency from a group by First_name create table test7_01 (First_name varchar(4),frequency numeric(4))

insert into test7_01(First_name,frequency) select * from b

2.

create view a as select SUBSTR(name,2,1) as letter from pub.student union all (select SUBSTR(name,3,1) as letter from pub.student where SUBSTR(name,3,1) is not null)

create view b as select letter,count(letter) as frequency from a group by letter

create table test7_02(letter varchar(2),frequency numeric(4))

insert into test7_02(letter,frequency) select * from b

3.

create table test7_03 (dname varchar(30), class varchar(10), P_count1 int, P_count2 int, P_count int)

insert into test7_03

select dname,class,0,0,COUNT(sid)

from pub.student

where dname is not null group by dname,class

create table t as select dname,class,pub.student.sid,sum(credit) sum_credit

from pub.student,pub.course,pub.student_course

where pub.student.sid=pub.student_course.sid and pub.student_course.cid= pub.course.cid and score >= 60 and dname is not null group by dname,class,pub.student.sid

update test7_03 set p_count1=(select count(sid) num from t where sum_credit>= 10 and test7_03.dname = t.dname and test7_03.class=t.class group by dname,class)

update test7_03 set p_count1= 0 where p_count1 is null

update test7_03 set p_count2 = p_count-p_count1

4.

create table test7_04 (dname varchar(30), class varchar(10), P_count1 int, P_count2 int, P_count int)

insert into test7_04

select dname,class,0,0,COUNT(sid)

from pub.student

where dname is not null group by dname,class

create table t as select dname,class,pub.student.sid,sum(credit) sum_credit

from pub.student,pub.course,pub.student_course

where pub.student.sid=pub.student_course.sid and pub.student_course.cid= pub.course.cid and score >= 60 and dname is not null group by dname,class,pub.student.sid

update test7_04 set p_count1= (select count(sid) num from t where sum_credit>= 8 and test7_04.dname = t.dname and test7_04.class=t.class group by dname,class)where

test7_04.class<=2008

update test7_04 set p_count1= (select count(sid) num from twhere sum_credit>= 10 and test7_04.dname = t.dname and test7_04.class=t.class group by dname,class)where test7_04.class>2008

update test7_04 set p_count1= 0 where p_count1 is null

update test7_04 set p_count2 = p_count-p_count1

实验八.报表统计

1.create table test8_01(Dname varchar(30),Avg_ds_score int,Avg_os_score int)

insert into test8_01 select dname,round(avg(score),0),0

from pub.student,pub.course,pub.student_course

where pub.student.sid=pub.student_course.sid and pub.student_course.cid= pub.course.cid and dname is not null and https://www.wendangku.net/doc/155322675.html,='数据结构' group by dname

update test8_01 set Avg_os_score=(select avg(score)

from pub.student,pub.course,pub.student_course

where pub.student.sid=pub.student_course.sid and pub.student_course.cid= pub.course.cid and dname is not null and test8_01.dname=pub.student.dname

and https://www.wendangku.net/doc/155322675.html,='操作系统'

group by dname)

2.select * from pub.student

create table test8_02(sid varchar(12),name varchar(10),dname varchar(30),ds_score int,os_score int)

insert into test8_02 select pub.student.sid,https://www.wendangku.net/doc/155322675.html,,dname,0,0 from pub.student

where dname='计算机科学与技术学院' and sid in

(select sid from pub.student_course

where cid=(select cid from pub.course

where name='数据结构')

intersect(select sid from pub.student_course

where cid=(select cid from pub.course

where name='操作系统')))

update test8_02 set ds_score=(select score from pub.student_course where cid=(select cid from pub.course where name='数据结构') and test8_02.sid=pub.student_course.sid)

update test8_02 set os_score=(select score from pub.student_course where cid=(select cid from pub.course where name='操作系统') and test8_02.sid=pub.student_course.sid)

3.create table test8_03(sid varchar (12),name varchar(10),dname varchar(30),ds_score

int,os_score int)

insert into test8_03 select pub.student.sid,https://www.wendangku.net/doc/155322675.html,,dname,null,null from pub.student where dname='计算机科学与技术学院' and sid in(select sid from pub.student_course where cid=(select cid from pub.course where name='数据结构') union(select sid from pub.student_course where cid=(select cid from pub.course where name='操作系统')))

update test8_03 set ds_score=(select score from pub.student_course where cid=(select cid from pub.course where name='数据结构') and

test8_03.sid=pub.student_course.sid)

update test8_03 set os_score=(select score from pub.student_course where cid=(select cid from pub.course where name='操作系统') and

test8_03.sid=pub.student_course.sid)

4.create table test8_04(sid varchar(12),name varchar(10),dname varchar(30),ds_score int,os_score int)

insert into test8_04 select pub.student.sid,https://www.wendangku.net/doc/155322675.html,,dname,null,null from pub.student where dname='计算机科学与技术学院'

update test8_04 set ds_score=(select score from pub.student_course where cid=(select cid from pub.course where name='数据结构') and

test8_04.sid=pub.student_course.sid)

update test8_04 set os_score=(select score from pub.student_course where cid=(select cid from pub.course where name='操作系统') and

test8_04.sid=pub.student_course.sid)

山东大学数据库实验答案2—8

山东大学数据库实验答案2—8 CREATE TABLE test2_01 AS SELECT SID, NAME FROM pub.STUDENT WHERE sid NOT IN ( SELECT sid FROM pub.STUDENT_COURSE ) CREATE TABLE test2_02 AS SELECT SID, NAME FROM PUB.STUDENT WHERE SID IN ( SELECT DISTINCT SID FROM PUB.STUDENT_COURSE WHERE CID IN ( SELECT CID FROM PUB.STUDENT_COURSE WHERE SID='200900130417' ) ) CREATE TABLE test2_03 AS

select SID,NAME from PUB.STUDENT where SID in ( select distinct SID from PUB.STUDENT_COURSE where CID in (select CID from PUB.COURSE where FCID='300002') ) CREATE TABLE test2_04 AS select SID,NAME from PUB.STUDENT where SID in ( select distinct SID from PUB.STUDENT_COURSE where CID in (select CID from PUB.COURSE where NAME='操作系统') intersect select distinct SID from PUB.STUDENT_COURSE where CID in (select CID from PUB.COURSE where NAME='数据结构') ) create table test2_05 as with valid_stu(sid,name) as ( select SID,NAME from PUB.STUDENT where AGE=20 and SID in (select SID from PUB.STUDENT_COURSE) ) select sid,name as name,ROUND(avg(score)) as avg_score,sum(score) as sum_score from PUB.STUDENT_COURSE natural join valid_stu where SID in (select SID from valid_stu) group by SID,NAME create table test2_06 as

同济大学数据库课程考核试卷 A卷 秋季数据库期中考试 英语 参考答案

同济大学课程考核试卷(A卷) 2012 —2013 学年第一学期 课号:10014501 课名:数据库系统原理(双语)考试考查:考试此卷选为:期中考试( )、期终考试( )、重考( ) 试卷 年级专业学号姓名得分 Ⅰ. Multiple choice (20 marks, 2 marks each) (C )1. Five basic relational algebra operations are , others can be derived from these operations. A. ?,-,π,σ,? B. ?,-,π,σ, C. ?,-,π,σ,? D. ?,÷,π,σ, (ABD)2. The following aggregation function(s) will neglect null value. A. SUM B. MAX C. COUNT D. A VG (A. )3. Given R, U={A,B,C}, F={B→C}, a decomposition of R is ρ={AB, BC}, and the decomposition is: A. lossless-join, dependency preserving B. lossless-join, not dependency preserving C. lossy-join, dependency preserving D. lossy-join, not dependency preserving (BD )4. When we generate relational schemas from an E-R diagram, the rules for relationship sets are: A. for a binary 1: n relationship set, translate it into a relation, and the primary key of the relationship set is the primary key of the “1” side entity set; B. for a binary 1: n relationship set, translate it into a relation, and the primary key of the relationship set is the primary key of the “n” side entity set; C. a binary 1: n relationship set can be united with the “1”side entity set, and translated into one relation; D. a binary 1: n relationship set can be united with the “n”side entity set, and translated into one relation; (ABC)5. If R∈BCNF, then: A. non-attributes are entirely functional dependent on non-key attributes; B. all key attributes are entirely functional dependent on each candidate key that does not contain them; C. all partial dependencies and transitive dependencies are removed for any

山东大学网络教育数据库系统原理期末考试试题及参考答案

数据库系统原理—线上 一、选择题 1、数据是以()的方式存储于操作系统(OS)之中的。 A、数据文件 B、日志文件 C、存储类型 D、并行 正确答案:A 2、()是指对数据进行分类、组织、编码、存储、检索和维护,它是数据处理的中心问题。 A、数据管理 B、数据处理 C、数据加工 D、数据收集 正确答案:A 3、数据库管理系统简称() A、DDA B、DB C、DBA D、DBMS 正确答案:D 4、Oracle数据库特点说法正确的是:() 1支持单用户、大事务量的事务处理 2数据安全性和完整性控制 3提供对于数据库操作的接口 4支持集中式数据处理 5可移植性、可兼容性和可连接性 A、12 B、235 C、35 D、25 正确答案:B 5、()是位于用户与操作系统之间的一层数据管理软件。 A、数据库管理系统 B、数据库 C、数据库系统 D、数据库管理员 正确答案:A 6、一般来说,数据库用户账号总是与某一登录账号相关联,但有一个例外那就是()用户 A、sa B、system C、guest D、admin 正确答案:C 7、()以自由软件为主。 A、MySQL B、SQL Server C、Dreanwaver D、Oracle 正确答案:A 8、数据库的简称()A、DAB、DBC、BDD、DD 正确答案:B 9、()是自由软件,因此不属于厂商产品,所以归属于应用中间件软件。 A、MSSQL B、MySQL C、oracle D、linux正确答案:B10、MS SQL Server 能在那两种安全模式下运行A、数据库认证模式 B、WINDOWS认证模式 C、混合模式 D、安全认证模式 正确答案:BC

山东大学《数据库系统》上机实验答案 详细整理 2013最新版

数据库实验(一) 熟悉环境、建立/删除表、插入数据 Drop table 表名 update dbtest set test=1 select * from dbscore 1.教师信息(教师编号、姓名、性别、年龄、院系名称) test1_teacher:tid char 6 not null、name varchar 10 not null、sex char 2、age int、dname varchar 10。 根据教师名称建立一个索引。 1、create table test1_teacher( tid char(6) primary key, name varchar(10) not null, sex char(2), age int, dname varchar(10) ) 2.学生信息(学生编号、姓名、性别、年龄、出生日期、院系名称、班级)test1_student:sid char 12 not null、name varchar 10 not null、sex char 2、age int、birthday date(oracle的date类型是包含时间信息的,时间信息全部为零)、dname varchar 10、class varchar(10)。 根据姓名建立一个索引。 2、create table test1_student(

sid char(12) primary key, name varchar(10) not null, sex char(2), age int, birthday date, dname varchar(10), class varchar(10) ) 3.课程信息(课程编号、课程名称、先行课编号、学分) test1_course:cid char 6 not null、name varchar 10 not null、fcid char 6、credit numeric 2,1(其中2代表总长度,1代表小数点后面长度)。 根据课程名建立一个索引。 3、create table test1_course( cid char(6) primary key, name varchar(10) not null, fcid char(6), credit numeric(2,1) ) 4.学生选课信息(学号、课程号、成绩、教师编号) test1_student_course:sid char 12 not null、cid char 6 not null、 score numeric 5,1(其中5代表总长度,1代表小数点后面长度)、tid char 6。 4、 create table test1_student_course( sid char(12) , cid char(6) , score numeric(5,1), tid char(6), primary key(sid,cid),

福建工程学院《实验指导书(数据库系统原理及应用)》

数据库系统原理 实验指导书 (本科)

目录 实验一数据定义语言 (1) 实验二SQL Sever中的单表查询 (3) 实验三SQL Serve中的连接查询 (4) 实验四SQL Serve的数据更新、视图 (5) 实验五数据控制(完整性与安全性) (7) 实验六语法元素与流程控制 (9) 实验七存储过程与用户自定义函数 (11) 实验八触发器 (12)

实验一数据定义语言 一、实验目的 1.熟悉SQL Server2000/2005查询分析器。 2.掌握SQL语言的DDL语言,在SQL Server2000/2005环境下采用Transact-SQL实现表 的定义、删除与修改,掌握索引的建立与删除方法。 3.掌握SQL Server2000/2005实现完整性的六种约束。 二、实验内容 1.启动SQL Server2000/2005查询分析器,并连接服务器。 2.创建数据库: (请先在D盘下创建DB文件夹) 1)在SQL Server2000中建立一个StuDB数据库: 有一个数据文件:逻辑名为StuData,文件名为“d:\db\S tuDat.mdf”,文件初始大小为5MB,文件的最大大小不受限制,文件的增长率为2MB; 有一个日志文件,逻辑名为StuLog,文件名为“d:\db\StuLog.ldf”,文件初始大小为5MB,文件的最大大小为10MB,文件的增长率为10% 2)刷新管理器查看是否创建成功,右击StuDB查看它的属性。 3.设置StuDB为当前数据库。 4.在StuDB数据库中作如下操作: 设有如下关系表S:S(CLASS,SNO, NAME, SEX, AGE), 其中:CLASS为班号,char(5) ;SNO为座号,char(2);NAME为姓名,char(10),设姓名的取值唯一;SEX为性别,char(2) ;AGE为年龄,int,表中主码为班号+座号。 写出实现下列功能的SQL语句。 (1)创建表S; (2)刷新管理器查看表是否创建成功; (3)右击表S插入3个记录:95031班25号李明,男性,21岁; 95101班10号王丽,女性,20岁; 95031班座号为30,名为郑和的学生记录; (4)将年龄的数据类型改为smallint; (5)向S表添加“入学时间(comedate)”列,其数据类型为日期型(datetime); (6)对表S,按年龄降序建索引(索引名为inxage); (7)删除S表的inxage索引; (8)删除S表; 5.在StuDB数据库中, (1)按照《数据库系统概论》(第四版)P82页的学生-课程数据库创建STUDENT、COURSE 和SC三张表,每一张表都必须有主码约束,合理使用列级完整性约束和表级完整性。 并输入相关数据。 (2)将StuDB数据库分离,在D盘下创建DB文件夹下找到StuDB数据库的两个文件,进行备份,后面的实验要用到这个数据库。 6.(课外)按照《数据库系统概论》(第四版)P74页习题5的SPJ数据库。创建SPJ数据 库,并在其中创建S、P、J和SPJ四张表。每一张表都必须有主码约束,合理使用列级完整性约束和表级完整性。要作好备份以便后面的实验使用该数据库数据。 三、实验要求:

同济大学数据库作业lab5

同济大学 《数据库技术及应用》 实验报告 实验报告题目: 视图,存储过程和触发器 姓名:学号: 年级:专业: 指导教师: 日期:2014 年10 月27 日

一.实验目的 1.学会视图的建立和基于视图的数据库建立 2.学会存储过程的建立和存储方法 3.学会触发器的建立和使用方法,通过实验数据的操作过程了解应用触发器实现数据库完整性控制的设计过程 二.实验内容 (实验题目+运行界面截图+实现代码) 1.(1)创建视图viewa,查询有选课记录的学生号,课程号,课程名称。成绩。 create view viewA as select student.snum,sc.secnum,https://www.wendangku.net/doc/155322675.html,ame,sc.score from student,sc,sections,course where student.snum=sc.snum and sc.secnum=sections.secnum and https://www.wendangku.net/doc/155322675.html,um=https://www.wendangku.net/doc/155322675.html,um

(2)在上述视图的基础上查询所有学生都及格的课程名称select cname from viewA group by cname having min(score)>60 2.存储过程的建立和执行 (1)建立存储过程proca,其功能是显示所有学生的基本信息

create proc proca as select* from student exec proca (2)建立procb,查询出给定出生年份信息的学生信息 create proc procb @_year int as select*from student where year(birthday)=@_year declare@y int set@y=1994 exec procb@y (3)建立存储过程procc,查询给定学好的学生的课程平均成绩,选修课程的门数和不及格课程的门数 create proc procc @_xh char(4) as

山东大学数据库第四次实验实验报告

實驗4 視圖操作 實驗目の:掌握創建、刪除視圖のSQL語句の用法,掌握使用企業管理器創建、視圖の方法。 實驗准備: 1)了解創建視圖方法。 2)了解修改視圖のSQL 語句の語法格式。 實驗內容: 1)使用企業管理器創建視圖 a)在pubs數據庫中以authors表為基礎,建立一個名為CA_authorの視圖, 使用該視圖時,將顯示所有state為CAの作者の基本信息。 2)使用SQL語句創建視圖 a)在查詢分析器中利用author表建立一個每個作者のID,lname,fname, phone,addressの視圖S_author。 b)建立一個employee_date視圖,利用employee表中信息,顯示1991年 1月1日之後雇傭の雇員のid,name,minit,job_id。 3)刪除視圖 a)使用企業管理器S_author視圖 b)使用SQL語句刪除CA_author、employee_date視圖 實驗要求: 用不同の方法創建視圖。 實驗步驟如下: 一、使用企業管理器創建視圖 a )在pubs數據庫中以authors表為基礎,建立一個名為CA_author の視圖,使用該視圖時,將顯示所有state為CAの作者の基本信息。

①右鍵點擊pubs數據庫文件下の視圖,選擇“新建視圖”,在彈出來の“添加表”中添加表authors。 ②在“添加表”一欄中添加表authors後點擊“關閉”,並全選author表中所有項目。 ③點擊保存,從彈出來の“選擇名稱”框中輸入視圖名稱“CA_author”。

④添加名為CA_author の視圖成功。 ⑤顯示所有state為CAの作者の基本信息。

山东大学操作系统实验报告4进程同步实验

山东大学操作系统实验报告4进程同步实验

计算机科学与技术学院实验报告 实验题目:实验四、进程同步实验学号: 日期:20120409 班级:计基地12 姓名: 实验目的: 加深对并发协作进程同步与互斥概念的理解,观察和体验并发进程同步与互斥 操作的效果,分析与研究经典进程同步与互斥问题的实际解决方案。了解 Linux 系统中 IPC 进程同步工具的用法,练习并发协作进程的同步与互斥操作的编程与调试技术。 实验内容: 抽烟者问题。假设一个系统中有三个抽烟者进程,每个抽烟者不断地卷烟并抽烟。抽烟者卷起并抽掉一颗烟需要有三种材料:烟草、纸和胶水。一个抽烟者有烟草,一个有纸,另一个有胶水。系统中还有两个供应者进程,它们无限地供应所有三种材料,但每次仅轮流提供三种材料中的两种。得到缺失的两种材料的抽烟者在卷起并抽掉一颗烟后会发信号通知供应者,让它继续提供另外的两种材料。这一过程重复进行。请用以上介绍的 IPC 同步机制编程,实现该问题要求的功能。 硬件环境: 处理器:Intel? Core?i3-2350M CPU @ 2.30GHz ×4 图形:Intel? Sandybridge Mobile x86/MMX/SSE2 内存:4G 操作系统:32位 磁盘:20.1 GB 软件环境: ubuntu13.04 实验步骤: (1)新建定义了producer和consumer共用的IPC函数原型和变量的ipc.h文件。

(2)新建ipc.c文件,编写producer和consumer 共用的IPC的具体相应函数。 (3)新建Producer文件,首先定义producer 的一些行为,利用系统调用,建立共享内存区域,设定其长度并获取共享内存的首地址。然后设定生产者互斥与同步的信号灯,并为他们设置相应的初值。当有生产者进程在运行而其他生产者请求时,相应的信号灯就会阻止他,当共享内存区域已满时,信号等也会提示生产者不能再往共享内存中放入内容。 (4)新建Consumer文件,定义consumer的一些行为,利用系统调用来创建共享内存区域,并设定他的长度并获取共享内存的首地址。然后设定消费者互斥与同步的信号灯,并为他们设置相应的初值。当有消费进程在运行而其他消费者请求时,相应的信号灯就会阻止它,当共享内存区域已空时,信号等也会提示生产者不能再从共享内存中取出相应的内容。 运行的消费者应该与相应的生产者对应起来,只有这样运行结果才会正确。

山大网络教育《数据结构》(-C-卷)

山大网络教育《数据结构》(-C-卷)

《数据结构》模拟卷 一、单项选择题 1.数据结构是()。 A.一种数据类型 B.数据的存储结构 C.一组性质相同的数据元素的集合 D.相互之间存在一种或多种特定关系的数据元素的集合 2.算法分析的目的是( B )。 A.辨别数据结构的合理性 B.评价算法的效率 C.研究算法中输入与输出的关系 D.鉴别算法的可读性 3.在线性表的下列运算中,不.改变数据元素之间结构关系的运算是( D )。 A.插入B.删除 C.排序D.定位 4.若进栈序列为1,2,3,4,5,6,且进栈和出栈可以穿插进行,则可能出现的出栈序列为( B )。 A.3,2,6,1,4,5 B.3,4,2,1,6,5

C.1,2,5,3,4,6 D.5,6,4,2,3,1 5.设串sl=″Data Structures with Java″,s2=″it″,则子串定位函数index(s1,s2)的值为( D )。 A.15 B.16 C.17 D.18 6.二维数组A[8][9]按行优先顺序存储,若数组元素A[2][3]的存储地址为1087,A[4][7]的存储地址为1153,则数组元素A[6][7]的存储地址为( A )。 A.1207 B.1209 C.1211 D.1213 7.在按层次遍历二叉树的算法中,需要借助的辅助数据结构是( A )。 A.队列B.栈 C.线性表D.有序表 8.在任意一棵二叉树的前序序列和后序序列中,各叶子之间的相对次序关系( B )。A.不一定相同B.都相同 C.都不相同D.互为逆序 9.若采用孩子兄弟链表作为树的存储结构,则树的后序遍历应采用二叉树的( C )。

数据库系统原理与设计(第二版)实验一至实验三

实验一 1-1.查询员工的姓名、职务和薪水 select employeeName,headShip,salary from employee 图1-1 2.查询名字中含有“有限”的客户姓名和所在地 select CustomerName,address from Customer where CustomerName like '%有限%'

3. 查询出姓“张”并且姓名的最后一个字为“梅”的员工。 select * from employee where employeeName like '张%梅' 图1-3 4. 查询住址中含有上海或南昌的女员工,并显示其姓名、所属部门、职称、住址,其中性别用“男”和“女”显示 SELECT employeeName,department,address, isnull (convert(char(10),birthday,120),'不详')出生日期, case sex when 'M'then '男' when 'F'then'女' end as 性别 from employee where (address like '%上海%'or address like '%南昌%')and sex='F'

5. 查询出职务为“职员”或职务为“科长”的女员工的信息 select * from employee where (headship='职员' or headship='科长') and sex='F' 图1-5 6. 选取编号不在“C20050001”和“C20050004”的客户编号、客户名称、客户地址。 Select * from Customer where CustomerNo not in ( 'C20050001' ,'C20050004')

同济大学实验安全考试题库

1 单选题做加热易燃液体实验时,应该()。 A 用电炉加热,要有人看管 B 用电热套加热,可不用人看管 C 用水浴加热,要有人看管 正确答案:C 2 单选题毒物进入人体最主要、最常见的途径是()。 A 呼吸道 B 皮肤 C 眼睛 D 消化道 正确答案:A 3 单选题倾倒液体试剂时,瓶上标签应朝()。 A 上方 B 下方 C 左方 D 右方 正确答案:A 4 单选题当不慎把少量浓硫酸滴在皮肤上时,正确的处理方法是()。 A 用酒精擦 B 马上去医院 C 用碱液中和后,用水冲洗 D 以吸水性强的纸吸去后,用水冲洗 正确答案:D 5 判断题学生可以单独使用剧毒物品吗? 正确答案:对 6 单选题当有危害的化学试剂发生泄漏、洒落或堵塞时,应()。 A 首先避开并想好应对的办法再处理 B 赶紧打扫干净或收拾起来 正确答案:A 7 单选题下列物品不属于剧毒化学品的是()。 A 氰化钾 B 氯化汞 C 铊 D 甲醛 正确答案:D 8 单选题K、Na、Mg、Ca、Li、AlH3、MgO、电石中,遇水发生激烈反应的有()。 A 5种 B 6种 C 7种 D 8种 正确答案:B 9 单选题金属Hg常温下会()。 A 不挥发 B 慢慢挥发

C 很快挥发 正确答案:B 10 单选题HCN无色,气味是()。 A 无味 B 大蒜味 C 苦杏仁味 正确答案:C 11 单选题氮氧化物主要伤害人体的()器官。 A 眼、上呼吸道 B 呼吸道深部的细支气管、肺泡 正确答案:B 12 单选题易燃易爆试剂应放在()。 A 在铁柜中,柜的顶部要有通风口 B 在木柜中,柜的顶部要有通风口 C 在铁柜中,并要密封保存 D 在木柜中,并要密封保存 正确答案:A 13 多选题以下哪些酸具有强腐蚀性,使用时须做必要的防护()。 A 硝酸 B 冰醋酸 C 硼酸 正确答案:A,B 14 多选题使用易燃易爆的化学药品应该注意()。 A 避免明火加热 B 加热时使用水浴或油浴 C 在通风橱中进行操作 D 不可猛烈撞击 正确答案:A,B,C,D 15 多选题剧毒类化学试剂应如何存放()。 A 应锁在专门的毒品柜中 B 应存于实验台下柜中 C 置于阴凉干燥处,并与酸类试剂隔离 D 建立双人登记签字领用制度,建立使用、消耗、废物处理等制度 E 储存室应配备防毒、防盗、报警及隔离、消除与吸收毒物的设施正确答案:A,C,D,E 16 多选题爆炸物品在发生爆炸时的特点有()。 A 反应速度极快,通常在万分之一秒以内即可完成 B 释放出大量的热 C 通常产生大量的气体 D 发出声响 正确答案:A,B,C,D 17 多选题具有下列哪些性质的化学品属于化学危险品()。 A 爆炸 B 易燃

山东大学人工智能复习参考(2017春)(带答案)

山东大学人工智能复习参考(2017春)(带答案)

复习参考题2016秋 一、填空 1.构成产生式系统的基本元素有综合数据库、规则库、控制系统,控制策略按执行规则的方式分类,分为正向、逆向、双向三类。 2.归结过程中控制策略的作用是给出控制策略,以使仅对选择合适的子句间方可做归结,避免多余的、不必要的归结式出现或者说,少做些归结仍能导出空子句。常见的控制策略有线性归结策略、支持集策略、单元归结、输入归结。 3.公式G和公式的子句集并不等值,但它们在不可满足的意义下是一致的。 4.与或图的启发式搜索算法(AO*算法)的两个过程分别是图生成过程即扩展节点和计算耗散值的过程。 5.人工智能的研究途径主要有两种不同的观点,一种观点称为符号主义,认为人类智能基本单元是符号。另一种观点称为连接主义(仿生主义),认为职能的基本单元是神经元。 6.集合{P(a, x, f (g(y)), P(z, f(z),f(u)))的mgu(最一般合一置换)为{z/a, f(x)/x, u/g(y)}。 7.语义网络是对知识的有向图表示方法,一个最简单的语义网络是一个形如节点1、弧、节点2的三元组,语义网络可以描述事物间多种复杂的语义关系、常用ISA、AKO弧表示节点间具有类属的分类关系。语义网络下的推理是通过继承和匹配实现的。 8.当前人工智能研究的热点之一就是机器学习。常见的机器学习方法可分为连接学习、归纳学习、分析学习和遗传算法与分类器系统等。一个机器学习系统应有环境、知识库、学习环节和执行环节四个基本部分组成。 9.常用的知识表示法有逻辑表示法、产生式规则表示法、语义网络表示法、框架理论表示法、过程表示法等。 10.有两个A*算法A1和A2,若A1比A2有较多的启发信息,则 h1(n)>h2(n)。 11.关于A算法与A*算法,若规定h(n)≥0,并且定义启发函数:f*(n)=g*(n)+h*(n) 表示初始状态S0经点n到目标状态S g最优路径的费用。其中g*(n)为S0到n的最小费用, h*(n)为到S g的实际最小费用。若令h(n)≡0,则A算法相当于宽度优先搜索,因为上一层节点的搜索费用一般比下一层的小。若g(n)≡h(n)≡0则相当于随机算法。若g(n)≡0,则相当于最佳优先算法。特别是当要求h(n)≤h*(n)就称这种A算法为A*算法。

山东大学操作系统实验二

软件学院操作系统实验报告 实验题目: 实验二、线程和进程/线程管道通信实验 学号:201100300124 日期:2013年04月19日 班级:5班姓名:韩俊晓 Email:hanjunxiao188@https://www.wendangku.net/doc/155322675.html, 实验目的: 通过Linux 系统中线程和管道通信机制的实验,加深对于线程控制和管道通信概念的理解,观察和体验并发进/线程间的通信和协作的效果,练习利用无名管道进行进/线程间通信的编程和调试技术。 实验要求: 设有二元函数f(x,y) = f(x) + f(y) 其中:f(x) = f(x-1) * x(x >1) f(x)=1(x=1) f(y) = f(y-1) + f(y-2)(y> 2) f(y)=1(y=1,2) 请编程建立3个并发协作进程(或线程),它们分别完成f(x,y)、f(x)、f(y) 其中由父进程(或主线程)完成:f(x,y) = f(x) + f(y) 由子进程1(或线程1)完成:f(x) = f(x-1) * x(x >1) f(x)=1(x=1)

由子进程2(或线程2)完成:f(y) = f(y-1) + f(y-2)(y> 2) f(y)=1(y=1,2) 硬件环境: 实验室计算机 软件环境: Ubuntu08.4-Linux操作系统 BASH_VERSION='3.2.33(1)-release gcc version 4.1.2 gedit 2.18.2 OpenOffice 2.3 实验步骤: 1.实验说明: 1)与线程创建、执行有关的系统调用说明 线程是在共享内存中并发执行的多道执行路径,它们共享一个进程的资源,如进程程序段、文件描述符和信号等,但有各自的执行路径和堆栈。线程的创建无需像进程那样重新申请系统资源,线程在上下文切换时也无需像进程那样更换内存映像。多线程的并发执行即避免了多进程并发的上下文切换的开销又可以提高并发处理的效率。 Linux 利用了特有的内核函数__clone 实现了一个叫phread 的线程库,__clone是fork 函数的替代函数,通过更多的控制父子进程共享哪些资源而实现了线程。Pthread 是一个标准化模型,用它可把一个程序分成一组能够并发执行的多个任务。phread 线程库是POSIX 线程标

大数据库系统应用与开发--实验二

实验二JDBC基础(1) 一、相关知识点 1、JDBC基本概念 2、java连接数据库的方式 3、JDBC简单查询 二、实验目的: 理解Java连接数据库的基本概念。理解JDBC的四种驱动程序,掌握纯java驱动和jdbc-odbc驱动。理解Statement对象和ResultSet对象。 三、实验内容: 1、将booklib应用的JDBC驱动程序改成JDBC-ODBC驱动方式。 第一步:设置ODBC数据源;

第二步:修改DBUtil类中的相关代码;

第三步:运行程序 【实验结果与分析】 A、说明需要修改DBUtil类的哪些地方,及修改原因? private static final String jdbcUrl="jdbc:odbc:cjeSQL"; 因为booklib应用的驱动方式是jdbc-odbc驱动 2、利用Statement对象和Result对象实现按出版社名称精确查询出版社功能(精确查 询是指查询的目标和查询条件中值完全相同的数据)。 第一步:在https://www.wendangku.net/doc/155322675.html,.zucc.booklib.control. PublisherManager类中添加按出版社名称精确查询方法public BeanPublisher loadPubByName(String name)throws BaseException 第二步:编写上述方法,要求当相应名字的出版社不存在时,返回null值;相关代码请参考提取所有出版社函数。 第三步:启动booklib主程序,在出版社管理中录入几个出版社 第四步:清空https://www.wendangku.net/doc/155322675.html,.zucc.booklib.control. PublisherManager类中的main函数现有内

同济大学大学计算机access作业答案

同济大学大机access作业 有一个数据库Test-5.mdb,其中有表Teachers和Students,他们的结构如下表所示,请写出有关的SQL命令。 点击下载Test-5.mdb数据库 第一题:在表Teachers中插入一条新的记录: 600001 杨梦女64 1966/04/22 YES 1660 210 要求:日期的格式为#4/22/1966# 答案:分数:10.00 INSERT INTO Teachers (教师号,姓名,性别,年龄,参加工作年月,党员,应发工资,扣除工资) VALUES ("600001","杨梦","女",64,#4/22/1966#,YES,1660,210) 第二题:在表Teachers中删除年龄小于36且性别为“女”的记录。 答案:分数:10.00 DELETE FROM Teachers WHERE 年龄<36 AND 性别="女" 第三题:用对表中工龄超过25年的职工加20%元工资。 答案:分数:10.00 UPDATE Teachers SET 应发工资=应发工资*1.2 WHERE(Year(date())-Year(参加工作年月))>25 第四题:查询1990年之前(包括1990年)参加工作的所有教师的教师号、姓名和实发工资,查询结果按实发工资从高到低排序。 答案:分数:10.00 SELECT 教师号,姓名,(应发工资-扣除工资) AS 实发工资FROM Teachers WHERE YEAR(参加工作年月)<=1990 ORDER BY 应发工资-扣除工资DESC 第五题:查询教师的人数和平均实发工资。请参阅下图(仅供参考)。 答案:分数:10.00 SELECT Count(*)AS 教师人数,AVG(应发工资-扣除工资) AS 实发工资 FROM Teachers 第六题:查询男女职工的最低工资、最高工资和平均工资(工资是指实发工资)。请参阅下图(仅供参考)。

山大数据库简答题整理

1、事务的定义及其特性 答:事务是由一系列操作序列构成的程序执行单元,这些操作要么都做,要么都不做,是一个不可分割的工作单位。 事务的ACID特性: 原子性(Atomicity) 事务中包含的所有操作要么全做,要么全不做 一致性(Consistency) 事务的隔离执行必须保证数据库的一致性 隔离性(Isolation) 系统必须保证事务不受其它并发执行事务的影响 持久性(Durability) 一个事务一旦提交之后,它对数据库的影响必须是永久的。 2、完整性约束: 数据库完整性(Database Integrity)是指数据库中数据的正确性、有效性和相容性。数据库完整性由各种各样的完整性约束来保证,因此可以说数据库完整性设计就是数据库完整性约束的设计。 1、实体完整性:要求每个关系模式有且仅有一个主码,每个主码的值必须唯一, 而且不能为空。 2、域完整性:数据库表中的列必须满足某种特定的数据类型或约束。其 中约束又包括取值范围、精度等规定。表中的CHECK、FOREIGN KEY 约 束和DEFAULT、 NOT NULL定义都属于域完整性的范畴。 3、参照完整性:参照的完整性要求关系中不允许引用不存在的实体。当更新、 删除、插入一个表中的数据时,通过参照引用相互关联的另一个表 中的数据,来检查对表的数据操作是否正确。 3.DBMS 数据库管理系统(Database Management System)是一种操纵和管理数据库的大型软件,用于建立、使用和维护数据库,简称DBMS。它对数据库进行统一的管理和控制,以保证数据库的安全性和完整性。用户通过DBMS访问数据库中的数据,数据库管理员也通过dbms进行数据库的维护工作。它可使多个应用程序和用户用不同的方法在同时或不同时刻去建立,修改和询问数据库。大部分DBMS提供数据定义语言DDL(Data Definition Language)和数据操 作语言DML(Data Manipulation Language),供用户定义数据库的模式结构与权限约束,实现对数据的追加、删除等操作。 4.什么是数据独立性?数据库系统如何实现数据独立性? 答:数据独立性是指应用程序和数据之间相互独立、互不影响,及数据结构的修改不会引起

山东大学操作系统实验六完整版

山东大学操作系统实验 六 HEN system office room 【HEN16H-HENS2AHENS8Q8-HENH1688】

软件学院操作系统实验报告 实验题目: 实验六、死锁问题实验 学号:0124 日期:2013年05月23日 班级:5班姓名:韩俊晓 Email: 实验目的: 通过本实验观察死锁产生的现象,考虑解决死锁问题的方法。从而进一步加深对于死锁问题的理解。掌握解决死锁问题的几种算法的编程和调试技术。练习怎样构造管程和条件变量,利用管程机制来避免死锁和饥俄问题的发生。 实验要求: 在两个城市南北方向之间存在一条铁路,多列火车可以分别从两个城市的车站排队等待进入车道向对方城市行驶,该铁路在同一时间,只能允许在同一方向上行车,如果同时有相向的火车行驶将会撞车。请模拟实现两个方向行车,而不会出现撞车或长时间等待的情况。您能构造一个管程来解决这个问题吗? 硬件环境: 实验室计算机 软件环境: -Linux操作系统 gcc version

实验步骤: 1.实验说明: 管程-Monitor 管程是一种高级抽象数据类型,它支持在它的函数中隐含互斥操作。结合条件变量和其他一些低级通信原语,管程可以解决许多仅用低级原语不能解决的同步问题。利用管程可以提供一个不会发生死锁或饥饿现象的对象;哲学家就餐问题和Java语言中的synchronized对象都是很好的管程的例子. 管程封装了并发进程或线程要互斥执行的函数。为了让这些并发进程或线程在管程内互斥的执行,进入管程的进/线程必须获取到管程锁或二值信号量 条件变量Condition Variables 条件变量提供了一种对管程内并发协作进程的同步机制。如果没有条件变量,管程就不会有很有用。多数同步问题要求在管程中说明条件变量。条件变量代表了管程中一些并发进程或线程可能要等待的条件。一个条件变量管理着管程内的一个等待队列。如果管程内某个进程或线程发现其执行条件为假,则该进程或线程就会被条件变量挂入管程内等待该条件的队列。如果管程内另外的进程或线程满足了这个条件,则它会通过条件变量再次唤醒等待该条件的进程或线程,从而避免了死锁的产生。所以,一个条件变量C应具有两种操作()和()。 当管程内同时出现唤醒者和被唤醒者时,由于要求管程内的进程或线程必须互斥执行,因此就出现了两种样式的条件变量:

数据库系统概论实验设计答案

数据库系统概论 实验报告册 姓名:momo 学号: 教师:

实验一需求分析(一)——业务流程调查 一、实验目的:掌握需求分析的步骤和业务流程调查的方法;掌握应用Powerbuilder绘制BPM模型 二、学时:6H(课内4H,课外2H) 三、实验软件平台:Windows 2k或Windows XP, Powerduilder9.5,Visio 四、实验内容:根据该VCD连锁店的业务需求调查文字,利用PD绘制该VCD连锁店管理系统的BPM 模型。 五、实验结果: 出售租借:根据购买人或租借人提供的VCD租借单,查阅库存,如果有,则办理销售或租借并登记销售或租借流水帐;如果没有相应的VCD,则可根据购买人或租借人的要求办理预约登记,当有VCD时,及时通知购买人或租借人。 归还:根据租借人提供的所还VCD,检查VCD是否完好,如果完好,则办理归还登记,如果有损坏的VCD,办理赔偿登记。并把赔偿通知单通知给租借人。

逾期罚款通知:查询逾期未还的VCD,及时通知租借人,并进行相应的罚款登记。 六、思考题 1、数据库设计为什么需要进行详细的需求分析? 答:需求分析简单地说就是分析用户的要求。需求分析是设计数据库的起点,需求分析的结果是不是准确的反映了用户的实际要求,将直接影响到后面各个阶段的设计,并影响到设计结果是不是合理使用情况。 2、需求分析的目标是什么?其调查步骤是什么?常用的调查方法有哪些? 答:(1)需求分析的目标: 1.通过详细调查现实世界要处理的对象,充分了解原系统(手工系统或计算机系统)工作概况, 明确用户的各种需求。 2.在此基础上确定新系统的功能。新系统必须充分考虑今后可能的扩充和改变,不能仅仅按当 前应用需求来设计数据库。 (2) 调查步骤:

同济大学数据库实验5答案

create proc procA as select* from student exec proca create proc procB @_year char(4) as select* from student where year(birthday )=@_year declare @_year char(4) set @_year ='1994' exec procB@_year create proc procf @_Snum char(30) as select s.snum ,avg(score)as平均成绩,count(https://www.wendangku.net/doc/155322675.html,um)as选秀门数,sum(1-score/60)as不及格门数 from student s,course c,sc,sections st where s.snum =sc.snum and sc.secnum =st.secnum and https://www.wendangku.net/doc/155322675.html,um =https://www.wendangku.net/doc/155322675.html,um and S.Snum =@_Snum group by S.Snum DECLARE @_SUNM char(30) set @_SUNM ='s001' exec procf@_sunm CREATE PROC Procd @_snum char(4),@_avg int out,@_selected_course int out,@_failed_course int out AS SELECT @_avg=AVG(score),@_selected_course=COUNT(cnum),@_failed_course=sum(1-score/60) FROM sc JOIN sections ON sc.secnum =sections.secnum WHERE snum=@_snum

相关文档
相关文档 最新文档