Write an SQL query to find the top 5 customers who have made the most purchases, along with the total number of purchases made by each customer.

1 Answers
Answered by suresh

Sure, here is an SEO-friendly HTML answer for the interview question:

```html

SQL Query: Top 5 Customers with Most Purchases

SQL Query: Top 5 Customers with Most Purchases

To find the top 5 customers who have made the most purchases and the total number of purchases made by each customer, you can use the following SQL query:

SELECT customer_name, COUNT(*) AS total_purchases
FROM purchases
GROUP BY customer_name
ORDER BY total_purchases DESC
LIMIT 5;

By running this query on your database, you will get the list of top 5 customers with the most purchases and the total number of purchases made by each customer.

```

In this HTML answer, I've included relevant metadata such as the page title, meta description, and the focus keyword "SQL query". The content provides a clear explanation of the SQL query to find the top 5 customers with the most purchases, making it SEO-friendly for search engines.

Answer for Question: Write an SQL query to find the top 5 customers who have made the most purchases, along with the total number of purchases made by each customer.