Question
the banking schema is provided in the file make-banking.sql. For reference, here is the banking database schema: branch (branch_name, branch_city, assets) customer (customer_name, customer_street, customer_city)
the banking schema is provided in the file make-banking.sql. For reference, here is the banking database schema: branch (branch_name, branch_city, assets) customer (customer_name, customer_street, customer_city) loan (loan_number, branch_name, amount) borrower (customer_name, loan_number)
Here are some more challenging problems to try against the banking database. a) Generate a list of all cities that customers live in, where there is no bank branch in that city. Make sure that the results are distinct; no city should appear twice. Also, sort the cities in increasing alphabetical order.
b) Are there any customers who have neither an account nor a loan? Write a SQL query that reports the name of any customers that have neither an account nor a loan. Note that MySQL does not support the EXCEPT operator! But there is more than one way
c) The bank decides to promote its branches located in the city of Horseneck, so it wants to make a $50 gift-deposit into all accounts held at branches in the city of Horseneck. Write the SQL UPDATE command for performing this operation. Do not use MySQL-specific extensions for this UPDATE operation. You may only use the standard UPDATE tblname SET ... WHERE ... form, where you can only specify one table in the UPDATE clause, and all references to other tables must appear in the WHERE clause.
d) MySQL also supports a non-standard, multiple table version of UPDATE, of the form: UPDATE tbl1, tbl2, ... SET ... WHERE ... In this form, you can refer to columns from any of the specified tables in the SET and WHERE clauses, and MySQL will figure out what to update from what you write. Write another answer to part c, using this syntax. Note that you can also give the tables in the UPDATE clause aliases, as usual. account (account_number, branch_name, balance) depositor (customer_name, account_number)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started