MIN (Lakehouse v1)
Aggregate function.
The MIN() function returns the minimum value in a set of values.
Analyze Syntax
Section titled “Analyze Syntax”func.min(<column>)Analyze Examples
Section titled “Analyze Examples”table.station_id, func.min(table.price).alias('min_price')
| station_id | min_price ||------------|-----------|| 1 | 3.45 |SQL Syntax
Section titled “SQL Syntax”MIN(<expr>)Arguments
Section titled “Arguments”| Arguments | Description |
|---|---|
<expr> | Any expression |
Return Type
Section titled “Return Type”The minimum value, in the type of the value.
SQL Examples
Section titled “SQL Examples”title: MIN
Section titled “title: MIN”Aggregate function.
The MIN() function returns the minimum value in a set of values.
SQL Syntax
Section titled “SQL Syntax”MIN(expression)Arguments
Section titled “Arguments”| Arguments | Description |
|---|---|
| expression | Any expression |
Return Type
Section titled “Return Type”The minimum value, in the type of the value.
SQL Examples
Section titled “SQL Examples”Create a Table and Insert Sample Data
CREATE TABLE gas_prices ( id INT, station_id INT, price FLOAT);
INSERT INTO gas_prices (id, station_id, price)VALUES (1, 1, 3.50), (2, 1, 3.45), (3, 1, 3.55), (4, 2, 3.40), (5, 2, 3.35);Query Demo: Find Minimum Gas Price for Station 1
SELECT station_id, MIN(price) AS min_priceFROM gas_pricesWHERE station_id = 1GROUP BY station_id;Result
| station_id | min_price ||------------|-----------|| 1 | 3.45 |