|
Select bolim id, ism from hodimlar where bolim id=
|
Sana | 11.01.2022 | Hajmi | 3,22 Kb. | | #341637 |
| Bog'liq 17-18-19-20
17-18-loborotoriiya
mysql> select bolim_id, ism from hodimlar where bolim_id=(select id from bolimlar where bolim_nomi='savdo');
+----------+------+
| bolim_id | ism |
+----------+------+
| 2 | Aziz |
+----------+------+
1 row in set (0.00 sec)
19-loborotoriya
mysql> use loyixa;
Database changed
mysql> show tables;
+------------------+
| Tables_in_loyixa |
+------------------+
| bolimlar |
| hodimlar |
| loyixa_ishlari |
| savdolar |
| shartnomalar |
| shertnomalar_2 |
| tashkilotlar |
+------------------+
7 rows in set (0.41 sec)
mysql> select*from hodimlar;
+----------+--------+---------------+-----------+----------+-------+----------+---------------+
| Fam | Ism | Ota_ism | lavozim | bolim_id | jinsi | manzil | tugulgan_sana |
+----------+--------+---------------+-----------+----------+-------+----------+---------------+
| axrorov | jasur | qahhorovich | ishchi | 1 | erkak | Andijon | 2017-03-20 |
| mansurov | Aziz | Anvarovich | savdogar | 2 | erkak | Andijon | 2027-03-20 |
| Toxirov | oydin | Boburjon qizi | dasturchi | 3 | ayol | fargona | 1994-06-20 |
| azizov | Qahhor | Valiyevich | dastavka | 4 | erkak | namangan | 1996-06-14 |
+----------+--------+---------------+-----------+----------+-------+----------+---------------+
4 rows in set (0.13 sec)
mysql> creat index shaxslar on hodimlar(Fam, ism);
Query OK, 4 rows affected (0.67 sec)
Records: 4 Duplicates: 0 Warnings: 0
mysql> show index from hodimlar;
+----------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
+----------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| hodimlar | 1 | bolim_id | 1 | bolim_id | A | 2 | NULL | NULL | | BTREE | |
| hodimlar | 1 | shaxslar | 1 | Fam | A | 2 | NULL | NULL | YES | BTREE | |
| hodimlar | 1 | shaxslar | 2 | Ism | A | 2 | NULL | NULL | YES | BTREE | |
+----------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
3 rows in set (0.03 sec)
mysql> alter table hodimlar drop index shaxslar;
Query OK, 4 rows affected (0.28 sec)
Records: 4 Duplicates: 0 Warnings: 0
mysql> show index from hodimlar;
+----------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
+----------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| hodimlar | 1 | bolim_id | 1 | bolim_id | A | 2 | NULL | NULL | | BTREE | |
+----------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
1 row in set (0.00 sec)
mysql>
Do'stlaringiz bilan baham: |
|
|