For each city, list number of customers from the city, who have placed order(s).
ID: 3695380 • Letter: F
Question
For each city, list number of customers from the city, who have placed order(s). Cities are listed in ascending alphabetical order. Use equal join for this query. – (Hint: make sure your query does not to count the same customer more than once.)
CITY COUNT(DISTINCTCUSTOMER.CUST_ID)
-------------------- -------------------------------
SF 1
SLC 6
Tucson 2
Explanation / Answer
Suppose it has 2 table where table1 has has city_name and count of customer_id and table2 has count of customer_id,city_name,population so to show equal join below query can be used :
Select count(DISTINCTCUSTOMER.CUST_ID) from table1,table2 where table1.city_name=table2.city_name and table1.CUSTOMER.CUST_ID = table2.CUSTOMER.CUST_ID;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.