Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Chapter 1 homework

Part 1: Exercises
1 List four significant differences between a file-processing and a DBMS.
2 Explain View of Data--Levels of Abstraction, Explain the difference between
physical and logical data independence.
3. List all the Data Models you know?
4. List the statement of SQL? Give some example for SQL statements.
5. Explain JDBC ODBC? Give the Model for communicating with the database
use them?
6 List the ACID properties of transaction. Explain the usefulness of each.
7 During its execution, a transaction passes through several states, until it finally
commits or aborts. List all possible sequences of states through which a transaction
may pass. Explain why each state transition may occur.
8 List all of the protocols in concurrent control? And describe the detail of these
protocol.
9 Describe the two parts of recovery algorithm.
10 Explain the process of the log base recovery? Why records for transactions on
the undo-list must be processed in reverse order, whereas redo is performed in a
forward direction.
11 List the characters of three generetion database?

Part 1: Experiment
Design the Bank database according the following data requirements. Use postgrSQL
to implement the bank application.
The Data Requirements for the Bank Database is following:.
a) The bank is organized into branches. Each branch is located in a particular city and
is identified by a unique name. The bank monitors the assets of each branch.
b) Bank customers are identified by their customer_id values. The bank stores each
customer's name and the street and city where the customer lives. Customers may
have accounts and can take out loans. A customer may be associated with a particular
banker, who may act as a loan officer or personal banker for that customer.
c) Bank employees are identified by their employee_id values. The bank
administration stores the name and telephone number of each employee, the names of
the employee's dependents, and the employee_id number of the employee's manager.
The bank also keeps track of the employee's start date, thus, length of employment.
d) The bank offers two types of accounts --savings and checking accounts. Accounts
can be held by more than one customer, and a customer can have more than one
account. Each account is assigned a unique account number. The bank maintains a
record of each account's balance and the most recent date on which account was
accessed by each customer holding the account. In addition, each saving account has
an interest rate and overdrafts are recorded for each checking account.
e) A loan originates at a particular branch and can be held by one or more customers.
A loan is identified by a unique loan number. For each loan, the bank keeps track of
the loan amount and the loan payment, Although a loan payment number does not
uniquely identify a particular payment among those for all the bank's loans, a payment
number does identify a particular payment for a specific loan. The data and amount
are recorded for each payment.

According to the bank database data requirement, answer following problem:


1)Write the entity set of the bank database.
2) Write the relationship set of the bank database
3) Write the bank database schema(all the table and attributes) and a list of
constraints, including primary-key and foreign-key constraints.
4) Install postgresql/ (Use DBMS you know)
5) Use PostgreSQL Pgadmin to finish the following functions(show the
interfaces—write correct SQL statements):
A. Create university bank database
B. Create the relations in the bank database accourding 3). inclde the primary
key, foreign-key, data type etc. for example:

branch(branch name, branch city, assets)


customer (customer name, customer street, cust omer city)
loan (loan number, branch name, amount)
borrower (customer name, loan number)
account (account number, branch name, balance )
depositor (customer name, account number)

C. Write Query statement:


a. Find all customers of the bank who have an account but not a loan.
b. Find the names and cities of residence of all employees who work for First
Bank Corporation.
c. Find all employees in the database who earn more than each employee of Small
Bank Corporation.
d. Find all employees in the database who earn more than each employee of Small
Bank Corporation.

D. User insert , update, delete statement to operate the data in the table of bank
database
a. Insert some data in Bank database (table; branch, customer, loan, borrower, etc.)
b. Give all employees of First Bank Corporation a 10 percent raise.
b. Give all managers of First Bank Corporation a 10 percent raise.
c. Delete all tuples in the works relation for employees of Small Bank Corporation.

E Write a function that, given the name of a department, return the count of the
number os instructors in that department.
F Consider the bank database above. Write an SQL trigger to carry out the following
action: On delete of an account, for each owner of the account, check if the owner
has any remaining accounts, and if she doesnot, delete her from the depositor relation.
G Create some user in Bank database, Use the DCL statement to grant some
prvilege to some student user or some teacher users

You might also like