Beruflich Dokumente
Kultur Dokumente
Part I
Create all the tables and insert the rows as shown on the following pages.
Show all work. This part is worth 10% of the project grade.
Part II
Answer the nine questions listed below, using these tables and SQL. For each
question in English
2.
3.
If the question requires a SELECT then the result from the SELECT is a temporary table
that you need to print out. If the question is an UPDATE, INSERT or DELETE then you need to
print out the affected tables both before and after the operation. There is one question where you
must use views since I specifically ask for it. However, you may use views in any question where
you think that they would be helpful to you. Each question is 10% of the project grade.
TABLES
E - EMPLOYEE
C - CUSTOMER
ENO
CNO
ENAME
name of employee
CNAME
name of customer
ASSETS
VP (for vice president), SLA (for senior loan officer) and JLA (for junior loan officer))
CL CUSTOMER LOAN
A - ACCOUNT
ANO
CNO
- customer number(FK-C)
TYPE
BALANCE
- current amount
L LOAN
LNO - loan number(unique PK)
AT ACCOUNT TRANSACTION
TNO
ADATE
- date of transaction(YYYYMMDD)
ANO
- account number
TYPE
PAID TO DATE
- W or D or I or C
- total loan
amount paid
LT LOAN TRANSACTION
TNO
- transaction number
LOAN ACTIVE
(unique PK)
- YES or NO
LDATE
- date of transaction
LNO
- loan number
AMOUNT
- amount of transaction
EQUIVALENT DOMAINS
The following columns all share the same domains:
TABLE
COLUMN
C
CNO
A
CNO
CL
CNO
A
ANO
AT
ANO
L
LNO
EL
LNO
CL
LNO
LT
LNO
AT
AMOUNT
A
BALANCE
L
PAID TO
DATE
LT
AMOUNT
Questions
1.
Find the name and number of all customers with assets less than 2 million dollars who
have never taken a loan for more than 100,000 dollars.
2.
For each customer, give me the name and number of each customer and the average
balance of all their accounts if they have at least 3 accounts.
3.
Find the name and number of all employees who have never created a loan for a
customer.
4.
Find all employee names and numbers who have the letter "W" or w in their name but
its not the first or last letter and does not have the lower case letter "d" in their name and
has a position of JLA.
5.
Find the name and number of all customers who have taken out loans with no known
END DATE.
6.
Find the name and number of all customers whose total balances in all their accounts
exceeds their asset value.
7.
For each type of loan, what is the total of initial amounts and the average of paid to date
as long as each type has at least 3 such loans.
8.
Find all customer names and numbers who have both checking and savings accounts.
9.
We have a new little customer with the name of DUNSTON and a CNO of C55.
DUNSTON has assets of 500,000. DUNSTON has opened a checking account with
account number A60 with an opening balance of $500. He also opened a savings account
with an account number of A77 with an opening balance of $2000. He also assumed all
existing loan from customer C5. Use the appropriate INSERTs, DELETEs and
UPDATEs.