О‘zbеkistоn rеspublikаsi raqamli texnologiyalar vаzirligi muhаmmаd аl-xоrаzmiy nоmidаgi tоshkеnt аxbоrоt tеxnоlоgiyаlаri univеrsitеti



Yüklə 23,53 Kb.
səhifə2/4
tarix07.01.2024
ölçüsü23,53 Kb.
#205559
1   2   3   4
3-labaratoriya ishi

SQL da INDEXlar yaratish.

Ishdan maqsad: SQL da INDEXlar yaratish bo`yicha ko`nikmaga ega bo`lish.

Masalani qo`yilishi: Berilgan predmet soha ma`lumotlar bazasidagi barcha ob`yektlarni ustida INDEXlar yaratish asosida amallarini bajarish.
Uslubiy ko`rsatmalar: CREATE INDEX ko'rsatmasi jadvallarda indekslarni yaratish uchun ishlatiladi. Indekslar ma'lumotlar bazasidan ma'lumotlarni tezda olish uchun ishlatiladi. Foydalanuvchilar indekslarni ko'ra olmaydilar, ular oddiygina qidirish / so'rovlarni tezlashtirish uchun ishlatiladi.
mysql> create index sam_ind on parvozlar(samalyot);

Query OK, 5 rows affected (0.27 sec)


Records: 5 Duplicates: 0 Warnings: 0
mysql> create index parvoz on parvozlar(samalyot, chiqish);

Query OK, 5 rows affected (0.25 sec)


Records: 5 Duplicates: 0 Warnings: 0
mysql> create index mar_index on parvozlar(marshrut);

Query OK, 5 rows affected (0.19 sec)


Records: 5 Duplicates: 0 Warnings: 0
mysql> show index from parvozlar;

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


| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
+-----------+------------+-----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| parvozlar | 1 | sam_ind | 1 | samalyot | A | 2 | NULL | NULL | YES | BTREE | |
| parvozlar | 1 | parvoz | 1 | samalyot | A | 2 | NULL | NULL | YES | BTREE | |
| parvozlar | 1 | parvoz | 2 | chiqish | A | 2 | NULL | NULL | YES | BTREE | |
| parvozlar | 1 | mar_index | 1 | marshrut | A | 2 | NULL | NULL | YES | BTREE | |
+-----------+------------+-----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
4 rows in set (0.06 sec)
mysql> alter table parvozlar drop index sam_ind;

Query OK, 5 rows affected (0.27 sec)


Records: 5 Duplicates: 0 Warnings: 0
mysql> show index from parvozlar;

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


| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
+-----------+------------+-----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| parvozlar | 1 | parvoz | 1 | samalyot | A | 2 | NULL | NULL | YES | BTREE | |
| parvozlar | 1 | parvoz | 2 | chiqish | A | 2 | NULL | NULL | YES | BTREE | |
| parvozlar | 1 | mar_index | 1 | marshrut | A | 2 | NULL | NULL | YES | BTREE | |
+-----------+------------+-----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
3 rows in set (0.00 sec)
mysql>



Yüklə 23,53 Kb.

Dostları ilə paylaş:
1   2   3   4




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin