Explain and write the pseudocode for a Mapper/Reducer that takes as input a larg
ID: 3844348 • Letter: E
Question
Explain and write the pseudocode for a Mapper/Reducer that takes as input a large file (possibly split into chucks) of integers and outputs:
a. The sum of the squares of each integer
b. The maximum integer
c. Assume you have a database with two relations (i.e. tables): customers and accounts.
The schema for customers is composed of the following attributes:
• customerID (integer)
• name (string)
• address (string)
• phone (string)
The schema for accounts is composed of the following attributes:
• customerID (integer)
• accountNumber (integer)
• balance (float)
Write the following queries using SQL:
A. Find the customer name with account number 12345.
B. Find all customer names who have at least one account with balance >$100,000 Write the following queries using Relational Algebra:
C. Find all account numbers with balance <$20,000 D. Calculate the sum of all accounts for customer with ID=432
Explanation / Answer
A)Select A.name from customers A join accounts B on A.customerID=B.customerID where B.accountNumber=12345
B)Select A.name from customers A join accounts B on A.customerID=B.customerID where B.balance>100000
C)Select accountNumber from accounts where balance<20000
D)Select Count(*) from accounts Where customerID=432
Note: In Question D, we are not clear about the requirement. Is it total no of accounts with id = 432 or sum of the balance of all accounts with id = 432.
If it is the sum of the balance of all accounts with id = 432, then take the below query.
Select Sum(balance) from accounts where customerID=432 Groupby customerID
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.