文档库 最新最全的文档下载
当前位置:文档库 › 数据库系统概念答案(第五版)

数据库系统概念答案(第五版)

数据库系统概念答案(第五版)
数据库系统概念答案(第五版)

C H A P T E R2

Exercises

2.4Describe the differences in meaning between the terms relation and relation schema.

Answer:A relation schema is a type de?nition,and a relation is an instance of that schema.For example,student(ss#,name)is a relation schema and

is a relation based on that schema.

2.5Consider the relational database of Figure2.35,where the primary keys are un-

derlined.Give an expression in the relational algebra to express each of the fol-lowing queries:

a.Find the names of all employees who work for First Bank Corporation.

b.Find the names and cities of residence of all employees who work for First

Bank Corporation.

c.Find the names,street address,and cities of residence of all employees who

work for First Bank Corporation and earn more than$10,000per annum.

d.Find the names of all employees in this database who live in the same city

as the company for which they work.

e.Assume the companies may be located in several cities.Find all companies

located in every city in which Small Bank Corporation is located.

Answer:

a.Πperson-name(σcompany-name=“First Bank Corporation”(works))

7

8Chapter2Relational Model

employee(person-name,street,city)

works(person-name,company-name,salary)

,city)

manages(person-name,manager-name)

Figure2.35.Relational database for Exercises2.1,2.3and2.9.

b.Πperson-name,city(employee1

company-name=“First Bank Corporation”(works)))

c.Πperson-name,street,city

(company-name=“First Bank Corporation”∧salary>10000)

works1employee)

d.Πperson-name(employee1works1company)

e.Note:Small Bank Corporation will be included in each answer.

Πcompany-name(company÷

(Πcity(σ

company-name=“Small Bank Corporation”

(company))))

2.6Consider the relation of Figure2.20,which shows the result of the query“Find

the names of all customers who have a loan at the bank.”Rewrite the query to include not only the name,but also the city of residence for each customer.

Observe that now customer Jackson no longer appears in the result,even though Jackson does in fact have a loan from the bank.

a.Explain why Jackson does not appear in the result.

b.Suppose that you want Jackson to appear in the result.How would you

modify the database to achieve this effect?

c.Again,suppose that you want Jackson to appear in the result.Write a query

using an outer join that accomplishes this desire without your having to modify the database.

Answer:The rewritten query is

Πcustomer-name,customer-city,amount(borrower1loan1customer)

a.Although Jackson does have a loan,no address is given for Jackson in the

customer relation.Since no tuple in customer joins with the Jackson tuple of borrower,Jackson does not appear in the result.

b.The best solution is to insert Jackson’s address into the customer relation.If

the address is unknown,null values may be used.If the database system does not support nulls,a special value may be used(such as unknown)for Jackson’s street and city.The special value chosen must not be a plausible name for an actual city or street.

c.Πcustomer-name,customer-city,amount((borrower1loan)1customer)

2.7Consider the relational database of Figure2.35.Give an expression in the rela-

tional algebra for each request:

a.Give all employees of First Bank Corporation a10percent salary raise.

Exercises 9

b.Give all managers in this database a 10percent salary raise,unless the salary would be greater than $100,000.In such cases,give only a 3percent raise.

c.Delete all tuples in the works relation for employees of Small Bank Corpora-tion.

Answer:

a.works ←Πperson -name,company -name,1.1?salary (σ(company -name =“First Bank Corporation”)(works ))

∪(works ?σcompany -name =“First Bank Corporation”(works ))

b.The same situation arises here.As before,t 1,holds the tuples to be updated and t 2holds these tuples in their updated form.

t 1←Πworks.person -name,company -name,salary (σworks.person -name =manager -name (works ×manages ))

t 2←Πworks.person -name,company -name,salary ?1.03(σt 1.salary ?1.1>100000(t 1))

t 2←t 2∪(Πworks.person -name,company -name,salary ?1.1(σt 1.salary ?1.1≤100000(t 1)))

works ←(works ?t 1)∪t 2

c.works ←works ?σcompany ?name =“Small Bank Corporation”(works )

2.8Using the bank example,write relational-algebra queries to ?nd the accounts

held by more than two customers in the following ways:

https://www.wendangku.net/doc/381306768.html,ing an aggregate function.

b.Without using any aggregate functions.

Answer:

a.t 1←account -number G count customer -name (depositor )Πaccount -number σnum -holders>2 ρaccount -holders (account -number,num -holders )(t 1)

b.t 1←(ρd 1(depositor )×ρd 2(depositor )×ρd 3(depositor ))t 2←σ(d 1.account -number =d 2.account -number =d 3.account -number )(t 1)Πd 1.account -number (σ(d 1.customer -name =d 2.customer -name ∧

d 2.customer -nam

e =d 3.customer -name ∧d 3.customer -name =d 1.customer -name )(t 2))

2.9Consider the relational database of Figure 2.35.Give a relational-algebra expres-

sion for each of the following queries:

a.Find the company with the most employees.

b.Find the company with the smallest payroll.

c.Find those companies whose employees earn a higher salary,on average,than the average salary at First Bank Corporation.Answer:

10Chapter 2Relational Model

a.t 1←company -name G count-distinct person -name (works )

t 2←max num -employees (ρcompany -strength (company -name,num -employees )(t 1))Πcompany -name (ρt 3(company -name,num -employees )(t 1)1ρt 4(num -employees )(t 2))b.t 1←company -name G sum salary (works )t 2←min payroll (ρcompany -payroll (company -name,payroll )(t 1))Πcompany -name (ρt 3(company -name,payroll )(t 1)1ρt 4(payroll )(t 2))c.t 1←company -name G avg salary (works )t 2←σcompany -name =“First Bank Corporation”(t 1)

Πt https://www.wendangku.net/doc/381306768.html,pany -name ((ρt 3(company -name,avg -salary )(t 1))1t 3.avg -salary >first -bank.avg -salary (ρfirst -bank (company -name,avg -salary )(t 2)))

2.10List two reasons why null values might be introduced into the database.

Answer:Nulls may be introduced into the database because the actual value is either unknown or does not exist.For example,an employee whose address has changed and whose new address is not yet known should be retained with a null address.If employee tuples have a composite attribute dependents ,and a particular employee has no dependents,then that tuple’s dependents attribute should be given a null value.

2.11Consider the following relational schema

employee (empno ,name ,of?ce ,age )

books (isbn ,title ,authors ,publishe r )

loan (empno ,isbn ,date )

Write the following queries in relational algebra.

a.Find the names of employees who have borrowed a book published by McGraw-Hill.

b.Find the names of employees who have borrowed all books published by

McGraw-Hill.

c.Find the names of employees who have borrowed more than ?ve different books published by McGraw-Hill.

d.For each publisher,?nd the names of employees who have borrowed more

than ?ve books of that publisher.

Answer:No answer

Exercises

3.8Consider the insurance database of Figure 3.11,where the primary keys are un-derlined.Construct the following SQL queries for this relational database.a.Find the number of accidents in which the cars belonging to “John Smith ”were involved.

b.Update the damage amount for the car with license number “AABB2000”in the accident with report number “AR2197”to $3000.

Answer:Note:The participated relation relates drivers,cars,and accidents.a.SQL query:

select

count (distinct *)from

accident where exists

(select *

from participated,person

where participated.driver id =person.driver id

and https://www.wendangku.net/doc/381306768.html, =’John Smith’

and accident.report number =participated.report number )

b.SQL query:

update participated

set damage amount =3000

where report number =“AR2197”and driver id in

(select driver id

from owns

where license =“AABB2000”)

11C H A P T E R

3

12Chapter3SQL

person(driver id,name,address)

car(license,model,year)

accident(report number,date,location)

