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 116.79 Kb.
Pdf ko'rish
bet3/6
Sana23.12.2022
Hajmi116.79 Kb.
#1048804
1   2   3   4   5   6
Bog'liq
2 deadline kif

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 xodimlar GROUP BY maosh HAVING COUNT(xodim_id)
> 1;
+-----------------+--------------+
| COUNT(xodim_id) | familiya |
+-----------------+--------------+
| 2 | Tursunov |
| 2 | Keldiyev |
| 2 | Abdulhamidov |
+-----------------+--------------+
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 xodimlar UNION SELECT nazoratchi_xodim FROM qismlar ORDER BY 
familiya;
+-------------------+
| familiya |
+-------------------+
| Abdulhamidov |
| Abdulla Komilov |
| Behzod Keldiyev |
| Ismoilov |
| Keldiyev |
| Komilov |
| Mahamadjonov |
| Nosiraliyev |
| Rayimjonov |
| Tursunov |
+-------------------+
10 rows in set (0.02 sec)
mysql> SELECT javobgar_xodim FROM mashinalar INTERSECT SELECT nazoratchi_xodim FROM xomashyo;
+-----------------+


| javobgar_xodim |
+-----------------+
| Behzod Keldiyev |
+-----------------+
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 |
+-------------------+
| Abdulla Komilov |
+-------------------+
1 row in set (0.00 sec)
mysql>

Download 116.79 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