SQL Challenge: Top 3 Customers by Total Spent

🔥 Day 5 – SQL Challenge 📌 Problem Statement: You are given a table orders with the following columns: order_id customer_id order_date order_amount 👉 Write a SQL query to find the top 3 customers who have spent the highest total amount. 💡 Expected Output: customer_id total_spent 🧠 Solution: SELECT customer_id, SUM(order_amount) AS total_spent FROM orders GROUP BY customer_id ORDER BY total_spent DESC LIMIT 3; 🎯 Concepts Covered: GROUP BY SUM() ORDER BY LIMIT 📢 : Today’s focus: Finding top customers based on total spending 🧠 Solved using aggregation and sorting 🚀 Consistency is the key — learning step by step! #SQL #DataAnalytics #Learning #CareerGrowth #100DaysOfCode #DataAnalyst #100DaysSQLChallenge 💻🔥

  • logo

Great job with this SQL query Kallayya Mathapati!

Like
Reply

To view or add a comment, sign in

Explore content categories