owns(driver id,license)

participated(driver id,car,report number,damage amount)

Figure3.11.Insurance database.

employee(employee name,street,city)

works(employee name,company name,salary)

company name,city)

manages(employee name,manager name)

Figure3.12.Employee database.

3.9Consider the employee database of Figure3.12,where the primary keys are un-

derlined.Give an expression in SQL for each of the following queries.

a.Find the names of all employees who work for First Bank Corporation.

b.Find all employees in the database who live in the same cities as the com-

panies for which they work.

c.Find all employees in the database who live in the same cities and on the

same streets as do their managers.

d.Find all employees who earn more than the average salary of all employees

of their company.

e.Find the company that has the smallest payroll.

Answer:

a.Find the names of all employees who work for First Bank Corporation.

select employee name

from works

where company name=’First Bank Corporation’

b.Find all employees in the database who live in the same cities as the com-

panies for which they work.

select e.employee name

from employee e,works w,company c

where e.employee name=w.employee name and e.city=c.city and

https://www.wendangku.net/doc/381306768.html,pany name=https://www.wendangku.net/doc/381306768.html,pany name

c.Find all employees in the database who live in the same cities and on the

same streets as do their managers.

select P.employee name

from employee P,employee R,manages M

where P.employee name=M.employee name and

M.manager name=R.employee name and

P.street=R.street and P.city=R.city

Exercises13

d.Find all employees who earn more than the average salary of all employees

of their company.

The following solution assumes that all people work for at most one com-pany.

select employee name

from works T

