5 - LABORATORIYA ISHI
Mavzu: AND, OR, NOT mantiqiy standart so‘zlardan foydalanish
So’rov: Select * from seriallar;
Natija:
So’rov: SELECT id, janr, UPPER(davlati) FROM seriallar WHERE id<3;
Natija:
UPPER funksiyasini qo’llanishi natijasi
So’rov: SELECT id, substr(serial_nomi,1,3)||','||janr, serial_nomi,yili,length(davlati), davlati, id FROM seriallar WHERE id IN(1,1,3) AND id<3;
Natija:
Substr va mantiqiy amallarning qo’llanishi
So’rov: SELECT serial_nomi, length(janr), yili, cassa FROM seriallar WHERE NOT id=3;
Natija:
Length funksiyasi va NOT mantiqiy amalining qo’llanishi
So’rov: SELECT id, Lower(janr), serial_nomi, length(yili),davlati, top_reyting, cassa FROM seriallar WHERE id BETWEEN 1 and 3;
Natija:
Lower, length funksiyalari va Between mantiqiy amalining qo’llanishi
6 - LABORATORIYA ISHI
Mavzu: Ma’lumotlarni saralash. Where standart so‘zidan foydalanish
So`rov: show tables from kinolar;
Natija:
Bazada mavjud jadvallarni ko`rish
So`rov:
desc seriallar;
desc trailer;
desc turlari;
Natija:
6.2-rasm. Ma`lumotlar bazasidagi seriallar, trailer, turlari jadvallari.
So`rov:
Select * from seriallar;
Select * from trailer;
Select * from turlari;
Natija:
INSERT operatoridan foydalangan holda tabllarni shakllantirish
Update va alter table add buyruqlari yordamida mavjud jadvallarni to’ldiramiz
6.5 – rasm. ALTER operatoridan foydalanish
6.6 – rasm. UPDATE operatoridan foydalanish
So`rov: Update trailer set davlati_id where id=NULL;
Select *from trailer;
So`rov: Delete from trailer where davlati_id NULL;
Select *from trailer;
Natija:
6.7 DELETE operatoridan foydalanish
So`rov: Select min(id) as ‘eng birinchi kino’, kino_nomi from trailer;
Natija:
6.8-rasm. MIN() funksiyasining qo’llanishi
So`rov: Select max(id) as ‘eng oxirgi kino’, kino_nomi from trailer;
Natija:
6.9 –rasm. MAX() funksiyasining qo’llanishi
So`rov: Select *from trailer where id between 1 and 4;
Natija:
6.10-rasm. BETWEEN operatorining qo’llanishi
So`rov: Select count(*) as ‘kino_soni’ from trailer;
Natija:
6.11-rasm. COUNT() funksiyasining qo’llanishi
So`rov: Select avg(id) as ‘kino id lari orta arifmetigi ’ from trailer;
Natija:
– rasm. AVG()funksiyasining qo’llanishi
So`rov: Select * from trailer where kino_nomi=’Baron’;
Natija:
– rasm. SELECT va WHEREning qo’llanishi
So`rov: Select sum(id) as ‘ kino id lari yig’indisi ’ from trailer;
Natija:
– rasm. SUM() funksiyasining qo’llanishi
So`rov: Select mid(kino_nomi, 1, 1) as ‘bosh harflar’, kino_nomi from trailer;
Natija:
MID() funksiyasining qo’llanishi
7 - LABORATORIYA ISHI Mavzu: Group by va Order by standart so‘zlaridan foydalanib so‘rov yaratish
So`rov: select davlati_id, sum(yili) as 'dalatdan chiquvchi kinolar yili' from trailer group by davlati_id;
Natija:
7.1-rasm. Group by kalit so’zi va Sum() funksiyasining qo’llanilishi
So`rov: select davlati_id, max(davlati_id) from trailer group by davlati_id;
Natija:
7.2 –rasm. Group by kalit so’zi va Max() funksiyasining qo’llanilishi
So`rov: Select* from trailer order by kino _nomi;
Natija:
7.3–rasm. Order by kalit so’zining qo’llanilishi
So`rov: Select* from trailer order by kino _nomi Desc;
Natija:
7.4–rasm. Order by kalit so’zining Desc bilan qo’llanilishi
Do'stlaringiz bilan baham: |