Example: Banking Database 國立東華大學試題: 資料庫管理 (每小題3分;滿分:111) 資訊管理學系2008.06.17 1. branch 2. customer 3. depositor 存款戶 Example: Banking Database 分公司 客戶(存款戶,貸款戶) 4. borrower 貸款戶 5. account 存款帳 6. loan 貸款帳
Question 1: E-R Model (12%) Suppose we have a relationship set borrower between customer and loan as shown in Figure 1. Draw an E-R Diagram for the application system in Figure 1. (Please show the mapping cardinalities.) What does it mean by the total participator, and which one is it? What does it mean by the partial participator, and which one is it? Reduce E-R model in a) to relational tables. customer loan E1 E2 E3 E4 . . Figure 1. Relationship Set: borrower
Question 2: E-R Model Tables (12%) E.g. Consider weak entity payment that depends on entity loan Draw a relational table for entity loan What is the primary key for your table laon? Draw a relational table for weak entity payment What is the primary key for your table payment?.
Question 3: Entity Sets vs. Attributes (6%) Consider a Entity Set: employee with attributes (employee-id, employee-name, telephone-number) Case 1: telephone-number as an attributes Case 2: Create a entity set: telephone Discuss case 1 之優缺點 Discuss case 2 之優缺點
Question 4: Normal Form (12%) 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 S# STATUS CITY S1 20 London S2 10 Paris S3 10 Paris S4 20 London S5 30 Athens SECOND (in 2NF) 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 (in 2NF) 從下面幾點討論把 FIRST 拆成 SECOND 及 SP 的好處: Update? S1 moves from London to Paris Insertion: (S5 30 Athens) Delete "S3 supplies P2 200", SECOND 還有缺點嗎? 它是3NF嗎? Why?
Question 5: Indexing (12%) Consider the Supplier table, S. 假設 Index 整個放在一個 page, S Table 每一筆 tuple 各放一個 page S1 S2 S3 S4 S5 Smith Jones Blake Clark Adams 20 10 30 London Paris Athens City-Index (index) S (indexed file) 要列印所有住在 “Athens” 的Supplier’s Name, 需多少Disk I/O? 解釋之。 要列印所有住在 “London” 的Supplier’s Name, 需多少Disk I/O? 解釋之。 要列印所有住在 “Taipei” 的Supplier’s Name, 需多少Disk I/O? 解釋之。 若插入 “S6 Yang 25 Hualien”, 重畫 S 及 City-Index 二 Tables.
Question 6: B+-tree (15%) index set - Sequence set 50 82 96 97 99 91 93 94 89 94 83 85 89 71 78 82 60 62 70 51 52 58 58 70 35 40 50 15 18 32 6 8 12 12 32 Question 6: B+-tree (15%) index set - Sequence set (with pointers to data records) What is the index set for? What is the sequence set for ? Write down the detailed procedures for searching “62”. 解釋 “with pointers to data records”? 若一個 node 可放 100 key 時,第三層共可放幾個 key?
Question 7: Terms Explanation (21%) Physical database design Logical database design The Internal Level Minimize the number of disk access "R.X functionally determines R.Y" Weak Entity Update Anomalies!
Question 8: About Your Final Term Project (21%) According to your final project as “Design and implement a useful database application system” What is the title of your project? Names of members in your team. Draw the E-R Diagram of your application system. (You can just give a similar diagram.) Draw a table to show one relation used in the system Check your answer in d) to see whether it is in the 1NF? Why? Please answer “why” by using the definition of the 1NF. Same as e) to see whether it is in the 2NF? Why? Same as e) to see whether it is in the 3NF? Why?