WHERE kurs = 4 AND stipend >0
Joylashtirilgan so`rovlar
Misol. Joylashtirilgan so`rov:
WHERE id_user IN (SELECT id_author FROM topics
WHERE topic_name='велосипедлар');
Misol. Xuddi shu so`rov:
SELECT name FROM users
WHERE id_user = (SELECT id_author FROM topics
WHERE topic_name='велосипедлар');
Moslashtirilgan so`rovda tashqi so`rov xar bir satri uchun ostki so`rov bajariladi
Misol:
SELECT *
FROM Customers outer
WHERE 10/03/1990 IN ( SELECT odate
FROM Orders inner
WHERE outer.cnum = inner.cnum );
Shu misol:
SELECT *
FROM Customers first, Orders second WHERE first.cnum = second.cnum AND second.odate = 10/03/1990; Misol.Tashqi so’rovdan foydalanish.
SELECT *
FROM Orders outer
WHERE amt > ( SELECT AVG amt
FROM Orders inter
WHERE inner.cnum = outer.cnum );
SQL da almashtirish funksiyalari bilan ishlash.
LOWER ()- berilgan satrni kichik harflarga almashtirib beradi.
UPPER () – kichik harflarni kata harflarga almashtirib beradi.
INIT CAP ()- satrdagi har bir so’z unlikni 1-harfini bosh harf qilib beradi.
Maslan, ularga quyidagi misolni ko’ramiz. SELECT LOWER (surname), UPPER (name) FROM Student
Do'stlaringiz bilan baham: |