Problem : Show number of customers in each city
Solution :
SELECT count(*) , City from customersProblem: Show only those cities with there customers counts where no of customers greater than 1
GROUP BY city
Solution :
SELECT count(*) , City from customersProblem: Only select customers who made their orders
GROUP BY city
HAVING count(*) > 1
Solution #1
SELECT customers.first_name , customers.last_name from Orders, customers where orders.customer_id = customers.id
Solution #2
SELECT CONCAT(customers.first_name ,' ', customers.last_name) as CustomerName
from Orders, customerswhere orders.customer_id = customers.id
Comments
Post a Comment