You have orders table with columns:
order_id, customer_id, city, amount, statusFind each city's: Completed order count, Unique customers, Total revenue, Average order value. Only include cities where completed revenue is greater than โน10,000. Sort by revenue from highest to lowest.
Solution:
SELECT
city,
COUNT(*) AS completed_orders,
COUNT(DISTINCT customer_id) AS unique_customers,
SUM(amount) AS revenue,
AVG(amount) AS average_order_value
FROM orders
WHERE status = 'Completed'
GROUP BY city
HAVING SUM(amount) > 10000
ORDER BY revenue DESC;
Claim your Free $5 Bonus Here:
https://bit.ly/3wUxw09
LinkedIn profile ๐
https://www.linkedin.com/in/subarno-roy-3b2251374
Join our WhatsApp Channel ๐
https://whatsapp.com/channel/0029VbAi27y0lwghBe9mE42i
WhatsApp Community Link ๐
https://chat.whatsapp.com/HPJDqRr6G1sKQIqfdJF3pL
1๏ธโฃ Artificial Intelligence
๐ Channel Link:
[ https://t.me/artificialintelligence_official ]
---
2๏ธโฃ Programming Books
๐ Channel Link:
[ https://t.me/programmingbooksofficial ]
---
3๏ธโฃ Android Development
๐ Channel Link:
[ https://t.me/androiddevelopmentofficial ]
---
4๏ธโฃ App Development
๐ Channel Link:
[ https://t.me/appdevelopmentofficial ]
---
5๏ธโฃ Ethical Hacking
๐ Channel Link:
[ https://t.me/ethicalhacking_official ]
Share with your College Whatsapp Groups & Friends too
All the best ๐๐