Question: Use SQL, no JOIN or subqueries allowed: 5. Count the number of joint accounts (i.e., accounts owned by at least two different customers) in New

Use SQL, no JOIN or subqueries allowed:

Use SQL, no JOIN or subqueries allowed: 5. Count the number of

joint accounts (i.e., accounts owned by at least two different customers) inNew York branch. 6. Return customerID, first name, last name, and income

5. Count the number of joint accounts (i.e., accounts owned by at least two different customers) in New York branch. 6. Return customerID, first name, last name, and income of customers who owns an account with balance greater than $5,000 in either Philadelphia branch or New York branch (not in both branches). Background 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*K-Brunch} Owns = {customerIDFK-Customer, accNumberlK-Account} Transaction = {transNumber, accNumber"K-Account, amount} Employee = {ssn, firstName, lastName, salary, branchNumberK-Branch} Branch = {branchNumber, branchName, managerSSNFK-Employee, budget} Notes. The customerID attribute (Customer) is a unique number that represents a customer, it is not a cus- tomer's SSN The accNumber attribute (Account) represents the account number The balance (Account) attribute represents the total amount in an account The type (Account) attribute represents the type an account: checking, saving, or business The transNumber attribute (Transactions) represents a transaction number, combined with account number it uniquely identify a transaction The branchNumber attribute (Branch) uniquely identifies a branch The manager SSN attribute (Branch) represents the SSN of the branch manager Questions Write SQL queries to return data specified in questions 1 to 20 (each is worth 5pts), which has to satisfy the following requirements: The answer to each question should be a single SQL query. You must order each query as described in the question, order is always ascending unless specified otherwise Every column in the result should be named. So if the query ask you to return something like income times 10, make sure you include an AS statement to name the column. While your question will not be assessed on their efficiency, marks may be deducted if unnecessary tables are included in the query (e.g., including both Owns and Customer when you only require the customerID of customers who own accounts). You may use some date functions in the following questions. In this homework, you should refer to the date and time functions of MySQL (which is also compatible with MariaDB). For more details, please refer to this page. In this homework, you are NOT allow to use JOIN keyword or subqueries

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!