O‘zbekiston respublikasi ax


Download 75.27 Kb.
Sana25.12.2022
Hajmi75.27 Kb.
#1065339
Bog'liq
Sherbek Nematov 2


O‘ZBEKISTON RESPUBLIKASI AXBOROT TEXNOLOGIYALARI VA KOMMUNIKATSIYALARINI RIVOJLANTIRISH VAZIRLIGI

MUHAMMAD AL-XORAZMIY NOMIDAGI
TOSHKЕNT AXBOROT TЕXNOLOGIYALARI UNIVЕRSITI

Axborot xavfsizlik fakulteti


MA’LUMOTLAR BAZASI
Variant 10.
SELECT'> Bajardi:071- 20 guruh talabasi
Sherbek Ne’matov

Toshkent-2022


SELECT id_st, mark
FROM mark_st
WHERE mark IN (2,3)
BETWEEN amali maydon qiymatini berilgan intervalga kirganligini tekshirish uchun ishlatiladi. Yuqoridagi natijani BETWEEN operatoridan foydalanib olish mumkin:
SELECT id_st, mark
FROM mark_st
WHERE mark BETWEEN 2 AND 3
Birorta xam 2, 3 olmagan talaba haqidagi ma’lumotlar olish uchun NOT IN yoki NOT BETWEEN ishlatiladi.
Misol: Familiyalari A xarfi bilan boshlanuvchi talabalar ro‘yxatini tanlab olish.
Bunday xolatda LIKE operatoridan foydalanish qulay hisoblanadi. LIKE operatori faqat simvolli maydonlar uchun qo‘llaniladi va maydon qiymati operatorda ko‘rsatilgan namunaga mosligini tekshirish imkonini yaratadi. Namuna quyidagi maxsus simvollardan tashkil topadi:

  • _ (tagiga chizish belgisi) – bitta ixtiyoriy simvolni bildiradi;

  • % (foiz belgisi) – ixtiyoriy miqdordagi simvollar ketma – ketligini bildiradi.

SELECT id_st, surname
FROM student
WHERE surname LIKE 'A%'

Dastur kodi:
mysql> select * from shaxar_nomlari;
+----+-----------+---------------+-------------+
| id | tumani | tumanlar_soni | shaxar_nomi |
+----+-----------+---------------+-------------+
| 1 | Yunsobod | 8 | Toshkent |
| 2 | Samarqand | 12 | NULL |
+----+-----------+---------------+-------------+
2 rows in set (0.07 sec)

mysql> use shaxar_malumoti;


Database changed
mysql> show tables;
Empty set (0.00 sec)

mysql> use shaxarlar_nomi;


Database changed
mysql> show tables;
+--------------------------+
| Tables_in_shaxarlar_nomi |
+--------------------------+
| shaxar_nomlari |
+--------------------------+
1 row in set (0.04 sec)

mysql> select * from shaxar_nomlari;


+----+-----------+---------------+-----------------+-----------------+
| id | nomi | tumanlar_soni | markaziy_tumani | mahallalar_soni |
+----+-----------+---------------+-----------------+-----------------+
| 1 | Toshkent | 13 | Yunsobos | 30 |
| 2 | Samarqand | 12 | Qo'shrabot | NULL |
+----+-----------+---------------+-----------------+-----------------+
2 rows in set (0.02 sec)

Oxirgi natijamiz:
mysql> select * from shaxar_nomlari;
+----+-----------+---------------+-----------------+-----------------+-------------+
| id | nomi | tumanlar_soni | markaziy_tumani | mahallalar_soni | davlat_nomi |
+----+-----------+---------------+-----------------+-----------------+-------------+
| 1 | Toshkent | 13 | Yunsobos | 30 | O'zbekiston |
| 4 | Samarqand | 12 | Qo'shrabot | 35 | O'zbekiston |
| 3 | Jizzax | 8 | g'alla_orol | 24 | O'zbekiston |
+----+-----------+---------------+-----------------+-----------------+-------------+
3 rows in set (0.00 sec)



Download 75.27 Kb.

Do'stlaringiz bilan baham:




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