Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

2 Introduction to Database System Wei-Pang Yang, IM.NDHU, 2010 Question 1: Write SQL and Output the Results (10%) Using the Example -- Banking Database, answering the queries: a)Find the loan number for each loan of an amount greater than $1200 b)Find the names of all branches in the loan relations for each loan of an amount greater than $1200, and remove duplicates. c)How many tuples are selected from the following statement? select  from borrower, loan e)What is the output of the following statement? select branch-name, avg (balance) from account group by branch-name having avg (balance) > 1200 2011 Midterm Test-2

3 Introduction to Database System Wei-Pang Yang, IM.NDHU, 2010 2011 Midterm Test-3 Question 2: 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?

4 Introduction to Database System Wei-Pang Yang, IM.NDHU, 2010 2011 Midterm Test-4 Question 3: Answer the following Terms (20%) a)Goal of a DBMS. b)Functions of a DBMS c)Data Dictionary in DBMS d)Schemas and Instances e)Superkey f)Candidate key g)Three levels of an architecture for a database system h)Relational-Algebra Operation: Cartesian product i)Relational-Algebra Operation: Natural Join j)Aggregate Functions

5 Introduction to Database System Wei-Pang Yang, IM.NDHU, 2010 2011 Midterm Test-5 account Question 4: 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.

6 Introduction to Database System Wei-Pang Yang, IM.NDHU, 2010 2011 Midterm Test-6 Assume we have two queries: Q1 and Q2 as follows: Question 5: View (10%) b) If we want to add a new tuple to big-customer insert into big-customer values (‘A-999’, ‘Hualien’) Where the insertion values will be placed? Draw a table to show your answer. a) Draw the result of Q2 c) What are the advantages of the View? Q1. create view big-customer as (select account-number, branch-name from account where balance > 500 Q2 select * from big-customer

7 Introduction to Database System Wei-Pang Yang, IM.NDHU, 2010 Question 6: 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 存款 戶 存款帳 2011Midterm Test-7

8 Introduction to Database System Wei-Pang Yang, IM.NDHU, 2010 2011 Midterm Test-8 Question 7: Fill in the following components to the Overall System Structure (10%) low-level data stored database 1. Query Processor 2. Storage Manager 3. Database administrator 4. Application programmers 5. DDL interpreter 6. Compiler and Linker 7. Buffer manager 8. Data dictionary 9. Index 10. Data 11. Na ï ve users 12. Application programs

9 Introduction to Database System Wei-Pang Yang, IM.NDHU, 2010 Question 8: Storage Management (10%) Storage Manager is a program module that provides the interface between the low-level data stored and the application programs and queries submitted to the system. a)What are the tasks of the Storage Manager: Explain the following components of Storage manager: b)Authorization and Integrity Manager c)Transaction Manager d)File Manager e)Buffer manager 2011 Midterm Test-9

10 Introduction to Database System Wei-Pang Yang, IM.NDHU, 2010 Question 9: 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 2011 Midterm Test-10


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

Similar presentations


Ads by Google