Write queries 5. List names of customers (without duplicates) who has any order(
ID: 3573872 • Letter: W
Question
Write queries
5. List names of customers (without duplicates) who has any order(s) and who has no any order(s)
using a JOIN statement.
6. Using view (dynamic) statement, list names of all customers who has yet to buy anything.
Column to show: customer name.
Explanation / Answer
#5
select distinct A.cust_name as cutomer_with_orders,
(select distinct cust_name from customer B where A.cust_id != B.cust_id) as customers_without_orders
from ordertable A;
#6
create view custnamesyettobuy as
select cust_name from customer
where cust_id not in (select distinct cust_id from ordertable);
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.