HAVING=WHERE, faqat HAVING guruxlar ichiga tegishli
Select Subj_name, max (hour)
From SUBJECT;
Group by Subj_name
Having max (Hour)>= 34;
Ishni bajarish tartibi
1. Zavod korpusidagi bir kunlik chiquvchi jami maxsulotlar o’girliklari topilsin.
So`rov: select korpus_id, sum(ogirligi_kg) as ‘korpusdan chiquvchi oxirgi jami maxsulotlar ogirligi’ from maxsulot group by korpus_id;
Natija:
6.1-rasm. Group by kalit so’zi va Sum() funksiyasining qo’llanilishi
2.Zavoddagi qurilmalar guruhlanib eng ko’p maxsulot chiqaruvchisi topilsin
So`rov: select qurilma_id, max(ogirligi_kg) from maxsulot group by qurilma_id;
Natija:
6.2 –rasm. Group by kalit so’zi va Max() funksiyasining qo’llanilishi
3.Zavoddagi korpuslar nomi alfavit bo`yicha tartiblansin va alfavitga teskari tartibda tartiblansin. Korpus nomini alfavit bo`yicha tartiblash:
So`rov: Select* from korpus order by korpus _nomi;
Natija:
6.3–rasm. Order by kalit so’zining qo’llanilishi
4.Korpus nomini alfavitga teskari tartibda tartiblash:
So`rov: Select* from korpus order by korpus _nomi Desc;
Natija:
6.4–rasm. Order by kalit so’zining Desc bilan qo’llanilishi
5. Zavoddan bir kunlik olinadigan maxsulotlarning 5000 kgdan kam ishlab chiqarilganlari haqida ma`lumot berilsin:
So’rov: Select *from maxsulot having ogirligi_kg<5000;
Natija:
Do'stlaringiz bilan baham: |