PostgreSQL MAX() function is an aggregate function that returns the maximum value in a set of values.
SELECT MAX(amount) FROM payment;
The following query gets the largest payment paid by each customer:
SELECT customer_id, MAX (amount) FROM payment GROUP BY customer_id;
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.