首页 > 数据库 >数据库原理与应用期末试卷(2)SCAU

数据库原理与应用期末试卷(2)SCAU

时间:2024-12-26 09:56:14浏览次数:5  
标签:key database 数据库 points relation 期末试卷 following relational SCAU

华南农业大学期末考试试卷(A卷)

2020-2021学年第一学期              考试科目: 数据库系统(双语)

考试类型:闭卷               考试时间: 120   分钟

学号              姓名               年级专业                     

题号

总分

得分

评阅人

Instructions to candidates:

1. Write your name, student number and class on both the question papers and the answer papers. And write ALL YOUR ANSWERS ON THE ANSWER PAPERS.

2. Write your answers in either Chinese or English.

3. Hand in all papers (both the question papers and the answer papers).            

得分

Question 1 (40 points, 2 points for each problem) single-choice question, select the most appropriate answer please.

  1. The database system is ________.

A. equivalent to the DBMS

B. equivalent to the DBMS and the managed databases

C. a collection of interrelated data

D. the overall design of the database

  1. The collection of information stored in the database at a particular moment is called         .
  1. database instance B. database scheme  C. physical scheme D. data relationship
  1.         is a nonprocedural language used in commercial database systems.

A. Relational algebra    B. Tuple relational calculus

C. SQL               D. Domain relational calculus

  1.       of the following is true about the number of keys with respect to a table?

A. There can be many primary keys and many candidate keys

B. There can be only one primary key and many candidate keys

C. There can be many primary keys but only one foreign key

D. There can be only one primary key and only one super key

  1. In the following terms,      is proper.

A. relation is a table in relational database  B. the attribute is a row of a table

C. the tuple means a column of a table   D. each table should have many records

  1. Using functions and procedures in the database system is beneficial to ________

A. modularization  B. performance  C. security  D. all of the above

  1. Which the following statement about view is not correct?

A. View relation can be defined as relations containing the result of queries.

B. View is useful for hiding unneeded information

C. View is a virtual relation, that is, it is an empty table with no records

D. View can be used to collect together information from more than one relation

  1.        is not one of the three basic notions in E-R model.

A. Entity    B. Relationship    C. Attributes    D. Schemas

  1. Which of the following statements is false?

A. 4NF is the most strict norm form with respect to the functional dependency theory

B. A relation in 3NF is also in 1NF

C. If a relation satisfies 4NF, it also satisfies 3NF

D. BCNF is stricter than 3NF

  1. _______ is not the property of transactions.

A. Atomicity B. Inconsistency C. Isolation D. Durability

  1. If a transaction T has obtained an shared lock on data item A, then T can   

A. only read A  B. only write A C. read and write A D. none of the above

  1. When mapping from an ER model to a relational model, a relationship can be mapped into          .

A. a super key of the relation transferred from a related entity set

B. a row of the relation transferred from a related entity set

C. a table with describing attribute of the relationship

D. a table or a set of columns in the relation transferred from a related entity set

  1. In database physical-design phase,         must be given.

A. dataflow graph B. inner Schema of database

C. logical schema of database D. user Schema of database

  1. In SQL, which of the following predicate can be used in the where clause to test ‘amount’ for a null value.

A. amount=’ ’    B. amount is null    C. amount =0    D. amount = null

  1. The SQL statement“Select count(*) From employee left outer join works”is run on the following tables, then         is the output of the query?

employee                                  works

emp_name

street

city

emp_name

company

salary

Alice

Toon

Seattle

Alice

Google

5000

Bob

Tunnel

Hollywood

Bob

Yahoo

4300

Coyote

Seaview

Carrotville

Williams

Dropbox

3800

Smith

Revolver

Death Valley

A. 2  B. 3   C. 4   D. 5

  1. Given the table T1, created by: CREATE TABLE EMP(ID CHAR(3) PRIMARY KEY,  Name CHAR(8),  Age Integer, CONSTRAINT const1 CHECK (Age>18 and Age<60));

The following SQL statements are issued:

