Question: Write SQL queries to return data specified in questions 16 to 20 NO JOIN Suppose you work at a bank as a data analyst. Your

Write SQL queries to return data specified in questions 16 to 20

NO JOIN

Write SQL queries to return data specified in questions 16 to 20NO JOIN Suppose you work at a bank as a data analyst.

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 Owns = {customerIDFK-Customer, accNumberFK-Account} Transaction = {transNumber, accNumberFK-Account, amount} Employee = {ssn, firstName, lastName, salary, branchNumberFK-Branch} Branch = {branchNumber, branchName, managerSSNFK-Employee, budget} FK-Branch 16. List 10 different last names of employees such that the average salary of employees in London branch sharing one of them is above $10,000. 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!