6.4–rasm. Order by
kalit so‘zining qo‘llanilishi
5
. Barselona jadvalidan 2000 yildan keyin tug’ilgan o’yinchilar haqida ma’lumot
berilsin:
So‘rov
:
select player_id, player_name, birth_year from barselona having
birth_year>2000;
Natija:
6.5 – rasm. Having
kalit so‘zining qo‘llanilishi
6
. Havingni Wheredan farqi having Group by bilan birgalikda ishlatiladi. 8 tadan ko’p
o’yinchilar o’ynayotgan davlatlar
chiqarilsin
So‘rov: select country, count(*) as oyinchi_soni from barselona group by country
having count(*)>8;
Natija:
6.6. – rasm. Group by va Having
kalit so‘zlarining qo‘llanilishi
Vazifalar
1.
Yuqorida ko‘rsatilganlardan foydalanib tanlangan variyantga
muvofiq mavzu uchun
MySQL da
order by
,
group by va having
buyruqlari bilan ishlang.
2.
Bajarilgan ishlar haqida hisobot tayyorlang (1-2-ilovalarga qarang).
Nazorat
savollari
1.
SQL tilida GROUP BY kalit so‘zining strukturasi qanday?
2.
SQL tilida ORDER BY kalit so‘zining strukturasi qanday?
3.
GROUP BY kalit so‘zidan qanday maqsadlarda foydalaniladi?
4.
ORDER BY kalit so‘zidan qanday maqsadlarda foydalaniladi?
5.
GROUP BY kalit so‘zi ORDER BY dan nimasi bilan faq qiladi?
6.
SQL tilida HAVING kalit so‘zining strukturasi qanday?
7.
HAVING kalit so‘zidan qanday maqsadlarda foydalaniladi?
8.
HAVING va WHERE kalit so‘zlarining vazifalarini farqlab bering.
9.
HAVING kalit so‘zi qanday agregat funksiyalar bilan qo‘llanilishi mumkin?