mysql> SELECT AVG(mark)
FROM exam_marks;
Natija:
AVG(mark)
4.25
Agregat funksiyalarini h a m W H E R E so‘zi bilan birgalikda
qo ‘llash m u m k in .
10.25-misoI. Identifikator nomeri 10 ga teng b o ‘lgan fan b o ‘yicha
talabalarning olgan baholari o ‘rtachasini hisoblang:
mysql> SELE C T AVG(mark)
FROM exam_m arks
W H E R E s u b j jd = 10;
Natija:
AVG(mark)
4,666666666666667
Biror xulosaga kelishdan oldin SQL tilin in g barcha imkoniyat-
larini ko‘rib chiqish kerak. M asalan, ixtiyoriy m a tn n i so'rov tarkibi-
ga kiritish m u m k in . 10.25-misolni quyidagicha yozamiz:
mysql> SE L E C T ‘0 ‘rtacha ball = ’, AVG(mark)
FRO M exam _m arks
W H E R E s u b j jd = 10
Do'stlaringiz bilan baham: |