Labaratoriya ishi -3 SQL tili so’rovlarida Jadvaldagi ma’lumotlarni ko’rish Select * From namuna Bu jadvaldagi barcha ma’lumotlarni korish
Select familiya, ism, otasi
From namuna
Jadvaldagi bazi maydonlarni ko’rish buning uchun kerakli maydonni selectdan keyin yoziladi.
Bu esa familiya bo’yicha tartiblash uchun hizmat qiladi. Select familiya, ism, otasi From namuna Order By familiya,ism
Tug’ilgan yili bo’yicha kamayib borish tartibida tartiblash Select familiya, ism, otasi, tug_yil From namuna Order By tug_yil DESC
Select operatoridan keyin amallar ham yozish mumkin Select familiya, ism, otasi, (2018-tug_yil) AS Yoshi From namuna
Jinsi ayol 1990 yildan keyin tug’ilganlar ro’yxati Select familiya, ism, otasi, tug_yil, (2018-tug_yil) AS yoshi From namuna Where jinsi=”Ayol” and tug_yil>1990
A harifidan boshlanuvchi barcha familiyalarni chiqaradi Select familiya, ism, otasi From namuna Where familiya like “A%”
1985 va 1990 yillar oralig’ida tug’ilganlar ro’yxati chiqadi Select familiya, ism, otasi From namuna Where tug_yil BETWEEN 1985 AND 1990
Ismi “Azamat”,”Qudrat”,”Ne’mat”) ismlarni chiqarib beradi Select * From namuna Where Ism IN(“Azamat”,”Qudrat”,”Ne’mat”)
Dstinct xizmatchi so’zi ko’rsatilgan maydon bo’yicha bix xil qiymatli ma’lumotlarni faqat bittasini chiqaradi Select DISTINCT familiya From namuna
Ko’rsatilgan maydon yoki barcha jadval bo’yicha yozuvlar sonini chiqaradi Select count (*) From namuna
95-99 guruhidagi talabalar sonini aniqlash Select count (*) as soni From namuna Where guruh=”95-99”
Select min(tug_yil), max(tug_yil), avg (2018-tug_yil) From namuna
Mavjud yozuvni tahrirlash (qiymatini yangilash) Update namuna SET tug_yil=1989 WHERE familiya=”Temirov” AND ism=”Husniddin”
Familiyasi Abdurahomov bo’lgan hamma familiya o’chadi DELETE FROM namuna WHERE familiya=”Abdurahomov”
Yoshi eng kata talabani topish Select familiya,ism,tug_yil From namuna WHERE tug_yil =(select min(tug_yil) FROM namuna)
Guruhdagi talabalar sonini aniqlovchi so’rov Select guruh, count(guruh) as soni From namuna Group by guruh
Birdan ortiq takrorlanuvchi familiyalar va ularning takrorlanishlar soni chiqaruvchi so’rov Select familiya,count(familiya) as soni From namuna Group by familiya having count(familiya) >=2
Jadvalga yangi yozuv qo’shish Insert into namuna(familiya,Ism) Values(“Temirov”, “Husniddin”)