| 3 | Qalam | 3 | Qizil qalam |
| NULL | NULL | 5 | Yumshoq ayiqcha |
+------+-------+------+-----------------+
6 rows in set (0.05 sec)
LEFT
JOIN
SELECT * FROM tovarlar left JOIN izoh ON tovarlar.ID = izoh.ID;
+----+-------+------+-------------+
| id | Nomi | id | Izoh |
+----+-------+------+-------------+
| 1 | Kitob | 1 | Badiy kitob |
| 3 | Qalam | 3 | Qizil qalam |
| 2 | Stul | NULL | NULL |
+----+-------+------+-------------+
RIGHT
JOIN
SELECT *FROM tovarlar right JOIN izoh
ON tovarlar.ID = izoh.ID;
+------+-------+----+-----------------+
| id | Nomi | id | Izoh |
+------+-------+----+-----------------+
| 1 | Kitob | 1 | Badiy kitob |
| 3 | Qalam | 3 | Qizil qalam |
| NULL | NULL | 5 | Yumshoq ayiqcha |
+------+-------+----+-----------------+
3 rows in set (0.00 sec)
CROSS
JOIN
SELECT * FROM tovarlar CROSS JOIN izoh;
+----+-------+----+-----------------+
| id | Nomi | id | Izoh |
+----+-------+----+-----------------+
| 1 | Kitob | 1 | Badiy kitob |
| 2 | Stul | 1 | Badiy kitob |
| 3 | Qalam | 1 | Badiy kitob |
| 1 | Kitob | 3 | Qizil qalam |
| 2 | Stul | 3 | Qizil qalam |
| 3 | Qalam | 3 | Qizil qalam |
| 1 | Kitob | 5 | Yumshoq ayiqcha |
| 2 | Stul | 5 | Yumshoq ayiqcha |
| 3 | Qalam | 5 | Yumshoq ayiqcha |
+----+-------+----+-----------------+
9 rows in set (0.00 sec)
Topshiriq: Har bir talaba o’ziga berilgan predmet soha mavzusi bo’yicha
JOIN operatorilaridan foydalanib so’rovlar yaratishi va natijasi bilan ko’rsatib
o’tishi kerak.
Do'stlaringiz bilan baham: |