Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

DO NOT USE JOIN or subqueries! Suppose you work at a bank as a data analyst. Your main job is to analyze the data stored

image text in transcribed

image text in transcribed

DO NOT USE "JOIN" or subqueries!

Suppose you work at a bank as a data analyst. Your main job is to analyze the data stored in their database. The database has five tables, whose schema is shown as below. Primary keys attributes are underlined and foreign keys are noted in the superscript. Customer = {customerID, firstName, lastName, income, birthDate} Account = {accNumber, type, balance, branchNumber FK-Branch} Owns = {customer DFK-Customer, accNumberFK-Account} Transaction = {transNumber, accNumber"K-Account, amount} Employee = {ssn, firstName, lastName, salary, branchNumber FK-Branch Branch = {branch Number, branchName, managerSSNFK-Employce, budget} 17. Return the average income of customers from different age group (where age group is formed in a unit of 10 years, i.e., [0,10), [10,20),...). Note that you can calculate a customer's age by subtracting his/her birth year from the current year. 18. Return customer ID, first name, last name, income and the average account balance of customers who have at least three accounts, and whose last names begin with 's' and contain an 'e' (e.g. Steve) OR whose first names begin with 'a' and have the letter 'n' just before the last 2 letters (e.g. Anne). Note that to appear in the result customers must have at least 3 accounts and satisfy one (or both) of the name conditions. 19. Return account number, balance, sum of transaction amounts, and (balance - transaction sum) for accounts in the London branch that have at least 15 transactions, order by transaction sum. 20. Return customer ID, first name, last name of the customers who have a total account balance in all branches greater than $300,000 but has less than $100,000 in the total balance of their accounts at the New York branch Suppose you work at a bank as a data analyst. Your main job is to analyze the data stored in their database. The database has five tables, whose schema is shown as below. Primary keys attributes are underlined and foreign keys are noted in the superscript. Customer = {customerID, firstName, lastName, income, birthDate} Account = {accNumber, type, balance, branchNumber FK-Branch} Owns = {customer DFK-Customer, accNumberFK-Account} Transaction = {transNumber, accNumber"K-Account, amount} Employee = {ssn, firstName, lastName, salary, branchNumber FK-Branch Branch = {branch Number, branchName, managerSSNFK-Employce, budget} 17. Return the average income of customers from different age group (where age group is formed in a unit of 10 years, i.e., [0,10), [10,20),...). Note that you can calculate a customer's age by subtracting his/her birth year from the current year. 18. Return customer ID, first name, last name, income and the average account balance of customers who have at least three accounts, and whose last names begin with 's' and contain an 'e' (e.g. Steve) OR whose first names begin with 'a' and have the letter 'n' just before the last 2 letters (e.g. Anne). Note that to appear in the result customers must have at least 3 accounts and satisfy one (or both) of the name conditions. 19. Return account number, balance, sum of transaction amounts, and (balance - transaction sum) for accounts in the London branch that have at least 15 transactions, order by transaction sum. 20. Return customer ID, first name, last name of the customers who have a total account balance in all branches greater than $300,000 but has less than $100,000 in the total balance of their accounts at the New York branch

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Objects And Databases International Symposium Sophia Antipolis France June 13 2000 Revised Papers Lncs 1944

Authors: Klaus R. Dittrich ,Giovanna Guerrini ,Isabella Merlo ,Marta Oliva ,M. Elena Rodriguez

2001st Edition

3540416641, 978-3540416647

More Books

Students also viewed these Databases questions