MIN(amount) keeps the smallest non-NULL amount value inside each category group.

highlighted = computed this step

Input table

Use the same sales rows with one NULL amount.

Sales\text{Sales}
Salesorder_idcategoryamounto1book20o2book35o3pen5o4penNULLo5pen20

Group query

Group by category and take the smallest non-NULL amount.

GROUP BY category, MIN(amount)\text{GROUP BY category, MIN(amount)}
GROUP BY category mingroup_byarity 2 rows 2Salesarity 3 rows 5

Grouped output

The NULL amount is skipped, so the pen minimum is the smallest known amount.

minimum amounts by category\text{minimum amounts by category}
Grouped outputcategorymin_amountbook20pen5