1

I'm kinda stuck on this relational algebra question, any help would be really appreciated. Many thanks!

Given the following database schema:
person (name, age, account id)
account (account id, balance)

Write relational algebra expressions to accomplish the following task:

Suppose every member of the bank will withdraw money via check equal to their age in two days. Find the names and balances for all customers in two days (assuming no other transactions).


My understanding is, finding all names, balances where the customer's age has been withdrawn;

for example, if Pete is 30 and has $500 in the bank, he will withdraw $30 and have a new balance of $470?

But how to do it in relational algebra?

Thanks!

Peter
  • 155
  • 2
  • 10
  • The question is not clearly posed. What about people with multiple accounts? What about shared accounts? So "every member of the bank will withdraw money via check equal to their age" is unanswerable, because we don't know what accounts get the cheques. So we can expect that the poser either intended, but has not given, some restriction(s) on what accounts people have and/or wants something that is not what they wrote--eg "withdraw money via check equal to their age from every account they have". The difficulty also is affected. Ask the poser. – philipxy Sep 18 '17 at 07:18
  • Please give a reference to the version of RA you are supposed to use--there are many. Please read the downvote arrow mouseover text, [ask] & hits from googling 'stackexchange homework'. What is some part of the solution? What do you understand is relevant? What point in a similar textbook example are you stuck at? See [this answer](https://stackoverflow.com/a/24425914/3404097)--show your work following it until you are stuck. Please clarify by editing your question, not comments. Right now your question is too broad--you're asking for a personalized textbook chapter--read a textbook. – philipxy Sep 18 '17 at 07:24
  • Prof said, we assume that "A person’s account id may or may not correspond to an account id in the account relation." – Peter Sep 18 '17 at 22:57
  • That does not address my comment, because the cases I mentioned are independent of it. Did you show your prof my comment exactly? Also, if there are people with accounts that are not in Account then they must not be "members of the bank", or you can't get their balances. That's not clear from the assignment. Indeed, to update or query we must be given for each table its *(characteristic) predicate*--the table holds the rows that make it into a true statement. Then we figure out how to phrase the query in terms of those, then translate to algebra. PS Edit your question, not comments. – philipxy Sep 19 '17 at 03:18

0 Answers0