introduction to database system wei-pang yang, im.ndhu, 2010 2011 final test-1 example: banking...
TRANSCRIPT
Introduction to Database SystemWei-Pang Yang, IM.NDHU, 2010 2011 Final Test-1
Example:Banking Database
1. branch 2. customer客戶 ( 存款戶 , 貸款戶 )
5.
account
存款帳
3. depositor 存款戶
6. loan 貸款帳 4. borrower 貸款戶
分公司
國立東華大學試題 : 資料庫管理 ( 每題 10分;共100分 ) 資訊管理學系 2011.06.21
Introduction to Database SystemWei-Pang Yang, IM.NDHU, 2010
Question 1: Terms Explanation (10%)
1) Semantic Data Model
2) Logical Database Design
3) Functional Dependency
4) Update Anomalies
5) Minimize the number of Disk Access
2011 Final Test-2
Introduction to Database SystemWei-Pang Yang, IM.NDHU, 2010
Question 2: Real-world vs. E-R Model vs. Tables (10%)
1. branch 2. customer 客戶 ( 存款戶 , 貸款戶 ) 3. depositor 存款戶分公司
Semantic Data Model:
Entity-Relationship (E-R) Data Model
The real-world enterprise
試討論 Real-world, E-R Model , 及 Tables 之關係
2011 Final Test-3
Introduction to Database SystemWei-Pang Yang, IM.NDHU, 2010
Suppose we have a relationship set borrower between customer and loan as shown in Figure 1.
1) Draw an E-R Diagram for the application system in Figure 1. (Please show the mapping cardinalities.)
2) What does it mean by the total participator, and which one is it?
3) What does it mean by the partial participator, and which one is it?
Question 3: E-R Model (10%)
.
.
.
.
customer loan
E1
E2
E3
E4
.
.
.
Relationship Set: borrower
Figure 1.
2011 Final Test-4
Introduction to Database SystemWei-Pang Yang, IM.NDHU, 2010
E.g. Consider weak entity payment that depends on entity loan
Question 4: E-R Model Tables (10%)
1) Draw a relational table for entity loan .
2) What is the primary key for your table laon?
3) Draw a relational table for weak entity payment.
4) What is the primary key for your table payment?
5) 要不要建一個 Table for weak relationship “loan-payment”, why?
2011 Final Test-5
Introduction to Database SystemWei-Pang Yang, IM.NDHU, 2010 6-6
Question 5: E-R Model Tables (10%)
在E-R Model 中Many-to-Many Relationship Set 須要造一個新 Table 例如 :
1) 解釋這一句敘述 : “A many-to-many relationship set is represented as a table with columns for the primary keys of the two participating entity sets, and any descriptive attributes of the relationship set.”
2) One-to-One Relationship Set 要建新 Table嗎 ? 為什麼 ?
borrower
n n
Introduction to Database SystemWei-Pang Yang, IM.NDHU, 2010
Question 6: 1NF 2NF (10%)
S# STATUS CITY
S1 20 London S2 10 Paris S3 10 Paris S4 20 London S5 30 Athens
SECOND
S# P# QTY) S1 P1 300 S1 P2 200 S1 P3 400 S1 P4 200 S1 P5 100 S2 P1 300 S2 P2 400 S3 P2 200 S4 P4 300 S4 P5 400
SP
S# STATUS CITY P# QTY
S1 20 London P1 300 S1 20 London P2 200 S1 20 London P3 400 S1 20 London P4 200 S1 20 London P5 100 S1 20 London P6 100 S2 10 Paris P1 300 S2 10 Paris P2 400 S3 10 Paris P2 200 S4 20 London P2 200 S4 20 London P4 300 S4 20 London P5 400
FIRST
從下面幾點討論把 FIRST 拆成 SECOND 及 SP 的好處 :
1) Update? S1 moves from London to Paris
2) Insertion: (S5 30 Athens)
3) Delete "S3 supplies P2 200",
2011 Final Test-7
Introduction to Database SystemWei-Pang Yang, IM.NDHU, 2010
Question 7: 2NF 3NF (10%)
S# STATUS CITY
S1 20 London S2 10 Paris S3 10 Paris S4 20 London S5 30 Athens
SECOND (in 2NF)
1) SECOND 還有缺點嗎 ?
2) SECOND 是 3NF 嗎 ? Why?
從下面幾點討論把 SECOND 拆成 CS 及 SC 的好處3) Update
4) Insertion
5) Delete
CITY STATUS
Athens 30 London 20 Paris 10 Rome 50
CS (in 3NF) SC (in 3NF)
S# CITY S1 London S2 Paris S3 Paris S4 London S5 Athens
2011 Final Test-8
Introduction to Database SystemWei-Pang Yang, IM.NDHU, 2010
Consider the Supplier table, S. 假設 Index 整個放在一個 page, S Table 每一筆 tuple 各放一個 page
S1
S2
S3
S4
S5
Smith
Jones
Blake
Clark
Adams
20
10
30
20
30
London
Paris
Paris
London
Athens
City-Index (index)
Athens
London
London
Paris
Paris
S (indexed file)
Question 8: Indexing (10%)
1) 要列印所有住在 “ Athens” 的 Supplier’s Name, 需多少 Disk I/O? 解釋之。2) 要列印所有住在 “ London” 的 Supplier’s Name, 需多少 Disk I/O? 解釋之。3) 要列印所有住在 “ Taipei” 的 Supplier’s Name, 需多少 Disk I/O? 解釋之。4) 若插入 “ S6 Yang 25 Hualien”, 重畫 S 及 City-Index 二 Tables.
5) 如果沒有 City-Index, 要列印所有住在 “ London” 的 Supplier’s Name, 需多少Disk I/O? 解釋之。
2011 Final Test-9
Introduction to Database SystemWei-Pang Yang, IM.NDHU, 2010
Question 9: B+-tree (10%)
50 82
96 97 9991 93 94
89 94
83 85 8971 78 8260 62 7051 52 58
58 70
35 40 5015 18 326 8 12
12 32
index set
Sequence set (with pointers to data records)
-
1) 何謂 direct access?
2) B+ tree 如何提供 “ fast direct access” 的服務 ?
3) 如果要找 key= “62”, 何謂 sequential access?
4) B+ tree 如何提供 “ fast sequential access” 的服務 ?
5) 若一個 node 可放 100 key 時,第三層共可放幾個 key?
2011 Final Test-10
Introduction to Database SystemWei-Pang Yang, IM.NDHU, 2010 2011 Final Test-11
According to your final project as “Design and implement a useful database application system”
1) What is the title of your project?
2) Names of members in your team.
3) Draw the E-R Diagram of your application system. (You can just give a similar diagram.)
4) Draw a table to show one relation used in the system
5) Check your answer in d) to see whether it is in the 1NF? Why? Please answer “why” by using the definition of the 1NF.
6) Same as e) to see whether it is in the 2NF? Why?
7) Same as e) to see whether it is in the 3NF? Why?
Question 10: About Your Final Term Project (10%)