PostgreSQL – MIN() Function
PostgreSQL MIN() function is an aggregate function that returns the minimum value in a set of values.
The MIN() function can be used with SELECT, WHERE and HAVING clause.
Now let’s look into some examples.For examples we will be using the sample database (ie, dvdrental).
The below query gets us the minimum amount paid by customers in the
SELECT MIN(amount) FROM payment;
The following query gets the smallest payment paid by each customer:
SELECT customer_id, MIN(amount) FROM payment GROUP BY customer_id;
My Personal Notes arrow_drop_up
Please Login to comment...