18.4k views
5 votes
Write a query to list a summary of customer balance for those customers who made purchase. More specifically, the summary should include the minimum balance, maximum balance, and average balance.

User Junya
by
8.2k points

1 Answer

1 vote

Final answer:

The question asks for a SQL query that can summarize the customer balances with the minimum, maximum, and average values. The student will need access to a 'Customer' table with a 'balance' column and a 'hasMadePurchase' flag to identify customers who have made purchases.

Step-by-step explanation:

The student is asking for a SQL query that will provide a summary of customer balances, specifically targeting customers who have made a purchase. To create such a summary report, one would need access to the database with the relevant customer and purchase data. Assuming we have a table that captures customer balances, we would use the MIN, MAX, and AVG functions to get the minimum balance, maximum balance, and average balance, respectively. An example of such a query might look like this:

SELECT MIN(balance) AS MinBalance, MAX(balance) AS MaxBalance, AVG(balance) AS AvgBalance FROM Customer WHERE hasMadePurchase = 1;

This query assumes there's a field called balance within the Customer table, and a boolean field called hasMadePurchase that flags whether the customer has made a purchase (1 for yes, 0 for no).

User VPeric
by
7.6k points