Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Oracle PL/SQL Programming Database Management Systems

Authors: Steven Feuerstein

1st Edition

978-1565921429

More Books

Students also viewed these Databases questions

Question

2. Show the trainees how to do it without saying anything.

Answered: 1 week ago