Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Database System Wei-Pang Yang, IM.NDHU, 2010 2012 Midterm Test-1 Example: Banking Database 1. branch 2. customer 客戶 ( 存款戶, 貸款戶 ) 5. account.

Similar presentations


Presentation on theme: "Introduction to Database System Wei-Pang Yang, IM.NDHU, 2010 2012 Midterm Test-1 Example: Banking Database 1. branch 2. customer 客戶 ( 存款戶, 貸款戶 ) 5. account."— Presentation transcript:

1 Introduction to Database System Wei-Pang Yang, IM.NDHU, 2010 2012 Midterm Test-1 Example: Banking Database 1. branch 2. customer 客戶 ( 存款戶, 貸款戶 ) 5. account 存款帳 3. depositor 存款戶 6. loan 貸款帳 4. borrower 貸款戶 分公司 國立東華大學試題 : 資料庫管理 資訊管理學系 2012.04.17

2 Introduction to Database System Wei-Pang Yang, IM.NDHU, 2010 Question 1: Answer the following Terms (30%) a)Goal of a DBMS. b)Functions of a DBMS c)Relational Database d)Data Dictionary in DBMS e)Schemas and Instances f)Physical Data Independence g)Query Processor h)Storage Manager i)Database administrator j)Authorization and Integrity Manager k)Query evaluation engine l)Three levels of an architecture for a database system m)Relational-Algebra Operation: Cartesian product n)Relational-Algebra Operation: Natural Join o)Aggregate Functions 2012 Midterm Test-2

3 Introduction to Database System Wei-Pang Yang, IM.NDHU, 2010 Question 2: Data-Definition Language (10%) Consider the following Table Definition: a) What is the purpose to define: primary key (branch-name), b) What is the purpose to define: check (assets >= 0) c) 這些定義的指令存在那裡 ? 有何用途 ? 如何使用 ? create table branch (branch-namechar(15), branch-citychar(30), assets integer, primary key (branch-name), check (assets >= 0)) 2012 Midterm Test-3

4 Introduction to Database System Wei-Pang Yang, IM.NDHU, 2010 Question 3: Flow of Query Processing (10%) Explain the following three tasks: a) Parsing and translation b) Optimization c) Evaluation 2012 Midterm Test-4

5 Introduction to Database System Wei-Pang Yang, IM.NDHU, 2010 Question 4: Using the following Example to explain the Referential Integrity Constraint (10%) create table account (account-numberchar(10), branch-namechar(15), balanceinteger, primary key (account-number), create table depositor (customer-namechar(20), account-numberchar(10), primary key (customer-name, account-number), foreign key (account-number) references account, 3. account 4. depositor references ( 存款戶 ) ( 存款帳 ) 2012 Midterm Test-5

6 Introduction to Database System Wei-Pang Yang, IM.NDHU, 2010 Question 5: Updates (10%) Query: Increase all accounts with balances over $700 by 6%, all other accounts receive 5%. Consider two update statements: update account set balance = balance  1.06 where balance > 700 update account set balance = balance  1.05 where balance  700 a) Give the account table after execute the above two update statements. b) The order is important, why? c) Please write a SQL by using the case statement for above update statements. 2012 Midterm Test-6

7 Introduction to Database System Wei-Pang Yang, IM.NDHU, 2010 account Question 6: Definition of Relation (10%) Relation: Formally, given sets D 1, D 2, …. D n D 1 x D 2 x … x D n = {(a 1, a 2, …, a n ) | where each a i  D i } a Relation r is a subset of D 1 x D 2 x … x D n Thus a relation is a set of n-tuples (a 1, a 2, …, a n ) where each a i  D i D 1 = { } D 2 = { } D 3 = { } D 1 x D 2 x D 3 = account = a) Write b) Write c) Why the Relation r is a subset of D 1 x D 2 x … x D n, please explain it by using above example. 2012 Midterm Test-7

8 Introduction to Database System Wei-Pang Yang, IM.NDHU, 2010 Query: “ Find the names of all customers who have a loan at the Perryridge branch.  Query 2  customer-name (  loan.loan-number = borrower.loan-number ( (  branch-name = “Perryridge” (loan)) x borrower) )  Query 1  customer-name (  branch-name = “Perryridge” (  borrower.loan-number = loan.loan-number (borrower x loan)) ) Question 7: Comparison (10%) c) Which one is better? Why? a) ? b) ? 2012 Midterm Test-8

9 Introduction to Database System Wei-Pang Yang, IM.NDHU, 2010 Question 8: multiple relations vs. Single relation (10%) Database: A database consists of multiple relations Information about an enterprise is broken up into parts, with each relation storing one part of the information E.g.: account: stores information about accounts depositor: stores information about which customer owns which account customer: stores information about customers If we store all information as a single relation such as bank(account-number, balance, customer-name,..) Question: The table bank may contain a lot of repetition of information and null values, why? … bank 2012 Midterm Test-9

10 Introduction to Database System Wei-Pang Yang, IM.NDHU, 2010 Question 9: Database System vs. File System (10%) In the early days, database applications were built on top of file systems Drawbacks of using file systems to store data are: a)Data redundancy and inconsistency, why? b)Difficulty in accessing data, why? c)Integrity problems, why? d)Application program unstable, why? e)Database systems offer solutions to all the above problems, why? 2012 Midterm Test-10


Download ppt "Introduction to Database System Wei-Pang Yang, IM.NDHU, 2010 2012 Midterm Test-1 Example: Banking Database 1. branch 2. customer 客戶 ( 存款戶, 貸款戶 ) 5. account."

Similar presentations


Ads by Google