where salary>(select avg(salary)

from works S

where https://www.wendangku.net/doc/381306768.html,pany name=https://www.wendangku.net/doc/381306768.html,pany name)

e.Find the company that has the smallest payroll.

select company name

from works

group by company name

having sum(salary)<=all(select sum(salary)

from works

group by company name)

3.10Consider the relational database of Figure3.12.Give an expression in SQL for

each of the following queries.

a.Give all employees of First Bank Corporation a10percent raise.

b.Give all managers of First Bank Corporation a10percent raise.

c.Delete all tuples in the works relation for employees of Small Bank Corpora-

tion.

Answer:

a.Give all employees of First Bank Corporation a10-percent raise.(the solu-

tion assumes that each person works for at most one company.)

update works

set salary=salary*1.1

where company name=’First Bank Corporation’

b.Give all managers of First Bank Corporation a10-percent raise.

update works

set salary=salary*1.1

where employee name in(select manager name

from manages)

and company name=’First Bank Corporation’

c.Delete all tuples in the works relation for employees of Small Bank Corpora-

tion.

delete works

where company name=’Small Bank Corporation’

3.11Let the following relation schemas be given:

14Chapter3SQL

R=(A,B,C)

S=(D,E,F)

Let relations r(R)and s(S)be given.Give an expression in SQL that is equivalent

to each of the following queries.

a.ΠA(r)

b.σB=17(r)

c.r×s

d.ΠA,F(σC=D(r×s))

Answer:

a.ΠA(r)

select distinct A

from r

b.σB=17(r)

select*

from r

where B=17

c.r×s

select distinct*

from r,s

d.ΠA,F(σC=D(r×s))

select distinct A,F

from r,s

where C=D

3.12Let R=(A,B,C),and let r1and r2both be relations on schema R.Give an

expression in SQL that is equivalent to each of the following queries.

a.r1∪r2

b.r1∩r2

c.r1?r2

d.ΠAB(r1)1ΠBC(r2)

Answer:

a.r1∪r2

(select*

from r1)

union

(select*

from r2)

b.r1∩r2

We can write this using the intersect operation,which is the preferred approach,but for variety we present an solution using a nested subquery.

Exercises15

select*

from r1

where(A,B,C)in(select*

from r2)

c.r1?r2

select?

from r1

where(A,B,C)not in(select?

from r2)

This can also be solved using the except clause.

d.ΠAB(r1)1ΠBC(r2)

select r1.A,r2.B,r3.C

from r1,r2

where r1.B=r2.B

3.13Show that,in SQL,<>all is identical to not in.

Answer:Let the set S denote the result of an SQL subquery.We compare(x<>

all S)with(x not in S).If a particular value x1satis?es(x1<>all S)then for all elements y of S x1=y.Thus x1is not a member of S and must satisfy(x1not in S).Similarly,suppose there is a particular value x2which satis?es(x2not in

S).It cannot be equal to any element w belonging to S,and hence(x2<>all S) will be satis?ed.Therefore the two expressions are equivalent.

3.14Consider the relational database of https://www.wendangku.net/doc/381306768.html,ing SQL,de?ne a view con-

sisting of manager name and the average salary of all employees who work for that manager.Explain why the database system should not allow updates to be expressed in terms of this view.

Answer:

create view salinfo as

select manager name,avg(salary)

from manages m,works w

where m.employee name=w.employee name

group by manager name

Updates should not be allowed in this view because there is no way to de-termine how to change the underlying data.For example,suppose the request is“change the average salary of employees working for Smith to$200”.Should everybody who works for Smith have their salary changed to$200?Or should the?rst(or more,if necessary)employee found who works for Smith have their salary adjusted so that the average is$200?Neither approach really makes sense.

3.15Write an SQL query,without using a with clause,to?nd all branches where

the total account deposit is less than the average total account deposit at all

branches,

16Chapter3SQL

https://www.wendangku.net/doc/381306768.html,ing a nested query in the from clauser.

https://www.wendangku.net/doc/381306768.html,ing a nested query in a having clause.

Answer:We output the branch names along with the total account deposit at

the branch.

https://www.wendangku.net/doc/381306768.html,ing a nested query in the from clauser.

select branch name,tot balance

from(select branch name,sum(balance)

from account

group by branch name)as branch total(branch name,tot balance)

where tot balance?

(select avg(tot balance)

from(select branch name,sum(balance)

from account

group by branch name)as branch total(branch name,tot balance)

)

https://www.wendangku.net/doc/381306768.html,ing a nested query in a having clause.

select branch name,sum(balance)

from account

group by branch name

having sum(balance)?

(select avg(tot balance)

from(select branch name,sum(balance)

from account

group by branch name)as branch total(branch name,tot balance)

)

3.16List two reasons why null values might be introduced into the database.

Answer:No Answer

3.17Show how to express the coalesce operation from Exercise3.4using the case

operation.

Answer:No Answer.

3.18Give an SQL schema de?nition for the employee database of Figure3.12.Choose

an appropriate domain for each attribute and an appropriate primary key for

each relation schema.

Answer:

create domain company names char(20)

create domain city names char(30)

create domain person names char(20)

create table employee

Exercises17 (employee name person names,

street char(30),

city city names,

primary key(employee name))

create table works

(employee name person names,

company name company names,

salary numeric(8,2),

primary key(employee name))

create table company

(company name company names,

city city names,

primary key(company name))

create table manages

(employee name person names,

manager name person names,

primary key(employee name))

3.19Using the relations of our sample bank database,write SQL expressions to de?ne

the following views:

a.A view containing the account numbers and customer names(but not the

balances)for all accounts at the Deer Park branch.

b.A view containing the names and addresses of all customers who have an

account with the bank,but do not have a loan.

c.A view containing the name and average account balance of every customer

of the Rock Ridge branch.

Answer:No Answer.

3.20For each of the views that you de?ned in Exercise3.19,explain how updates

would be performed(if they should be allowed at all).

Answer:No Answer.

3.21Consider the following relational schema

employee(empno,name,of?ce,age)

books(isbn,authors,publisher)

loan(empno,isbn,date)

Write the following queries in SQL.

a.Print the names of employees who have borrowed any book published by

McGraw-Hill.

18Chapter3SQL

b.Print the names of employees who have borrowed all books published by

McGraw-Hill.

c.For each publisher,print the names of employees who have borrowed more

than?ve books of that publisher.

Answer:No Answer.

3.22Consider the relational schema

student(student id,student name)

registered(student id,course id)

Write an SQL query to list the student-id and name of each student along with

the total number of courses that the student is registered for.Students who are

not registered for any course must also be listed,with the number of registered

courses shown as0.

Answer:No Answer.

3.23Suppose that we have a relation marks(student id,score).Write an SQL query to

?nd the dense rank of each student.That is,all students with the top mark get a

rank of1,those with the next highest mark get a rank of2,and so on.Hint:Split

the task into parts,using the with clause.

Answer:No Answer.

C H A P T E R4

Exercises

4.7Referential-integrity constraints as de?ned in this chapter involve exactly two

relations.Consider a database that includes the following relations:

salaried-worker(name,of?ce,phone,salary)

hourly-worker(name,hourly-wage)

address(name,street,city)

Suppose that we wish to require that every name that appears in address appear in either salaried-worker or hourly-worker,but not necessarily in both.

a.Propose a syntax for expressing such constraints.

b.Discuss the actions that the system must take to enforce a constraint of this

form.

Answer:

a.For simplicity,we present a variant of the SQL syntax.As part of the create

table expression for address we include

foreign key(name)references salaried-worker or hourly-worker

b.To enforce this constraint,whenever a tuple is inserted into the address rela-

tion,a lookup on the name value must be made on the salaried-worker relation

and(if that lookup failed)on the hourly-worker relation(or vice-versa).

4.8Write a Java function using JDBC metadata features that takes a ResultSet as

an input parameter,and prints out the result in tabular form,with appropriate names as column headings.

Answer:No Answer.

19

20Chapter4Advanced SQL

4.9Write a Java function using JDBC metadata features that prints a list of all re-

lations in the database,displaying for each relation the names and types of its

attributes.

Answer:No Answer.

4.10Consider an employee database with two relations

employee(employee-name,street,city)

works(,salary)

where the primary keys are underlined.Write a query to?nd companies whose

employees earn a higher salary,on average,than the average salary at First Bank

Corporation.

https://www.wendangku.net/doc/381306768.html,ing SQL functions as appropriate.

b.Without using SQL functions.

Answer:

a.create function avg-salary(cname varchar(15))

returns integer

declare result integer;

select avg(salary)into result

from works

where https://www.wendangku.net/doc/381306768.html,pany-name=cname

return result;

end

select company-name

from works

where avg-salary(company-name)>avg-salary(”First Bank Corporation”)

b.select company-name

from works

group by company-name

having avg(salary)>(select avg(salary)

from works

where company-name=”First Bank Corporation”)

4.11Rewrite the query in Section4.6.1that returns the name,street and city of all

customers with more than one account,using the with clause instead of using a

function call.

Answer:No Answer.

4.12Compare the use of embedded SQL with the use in SQL of functions de?ned in

a general-purpose programming language.Under what circumstances would

you use each of these features?

Answer:SQL functions are primarily a mechanism for extending the power

of SQL to handle attributes of complex data types(like images),or to perform

complex and non-standard operations.Embedded SQL is useful when imper-

ative actions like displaying results and interacting with the user are needed.

Exercises21 These cannot be done conveniently in an SQL only environment.Embedded SQL can be used instead of SQL functions by retrieving data and then perform-ing the function’s operations on the SQL result.However a drawback is that a lot of query-evaluation functionality may end up getting repeated in the host language code.

4.13Modify the recursive query in Figure4.14to de?ne a relation

empl depth(employee name,manager name,depth)

where the attribute depth indicates how many levels of intermediate managers are there between the employee and the manager.Employees who are directly under a manager would have a depth of0.

Answer:No Answer.

4.14Consider the relational schema

part(part id,name,cost)

subpart(part id,subpart id,count)

A tuple(p1,p2,3)in the subpart relation denotes that the part with part-id p2is a

direct subpart of the part with part-id p1,and p1has3copies of p2Note that p2 may itself have further subparts.Write a recursive SQL query that outputs the names of all subparts of the part with part-id“P-100”.

Answer:No Answer.

4.15Consider again the relational schema from Exercise4.14.Write a JDBC function

using non-recursive SQL to?nd the total cost of part“P-100”,including the costs of all its subparts.Be sure to take into account the fact that a part may have multiple occurrences of a subpart.You may use recursion in Java if you wish.

Answer:No Answer.

7.22Using the functional dependencies of Practice Exercise7.6,compute B+.

Answer:Computing B+by the algorithm in Figure7.9we start with result= {B}.Considering FDs of the formβ→γin F,we?nd that the only depen-dencies satisfyingβ?result are B→B and B→D.Therefore result= {B,D}.No more dependencies in F apply now.Therefore B+={B,D}

7.23Show that the following decomposition of the schema R of Practice Exercise7.1

is not a lossless-join decomposition:

(A,B,C)

(C,D,E).

Hint:Give an example of a relation r on schema R such that

ΠA,B,C(r)1ΠC,D,E(r)=r

Answer:Following the hint,use the following example of r:

A B C D E

a1b1c1d1e1

a2b2c1d2e2

With R1=(A,B,C),R2=(C,D,E):

a.ΠR

1

(r)would be:

A B C

a1b1c1

a2b2c1

b.ΠR

2

(r)would be:

C D E

c1d1e1

c1d2e2

c.ΠR

1

(r)1ΠR

2

(r)would be: A B C D E

a1b1c1d1e1

a1b1c1d2e2

a2b2c1d1e1

a2b2c1d2e2

Clearly,ΠR

1(r)1ΠR

2

(r)=r.Therefore,this is a lossy join.

Exercises

6.14Explain the distinctions among the terms primary key,candidate key,and su-

perkey.

Answer:A superkey is a set of one or more attributes that,taken collectively,al-lows us to identify uniquely an entity in the entity set.A superkey may contain extraneous attributes.If K is a superkey,then so is any superset of K.A superkey for which no proper subset is also a superkey is called a candidate key.It is pos-sible that several distinct sets of attributes could serve as candidate keys.The primary key is one of the candidate keys that is chosen by the database designer as the principal means of identifying entities within an entity set.

6.15Construct an E-R diagram for a hospital with a set of patients and a set of medi-

cal doctors.Associate with each patient a log of the various tests and examina-tions conducted.

Answer:See Figure6.1

6.16Construct appropriate tables for each of the E-R diagrams in Practice Exercises6.1

and6.2.

Answer:

a.Car insurance tables:

person(driver-id,name,address)

car(license,year,model)

accident(report-number,date,location)

participated(driver-id,license,report-number,damage-amount)

b.Hospital tables:

33

Figure6.1E-R diagram for a hospital.

patients(patient-id,name,insurance,date-admitted,date-checked-out)

doctors(doctor-id,name,specialization)

test(testid,testname,date,time,result)

doctor-patient(patient-id,doctor-id)

test-log(testid,performed-by(testid,doctor-id)

c.University registrar’s tables:

student(student-id,name,program)

course(courseno,title,syllabus,credits)

course-offering(courseno,secno,year,semester,time,room)

instructor(instructor-id,name,

enrols(student-id,courseno,secno,semester,year,grade)

teaches(courseno,secno,semester,year,instructor-id)

requires(maincourse,prerequisite)

数据库系统概论复习题及答案

第一学期期末考试试卷和答案 试卷代码:03115 授课课时:96 课程名称:数据库系统原理A 适用对象:本科选课班 一、选择题(从下列各题四个答案中选出一个正确答案,每小题1分,共10分) 1、在数据库技术发展的几个阶段中,数据独立性最高的是__A___阶段。 A、数据库系统 B、文件系统 C、人工管理 D、数据项管理 2、在SQL的SELECT语句中,与选择运算对应的命令动词是__C___。 A、SELECT B、FROM C、WHERE D、ORDER BY 3、在数据库中,下列说法_A__是不正确的 A、数据库避免了一切数据的重复 B、若系统是完全可以控制的,则系统可确保更新是的一致性 C、数据可以共享 D、数据库减少了冗余 4、在数据库系统中,模式/外模式映像用于解决数据的_C__ A、结构独立性 B、物理独立性 C、逻辑独立性 D、分布独立性 5、关系代数的5种基本运算是__D_。 A、并、差、选择、投影、自然连接 B、并、差、交、选择、投影 C、并、差、交、选择、笛卡尔积 D、并、差、选择、投影、笛卡尔积 6、在SQL语句中,谓词“EXISTS”的含义是_B___。 A、全称量词 B、存在量词 C、自然连接--在连接条件中使用等于(=)运算符比较被连接列的列值,但它使用选择列表指出查询结果集合中所包括的列,并删除连接表中的重复列 D、等值连接--在连接条件中使用等于号(=)运算符比较被连接列的列值,其查询结果中列出被连接表中的所有列,包括其中的重复列 7、规范化过程主要为克服数据库逻辑结构中的插入异常、删除异常、更新异常以及_C__的缺陷 A、数据不一致性 B、结构不合理 C、冗余度大 D、数据丢失 8、数据库数据的正确性和相容性是数据库的__B____。 A、安全性 B、可维护性 C、完整性 D、并发控制 9、数据库三级模式体系结构主要的目标是确保数据库的_B__。 A、数据安全性 B、数据独立性

数据库系统概念(各章节练习简答题答案)

数据库系统概念(章节练习简答题答案) 1 .试述sQL 语言的特点。 (l)综合统一。sQL 语言集数据定义语言DDL 、数据操纵语言DML、数据控制语言DCL 的功能于一体。(2)高度非过程化。用sQL 语言进行数据操作,只要提出“做什么”,而无需指明“怎么做”,因此无需了解存取路径,存取路径的选择以及sQL 语句的操作过程由系统自动完成。 (3)面向集合的操作方式。sQL 语言采用集合操作方式,不仅操作对象、查找结果可以是元组的集合,而且一次插入、删除、更新操作的对象也可以是元组的集合。 (4)以同一种语法结构提供两种使用方式。sQL 语言既是自含式语言,又是嵌入式语言。作为自含式语言,它能够独立地用于联机交互的使用方式;作为嵌入式语言,它能够嵌入到高级语言程序中,供程序员设计程序时使用。(5)语言简捷,易学易用。 2 .试述sQL 的定义功能。 sQL 的数据定义功能包括定义表、定义视图和定义索引。SQL 语言使用cREATE TABLE 语句建立基本表,ALTER TABLE 语句修改基本表定义,DROP TABLE 语句删除基本表;使用CREATE INDEX 语句建立索引,DROP INDEX 语句删除索引;使用CREA TE VIEW 语句建立视图,DROP VIEW 语句删除视图。 3 .什么是基本表?什么是视图?两者的区别和联系是什么? 基本表是本身独立存在的表,在sQL 中一个关系就对应一个表。视图是从一个或几个基本表导出的表。视图本身不独立存储在数据库中,是一个虚表。即数据库中只存放视图的定义而不存放视图对应的数据,这些数据仍存放在导出视图的基本表中。视图在概念上与基本表等同,用户可以如同基本表那样使用视图,可以在视图上再定义视图。 4.试述视图的优点。 ( l )视图能够简化用户的操作;( 2 )视图使用户能以多种角度看待同一数据;( 3 )视图对重构数据库提供了一定程度的逻辑独立性;( 4 )视图能够对机密数据提供安全保护。 5 .所有的视图是否都可以更新?为什么? 不是。视图是不实际存储数据的虚表,因此对视图的更新,最终要转换为对基本表的更新。因为有些视图的更新不能惟一有意义地转换成对相应基本表的更新,所以,并不是所有的视图都是可更新的. 6 .哪类视图可以更新的?哪类视图不可以更新的?各举一例说明。 基本表的行列子集视图一般是可更新的。若视图的属性来自集函数、表达式,则该视图肯定是不可以更新的。(举例在书上有) 7 .什么是数据库的安全性? 数据库的安全性是指保护数据库以防止不合法的使用所造成的数据泄露、更改或破坏。 8 .数据库安全性和计算机系统的安全性有什么关系? 安全性问题不是数据库系统所独有的,所有计算机系统都有这个问题。只是在数据库系统中大量数据集中存放,而且为许多最终用户直接共享,从而使安全性问题更为突出。 系统安全保护措施是否有效是数据库系统的主要指标之一。 数据库的安全性和计算机系统的安全性,包括操作系统、网络系统的安全性是紧密联系、相互支持的。 9 .什么是数据库中的自主存取控制方法和强制存取控制方法? 自主存取控制方法:定义各个用户对不同数据对象的存取权限。当用户对数据库访问时首先检查用户的存取权限。防止不合法用户对数据库的存取。 强制存取控制方法:每一个数据对象被(强制地)标以一定的密级,每一个用户也被(强制地)授予某一个级别的许可证。系统规定只有具有某一许可证级别的用户才能存取某一个密级的数据对象。 10. 为什么强制存取控制提供了更高级别的数据库安全性? 强制存取控制(MAC )是对数据本身进行密级标记,无论数据如何复制,标记与数据是一个不可分的整体,只有符合密级标记要求的用户才可以操纵数据,从而提供了更高级别的安全性。

数据库系统概论各章复习试题及答案

数据库系统概论复习资料: 第一章: 一、选择题: 1.在数据管理技术的发展过程中,经历了人工管理阶段、文件系统阶段和数据库系统阶段。在这几个阶段中,数据独立性最高的是 A 阶段。 A.数据库系统 B.文件系统 C.人工管理 D.数据项管理 2.数据库的概念模型独立于 A 。 A.具体的机器和DBMS B.E-R图 C.信息世界 D.现实世界 3.数据库的基本特点是 B 。 A.(1)数据可以共享(或数据结构化) (2)数据独立性 (3)数据冗余大,易移植 (4)统一管理和控制 B.(1)数据可以共享(或数据结构化) (2)数据独立性 (3)数据冗余小,易扩充 (4)统一管理和控制 C.(1)数据可以共享(或数据结构化) (2)数据互换性 (3)数据冗余小,易扩充 (4)统一管理和控制 D.(1)数据非结构化 (2)数据独立性 (3)数据冗余小,易扩充 (4)统一管理和控制 4. B 是存储在计算机内有结构的数据的集合。 A.数据库系统B.数据库 C.数据库管理系统 D.数据结构 5.数据库中存储的是 C 。 A.数据 B.数据模型C.数据以及数据之间的联系 D.信息 6. 数据库中,数据的物理独立性是指 C 。 A.数据库与数据库管理系统的相互独立 B.用户程序与DBMS的相互独立 C.用户的应用程序与存储在磁盘上数据库中的数据是相互独立的 D.应用程序与数据库中数据的逻辑结构相互独立 7. 数据库的特点之一是数据的共享,严格地讲,这里的数据共享是指 D 。 A.同一个应用中的多个程序共享一个数据集合 B.多个用户、同一种语言共享数据 C.多个用户共享一个数据文件 D.多种应用、多种语言、多个用户相互覆盖地使用数据集合 8.数据库系统的核心是 B 。 A.数据库 B.数据库管理系统 C.数据模型 D.软件工具 9. 下述关于数据库系统的正确叙述是 A 。 A.数据库系统减少了数据冗余 B.数据库系统避免了一切冗余 C.数据库系统中数据的一致性是指数据类型一致 D.数据库系统比文件系统能管理更多的数据 10. 数将数据库的结构划分成多个层次,是为了提高数据库的①和②。 ①A.数据独立性 B.逻辑独立性 C.管理规范性 D.数据的共享 ②A.数据独立性 B.物理独立性 C.逻辑独立性 D.管理规范性 【答案:】①B ②B 11. 数据库(DB)、数据库系统(DBS)和数据库管理系统(DBMS)三者之间的关系是 A 。 A.DBS包括DB和DBMS B.DDMS包括DB和DBS C.DB包括DBS和DBMS D.DBS就是DB,也就是DBMS

数据库系统概论试题及答案整理版

数据库系统概论复习资料 第一章绪论 一、选择题 1.在数据管理技术的发展过程中,经历了人工管理阶段、文件系统阶段和数据库系统阶段。在这几个 阶段中,数据独立性最高的是 A 阶段。 A.数据库系B.文件系统C.人工管理D.数据项管理 2.数据库的概念模型独立于 A 。 A.具体的机器和DBMS B.E-R图C.信息世界D.现实世界 3.数据库的基本特点是 B 。 A.(1)数据结构化(2)数据独立性 (3)数据共享性高,冗余大,易移植 (4)统一管理和控制 B.(1)数据结构化(2)数据独立性 (3)数据共享性高,冗余小,易扩充 (4)统一管理和控制 C.(1)数据结构化(2)数据互换性 (3)数据共享性高,冗余小,易扩充 (4)统一管理和控制 D.(1)数据非结构化 (2)数据独立性 (3)数据共享性高,冗余小,易扩充 (4)统一管理和控制 4. B 是存储在计算机内有结构的数据的集合。 A.数据库系统B.数据库C.数据库管理系统D.数据结构 5.数据库中存储的是 C 。 A. 数据 B. 数据模型 C.数据及数据间的联系 D. 信息 6.数据库中,数据的物理独立性是指 C 。 A.数据库与数据库管理系统的相互独立 B.用户程序与DBMS的相互独立 C.用户的应用程序与存储在磁盘上数据库中的数据是相互独立的 D.应用程序与数据库中数据的逻辑结构相互独立 7.数据库的特点之一是数据的共享,严格地讲,这里的数据共享是指 D 。 A.同一个应用中的多个程序共享一个数据集合 B.多个用户、同一种语言共享数据 C.多个用户共享一个数据文件 D.多种应用、多种语言、多个用户相互覆盖地使用数据集合

(完整版)数据库系统概论试题及答案3

试题三 一、单项选择题 (本大题共20小题,每小题1.5分,共30分) 在每小题列出的四个备选项中只有一个是符合题目要 求的,请将其代码填写在题后的括号内。错选、多选或 未选均无分。 1. 数据库系统与文件系统的主要区别是() A.数据库系统复杂,而文件系统简单 B.文件系统不能解决数据冗余和数据独立性问题,而数据库系统可以解决C.文件系统只能管理程序文件,而数据库系统能够管理各种类型的文件D.文件系统管理的数据量较少,而数据库系统可以管理庞大的数据量 2.数据库管理系统能实现对数据库中数据的查询、插入、修改和删除等操作的 数据库语言称为() A.数据定义语言(DDL)B.数据管理语言 C.数据操纵语言(DML)D.数据控制语言 3.数据库的网状模型应满足的条件是() A.允许一个以上结点无双亲,也允许一个结点有多个双亲 B.必须有两个以上的结点 C.有且仅有一个结点无双亲,其余结点都只有一个双亲 D.每个结点有且仅有一个双亲 4.数据的逻辑独立性是指() A.内模式改变,模式不变 B.模式改变,内模式不变 C.模式改变,外模式和应用程序不变 D.内模式改变,外模式和应用程序不变 5.设有关系模式EMP(职工号,姓名,年龄,技能)。假设职工号唯一,每个职工有多项技能,则EMP表的主码是() A.职工号B.姓名,技能 C.技能D.职工号,技能 6.在关系代数中,对一个关系做投影操作后,新关系的元组个数()原来 关系的元组个数。

A.小于B.小于或等于C.等于D.大于 7.设关系R和S的属性个数分别是2和3,那么R S等价于() 1<2 A.σ1<2(R?S)B.σ1<4(R?S) C.σ1<2(R S)D.σ1<4(R S) 8.学校数据库中有学生和宿舍两个关系: 学生(学号,姓名)和宿舍(楼名,房间号,床位号,学号) 假设有的学生不住宿,床位也可能空闲。如果要列出所有学生住宿和宿舍分配的情况,包括没有住宿的学生和空闲的床位,则应执行() A. 全外联接 B. 左外联接 C. 右外联接 D. 自然联接 9.用下面的T-SQL语句建立一个基本表: CREATE TABLE Student(Sno CHAR (4) NOT NULL, Sname CHAR (8) NOT NULL, Sex CHAR (2), Age SMALLINT) 可以插入到表中的元组是() A. '5021','刘祥',男,21 B.NULL,'刘祥',NULL,21 C. '5021',NULL,男,21 D. '5021','刘祥',NULL,NULL 10. 把对关系SC的属性GRADE的修改权授予用户ZHAO的T-SQL语句是 () A. GRANT GRADE ON SC TO ZHAO B. GRANT UPDA TE ON SC TO ZHAO C. GRANT UPDA TE (GRADE) ON SC TO ZHAO D. GRANT UPDA TE ON SC (GRADE) TO ZHAO 11.图1中()是关系完备的系统 A B C D 图1 12.给定关系模式SCP(Sno,Cno,P),其中Sno表示学号,Cno表示课程号,P 表示名次。若每一名学生每门课程有一定的名次,每门课程每一名次只有一名学生,则以下叙述中错误的是()

数据库系统概念(database system concepts)英文第六版 课后练习题 答案 第23章

C H A P T E R23 XML Practice Exercises 23.1Give an alternative representation of university information contain- ing the same data as in Figure23.1,but using attributes instead of subelements.Also give the DTD or XML S chema for this representation. Answer: a.The XML representation of data using attributes is shown in Figure 23.100. b.The DTD for the bank is shown in Figure23.101. 1

2Chapter23XML Figure23.100XML representation. 23.2Give the DTD or XML S chema for an XML representation of the following nested-relational schema: Emp=(ename,ChildrenSet setof(Children),SkillsSet setof(Skills)) Children=(name,Birthday) Birthday=(day,month,year) Skills=(type,ExamsSet setof(Exams)) Exams=(year,city)

数据库系统概论课后练习答案4

第4章数据库安全性 1 .什么是数据库的安全性? 答:数据库的安全性是指保护数据库以防止不合法的使用所造成的数据泄露、更改或破坏。 2 .数据库安全性和计算机系统的安全性有什么关系? 答:安全性问题不是数据库系统所独有的,所有计算机系统都有这个问题。只是在数据库系统中大量数据集中存放,而且为许多最终用户直接共享,从而使安全性问题更为突出。 系统安全保护措施是否有效是数据库系统的主要指标之一。 数据库的安全性和计算机系统的安全性,包括操作系统、网络系统的安全性是紧密联系、相互支持的。 3 .试述可信计算机系统评测标准的情况,试述TDI / TCSEC 标准的基本内容。 答:各个国家在计算机安全技术方面都建立了一套可信标准。目前各国引用或制定的一系列安全标准中,最重要的是美国国防部(DoD )正式颁布的《 DoD 可信计算机系统评估准则》。CC通用准则V2.1版于1999年被ISO纳为国际标准,2001年我国采用其为国家标准。目前CC已经基本取代了TCSEC,成为评估信息产品安全性的主要标准。 TDI / TCSEC 标准是将TcsEc 扩展到数据库管理系统,即《可信计算机系统评估标准关于可信数据库系统的解释》(Tmsted Database Interpretation 简称TDI , 又称紫皮书)。在TDI 中定义了数据库管理系统的设计与实现中需满足和用以进行安全性级别评估的标准。 TDI 与TcsEc 一样,从安全策略、责任、保证和文档四个方面来描述安全性级别划分的指标。每个方面又细分为若干项。 CC提出目前国际公认的表述信息技术安全性的结构,即把对信息产品的安全要求分为安全功能要求和安全保证要求。 安全功能要求用以规范产品和系统的安全行为,安全保证要求解决如何正确、有效地实施这些功能。 4 .试述TcsEC ( TDI )将系统安全级别划分为4 组7 个等级的基本内容。 答:根据计算机系统对安全性各项指标的支持情况,TCSEC ( TDI )将系统划分为四组(division )7 个等级,依次是 D 、C ( CI , CZ )、B ( BI , BZ , B3 )、A ( AI ) ,按系统可靠或可信程度逐渐增高。 这些安全级别之间具有一种偏序向下兼容的关系,即较高安全性级别提供的安全保护包含较低级别的所有保护要求,同时提供更多或更完善的保护能力。各个等级的基本内容为: ● D 级D 级是最低级别。一切不符合更高标准的系统,统统归于D 组。 ●Cl级只提供了非常初级的自主安全保护。能够实现对用户和数据的分离,进行自主存取控制 (DAC ) ,保护或限制用户权限的传播。 ●C2 级实际是安全产品的最低档次,提供受控的存取保护,即将Cl 级的DAC 进一步细化,以个 人身份注册负责,并实施审计和资源隔离。 ●Bl 级标记安全保护。对系统的数据加以标记,并对标记的主体和客体实施强制存取控制(MAC ) 以及审计等安全机制。

数据库系统概念第六版课后习题部分答案2s

C H A P T E R2 Introduction to the Relational Model Practice Exercises 2.1Consider the relational database of Figure??.What are the appropriate primary keys? Answer:The answer is shown in Figure2.1,with primary keys under- lined. 2.2Consider the foreign key constraint from the dept name attribute of in- structor to the department relation.Give examples of inserts and deletes to these relations,which can cause a violation of the foreign key constraint. Answer: ?Inserting a tuple: (10111,Ostrom,Economics,110,000) into the instructor table,where the department table does not have the department Economics,would violate the foreign key constraint. ?Deleting the tuple: (Biology,Watson,90000) from the department table,where at least one student or instructor tuple has dept name as Biology,would violate the foreign key con- straint. employee(person name,street,city) works(person name company name,salary) company(company name,city) Figure2.1Relational database for Practice Exercise2.1. 1

《数据库系统概论》课后习题及参考答案

课后作业习题 《数据库系统概论》课程部分习题及参考答案 第一章绪论(教材 41页) 1.试述数据、数据库、数据库系统、数据库管理系统的概念。 数据: 描述事物的符号记录称为数据。数据的种类有文字、图形、图象、声音、正文等等。数据与其语义是不可分的。 数据库: 数据库是长期储存在计算机内、有组织的、可共享的数据集合。数据库中的数据按一定的数据模型组织、描述和储存,具有较小的冗余度、较高的数据独立性和易扩展性,并可为各种用户共享。 数据库系统: 数据库系统( DBS)是指在计算机系统中引入数据库后的系统构成。数据库系统由数据库、数据库管理系统(及其开发工具)、应用系统、数据库管理员构成。 数据库管理系统: 数据库管理系统 (DBMS)是位于用户与操作系统之间的一层数据管理软件。用于科学地组织和存储数据、高效地获取和维护数据。DBMS主要功能包括数据定义功能、数据操纵功能、数据库的运行管理功能、数据库的建立和维护功能。 2.使用数据库系统有什么好处? 使用数据库系统的好处是由数据库管理系统的特点或优点决定的。 使用数据库系统的好处很多,例如可以大大提高应用开发的效率,方便用户的使用,减轻数据库系统管理人员维护的负担等。 为什么有这些好处,可以结合第 5题来回答。

使用数据库系统可以大大提高应用开发的效率。因为在数据库系统中应用程序不必考虑数据的定义、存储和数据存取的具体路径,这些工作都由 DBMS来完成。 此外,当应用逻辑改变,数据的逻辑结构需要改变时,由于数据库系统提供了数据与程序之间的独立性。数据逻辑结构的改变是 DBA的责任,开发人员不必修改应用程序,或者只需要修改很少的应用程序。从而既简化了应用程序的编制,又大大减少了应用程序的维护和修改。 使用数据库系统可以减轻数据库系统管理人员维护系统的负担。因为 DBMS在数据库建立、运用和维护时对数据库进行统一的管理和控制,包括数据的完整性、安全性,多用户并发控制,故障恢复等等都由DBMS执行。 总之,使用数据库系统的优点是很多的,既便于数据的集中管理,控制数据冗余,可以提高数据的利用率和一致性,又有利于应用程序的开发和维护。 3.试述文件系统与数据库系统的区别和联系。 文件系统与数据库系统的区别: 文件系统面向某一应用程序,共享性差、冗余度大,独立性差,纪录内有结构、整体无结构,应用程序自己控制。 数据库系统面向现实世界,共享性高、冗余度小,具有高度的物理独立性和一定的逻辑独立性,整体结构化,用数据模型描述,由数据库管理系统提供数据安全性、完整性、并发控制和恢复能力。 文件系统与数据库系统的联系是: 文件系统与数据库系统都是计算机系统中管理数据的软件。 5.试述数据库系统的特点。 数据库系统的主要特点有: 一、数据结构化 数据库系统实现整体数据的结构化,这是数据库的主要特征之一,也是数据库系统与文件系统的本质区别。 二、数据的共享性高,冗余度低,易扩充

数据库系统概论试题及答案

试题二 一、单项选择题 在每小题列出的四个备选项中只有一个是符合题目 要求的,请将其代码填写在题后的括号内。错选、 多选或未选均无分。 1. 下列四项中,不属于数据库系统的主要特点的是()。 A.数据结构化B.数据的冗余度小 C.较高的数据独立性 D.程序的标准化 2. 数据的逻辑独立性是指() A.内模式改变,模式不变 B.模式改变,内模式不变 C.模式改变,外模式和应用程序不变 D.内模式改变,外模式和应用程序不变 3. 在数据库的三级模式结构中,描述数据库中全体数据的全局逻辑结构和特征 的是()。 A.外模式 B.内模式 C.存储模式 D.模式 4. 相对于非关系模型,关系数据模型的缺点之一是()。 A.存取路径对用户透明,需查询优化 B.数据结构简单 C.数据独立性高D.有严格的数学基础 5. 现有关系表:学生(宿舍编号,宿舍地址,学号,姓名,性别,专业,出生 日期)的主码是()。 A.宿舍编号 B.学号 C.宿舍地址,姓名 D.宿舍编号,学号 6.自然连接是构成新关系的有效方法。一般情况下,当对关系R和S使用自然 连接时,要求R和S含有一个或多个共有的()。 A.元组 B.行 C.记录 D.属性 7.下列关系运算中,()运算不属于专门的关系运算。 A.选择B.连接 C.广义笛卡尔积D.投影 8. SQL语言具有()的功能。

A.关系规范化、数据操纵、数据控制 B.数据定义、数据操纵、数据控制 C.数据定义、关系规范化、数据控制 D.数据定义、关系规范化、数据操纵 9.从E-R模型关系向关系模型转换时,一个M:N联系转换为关系模式时,该关系模式的关键字是()。 A.M端实体的关键字B.N端实体的关键字 C.M端实体关键字与N端实体关键字组合 D.重新选取其他属性 10. SQL语言中,删除一个表的命令是() A. DELETE B. DROP C. CLEAR D. REMOVE 11. 图1中()是关系完备的系统 A B C D 图1 12.有关系模式A(S,C,M),其中各属性的含义是:S:学生;C :课程;M:名次,其语义是:每一个学生选修每门课程的成绩有一定的名次,每门课程中每一名次只有一个学生(即没有并列名次),则关系模式A最高达到()A.1NF B.2NF C.3NF D.BCNF 13.关系规范化中的删除异常是指 ( ) A.不该删除的数据被删除B.不该插入的数据被插入C.应该删除的数据未被删除D.应该插入的数据未被插入 14.在数据库设计中, E-R图产生于() A.需求分析阶段B.物理设计阶段 C.逻辑设计阶段D.概念设计阶段 15.有一个关系:学生(学号,姓名,系别),规定学号的值域是8个数字组成的字符串,这一规则属于()。 A.实体完整性约束 B.参照完整性约束 C.用户自定义完整性约束 D.关键字完整性约束

数据库系统概念答案(第五版)

C H A P T E R2 Exercises 2.4Describe the differences in meaning between the terms relation and relation schema. Answer:A relation schema is a type de?nition,and a relation is an instance of that schema.For example,student(ss#,name)is a relation schema and is a relation based on that schema. 2.5Consider the relational database of Figure2.35,where the primary keys are un- derlined.Give an expression in the relational algebra to express each of the fol-lowing queries: a.Find the names of all employees who work for First Bank Corporation. b.Find the names and cities of residence of all employees who work for First Bank Corporation. c.Find the names,street address,and cities of residence of all employees who work for First Bank Corporation and earn more than$10,000per annum. d.Find the names of all employees in this database who live in the same city as the company for which they work. e.Assume the companies may be located in several cities.Find all companies located in every city in which Small Bank Corporation is located. Answer: a.Πperson-name(σcompany-name=“First Bank Corporation”(works)) 7

数据库系统概论知识点

第一章:绪论 数据库(DB):长期存储在计算机内、有组织、可共享的大量数据的集合。数据库中的数据按照一定的数据模型组织、描述和存储,具有娇小的冗余度、交稿的数据独立性和易扩展性,并可为各种用户共享。 数据库管理系统(DBMS):位于用户和操作系统间的数据管理系统的一层数据管理软件。用途:科学地组织和存储数据,高效地获取和维护数据。包括数据定义功能,数据组织、存储和管理,数据操纵功能,数据库的事物管理和运行管理,数据库的建立和维护功能,其他功能。 数据库系统(DBS):在计算机系统中引入数据库后的系统,一般由数据库。数据库管理系统(及其开发工具)、应用系统、数据库管理员构成。目的:存储信息并支持用户检索和更新所需的信息。 数据库系统的特点:数据结构化;数据的共享性高,冗余度低,易扩充;数据独立性高;数据由DBMS统一管理和控制。 概念模型实体,客观存在并可相互区别的事物称为实体。 属性,实体所具有的某一特性称为属性。 码,唯一标识实体的属性集称为码。 域,是一组具有相同数据类型的值的集合。 实体型,具有相同属性的实体必然具有的共同的特征和性质。 实体集,同一类型实体的集合称为实体集。 联系 两个实体型之间的联系一对一联系;一对多联系;多对多联系 关系模型关系,元组,属性,码,域,分量,关系模型 关系数据模型的操纵与完整性约束关系数据模型的操作主要包括查询,插入,删除和更新数据。这些操作必须满足关系完整性约束条件。关系的完整性约束条件包括三大类:实体完整性,参照完整性和用户定义的完整性。 数据库系统三级模式结构外模式,模式,内模式 模式:(逻辑模式)数据库中全体数据的逻辑结构和特征的描述,是所有用户的公共数据视图。一个数据库只有一个模式。

数据库系统概论第一章课后答案

第01章绪论 1 .试述数据、数据库、数据库系统、数据库管理系统的概念。 答: ( l )数据(Data ) :描述事物的符号记录称为数据。数据的种类有数字、文字、图形、图像、声音、正文等。数据与其语义是不可分的。解析在现代计算机系统中数据的概念是广义的。早期的计算机系统主要用于科学计算,处理的数据是整数、实数、浮点数等传统数学中的数据。现代计算机能存储和处理的对象十分广泛,表示这些对象的数据也越来越复杂。数据与其语义是不可分的。500 这个数字可以表示一件物品的价格是500 元,也可以表示一个学术会议参加的人数有500 人,还可以表示一袋奶粉重500 克。 ( 2 )数据库(DataBase ,简称DB ) :数据库是长期储存在计算机内的、有组织的、可共享的数据集合。数据库中的数据按一定的数据模型组织、描述和储存,具有较小的冗余度、较高的数据独立性和易扩展性,并可为各种用户共享。 ( 3 )数据库系统(DataBas 。Sytem ,简称DBS ) :数据库系统是指在计算机系统中引入数据库后的系统构成,一般由数据库、数据库管理系统(及其开发工具)、应用系统、数据库管理员构成。解析数据库系统和数据库是两个概念。数据库系统是一个人一机系统,数据库是数据库系统的一个组成部分。但是在日常工作中人们常常把数据库系统简称为数据库。希望读者能够从人们讲话或文章的上下文中区分“数据库系统”和“数据库”,不要引起混淆。 ( 4 )数据库管理系统(DataBase Management sytem ,简称DBMs ) :数据库管理系统是位于用户与操作系统之间的一层数据管理软件,用于科学地组织和存储数据、高效地获取和维护数据。DBMS 的主要功能包括数据定义功能、数据操纵功能、数据库的运行管理功能、数据库的建立和维护功能。解析DBMS 是一个大型的复杂的软件系统,是计算机中的基础软件。目前,专门研制DBMS 的厂商及其研制的DBMS 产品很多。著名的有美国IBM 公司的DBZ 关系数据库管理系统和IMS 层次数据库管理系统、美国Oracle 公司的orade 关系数据库管理系统、s 油ase 公司的s 油ase 关系数据库管理系统、美国微软公司的SQL Serve ,关系数据库管理系统等。

数据库系统概念16章课后习题

1. 假设两阶段锁定并不保证可串行性。然后有一个组事务T0,T1……Tn?1,服从2pl和它产生的非序列化时间表。一个非可序列化的时间表意味着一个周期在优先图,我们将显示,2pl 不能产生这种循环。没有损失的通用性,假设以下循环存在于优先图: T0→T1→T2→……Tn?→1→T0。让αi是Ti获得其最后一个锁(即Ti的锁点)的时间。然后对所有事务,以便Ti →Tj,αi <αj。然后我们有周期 α0 <α1 <α2 <……< <α0αn?1 因为α0 <α0是一个矛盾,没有这样的循环可以存在。因此2pl无法产生非可序列化的时间表。因为所有事物的属性,Ti→Tj,αi <αj,锁点排序的事务也是一个拓扑排序顺序图的优先级。因此事物根据他们的锁点可以序列化。 2.a.锁定和解锁指令: b执行这些事务可能导致死锁。例如,考虑下面的部分计划: 现在的事务陷入死锁。

3. 严格的两阶段锁具有严格的2pl。此外,它已经属性,对于两种相互冲突的交易,他们的提交订单是他们的可串行性秩序。在一些系统中用户可能希望这种行为。 4. 证据就是Buckley和Silberschatz,并发控制在图协议通过使用边锁,Proc。ACM SIGACT-SIGMOD的研讨会上数据库系统原理,1984。 5. 考虑下面的树型结构数据库图。 时间表可能在树协议但不低于2pl 6. 证据就是Kedem和Silberschatz,锁定协议:从独享共享锁,JACM卷。30,4,1983。 7. 证据就是Kedem和Silberschatz,控制并发使用锁定协议,Proc。年度IEEE研讨会的计算机基础科学,1979。 8. 证据就是Kedem和Silberschatz,控制并发使用锁定协议,Proc。年度IEEE研讨会的计算机基础科学,1979。 9. 访问保护机制可以用于实现页面级锁。考虑读第一,一个过程是允许读一页只有在它读-锁该页面。这是通过使用mprotect实现最初关掉阅读所有页面的权限,因为这个过程。当进程试图访问一个地址在一个页面上,保护违反发生。处理程序关联保护违反然后请求一个页面上的读锁,锁后获得,它使用mprotect允许读访问页面的过程,最后允许过程继续。写访问的处理是类似的。 10. 证据就是Korth,锁定原语在一个数据库系统,JACM卷。30日,1983。 11. 它没有什么区别。写协议是这样的,最近的写一项事务也是最大时间戳的那个。

数据库系统概论选择题

第一章:数据与信息 1、关于信息和数据的描述正确的是? A、数据是信息的符号表示 B、数据是信息的载体 C、信息是数据的内涵 D、以上都不正确 2、数据和信息的关系是? A、二者不可区分 B、二者的可区分性不确定 C、信息和数据不可分离又有一定区别 D、任何数据均可表示信息 3、以下说法错误的是? A、数据具有客观性,本身没有意义 B、数据是信息的载体 C、数据与信息是一个概念,都是对现实世界的客观存在的描述 D、数据包括数字、文字、符号、图形、图像等形式 4、以下关于数据和信息的关系,说法不正确的是? A、数据是信息的载体,信息是从数据中提炼出来的 B、123456是数据,当它被当作密码时,就是信息 C、信息和数据就是一回事,不能被严格的区分 D、同一数据可以表达不同信息,同一信息也可以用不同的数据来表达 5、以下关于数据和信息的关系,说法不正确的是? A、数据就是信息,本来就是一回事 B、love这个单词是数据,当你向女生表白的时候,它就项女生传达了信息 C、202.108.33.60是由数字和点组成的数据,在网络中它指的是新浪的服务器 D、同一数据可以表达不同信息,同一信息也可以用不同的数据来表达 数据库存储和管理

1、在数据库系统中,负责监控数据库系统的运行情况,及时处理运行过程中出现的问题,这类职责的人员统称为( )? A、数据库管理员 B、数据库设计员 C、系统分析员 D、应用程序员 2、下面关于数据库的用途的说法正确的是? A、淘宝网、京东商城页面上显示的商品的信息来自于数据库中的数据 B、我们在淘宝上能看到我们的购买记录,是因为淘宝网用数据库记录了买家的每一笔 交易记录 C、去移动营业厅能够打印每一次通话记录的时长,呼入方和呼出方的电话号码,是因 为中国移动的后天服务器记录了用户的每一次通话 D、QQ上的聊天记录能够漫游,是因为聊天记录存放在腾讯的服务器上 3、数据库系统与文件系统的主要区别是? A、数据库系统复杂,而文件系统简单 B、文件系统不能解决数据冗余和数据独立性问题,而数据库系统可以解决 C、文件系统只能管理程序文件,而数据库系统能够管理各种类型的文件 D、文件系统管理的数据量较少,而数据库系统可以管理庞大的数据量 4、以下关于数据库、数据库关系系统,说法不正确的是? A、数据库字面上的意思是存放数据的仓库,把数据按照一定的逻辑存放在一起 B、平常常说数据库,实际上是指数据库管理系统,数据库是基础,在这个基础之上, 提供给用户操作数据的界面或对数据实施管理,那么,数据库加上对数据的管理,就是我们常说的数据库管理系统 C、严格意义上来说,SQLServer /Oracle是属于数据库管理系统,简称DBMS D、从本质来看,SQLServer/Oracle是数据库 5、数据库系统的核心是? A、数据库 B、数据库管理系统 C、数据模型 D、软件工具 6、数据库管理系统的缩写是?

数据库系统概论课后答案{王珊版}

2 .使用数据库系统有什么好处? 答: 使用数据库系统的好处是由数据库管理系统的特点或优点决定的。使用数据库系统的好处很多,例如,可以大大提高应用开发的效率,方便用户的使用,减轻数据库系统管理人员维护的负担,等等。使用数据库系统可以大大提高应用开发的效率。因为在数据库系统中应用程序不必考虑数据的定义、存储和数据存取的具体路径,这些工作都由DBMS 来完成。用一个通俗的比喻,使用了DBMS 就如有了一个好参谋、好助手,许多具体的技术工作都由这个助手来完成。开发人员就可以专注于应用逻辑的设计,而不必为数据管理的许许多多复杂的细节操心。还有,当应用逻辑改变,数据的逻辑结构也需要改变时,由于数据库系统提供了数据与程序之间的独立性,数据逻辑结构的改变是DBA 的责任,开发人员不必修改应用程序,或者只需要修改很少的应用程序,从而既简化了应用程序的编制,又大大减少了应用程序的维护和修改。使用数据库系统可以减轻数据库系统管理人员维护系统的负担。因为DBMS 在数据库建立、运用和维护时对数据库进行统一的管理和控制,包括数据的完整性、安全性、多用户并发控制、故障恢复等,都由DBMS 执行。总之,使用数据库系统的优点是很多的,既便于数据的集中管理,控制数据冗余,提高数据的利用率和一致性,又有利于应用程序的开发和维护。读者可以在自己今后的工作中结合具体应用,认真加以体会和总结。 3 .试述文件系统与数据库系统的区别和联系。 答: 文件系统与数据库系统的区别是:文件系统面向某一应用程序,共享性差,冗余度大,数据独立性差,记录内有结构,整体无结构,由应用程序自己控制。数据库系统面向现实世界,共享性高,冗余度小,具有较高的物理独立性和一定的逻辑独立性,整体结构化,用数据模型描述,由数据库管理系统提供数据的安全性、完整性、并发控制和恢复能力。 文件系统与数据库系统的联系是:文件系统与数据库系统都是计算机系统中管理数据的软件。解析文件系统是操作系统的重要组成部分;而DBMS 是独立于操作系统的软件。但是DBMS 是在操作系统的基础上实现的;数据库中数据的组织和存储是通过操作系统中的文件系统来实现的。 4 .举出适合用文件系统而不是数据库系统的例子;再举出适合用数据库系统的应用例子。答: ( l )适用于文件系统而不是数据库系统的应用例子数据的备份、软件或应用程序使用过程中的临时数据存储一般使用文件比较合适。早期功能比较简单、比较固定的应用系统也适合用文件系统。 ( 2 )适用于数据库系统而非文件系统的应用例子目前,几乎所有企业或部门的信息系统都以数据库系统为基础,都使用数据库。例如,一个工厂的管理信息系统(其中会包括许多子系统,如库存管理系统、物资采购系统、作业调度系统、设备管理系统、人事管理系统等),学校的学生管理系统,人事管理系统,图书馆的图书管理系统,等等,都适合用数据库系统。希望读者能举出自己了解的应用例子。 5 .试述数据库系统的特点。 答: 数据库系统的主要特点有: ( l )数据结构化数据库系统实现整体数据的结构化,这是数据库的主要特征之一,也是数据库系统与文件系统的本质区别。解析注意这里的“整体’夕两个字。在数据库系统中,数

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