Aggregate

MIN

BigQueryBigQuery

Returns the minimum value from a column or expression. Supports numeric, string, date/time, and boolean types in BigQuery.

Tipe hasil: Same as input typeDiperbarui: 13 Jun 2026

Syntax

SQL
MIN(expression)

Parameter

expressionanywajib

A column or expression to find the minimum value of. Supports INT64, FLOAT64, STRING, DATE, TIMESTAMP, and more.

Contoh Penggunaan

Simple Minimum Value

SQL
1SELECT MIN(price) as lowest_price
2FROM `project.dataset.products`
3WHERE category = 'Electronics';

Finds the lowest price among electronics products.

Hasil
99000

MIN with GROUP BY

SQL
1SELECT
2 product_category,
3 MIN(price) as min_price,
4 MAX(price) as max_price
5FROM `project.dataset.products`
6GROUP BY product_category;

Finds the price range (min and max) per product category.

Hasil
product_categorymin_pricemax_price
Electronics9900025000000
Fashion500005000000
Books25000500000

MIN on Dates

SQL
1SELECT
2 customer_id,
3 MIN(order_date) as first_order_date,
4 MAX(order_date) as last_order_date
5FROM `project.dataset.orders`
6GROUP BY customer_id
7LIMIT 5;

Finds the first and last order date per customer.

Hasil
customer_idfirst_order_datelast_order_date
C0012023-01-152024-06-20
C0022023-03-222024-05-18
C0032022-11-082024-06-25

MIN with STRUCT

SQL
1SELECT
2 MIN(STRUCT(price, product_name)) as cheapest_product
3FROM `project.dataset.products`;

Finds the cheapest product along with its name using a STRUCT.

Hasil
cheapest_product
{price: 25000, product_name: "Basic Notebook"}

Pertanyaan Umum tentang MIN

Apa itu fungsi MIN di BigQuery?
Returns the minimum value from a column or expression. Supports numeric, string, date/time, and boolean types in BigQuery. Di BigQuery, fungsi MIN termasuk dalam kelompok fungsi yang sering digunakan untuk mengolah dan menganalisis data secara efisien.
Bagaimana cara menggunakan MIN di BigQuery?
Gunakan sintaks berikut: MIN(expression). Pastikan argumen yang dimasukkan sudah sesuai dengan tipe data yang diharapkan.
Apa nilai yang dikembalikan oleh fungsi MIN?
Fungsi MIN mengembalikan nilai bertipe Same as input type. Pastikan tipe data hasil sudah sesuai dengan kebutuhan query atau formula kamu. Jika input mengandung nilai NULL, perilaku fungsi dapat berbeda — selalu periksa dokumentasi untuk memastikan hasilnya sesuai ekspektasi.
Apa saja parameter fungsi MIN?
Fungsi ini memiliki 1 parameter wajib. Parameter yang digunakan: expression (any, wajib): A column or expression to find the minimum value of. Supports INT64, FLOAT64, STRING, DATE, TIMESTAMP, and more..

Fungsi Terkait

Ngulik Langsung

Sudah paham MIN? Latih langsung di browser

Latihan interaktif, langsung di browser.

Latihan Langsung →