1. Har bir talaba o’ziga berilgan predmet soha mavzusi bo’yicha and, or


Har bir talaba o’ziga berilgan predmet soha mavzusi bo’yicha HAVING


Download 432.03 Kb.
Pdf ko'rish
bet3/6
Sana18.12.2022
Hajmi432.03 Kb.
#1027742
1   2   3   4   5   6
Bog'liq
2 - dedline

4. Har bir talaba o’ziga berilgan predmet soha mavzusi bo’yicha HAVING
operatoridan foydalanib so’rovlar yaratishi va natijasi bilan ko’rsatib 
o’tishi kerak. 
mysql> SELECT COUNT(xodim_id), familiya FROM oqituvchilar GROUP BY maosh HAVING 
COUNT(xodim_id) > 1; 
+-----------------+--------------+ 
| COUNT(xodim_id) | familiya | 
+-----------------+--------------+ 
| 2 | Xaydarov | 
| 2 | Boriyev | 
| 2 | Jabborov | 
+-----------------+--------------+ 
3 rows in set (0.00 sec) 
5. Har bir talaba o’ziga berilgan predmet soha mavzusi bo’yicha UNION, 
INTERSECT, MINUS operatorlaridan foydalanib so’rovlar yaratishi va 
natijasi bilan ko’rsatib o’tishi kerak. 
mysql> SELECT familiya FROM oqituvchilar UNION SELECT nazoratchi_xodim FROM qismlar ORDER BY 
familiya; 
+-------------------+ 
| familiya | 
+-------------------+ 
| Jabborov | 
| Dilshod Komilov | 
| Behruz Boriyev | 
| Raimjonov | 
| Boriyev | 
| Komilov | 
| Mahamadjonov | 
| Nosiraliyev | 
| Xaydarov | 
+-------------------+ 
10 rows in set (0.02 sec) 


mysql> SELECT javobgar_xodim FROM mashinalar INTERSECT SELECT nazoratchi_xodim FROM xomashyo; 
+-----------------+ 
| javobgar_xodim | 
+-----------------+ 
| Behruz Boriyev | 
+-----------------+ 
1 row in set (0.00 sec) 
(MINUS opertori MySql 8.0 da deprecate ga uchragan uning o`rniga shu vazifani bajaruvchi EXCEPT operatori 
mavjud)
mysql> SELECT javobgar_xodim FROM mashinalar EXCEPT SELECT nazoratchi_xodim FROM xomashyo; 
+-------------------+ 
| javobgar_xodim | 
+-------------------+ 
| Dilshod Komilov | 
+-------------------+ 
1 row in set (0.00 sec) 
mysql> 

Download 432.03 Kb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling