Question

Need the SQL query for the questions below

1) Print the name of customers who do not live in MPLS or Edina, have a loan with an amount of more than 500 in any branch of the bank but not in the France branch, and have one or more accounts only in the France branch.

2) Show the name of all Customers who have only one account with a balance of more than $1000 in any branch of the bank and one or more loan with an amount of more than $4000 in any branch in Edina in two different ways:

3) Print the branch name and the average balance for all accounts in the branch if one or more customers who live in Eden Prairie have accounts in the branch and the average balance of their accounts in this branch is more than $800

Example: Assume Rahimi lives in Eden Prairie and has two accounts one in York and one is Southdale. Rahimi’s average account balance is 1111 which is more than 800. Since that is the case, we need to print the average balance of all accounts in the York (3141.75) and Southdale (1055.50) branches.

4) Find the name of all customers who live in Minnetonka OR Eden Prairie, have one or more accounts in any branch in Edina, and have a loan in every branch in Minnetonka that has assets of less than 125000 but do not have a loan in those branches in Minnetonka that have assets of >= 125000.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

question 1:

SELECT * FROM CUSTOMER as cus LEFT JOIN LOAN AS `loan` ON `cus`.`CNAME` = `loan`.`CNAME` LEFT JOIN ACCOUNT AS `acc` ON `acc`.`CNAME`=`cus`.`CNAME` WHERE (`cus`.`CCITY`='MPLS' OR `cus`.`CCITY`='Edina') AND `loan`.`AMT`>500 AND `loan`.`BNAME` !='France' AND `acc`.`BNAME` ='France'

Question 2:

SELECT * FROM CUSTOMER as cus LEFT JOIN LOAN AS `loan` ON `cus`.`CNAME` = `loan`.`CNAME` LEFT JOIN ACCOUNT AS `acc` ON `acc`.`CNAME`=`cus`.`CNAME` WHERE COUNT(`acc`.`Bname`)=1 AND `acc`.`BAL`>1000 AND `loan`.`AMT`>4000

Question 3:

SELECT `bran`.`BNAME`,AVG(`acc`.`BAL`) FROM CUSTOMER as cus LEFT JOIN ACCOUNT AS `acc` ON `acc`.`CNAME`=`cus`.`CNAME` LEFT JOIN BRANCH AS `bran` ON `acc`.`BNAME` = `bran`.`BNAME` WHERE `cus`.`CCITY` = 'Eden Prairie' AND AVG(`acc`.`BAL`) >800

Question 4:


SELECT * FROM CUSTOMER as cus LEFT JOIN ACCOUNT AS `acc` ON `acc`.`CNAME`=`cus`.`CNAME` LEFT JOIN BRANCH AS `bran` ON `acc`.`BNAME` = `bran`.`BNAME` LEFT JOIN LOAN AS `loan` ON `cus`.`CNAME` = `loan`.`CNAME` WHERE (`cus`.`CCITY` = 'Eden Prairie' OR `cus`.`CCITY` = 'Minnetonka') AND `bran`.`BCITY`='Edina' AND `bran`.`ASSETS`<125000

