Natijalar - 1-amaliy mashg’ulot Mavzu: Lombard Ma’lumotlar bazasini loyihash. Maqsad

Natijalar
Bu lombard ma’lumotlar bazasining jadvallari
Xulosa
Men Aminjonov Muzaffar ushbu amaliy topshiriqni bajarish mobaynida juda ko’p
ma’lumotlarga ega bo’ldim. Men oldin MongoDB ma’lumotlar bazasidan foydalangan
edim. MongoDB norelatsion ma’lumotlar bazasi hisoblanadi. Ushubu amaliy
topshiriqni bajarisj mobaynida men MySql ma’lumotlar bazasini qanday ishlashini
o’rgandim. MySql relatsion ma’lumotlar bazasi hisoblanadi. Men bugun Lombard
uchun ma’lumotlar bazasini yaratdim unda 3 ta jadval mavjud bo’lib, ular: Mijozlar,
Mahsulot toifalari va Lombardga yetkazib berish jadvallaridir. Mijozlar jadvalimda id
sib or va u primaey key va unga auto_increment berganman va ma’lumot
qo’shayotganimda id si bir biriga teng bo’lmaydi, ma’lumotlar bazasi avtomatik o’sish
tartibida raqam berib ketadi. Ushbu ma’lumotlar bazasini bir-biri bilan bog’lab
bo’lgach unda ma’lumotlar qo’shdim va natijalarni rasm holatda tag qismida izohlar
yozdim. Dasturda yozgan hamma kodlarni natijadan oldin yozib qo’ydim.
3-amaliy mashg’ulot Mavzu: Ma’lumotlar bazasi uchun interfeys yaratish.
Maqsad: Dasturlash tillari va ma’lumotlar bazasi yordamida oddiy interfeys yaratish.
mysql> SELECT *
-> FROM yetkazib_berish
-> INNER JOIN mijozlar ON yetkazib_berish.id = mijozlar.id;
+----+---------------------+------------------------+------------------+-------+-----------+-------
----------------+----+-----------+---------+----------------+----------------+------------------+--
---------------------+
| id | mahsulot_tavsifi | yetkazib_berish_sanasi | qaytarish_sanasi | summa |
komissiya | mahsulot_toifalari_id | id | familyasi | ismi | otasining_ismi |
pasport_raqami | pasport_seriyasi | pasport_berilgan_sana |
+----+---------------------+------------------------+------------------+-------+-----------+-------
----------------+----+-----------+---------+----------------+----------------+------------------+--
---------------------+
| 2 | Product description | 2023-11-09 | 2023-11-15 | 500 | 5% |
1 | 2 | Smith | Jessica | Emily | 987654321 | XY9876 | 2023-11-15
|
+----+---------------------+------------------------+------------------+-------+-----------+-------
----------------+----+-----------+---------+----------------+----------------+------------------+--
---------------------+
1 row in set (0.00 sec)
mysql> SELECT *
-> FROM yetkazib_berish
-> LEFT JOIN mijozlar ON yetkazib_berish.id = mijozlar.id;
+----+---------------------+------------------------+------------------+-------+-----------+-------
----------------+------+-----------+---------+----------------+----------------+------------------
+-----------------------+
| id | mahsulot_tavsifi | yetkazib_berish_sanasi | qaytarish_sanasi | summa |
komissiya | mahsulot_toifalari_id | id | familyasi | ismi | otasining_ismi |
pasport_raqami | pasport_seriyasi | pasport_berilgan_sana |
+----+---------------------+------------------------+------------------+-------+-----------+-------
----------------+------+-----------+---------+----------------+----------------+------------------
+-----------------------+
| 2 | Product description | 2023-11-09 | 2023-11-15 | 500 | 5% |
1 | 2 | Smith | Jessica | Emily | 987654321 | XY9876 | 2023-11-15
|
+----+---------------------+------------------------+------------------+-------+-----------+-------
----------------+------+-----------+---------+----------------+----------------+------------------
+-----------------------+
1 row in set (0.00 sec)
mysql> SELECT *
-> FROM yetkazib_berish
-> RIGHT JOIN mijozlar ON yetkazib_berish.id = mijozlar.id;
+------+---------------------+------------------------+------------------+-------+-----------+-----
------------------+----+-----------+---------+----------------+----------------+------------------
+-----------------------+
| id | mahsulot_tavsifi | yetkazib_berish_sanasi | qaytarish_sanasi | summa |
komissiya | mahsulot_toifalari_id | id | familyasi | ismi | otasining_ismi |
pasport_raqami | pasport_seriyasi | pasport_berilgan_sana |
+------+---------------------+------------------------+------------------+-------+-----------+-----
------------------+----+-----------+---------+----------------+----------------+------------------
+-----------------------+
| NULL | NULL | NULL | NULL | NULL | NULL |
NULL | 1 | Smith | John | Michael | 123456789 | AB1234 | 2023-
11-09 |
| 2 | Product description | 2023-11-09 | 2023-11-15 | 500 | 5% |
1 | 2 | Smith | Jessica | Emily | 987654321 | XY9876 | 2023-11-15
|
+------+---------------------+------------------------+------------------+-------+-----------+-----
------------------+----+-----------+---------+----------------+----------------+------------------
+-----------------------+
2 rows in set (0.00 sec)
mysql> SELECT *
-> FROM yetkazib_berish
-> FULL JOIN mijozlar ON yetkazib_berish.id = mijozlar.id;
ERROR 1054 (42S22): Unknown column 'yetkazib_berish.id' in 'on clause'
mysql> SELECT * FROM mijozlar ORDER BY familyasi ASC, ismi ASC;
+----+-----------+---------+----------------+----------------+------------------+------------------
-----+
| id | familyasi | ismi | otasining_ismi | pasport_raqami | pasport_seriyasi |
pasport_berilgan_sana |
+----+-----------+---------+----------------+----------------+------------------+------------------
-----+
| 2 | Smith | Jessica | Emily | 987654321 | XY9876 | 2023-11-15
|
| 1 | Smith | John | Michael | 123456789 | AB1234 | 2023-11-09
|
+----+-----------+---------+----------------+----------------+------------------+------------------
-----+
2 rows in set (0.00 sec)
mysql> SELECT MIN(pasport_raqami) AS eng_kichik_raqam FROM mijozlar;
+------------------+
| eng_kichik_raqam |
+------------------+
| 123456789 |
+------------------+
1 row in set (0.00 sec)
mysql> SELECT MAX(pasport_raqami) AS eng_katta_raqam FROM mijozlar;
+-----------------+
| eng_katta_raqam |
+-----------------+
| 987654321 |
+-----------------+
1 row in set (0.00 sec)
mysql> SELECT COUNT(*) AS jami_mijozlar FROM mijozlar;
+---------------+
| jami_mijozlar |
+---------------+
| 2 |
+---------------+
1 row in set (0.00 sec)
Xulosa
Men Aminjonov Muzaffar 711-21-guruh talabasi ushbu topshiriqni bajardim va uning
uchun join dan foydalanib, mijozlarga biriktirilgan mahsulot va mahsulot toifalarini
birlashtirdim.
|