Group by – GURUHLASH;
Order by – TARTIBLASH;
Order by(asc)- O’SISH TARTIBI;
Order by desc- KAMAYISH TARTIBI;
HAWING==WHERE;
Endi shu operatirlar yordamida ishlar amalga oshiramiz…
So’rovlar va natijalar:
select * from kafedra order by staji;// order by dan foydalandik
select * from kafedra order by Staji desc;// order by desc dan foydalandik kamayish tartibida
select Maoshi from kafedra group by Maoshi;// group by dan foydalandik
select id,FISH,sum(Staji) from kafedra group by id,FISH;// summasi groupbyda
select id,FISH,Manzili,sum(Staji) from kafedra group by id,FISH,Manzili;
select id,FISH,Lavozimi,Maoshi from kafedra having Maoshi>5000 order by Lavozimi;//Having dan foydalandik…
select id, max(Maoshi) from kafedra group by id;// max dan group by dan qo’llanishi…
11-rasmlar: kafedra Group by va Order by standart so’zlaridan qo’llanildi..
birlashtirish(UNION);
-kеsishuv(INTERSECT);
- ayirma(MINUS);
select * from kafedra union select * from kafedra2;// union yordamida birlashtirdik
select * from kafedra union all select * from kafedra2;//union all yordamida birlashtirdik..
INTERSECT ni MySql qo’llab quvatlamaydi Shuning uchun EXISTS yordamida jadvallar kesishmasini topamiz;
select * from kafedra2 where exists(select * from kafedra where kafedra.id=kafedra2.id);// exists qo’llanishi…
SELECT id FROM kafedra WHERE id NOT IN (SELECT id FROM kafedra2);// minus ni o’rniga shuni ishlatdim..
Xulosa:
MEN DARSLAR DAVOMIDA MAL’LUMOTLAR BAZASINI
Do'stlaringiz bilan baham: |