9-lobaratoriya ishi
Agregat funksiyalardan foydalanib so‘rovlar yaratish
MAX() – maksimal qiymat;
MIN() – minimal qiymat;
SUM() – yig’indini hisoblash;
COUNT() – sanash;
AVG() – o’rtacha qiymat;
SUM()
So`rov: Select sum(Davomiyligi) as 'Fanlar davomiyligi yigindisi' from fanlar
Natija:
2.AVG()
So`rov: Select avg(Davomiyligi) as 'fanlar davomiyligini orta arifmetigi' from fanlar
Natija:
3.MIN()
So`rov: Select min(id) as 'birinchi turgan talaba', Ism from talaba
Natija:
4.MAX() – eng katta qiymatni chiqarish
a ) Talabalar eng kata kursdagilar topilsin
So`rov: select id,Ism,Familiya, max(Kursi) from talaba group by Kursi
Natija:
5.So`rov: Select count(Kursi) from talaba
Natija: Bu funksiyalarga qo`shimcha ravishda quyidagi funksiyalarni ham ko`rib chiqamiz:
Rand() - tasodifiy son.
So`rov: Select id, Ism, rand(Kursi) from talaba
Natija:
ROUND() - Butun sonni yaxlitlash funktsiyasi.
So`rov: Select id, Ism, round(Kursi/id, 3) from talabaNatija:
POWER() - Sonning darajasini hisoblash.
Select id, Kursi , power(id, Kursi) from talaba
Natija:
SQRT() - Sonning kvadrat ildizini topish.
So`rov: Select Kursi, sqrt(Kursi) from talaba
Natija:
Do'stlaringiz bilan baham: |