INSERT INTO EMP(ID, Age) VALUES ('001',25);

INSERT INTO EMP(ID, Age) VALUES (‘002’,35);

INSERT INTO EMP(ID, Age) VALUES (‘003’,15);

INSERT INTO EMP VALUES (‘004’, 40);

COMMIT;

How many rows are inserted into Table EMP?

A. 0          B. 1         C. 2         D. 3

  1.  In the following rules about functional dependency,            is correct.

A. X®Y if XÇ Y =Æ   B. WX®Z if X®Y and WY®Z

C. X®Z, Y®Z if XY®Z D. X®Y if XÍ Y

  1. Let A, B, C and D be attributes, in the following relational algebra expressions, 

          is not a relation.

A. R(A´B´C´D) B.R(A) C. R(A,B) D. R(A,B) ´ S(C,D)

  1. Among the following sentences about trigger,           is wrong.

A. trigger is a special kind of stored procedure

B. trigger is different to stored procedure in that it is auto-executed and with no parameters.

C. triggers can be used to maintain data consistence

D. in triggers, temporary table new and old (or inserted and deleted) can be queried and updated.

  1.  If there is a one-to-many relationship between the entity sets A and B, then    

A. there exists a functional dependency from the primary key in B to the primary key in A, i.e., PK(B) → PK(A).

B. there exists a functional dependency from the primary key in A to the primary key in B, i.e., PK(A) → PK(B).

C. both A and B. D. neither A nor B

得分

Question 2 

(21 points) Consider the following relational schema

Teacher(TId, TName, office, age)

Equipment(EId, Ename, serial_number, price)

Own(TId, EId, date)

a. Print the Id of teacher who do not own any equipment. (in relational algebra,3 points).

b. Print the name of teachers who have owned any equipment with price < 1000(in both SQL and relational algebra, 3 points for each, 6 points in total).

c. Print the name of teachers who have owned the equipment with the highest price (in SQL and relational algebra, 3 points for each, 6 points in total).

d. For each teacher, print the name and the total price of equipment which is owned by that teacher. (in SQL, 3points)

e. Give all price of equipment with price>10000 a 10 percent devaluation (贬值) (in SQL, 3 points).

Question 3

(15 points)

得分

A hospital has properties like ID, name, location, rank, capacity. A hospital has many wards used for patients, and a ward can be described by attributes like roomID, building, number of hospital beds. A doctor can be described by ID, name, age, specialty and title. A patient has properties like ID, name, age, sex, address. The above objects must satisfy some constraints: Each doctor can be unemployed or employed by one hospital. If a doctor is employed, his salary needs to be recorded in the database. A patient can go to many hospitals. An inpatient is a patient lived in a certain ward and managed by a resident doctor (resident is a kind of title of doctors.). A ward belongs to only one hospital, and each hospital is equipped with multiple wards.

a. Draw ER diagram to illustrate the above database requirement (8 points).

b. Translate your ER diagram into relational database schemas, and point out the primary keys and foreign keys. You can write your answers in the following format:  “R(a1, a2, a3, a4), primary key: a1, foreign key: a4” (5 points).

c. Please give an example from the database schema you designed to illustrate the function of foreign key. (2 points)

得分

Question 

4 (12 points)

 Let R=ABCDE be a relation, and the set of functional dependency F ={A

C, C

A, B

AC, D

AC} holds on R.

a. Compute AD+. (2 points)

b. Compute a canonical cover for the above set of functional dependencies F; give each step of your derivation with an explanation.  (2 points)

c. List the candidate keys for R.  (2 points)

d. Give a decomposition of R with only one time of BCNF decomposition using the original set of functional dependencies. (3 points)

e. Give a 3NF decomposition of R based on the canonical cover. (3points)

得分

Question 5 (12 points). Suppose the immediate database modification approach and the checkpoint technique are used. The following figure depicts the concurrent transactions, time of checkpoint and time of system failure.

a. Write down the log records according to the above figure. (3 points)

c. What is the advantage of using checkpoint technique? (3 points)

