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. 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 a loan but do not have an account at the bank?
SELECT DISTINCT customer_name FROM depositor WHERE customer_name NOT IN (SELECT customer_name FROM borrower); | ||
SELECT DISTINCT customer_name FROM borrower WHERE customer_name NOT IN (SELECT customer_name FROM depositor); | ||
SELECT DISTINCT customer_name FROM borrower LESS SELECT customer_name FROM depositor; | ||
SELECT DISTINCT customer_name FROM borrower WHERE NOT IN (SELECT customer_name FROM depositor); |
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