|
So`rov: Select sum(id) as ‘ id lar yig’indisi ’ from xodimlar
|
bet | 5/6 | Sana | 18.05.2024 | Hajmi | 448,64 Kb. | | #243310 |
Bog'liq 10-Amaliy mashg\'ulotSo`rov: Select sum(id) as ‘ id lar yig’indisi ’ from xodimlar;
Natija:
11.1 – rasm. Sum() agregat funksiyasidan foydalanish
2. AVG() – qiymqatlar o`rta arifmetigini hisoblash.
“xodimlar” jadvalidagi xodimlarning id larining o’rta arifmetigini aniqlaymiz.
So`rov: Select avg(id) as ‘ id lari orta arifmetigi ’ from xabar;
Natija:
11.2– rasm. Avg() agregat funksiyasidan foydalanish
3. MIN() – eng kichik qiymatni chiqarish
“xodimlar” jadvalidan eng kam stajinini chiqaramiz;
So`rov: Select min(id) as ‘eng kam ish staji’ from xodimlar;
Natija:
11.3 – rasm. Min() agregat funksiyasidan foydalanish
4. MAX() – eng katta qiymatni chiqarish
So`rov: So`rov: select id, max(staji) from maxsulot group by qurilma_id;
Natija:
11.4– rasm. Max() agregat funksiyasidan foydalanib, ustundagi eng katta qiymatni aniqlash
b) “Qurilma” jadvalidan oxirida turgan qurilma id sini chiqaramiz;
So`rov: Select max(id) from xodimlar;
Natija:
11.5– rasm. Max() agregat funksiyasidan foydalanib eng kop ish stajini topish.
5. COUNT() – Ustundagi qatorlar sonini sanaydi.
a) Ikki va undan maxsulot ishlaydigan qurilmalar chiqarilsin.
So’rov: Select korpus_id as ‘2 tadan kop maxsulot ishlab chiqaradigan korpuslar id lari’ , count(maxsulot_nomi) as ‘maxsulotlar soni’ from maxsulot group by korpus_id having count(maxsulot_nomi)>=2;
Natija:
11.6– rasm. Count() agregat funksiyasidan foydalanish
“Xodimlar” jadvalidagi qurilmalar sonini aniqlaymiz.
So’rov: Select count(*) as ‘id lari soni’ from xodimlar;
Natija:
|
| |