Professional Documents
Culture Documents
1911562106-朴维-parvez Mohammad Shariar -Final Exam
1911562106-朴维-parvez Mohammad Shariar -Final Exam
Of Database》 期末考试答题纸
2020.12.19
卷号:A
Student ID
1911562106
Name
总分
PARVEZ 朴维 二 O 二 O —二 O 二一学年第一学期期末考试
Grade
密 核分人 Prin. & App.Of Database 答题纸
19lc 软工
( 计算机专业留学生 用)开卷
注意
意: 题号 一 二 三 四 五 六 七 八 九 十
四、试卷印刷不清楚。可举手向监考教师询问。
三、考生在答题前应先将姓名、学号、年级和班级填写在指定的方框内。
二、姓名、学号不许涂改,否则试卷无效。
一、密封线内不准答题。
题分 20 15 30 15 20
得分
Marking
一 、 Scores True or False questions (2 points for each
people
question, 20 points in total)
封
1 2 3 4 5 6 7 8 9 10
T F T T F T F F F F
二、
Ter Marking ms Explanation (3 points for each question, 15
Scores
people points in total)
1. Data- Manipulation Language
2. Superkey
A superkey is a set of one or more attributes that, taken collectively, allow us
to identify uniquely a tuple in the relation. For example, the ID attribute of the
relation instructor is sufficient to distinguish one instructor tuple from another.
Thus, ID is a superkey. The name attribute of instructor, on the other hand, is not
a superkey, because several instructors might have the same name.
3. View Relations
View relations can be defined as relations containing the result of queries.
第 1 页
湖北工业大学计算机学院 《Prin. & App.Of Database》 期末考试答题纸
2020.12.19
Views are useful for hiding unneeded information, and for collecting together
information from more than one relation into a single view.
create view physics fall 2009 watson as
select course id, room number
from physics fall 2009
where building= ’Watson’;
4. JDBC
-DBC or Java Database Connectivity is a specification from Sun microsystems that
provides a standard abstraction(that is API or Protocol) for java applications to
communicate with various databases. It provides the language with java database
connectivity standard. It is used to write programs required to access databases.
JDBC along with the database driver is capable of accessing databases and
spreadsheets. The enterprise data stored in a relational database(RDB) can be
accessed with the help of JDBC APIs.
The classes and interfaces of JDBC allows application to send request made by
users to the specified database.
5. Snapshot Isolation
第 2 页
湖北工业大学计算机学院 《Prin. & App.Of Database》 期末考试答题纸
2020.12.19
1. ANSWER :
List six major steps that you would take in setting up a database for a particular enterprise
1. Define a model containing all appropriate types of data and data relationships.
2. Define the integrity constraints on the data.
3. Define the conceptual schema for the model.
4. Define the physical level.
5. For each known problem to be solved on a regular basis (e.g., weekly inventory), define a
view of the database and write the necessary application programs.
6. Create and initialize the database.
2. ANSWER
A relation schema is a type definition, 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
3. ANSWER
a.
select * from student natural left outer join takes
can be rewritten as:
Exercises 21
select * from student natural join takes
union
select ID, name, dept name, tot cred, NULL, NULL, NULL, NULL, NULL
from student S1 where not exists
(select ID from takes T1 where T1.id = S1.id) ;
b.
第 3 页
湖北工业大学计算机学院 《Prin. & App.Of Database》 期末考试答题纸
2020.12.19
select * from student natural full outer join takes
can be rewritten as:
(select * from student natural join takes)
union
(select ID, name, dept name, tot cred, NULL, NULL, NULL, NULL, NULL
from student S1
where not exists
(select ID from takes T1 where T1.id = S1.id))
union
(select ID, NULL, NULL, NULL, course id, section id, semester, year, grade
from takes T1
where not exists
(select ID from student S1 whereT1.id = S1.id))
4. ANSWER
SELECT student, subject, marks
form s
ORDER BY total_marks DESC;
5. ANSWER
A.
select name from employee e, books b, loan l where e.empno = l.empno and l.isbn =
b.isbn and b.publisher = ‘McGrawHill’
Relational Algebra: π name (employee ⋈ (πempno (Loan ⋈ (π isbn(Ϭ
publisher=’McGrawHILL’ (books)))))
B.
1.
SELECT [employee_name]
,[city]
From [dbo].[employee]
WHERE employee_name =(SELECT employee_name
FROM [dbo].[works]
WHERE company_name='First Bnak corporation '
2.
SELECT [employee_name]
,[street]
,[city]
From [dbo].[employee]
WHERE employee_name =(SELECT employee_name
FROM [dbo].[works]
WHERE company_name='First Bnak corporation ' and salary>10000 )
3.
SELECT employee-name
From [dbo].[works]
WHERE company-name <> 'First Bnak corporation'
4.
SELECT employee-name
From works
WHERE salary > all (SELECT salary
From [dbo].[works]
WHERE company-name = 'Small Bank Corporation;)
5.
SELECT s.company-name
From [dbo].[company]
WHERE not exists
((SELECT city From company WHERE company-name = 'Small Bank Corporation')
Except
(SELECT city From company t WHERE s.company-name = t.company-name))
第 5 页
湖北工业大学计算机学院 《Prin. & App.Of Database》 期末考试答题纸
2020.12.19
one to show the main entity relationships. Write down descriptions of any
constraints and any special conditions that are not represented by the diagram
alone. (20 points in total)
Descriptions :
第 6 页
湖北工业大学计算机学院 《Prin. & App.Of Database》 期末考试答题纸
2020.12.19
relationships.
The composite entity table must contain at least the primary keys of the
original tables.
The linking table contains multiple occurrences of the foreign key values.
depending on the business rules. Or, a student can have many classes and
第 7 页