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
SELECTMIN(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
SELECTROUND(MIN(amount), 2) AS minimum_transaction
FROM transactions;
Minimum Product Price
SELECTROUND(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
SELECTMIN(signup_date) AS earliest_signup
FROM users;
Earliest Order Date
SELECTMIN(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
SELECTROUND(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 1Retrieve 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
SELECTROUND(MIN(amount), 2) AS minimum_transaction
FROM transactions;
Practice 2Retrieve 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
SELECTROUND(MIN(unit_price), 2) AS minimum_price
FROM products;
Practice 3Retrieve 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
SELECTROUND(MIN(monthly_fee), 2) AS minimum_fee
FROM subscriptions;
Practice 4Retrieve 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
SELECTMIN(signup_date) AS earliest_signup
FROM users;
Practice 5Retrieve 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
SELECTMIN(order_date) AS earliest_order
FROM orders;
Practice 6Retrieve 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
SELECTMIN(start_date) AS earliest_campaign
FROM campaigns;
Practice 7Retrieve 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
SELECTMIN(quantity) AS minimum_quantity
FROM order_items;
Practice 8Retrieve 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
SELECTMIN(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
Correct. MIN() scans the entire column and returns the single smallest value β the lowest number, the earliest date, or the alphabetically first text value.
Not quite. MIN() returns the smallest value in the column β not the first row, not the average, not the total.
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
Correct. MIN() is an aggregate function β it collapses the entire column into a single summary row regardless of table size.
Not quite. MIN() always returns exactly one row β a single value representing the smallest in the column.
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;
Correct. MIN() on a date column returns the earliest date. No ROUND() is needed β dates are already clean values.
Not quite. MIN(signup_date) returns the earliest date. ROUND() is for numeric values only and should not be applied to dates.
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
Correct. MIN() on decimal columns like amount or unit_price can return many trailing decimal places. ROUND(…, 2) keeps the result to 2 decimal places β the standard for currency in business reports.
Not quite. ROUND() limits the decimal places in the output for clean financial reporting. It is not required for MIN() to function.
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
Correct. The minimum value is the analytical baseline β the lowest point the metric has ever reached. Combined with MAX() and AVG(), it describes the full shape of business performance.
Not quite. The minimum value establishes the analytical floor β the lowest observed value β used as a baseline when combined with MAX() and AVG().
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.