Question: Given: SQL> select * from borrower; CUSTOMER_NAME LOAN_NUMBER --------------- --------------- Adams L-16 Curry L-93 Hayes L-15 Jackson L-14 Jones L-17 McBride L-20 Smith L-11 Smith

Given: SQL> select * from borrower; CUSTOMER_NAME LOAN_NUMBER --------------- --------------- Adams L-16 Curry L-93 Hayes L-15 Jackson L-14 Jones L-17 McBride L-20 Smith L-11 Smith L-21 Smith L-23 Williams L-17 10 rows selected. SQL> select * from depositor; CUSTOMER_NAME ACCOUNT_NUMBER --------------- --------------- Hayes A-101 Hayes A-102 Johnson A-101 Johnson A-201 Johnson A-444 Jones A-217 Lindsay A-222 Majeris A-333 Smith A-215 Smith A-444 Turner A-305 11 rows selected. Question: What is the SQL command to find all customers who have an account and a loan at the bank?

SELECT customer_name FROM borrower WHERE customer_name NOT IN (SELECT customer_name FROM depositor);

SELECT DISTINCT customer_name FROM borrower WHERE customer_name IN (SELECT customer_name FROM depositor);

SELECT DISTINCT customer_name FROM borrower UNION SELECT customer_name FROM depositor;

SELECT DISTINCT customer_name FROM borrower WHERE customer_name NOT IN (SELECT customer_name FROM depositor);

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!