d. Draw the state diagram of a transaction. (Hint: there are five states) (3 points)

标签:key,database,数据库,points,relation,期末试卷,following,relational,SCAU
From: https://blog.csdn.net/csdn3043663729/article/details/144735218

相关文章

  • 3种常见的数据库迁移工具对比
    3种常见的数据库迁移工具对比神州数码云基地​已认证账号​关注2人赞同了该文章之前在项目中,收到一个紧急需求,要把数据从 PostgreSQL 迁移到 TiDB 中。由于时间紧任务重,来不及调研高效的方式,直接使用了Navicat内置的功能,把数据从PostgreSQL迁移到......
  • redis中,msyql数据库读写分离搭建
    一.mysql读写分离:缓解主服务器的压力 1.概念:主服务器写数据,从服务器读数据 2.实现方法: 客户端分离:开发手动分离地址 服务端分离:数据库与应用之间加一个中间件,分离读写请求 mysql-proxy,mysql-route,maxscale amoeba,cobar,mycat2 atlas,k......
  • GuassDB数据库的GRANT & REVOKE
    ​目录一、GaussDB的权限概述二、GaussDB权限设计建议三、GaussDB的GRANT命令1.功能说明2.注意事项3.常用语法四、GaussDB的REVOKE命令用法1.功能说明2.注意事项3.常用语法五、GaussDB示例1.GRANT语句示例2.REVOKE语句示例一、GaussDB的权限概述在数据库中,对象......
  • GaussDB 数据库实验环境搭建指导
    @目录简介内容描述实验环境说明1GaussDB数据库购买1.1实验介绍1.1.1关于本实验1.1.2实验目的1.2购买GaussDB数据库1.2.1登录华为云1.2.2购买华为云GaussDB数据库简介本指导书适用于在华为云部署购买GaussDB数据库,通过该指导书可以顺利完成GaussDB数据库在华为云的购买。......
  • 4.2 数据库分组查询
    1、为什么要分组上一节课我们学习了聚合函数,默认统计的是全表范围的数据。配合上where子句就能缩小统计的范围了,但是这并不能满足我们的要求。比如说我现在想查询每个部门的平均底薪是多少钱,这个就需要对员工记录,按照部门编号去分组了。比如说10部门的员工分成一组,20部门的员......
  • centos 自动备份mysql数据库
    创建自动备份脚本创建文件mysql_auth_back.sh#!/bin/bash#source/etc/profile#以下配置信息需要根据自己情况进行编辑DB_HOST="127.0.0.1"......
  • 崩溃列表数据库查询(可供参考)
    首先去https://weikezhijia.feishu.cn/sheets/BIvxsKZhHhzpC6tDyoLcPE50n4d?sheet=9ikXjx看库中导出指标,然后可以查到是rum_error表,然后去ors_rum_test服务器,ors_rum_test数据库,rum_error表去查询,结合点击全部按钮后查看F12 然后查看preView里的字段,结合着去查rum_error表,比......
  • 数据库基础
    1、数据库概念一个存储数据的地方数据按照分类存储到不同的表简单的电子表格非常高效快速查询其中的数据2、为什么学习数据库关注页面操作,还需要检查数据库中的数据是否正确出现bug时,能够定位到问题原因造数据,修改数据-测试环境3、数据库类型关系型数......
  • 使用python脚本,批量修改mysql数据库表字段名称
    前提:搭建python相关环境目的:将驼峰式命名或混合大小写的字段名转换为下划线分隔的小写字段名。例如:UserName->user_name,userName->user_name一、新建脚本update_table_column_names.pyimportpymysqlimportreimportsysdefto_snake_case(name):s1......
  • 数据库连接池----DBUtils的使用
      DBUtils是一个用于管理数据库连接池的Python库,它提供了连接池的管理,可以避免每次进行数据库操作时都重新建立连接。通过DBUtils,你可以更高效地管理数据库连接,尤其在高并发的情况下,能够有效减少创建和销毁连接的开销。DBUtils支持多种数据库驱动,包括MySQL、Postgre......