Would please help me with these two questions by sql query not relational algebr
ID: 3554274 • Letter: W
Question
Would please help me with these two questions by sql query not relational algebra.
customer (customer_name, customer_street, customer_city )
account (account_number, branch_name(+), balance )
loan (loan_number, branch_name(+), amount )
depositor (customer_name(+), account_number(+) )
borrower (customer_name(+), loan_number(+) )
A. Find the names of all depositors who have an account with a value greater than $4,500.
B. Find the names of all depositors who have an account with a value greater than $7,800 at the "West End" branch.
Explanation / Answer
A. Find the names of all depositors who have an account with a value greater than $4,500.
we can know the account balance from the account table, depositer name from the depositer table, so we have to JOIN the two tables depositor and account on condition that both account numbers should match. one more condition we have to put is, the balance should be greater than $ 4500 which is included in WHERE clause.
SELECT depositor.customer_name FROM depositer JOIN account ON account.account_number= depositor.account_number WHERE account.balance > $4,500
B. Find the names of all depositors who have an account with a value greater than $7,800 at the "West End" branch.
we need to JOIN account and depositor tables to know the depositor's account balance and branch_name.the conditions of branch name "west end" and balance > $7800 are included in WHERE clause.
SELECT depositor.cutomer_name FROM depositer JOIN account ON account.account_number= depositer.account_number WHERE account.branch_name="West End" AND account.balance> $7,800
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.