Part 1: Mastering the MIN() Function

Part 1: Mastering the MIN() Function | SQL Challenges & Capstone
SQL Aggregation & Grouping Practice · Part 1 · Lecture Notes

Mastering the MIN() Function

How to identify the smallest values and earliest dates in business datasets β€” minimum prices, fees, transaction amounts, and operational date baselines.

Part 1 of 714% Complete
MIN()
Numeric Minimums
Earliest Dates
Operational Baseline
8 Practice Questions

Learning Objectives

  • Use MIN() to return the smallest numeric value from a column
  • Apply MIN() to date columns to find the earliest date in a dataset
  • Wrap MIN() with ROUND() for clean 2-decimal-place output on financial columns
  • Understand that MIN() always returns one row regardless of table size
Click any section header to open or close it

MIN() returns the smallest value from a column. It works on numbers (prices, amounts, quantities), dates (earliest signup, first order), and text (alphabetically first value). MIN() is a single-row summary function β€” no matter how many rows are in the table, it always returns exactly one value.

In industry, analysts use MIN() to identify the lowest-priced products, find the minimum transaction amount, establish operational baselines, discover the earliest customer signup or order, and review the lowest financial metrics across any dataset.

The Basic Structure

MIN() goes inside the SELECT clause, wrapping the column you want the minimum of. Give the result a readable alias using AS. For decimal columns, wrap in ROUND(…, 2) to keep financial output clean.

Basic MIN() Syntax
SELECT MIN(column_name) FROM table_name;

MIN() on a numeric column returns the single lowest number in that column β€” the cheapest product price, the smallest transaction amount, the lowest subscription fee. Pair it with ROUND() for clean decimal output in financial reports.

MIN() Always Returns One Row

Unlike SELECT * which returns many rows, MIN() collapses an entire column into one output value. No matter how large the table is, the result is always a single row with a single number.

Minimum Transaction Amount
SELECT ROUND(MIN(amount), 2) AS minimum_transaction FROM transactions;
Minimum Product Price
SELECT ROUND(MIN(unit_price), 2) AS minimum_price FROM products;

MIN() on a date column returns the earliest date β€” the first signup, the oldest order, the earliest campaign start. Dates in SQL are ordered chronologically, so MIN() on a date column is the direct SQL equivalent of “when did this start?” or “what was the first record?”

No ROUND() on Dates

ROUND() is for numeric values only. When using MIN() on a DATE column like signup_date or order_date, use MIN() without ROUND(). The result is already a clean date in YYYY-MM-DD format.

Earliest Signup Date
SELECT MIN(signup_date) AS earliest_signup FROM users;
Earliest Order Date
SELECT MIN(order_date) AS earliest_order FROM orders;

The minimum value is the analytical baseline β€” the floor below which the metric has never fallen. Understanding the minimum subscription fee tells analysts the entry price point. The minimum transaction amount reveals the smallest purchase a customer has made. These are anchor points for pricing analysis, revenue benchmarking, and operational review.

MIN() in Context

A minimum transaction of $29.99 tells you nothing by itself. Paired with MAX() and AVG(), it reveals the full shape of business activity β€” the floor, ceiling, and middle. Analysts almost always report MIN and MAX together for this reason.

Minimum Subscription Fee
SELECT ROUND(MIN(monthly_fee), 2) AS minimum_fee FROM subscriptions;

Work through each question below. Run your query first, then use Check Answer. A wrong answer reveals the correct SQL with a Copy button; a correct result earns a congratulations message.

Practice 1 Retrieve the minimum transaction amount rounded to 2 decimal places
AI Prompt
Write a MySQL query to retrieve the minimum transaction amount rounded to 2 decimal places.
SQL Answer
SELECT ROUND(MIN(amount), 2) AS minimum_transaction FROM transactions;
Practice 2 Retrieve the minimum product price rounded to 2 decimal places
AI Prompt
Write a MySQL query to retrieve the minimum product price rounded to 2 decimal places.
SQL Answer
SELECT ROUND(MIN(unit_price), 2) AS minimum_price FROM products;
Practice 3 Retrieve the minimum subscription monthly_fee rounded to 2 decimal places
AI Prompt
Write a MySQL query to retrieve the minimum subscription monthly_fee rounded to 2 decimal places.
SQL Answer
SELECT ROUND(MIN(monthly_fee), 2) AS minimum_fee FROM subscriptions;
Practice 4 Retrieve the earliest signup_date from the users table
AI Prompt
Write a MySQL query to retrieve the earliest signup_date from the users table.
SQL Answer
SELECT MIN(signup_date) AS earliest_signup FROM users;
Practice 5 Retrieve the earliest order_date from the orders table
AI Prompt
Write a MySQL query to retrieve the earliest order_date from the orders table.
SQL Answer
SELECT MIN(order_date) AS earliest_order FROM orders;
Practice 6 Retrieve the earliest campaign start_date from the campaigns table
AI Prompt
Write a MySQL query to retrieve the earliest campaign start_date from the campaigns table.
SQL Answer
SELECT MIN(start_date) AS earliest_campaign FROM campaigns;
Practice 7 Retrieve the minimum quantity from the order_items table
AI Prompt
Write a MySQL query to retrieve the minimum quantity from the order_items table.
SQL Answer
SELECT MIN(quantity) AS minimum_quantity FROM order_items;
Practice 8 Retrieve the earliest support ticket created_date from the support_tickets table
AI Prompt
Write a MySQL query to retrieve the earliest support ticket created_date from the support_tickets table.
SQL Answer
SELECT MIN(created_date) AS earliest_ticket FROM support_tickets;

Knowledge Check

Five questions β€” select the best answer for each.

1. What does MIN() return from a column?
AThe first row in the table
BThe average of all values
CThe smallest value in the column
DThe total of all values
2. How many rows does MIN() return?
AOne row per record in the table
BExactly one row containing the minimum value
CThe number of rows that equal the minimum
DAll rows sorted from smallest to largest
3. Which query correctly finds the earliest signup date?
ASELECT MIN(signup_date) AS earliest_signup FROM users;
BSELECT ROUND(MIN(signup_date), 2) AS earliest_signup FROM users;
CSELECT AVG(signup_date) AS earliest_signup FROM users;
DSELECT ORDER BY signup_date ASC LIMIT 1 FROM users;
4. Why should ROUND() be used with MIN() on decimal columns?
AROUND() is required for MIN() to work correctly
BTo limit decimal places to a readable financial format such as 2
CTo prevent MIN() from returning NULL
DTo make MIN() run faster on large tables
5. What is the analytical purpose of finding a minimum value in a business context?
ATo delete the smallest records from the database
BTo establish the floor β€” the lowest point of business activity β€” as a baseline for analysis
CTo sort the entire table from smallest to largest
DTo check whether any NULL values exist in the column

Part 1 Summary

The key ideas from this lecture β€” keep these in mind as you move forward.

MIN() helps analysts identify the smallest values, earliest dates, and lowest business metrics inside operational datasets. Use ROUND() with decimal columns. Never use ROUND() on date columns. MIN() always returns exactly one row.

MIN()Smallest ValueEarliest DateOperational BaselineROUND()AggregateFloor