MIN() နဲ့ MAX() က numeric/date column တွေထဲက အငယ်ဆုံးနဲ့အကြီးဆုံးတန်ဖိုးကိုရှာဖို့သုံးပါတယ်။ Price အနိမ့်ဆုံး/အမြင့်ဆုံး၊ earliest date/latest date, smallest ID/largest ID တွေရှာတဲ့အခါအသုံးဝင်ပါတယ်။
sql
SELECT MIN(CustomerID) AS SmallestID,
MAX(CustomerID) AS LargestID
FROM Customers;You should see
+------------+-----------+ | SmallestID | LargestID | +------------+-----------+ | 1 | 4 | +------------+-----------+ What this code does: Customers table ထဲက CustomerID အနည်းဆုံးနဲ့အများဆုံးကိုရှာပြီး alias name နဲ့ပြပါတယ်။ Practical use: Product table မှာ MIN(price) , MAX(price) သုံးပြီး price range filter ပြနိုင်ပါတယ်။