|
O‘zbekiston respublikаsi аxborot vа kommunikаtsion texnologiyalаrini rivojlаntirish vаzirligi
|
Sana | 05.01.2024 | Hajmi | 184,48 Kb. | | #130381 |
Bog'liq 6-amaliy ish
O‘ZBEKISTON RESPUBLIKАSI АXBOROT VА KOMMUNIKАTSION TEXNOLOGIYALАRINI RIVOJLАNTIRISH VАZIRLIGI
MUXАMMАD АL-XORАZIMIY NOMIDАGI
TOSHKENT АXBOROT TEXNOLOGIYALАRI UNIVERSITETI
Ma’lumotlar bazasi fanidan
AMALIY ISH
Bajardi: 029-21 guruh talabasi
Ro‘ziboyev Zarifjon
Toshkent 2023
6 - AMALIY MASHG‘ULOTI Mavzu: Group by va Order by standart so‘zlaridan foydalanib so‘rov yaratish. Having standart so‘zi orqali so‘rovlar yaratish
Ishni bajarish tartibi
1. Talabalar ro‘yxatidan qaysi shahardan nechta talaba borligini aniqlaymiz buning uchun ustunini group by yordamida birlashtirib yuboramiz.
Count(*) – sonini hissoblash uchun ishlatiladi
So‘rov: select manzili, count(*) as FIO from Talabalar group by manzili;
Natija:
6.1-rasm. Group by kalit so‘zidan foydalanish
2. Topilgan natijani manzillar nomi bo’yicha tartiblaymiz buning uchun so’rovimizga order by mamlakat buyurug’ini qo’shamiz.
So‘rov: select manzili, count(*) as FIO from Talabalar group by manzili order by manzili;
Natija:
6.2 –rasm. Group by kalit va Order by kalit so‘zlaridan foydalanish
3. Filmlar nomi alifbo bo‘yicha tartiblansin va alifboga teskari tartibda tartiblansin. Filmlar nomini alifbo bo‘yicha tartiblash:
So‘rov: select FIO, Manzili from Talabalar order by FIO;
Natija:
6.3–rasm. Order by kalit so‘zining qo‘llanilishi
4. Filmlar nomini alifboga teskari tartib bo‘yicha tartiblash:
So‘rov: select FIO, Manzili from Talabalar order by FIO desc;
Natija:
6.4–rasm. Order by kalit so‘zining qo‘llanilishi
5. Filmlar jadvalidan 2020 yildan keyin chiqgan kinolar haqida ma’lumot berilsin:
So‘rov: select FIO, Manzili, yoshi from Talabalar having yoshi>22;
Natija:
6.5 – rasm. Having kalit so‘zining qo‘llanilishi
|
| |