Standart so’zidan foydalanish



Download 1,19 Mb.
bet1/2
Sana14.01.2022
Hajmi1,19 Mb.
#361677
  1   2
Bog'liq
Ortiqov Jurabek amaliy


Mavzu: UNION standart so’zidan foydalanish.
mysql> show databases;

+--------------------+

| Database |

+--------------------+

| information_schema |

| mexmonxonalar |

| mysql |

| sayohat_agentligi |

| test |

+--------------------+

5 rows in set (0.06 sec)

mysql> use sayohat_agentligi;

Database changed

mysql> show tables;

+-----------------------------+

| Tables_in_sayohat_agentligi |

+-----------------------------+

| mexomonxonalar |

| sayohatchilar |

| sayohatchilar_2 |

+-----------------------------+

UNION,UNION ALL:

Bir nechta so'rovlarni bitta SQL-buyruqqa birlashtirish va
shunga mos ravishda so'rovlar natijalarini birlashtirish uchun UNION kalit so'zidan
foydalaniladi. UNION bilan qo'shilgan so'rovlar bir xil miqdordagi ustunlarni
chiqarishi kerak va ustunlar ma'lumotlari turlari mos bo'lishi kerak. Natijalarni
birlashtirishda takroriy satrlar avtomatik ravishda o'chiriladi. Takroriy satrlarning
o'chirilishining oldini olish uchun UNION so'zining o'rniga UNION ALL
ifodasidan foydalaniladi

mysql> select * from sayohatchilar;

+---------------+---------------+------------+----------------+----------------+----------------------+

| id_sayohatchi | Fam | Ism | telefon_raqami | Manzili | elektron_pochta |

+---------------+---------------+------------+----------------+----------------+----------------------+

| 1 | Shokirov | Asadbek | 2221010 | Bagdod tumani | shokirov@gmail.com |

| 2 | Muxamadaliyev | Abdurahmon | 3002021 | bagdad | abdurahmon@gmail.com |

| 3 | Musajonov | Jasur | 2584547 | Fargona shahri | jasur008@gmail.com |

| 4 | Musajonov | temur | 1452369 | Fargona shahri | temur005gmail.com |

| 5 | Musajonov | Umid | 0 | Fargona shahri | umid005gmail.com |

| 6 | Azimov | Abrorbek | 1564402 | Toshkent sh | abrorbek@gmail.com |

| 7 | Abdumutalibov | Zafarbek | 9945878 | Qoqon sh | zafarbek@gmail.com |

| 8 | Aktamov | Abbos | 2356484 | Bagdod t | aktamov@outloc.com |

+---------------+---------------+------------+----------------+----------------+----------------------+

8 rows in set (0.00 sec)

mysql> select * from sayohatchilar_2;

+---------------+---------------+------------+----------------+----------------+----------------------+

| id_sayohatchi | Fam | Ism | telefon_raqami | Manzili | elektron_pochta |

+---------------+---------------+------------+----------------+----------------+----------------------+

| 1 | Shokirov | Asadbek | 2221010 | Bagdod tumani | shokirov@gmail.com |

| 2 | Muxamadaliyev | Abdurahmon | 3002021 | bagdad | abdurahmon@gmail.com |

| 3 | Musajonov | Jasur | 2584547 | Fargona shahri | jasur008@gmail.com |

| 4 | Musajonov | temur | 1452369 | Fargona shahri | temur005gmail.com |

| 5 | Musajonov | Umid | 0 | Fargona shahri | umid005gmail.com |

| 6 | Azimov | Abrorbek | 1564402 | Toshkent sh | abrorbek@gmail.com |

| 7 | Abdumutalibov | Zafarbek | 9945878 | Qoqon sh | zafarbek@gmail.com |

| 8 | Aktamov | Abbos | 2356484 | Bagdod t | aktamov@outloc.com |

| 9 | Ahrorov | Jasur | 1234569 | Fargona tumani | jasurbek23@gmail.com |

+---------------+---------------+------------+----------------+----------------+----------------------+

mysql> select * from sayohatchilar union all select * from sayohatchilar_2;

+---------------+---------------+------------+----------------+----------------+----------------------+

| id_sayohatchi | Fam | Ism | telefon_raqami | Manzili | elektron_pochta |

+---------------+---------------+------------+----------------+----------------+----------------------+

| 1 | Shokirov | Asadbek | 2221010 | Bagdod tumani | shokirov@gmail.com |

| 2 | Muxamadaliyev | Abdurahmon | 3002021 | bagdad | abdurahmon@gmail.com |

| 3 | Musajonov | Jasur | 2584547 | Fargona shahri | jasur008@gmail.com |

| 4 | Musajonov | temur | 1452369 | Fargona shahri | temur005gmail.com |

| 5 | Musajonov | Umid | 0 | Fargona shahri | umid005gmail.com |

| 6 | Azimov | Abrorbek | 1564402 | Toshkent sh | abrorbek@gmail.com |

| 7 | Abdumutalibov | Zafarbek | 9945878 | Qoqon sh | zafarbek@gmail.com |

| 8 | Aktamov | Abbos | 2356484 | Bagdod t | aktamov@outloc.com |

| 1 | Shokirov | Asadbek | 2221010 | Bagdod tumani | shokirov@gmail.com |

| 2 | Muxamadaliyev | Abdurahmon | 3002021 | bagdad | abdurahmon@gmail.com |

| 3 | Musajonov | Jasur | 2584547 | Fargona shahri | jasur008@gmail.com |

| 4 | Musajonov | temur | 1452369 | Fargona shahri | temur005gmail.com |

| 5 | Musajonov | Umid | 0 | Fargona shahri | umid005gmail.com |

| 6 | Azimov | Abrorbek | 1564402 | Toshkent sh | abrorbek@gmail.com |

| 7 | Abdumutalibov | Zafarbek | 9945878 | Qoqon sh | zafarbek@gmail.com |

| 8 | Aktamov | Abbos | 2356484 | Bagdod t | aktamov@outloc.com |

| 9 | Ahrorov | Jasur | 1234569 | Fargona tumani | jasurbek23@gmail.com |

+---------------+---------------+------------+----------------+----------------+----------------------+

mysql> select * from sayohatchilar union select * from sayohatchilar_2;

+---------------+---------------+------------+----------------+----------------+----------------------+

| id_sayohatchi | Fam | Ism | telefon_raqami | Manzili | elektron_pochta |

+---------------+---------------+------------+----------------+----------------+----------------------+

| 1 | Shokirov | Asadbek | 2221010 | Bagdod tumani | shokirov@gmail.com |

| 2 | Muxamadaliyev | Abdurahmon | 3002021 | bagdad | abdurahmon@gmail.com |

| 3 | Musajonov | Jasur | 2584547 | Fargona shahri | jasur008@gmail.com |

| 4 | Musajonov | temur | 1452369 | Fargona shahri | temur005gmail.com |

| 5 | Musajonov | Umid | 0 | Fargona shahri | umid005gmail.com |

| 6 | Azimov | Abrorbek | 1564402 | Toshkent sh | abrorbek@gmail.com |

| 7 | Abdumutalibov | Zafarbek | 9945878 | Qoqon sh | zafarbek@gmail.com |

| 8 | Aktamov | Abbos | 2356484 | Bagdod t | aktamov@outloc.com |

| 9 | Ahrorov | Jasur | 1234569 | Fargona tumani | jasurbek23@gmail.com |

+---------------+---------------+------------+----------------+----------------+----------------------+






Download 1,19 Mb.

Do'stlaringiz bilan baham:
  1   2




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

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish