Aggregate
BigQuery
MIN
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 2026Syntax
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
1 SELECT MIN(price) as lowest_price 2 FROM `project.dataset.products` 3 WHERE category = 'Electronics';
Finds the lowest price among electronics products.
Hasil
99000
MIN with GROUP BY
SQL
1 SELECT 2 product_category, 3 MIN(price) as min_price, 4 MAX(price) as max_price 5 FROM `project.dataset.products` 6 GROUP BY product_category;
Finds the price range (min and max) per product category.
Hasil
| product_category | min_price | max_price |
|---|---|---|
| Electronics | 99000 | 25000000 |
| Fashion | 50000 | 5000000 |
| Books | 25000 | 500000 |
MIN on Dates
SQL
1 SELECT 2 customer_id, 3 MIN(order_date) as first_order_date, 4 MAX(order_date) as last_order_date 5 FROM `project.dataset.orders` 6 GROUP BY customer_id 7 LIMIT 5;
Finds the first and last order date per customer.
Hasil
| customer_id | first_order_date | last_order_date |
|---|---|---|
| C001 | 2023-01-15 | 2024-06-20 |
| C002 | 2023-03-22 | 2024-05-18 |
| C003 | 2022-11-08 | 2024-06-25 |
MIN with STRUCT
SQL
1 SELECT 2 MIN(STRUCT(price, product_name)) as cheapest_product 3 FROM `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..
Ngulik Langsung
Latihan Langsung →Sudah paham MIN? Latih langsung di browser
Latihan interaktif, langsung di browser.