Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.51-community MySQL Community Server (GPL)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use supermarket;
Database changed
mysql> show tables;
+-----------------------+
| Tables_in_supermarket |
+-----------------------+
| bolim_jadvali |
| lavozim_jad |
| tavarlar_jad |
| tavarlar_savdosi |
| xodimlar_jad |
+-----------------------+
5 rows in set (0.00 sec)
mysql> select* from tavarlar_jad
-> ;
+-----------+------------+-----------------+-----------------------------+------------------+-----------------+
| tartib_id | tavar_nomi | bolim | ishlab_chiqarilgan_mamlakat | saqlash_sharoiti | saqlash_muddati |
+-----------+------------+-----------------+-----------------------------+------------------+-----------------+
| 1 | Olma | Mevalar | O`zbekiston | 0 dan 15 c gacha | 2021-12-18 |
| 2 | Apelsin | Mevalar | Rossiya | 0 dan 15 c gacha | 2021-12-18 |
| 3 | olma | Mevalar | Rossiya | 0 dan 15 c gacha | 2021-12-18 |
| 4 | Sut | Sut Mahsulotlar | O`zbekiston | 0 dan 15 c gacha | 2021-09-18 |
| 5 | Qaymoq | Sut Mahsulotlar | O`zbekiston | 0 dan 15 c gacha | 2021-09-18 |
+-----------+------------+-----------------+-----------------------------+------------------+-----------------+
5 rows in set (0.00 sec)
mysql> select * from bolim_jadvali;
+-----------+---------------------+---------------+------------------+------------+
| tartib_id | bolim_nomi | rastalar_soni | sotuvchilar_soni | zal_raqami |
+-----------+---------------------+---------------+------------------+------------+
| 1 | G`osht Maxsulotlari | 2 | 2 | 12 |
| 2 | Sut Mahsulotlari | 1 | 2 | 7 |
| 3 | Non Mahsulotlari | 1 | 2 | 4 |
| 4 | Mevalar | 2 | 2 | 2 |
| 5 | Sabzavodlar | 2 | 3 | 5 |
| 6 | shokolatlar | 3 | 4 | 9 |
| 7 | Ichumliklar | 1 | 5 | 8 |
+-----------+---------------------+---------------+------------------+------------+
7 rows in set (0.02 sec)
mysql> select tavarlar_jad.tavar_nomi , tavarlar_jad.tartib_id , bolim_jadvali.zal_raqami
-> from tavarlar_jad
-> inner join bolim_jadvali on tavarlar_jad.bolim = bolim_jadvali.bolim_nomi;
+------------+-----------+------------+
| tavar_nomi | tartib_id | zal_raqami |
+------------+-----------+------------+
| Olma | 1 | 2 |
| Apelsin | 2 | 2 |
| olma | 3 | 2 |
+------------+-----------+------------+
3 rows in set (0.11 sec)
mysql> select tavarlar_jad.tavar_nomi , bolim_jadvali.zal_raqami
-> from tavarlar_jad
-> inner join bolim_jadvali on tavarlar_jad.bolim = bolim_jadvali.bolim_nomi;
+------------+------------+
| tavar_nomi | zal_raqami |
+------------+------------+
| Olma | 2 |
| Apelsin | 2 |
| olma | 2 |
+------------+------------+
3 rows in set (0.00 sec)
mysql> update bolim_jadvali
-> set bolim = "Sut Mahsulotlari"
-> where tartib_id = 4 and tartib_id = 5;
ERROR 1054 (42S22): Unknown column 'bolim' in 'field list'
mysql> update tavarlar_jad
-> set bolim = "Sut Mahsulotlari"
-> where tartib_id = 4 and tartib_id = 5;
Query OK, 0 rows affected (0.11 sec)
mysql> select tavarlar_jad.tavar_nomi , bolim_jadvali.zal_raqami
-> from tavarlar_jad
-> inner join bolim_jadvali on tavarlar_jad.bolim = bolim_jadvali.bolim_nomi;
+------------+------------+
| tavar_nomi | zal_raqami |
+------------+------------+
| Olma | 2 |
| Apelsin | 2 |
| olma | 2 |
+------------+------------+
3 rows in set (0.00 sec)
mysql> select * tavarlar_jad;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'tavarlar_jad' at line 1
mysql> select *from tavarlar_jad;
+-----------+------------+-----------------+-----------------------------+------------------+-----------------+
| tartib_id | tavar_nomi | bolim | ishlab_chiqarilgan_mamlakat | saqlash_sharoiti | saqlash_muddati |
+-----------+------------+-----------------+-----------------------------+------------------+-----------------+
| 1 | Olma | Mevalar | O`zbekiston | 0 dan 15 c gacha | 2021-12-18 |
| 2 | Apelsin | Mevalar | Rossiya | 0 dan 15 c gacha | 2021-12-18 |
| 3 | olma | Mevalar | Rossiya | 0 dan 15 c gacha | 2021-12-18 |
| 4 | Sut | Sut Mahsulotlar | O`zbekiston | 0 dan 15 c gacha | 2021-09-18 |
| 5 | Qaymoq | Sut Mahsulotlar | O`zbekiston | 0 dan 15 c gacha | 2021-09-18 |
+-----------+------------+-----------------+-----------------------------+------------------+-----------------+
5 rows in set (0.00 sec)
mysql> update tavarlar_jad
-> set bolim = "Sut Mahsulotlari"
-> where tartib_id = 4;
Query OK, 1 row affected (0.14 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> update tavarlar_jad
-> set bolim = "Sut Mahsulotlari"
-> where tartib_id = 5;
Query OK, 1 row affected (0.14 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select tavarlar_jad.tavar_nomi , bolim_jadvali.zal_raqami
-> from tavarlar_jad
-> inner join bolim_jadvali on tavarlar_jad.bolim = bolim_jadvali.bolim_nomi;
+------------+------------+
| tavar_nomi | zal_raqami |
+------------+------------+
| Sut | 7 |
| Qaymoq | 7 |
| Olma | 2 |
| Apelsin | 2 |
| olma | 2 |
+------------+------------+
5 rows in set (0.00 sec)
mysql> select tavarlar_jad.tavar_nomi , bolim_jadvali.zal_raqami
-> from tavarlar_ja;
ERROR 1146 (42S02): Table 'supermarket.tavarlar_ja' doesn't exist
mysql> select tavarlar_jad.tavar_nomi , bolim_jadvali.zal_raqami
-> from tavarlar_jad
-> right join bolim_jadvali on tavarlar_jad.tartib_id = bolim_jadvali.tartib_id;
+------------+------------+
| tavar_nomi | zal_raqami |
+------------+------------+
| Olma | 12 |
| Apelsin | 7 |
| olma | 4 |
| Sut | 2 |
| Qaymoq | 5 |
| NULL | 9 |
| NULL | 8 |
+------------+------------+
7 rows in set (0.03 sec)
mysql> select tavarlar_jad.tavar_nomi , bolim_jadvali.zal_raqami , bolim_jadvali.bolim_nomi
-> from tavarlar_jad
-> right join bolim_jadvali on tavarlar_jad.tartib_id = bolim_jadvali.tartib_id;
+------------+------------+---------------------+
| tavar_nomi | zal_raqami | bolim_nomi |
+------------+------------+---------------------+
| Olma | 12 | G`osht Maxsulotlari |
| Apelsin | 7 | Sut Mahsulotlari |
| olma | 4 | Non Mahsulotlari |
| Sut | 2 | Mevalar |
| Qaymoq | 5 | Sabzavodlar |
| NULL | 9 | shokolatlar |
| NULL | 8 | Ichumliklar |
+------------+------------+---------------------+
7 rows in set (0.00 sec)
mysql> select bolim_jadvali.bolim_nomi, tavarlar_jad.tavar_nomi , bolim_jadvali.zal_raqami
-> from tavarlar_jad
-> right join bolim_jadvali on tavarlar_jad.tartib_id = bolim_jadvali.tartib_id;
+---------------------+------------+------------+
| bolim_nomi | tavar_nomi | zal_raqami |
+---------------------+------------+------------+
| G`osht Maxsulotlari | Olma | 12 |
| Sut Mahsulotlari | Apelsin | 7 |
| Non Mahsulotlari | olma | 4 |
| Mevalar | Sut | 2 |
| Sabzavodlar | Qaymoq | 5 |
| shokolatlar | NULL | 9 |
| Ichumliklar | NULL | 8 |
+---------------------+------------+------------+
7 rows in set (0.00 sec)
mysql> select tavarlar_jad.tavar_nomi , bolim_jadvali.zal_raqami , bolim_jadvali.bolim_nomi
-> from tavarlar_jad
-> left join bolim_jadvali on tavarlar_jad.tartib_id = bolim_jadvali.tartib_id;
+------------+------------+---------------------+
| tavar_nomi | zal_raqami | bolim_nomi |
+------------+------------+---------------------+
| Apelsin | 7 | Sut Mahsulotlari |
| Olma | 12 | G`osht Maxsulotlari |
| olma | 4 | Non Mahsulotlari |
| Qaymoq | 5 | Sabzavodlar |
| Sut | 2 | Mevalar |
+------------+------------+---------------------+
5 rows in set (0.00 sec)
mysql>
Do'stlaringiz bilan baham: |