Consider an Account class and a TransactionActivity class in a banking system.
a. Posit ODMG ODL class de?nitions for them. The Account class must include a relationship to the set of objects in the TransactionActivity class corresponding to the deposit and withdraw transactions executed against that account.
b. Give an example of a database instance satisfying that description.
c. Write an OQL query against that database that will return the account numbers of all accounts for which there was at least one withdrawal of more than $10,000.
a.
class Account {
attribute Integer AcctId;
relationship SetOwner;
relationship SetTransactions
inverse TransactionActivity::ActivityAccount;
}
class TransactionActivity {
attribute enum TransType {deposit,withdraw} Type;
attribute Float Amount;
attribute Date ActivityDate;
relationship Account ActivityAccount
inverse Account::Transactions;
}
Note that Transactions and ActivityAccount are declared to be inverses of each other. This means that if ta is a transaction activity and ac is an account such that ta ? ac.Transactions then ac = ta.ActivityAccount,andviceversa, if ac = ta.ActivityAccount then ta ? ac.Transactions.
b. An account:
(#123, [12345,
{#p4345, #p0987},
{#t435, #t8132}
])
...
Some transactions:
(#t435, [withdraw, 58.34, 2001-3-4, #123])
(#t8132, [deposit, 231.99, 2001-4-5, #123])
c.
SELECT A.AcctId
FROM AccountExt A, A.Transactions T
WHERE T.Type = withdraw AND T.Amount > 10000
You might also like to view...
To display the Create Names from Selection dialog box, you click Create From Selection in the:
A) Defined Names group on the FORMULAS tab. B) Edit group on the FORMULAS tab. C) Defined Names group on the HOME tab. D) Edit group on the HOME tab.
Which comparison operation returns True if variable x is not equal to variable y?
A. x .ne. y B. x neq y C. x <> y D. x != y