10-TOPSHIRIQ. BIR NECHA JADVALLARNI BIRLASHTIRISH, ‘JOIN’ LAR BILAN ISHLASH 10.1. Guruhlar yaratish. Guruhlar SELECT iborasining GROUP BY bandi yordamida yaratiladi. Buni quyidagi aniq misol bilan ko'rsatish mumkin:
SELECT `Boshlanish_vaqti`, COUNT(`Boshlanish_vaqti`) AS 'bv' FROM Imtixon GROUP BY `Boshlanish_vaqti`
SELECT `Kridit_miqdori`, COUNT(`Kridit_miqdori`) AS 'KRIDIT' FROM Fan GROUP BY `Kridit_miqdori`
SELECT `ism`,`maoshi`, COUNT(`maoshi`) AS yangi FROM Uqituvchi GROUP BY `maoshi`;
10.2. Guruh bo’yicha filtrlash
SELECT `fani`, COUNT(`fani`) AS fanim FROM Uqituvchi GROUP BY `fani`HAVING COUNT(`fani`)>1;
SELECT `Nomi`,`Dars_soati`, COUNT(`Dars_soati`) AS soati FROM Fan GROUP BY `Dars_soati` HAVING (`Dars_soati`)>22
10.3. Bir nechta jadvallarni birlashtirish. JOIN so’rovlari
Do'stlaringiz bilan baham: |