Bir nechta jadvallar birlashtirish, “JOIN” lar bilan
ishlash. Murakkab so’rovlar yaratish
mysql>
select
x.xodim_familiyasi,
x.kutubxonasi,
x.lavozimi,
x.ishga_kirgan_yili from xodimlar x
->
inner join kutubxona k
-> on k.id_k=x.id_x;
+------------------+-------------+--------------+-------------------+
| xodim_familiyasi | kutubxonasi | lavozimi | ishga_kirgan_yili |
+------------------+-------------+--------------+-------------------+
| Ergashev | TATU 1-ARM | Mudir | 2021 |
| Turgunov | TATU 2-ARM |Kutubxonachi | 2019 |
| Shokarimov | TATU 3-ARM |Kutubxonachi | 2011 |
| Sobirov | TATU 4-ARM |oqituvchi | 2011 |
| Komilov | TATU 2-ARM |oqituvchi | 2011 |
| Ergashev | TATU 2-ARM |rektor | 2019 |
| Dilshodov | TATU 1-ARM |tuiter | 2019 |
+------------------+-------------+--------------+-------------------+
7 rows in set (0.06 sec)
mysql>
select
x.xodim_familiyasi,
x.kutubxonasi,
x.lavozimi,
x.ishga_kirgan_yili, k.shahar from xodimlar x
-> inner join kutubxona k
-> on k.id_k=x.id_x;
+------------------+-------------+--------------+-------------------+----------+
| xodim_familiyasi | kutubxonasi | lavozimi | ishga_kirgan_yili | shahar |
+------------------+-------------+--------------+-------------------+----------+
| Ergashev | TATU 1-ARM | Mudir | 2021 | Fergana |
| Turgunov | TATU 2-ARM |Kutubxonachi | 2019 | Fergana |
| Shokarimov | TATU 3-ARM |Kutubxonachi | 2011 | Fergana |
| Sobirov | TATU 4-ARM |oqituvchi | 2011 | Fergana |
| Komilov | TATU 2-ARM |oqituvchi | 2011 | Fergana |
| Ergashev | TATU 2-ARM |rektor | 2019 | Toshkent |
| Dilshodov | TATU 1-ARM |tuiter | 2019 | Toshkent |
+------------------+-------------+--------------+-------------------+----------+
7 rows in set (0.00 sec)