Aggregate functions တွေက rows အများကြီးကို summary တန်ဖိုးတစ်ခုအဖြစ်တွက်ပေးပါတယ်။ Dashboard card တွေမှာ “Total Users”, “Average Sales”, “Total Revenue” ပြတဲ့အခါ အများကြီးသုံးပါတယ်။
• COUNT() — row အရေအတွက်တွက်ရန်
• AVG() — ပျမ်းမျှတန်ဖိုးတွက်ရန်
• SUM() — စုစုပေါင်းတွက်ရန်
sql
SELECT COUNT(CustomerID) AS TotalCustomers
FROM Customers;You should see
+----------------+ | TotalCustomers | +----------------+ | 4 | +----------------+ What this code does: Customers table ထဲမှာ customer ဘယ်နှယောက်ရှိလဲရေတွက်ပါတယ်။ Important things to notice: COUNT(column) က NULL မဟုတ်တဲ့ values ကိုရေတွက်ပါတယ်။ Rows အားလုံးရေတွက်ချင်ရင် COUNT(*) ကိုသုံးလေ့ရှိပါတယ်။