Add a comment
Know the answer?
Add Answer to:
Need the SQL query for the questions below 1) Print the name of customers who do...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • WRITE SQL QUERY THAT DOES THE FOLLOWING Q3| Find the customer's name and branch names of...

    WRITE SQL QUERY THAT DOES THE FOLLOWING Q3| Find the customer's name and branch names of all customers who do have accounts but not a loan in the bank. And find those customers who do have loan but not have an account in the bank. GIVEN DATABASE TABLES 2 Account table Branch table Customer table Loan table BNAME 3 A# CNAME BNAME BAL BNAME ASSETS BCITY CNAME STREET CCITY CNAME AMT 1234 Baba 2222 Rahimi Sauthdale Ridgedale 150eee Minnetonka Minnetonka...

  • SQL MS Acess 1. Display cid, clast, and cfirst for customers whose (last name starts with...

    SQL MS Acess 1. Display cid, clast, and cfirst for customers whose (last name starts with a “D” and has a “v” in the third position) or (first name ends with an “a”). 2. Display all the columns in Invoice for those invoices that have less than the average iprice. 3. Display all the columns in Customer for those customers who purchased a vehicle that has the same date value in icontract and isold. In other words, customers who signed...

  • Problem 1) Banking Application Consider the application domain of a banking application where you have customers...

    Problem 1) Banking Application Consider the application domain of a banking application where you have customers who have one or more accounts of type Checking or Saving. Some of the customers may also have one or more loans that they have taken from the bank. Each loan has a borrowed amount and current balance amount. Loan may be either outstanding or paid off. Questions 1. Create a Conceptual model (List Entities and note Relationships, 2- 3 Relationships only) (3 Pts)...

  • Using the database: Write SQL queries for each of the questions below. 1. Find the media...

    Using the database: Write SQL queries for each of the questions below. 1. Find the media type which has 100 or more tracks. Print the name of such media type. Number of rows returned in the result = 3 A) Find the playlists which have one or more tracks that have never been purchased in California (CA). Print the Id, and the name of such playlists. Number of rows returned in the result = 18 B) Find the customers who...

  • I need submission 2 and submission 3 completed please, thank you!!! Submission 1 - due Friday...

    I need submission 2 and submission 3 completed please, thank you!!! Submission 1 - due Friday January 17 before 5pm - You must submit your completed Journal entries, the Worksheet complete through the Trial Balance (with totals for all columns), and the worksheet formulas tab complete through the Trial Balance. Your file must be named correctly - "Your name (first and last) Project 1 part 1. Failure to name your file correctly will result in a 1 point deduction Submission...

  • Please do not delete the questions. 1. What is the purpose of a database? 2. What...

    Please do not delete the questions. 1. What is the purpose of a database? 2. What is the reason to use a database over a spreadsheet? 3. Based on the previous answers (#1 & #2), there is a simple rule of thumb. A spread sheet is used when there is _________________________. A database is used when there are _________________________. 4. Please answer followings. a) A group of 8 bits is called a ____________ (from Chapter 4). b) The answers of...

  • Is this too much? I thought 1-6 to be more like steps then, individual questions. If...

    Is this too much? I thought 1-6 to be more like steps then, individual questions. If it is can you do the 1st and 2nd part/questions with an explanation, please and thank you. HOMEWORK #2 Due September 18, 5:00 pm 10 points Sparty Corporation has been operating for two years. The December 31, 2018 account balances are: Cash $250,000 Accounts Payable $170,000 Accounts Receivable 70,000 Salaries Payable 50,000 Inventory 30,000 Long Term Notes Payable 180,000 Short-term Investments 20,000 Contributed Capital...

  • Read below and answer, Why does a business that has profit of $30,000 per year need...

    Read below and answer, Why does a business that has profit of $30,000 per year need a bank loan? Jones Electrical Distribution After several years of rapid growth, in the spring of 2007 Jones Electrical Distribution anticipated a further substantial increase in sales. Despite good profits, the company had experienced a shortage of cash and had found it necessary to increase its borrowing from Metropolitan Bank-a local one- branch bank-to $250,000 in 2006. The maximum loan that Metropolitan would make...

  • Answer questions 1-8 How do you think this would help DASE &-1 NOT SPLLING THE BEANS...

    Answer questions 1-8 How do you think this would help DASE &-1 NOT SPLLING THE BEANS AT JELLY BELLY DEVELOPING A MORE PERFORMANCE APPRAISAL SYSTE be the sweetost job in the world? Why not as chocolates, gummies, gum balls, . Cheesecake, candy corns. licorice, sour car- tbeliel That's the way it is at F ind of course lotce, sour can ections, jellies, and of course let us not forget Fairfield, California-based Jelly retention, and rete. Happy workers lead to higher...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT