Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

image text in transcribed

image text in transcribed

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} 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. 10. Return customer ID, income, account numbers and branch numbers of customers with income greater than $90,000 who own an account at both London and New York branches, order by customer ID then account number. The result should contain ALL the account numbers of customers who meet the criteria, even if the account itself is not held at London or New York. 11. Return customer ID, types, account numbers, and balances of all business and savings accounts owned by customers who own at least one business account or at least one savings account, order by customer ID, then type, then account number. 12. Return branch name, account number and balance of accounts with balances greater than $110,000 held at the branch managed by Phillip Edwards, order by account number

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

SQL Antipatterns Avoiding The Pitfalls Of Database Programming

Authors: Bill Karwin

1st Edition

1680508989, 978-1680508987

More Books

Students also viewed these Databases questions