Laboratoriya mashg’ulotlarida berilgan topshiriqlar Создание таблиц


Download 416.23 Kb.
bet20/21
Sana19.08.2023
Hajmi416.23 Kb.
#1668308
1   ...   13   14   15   16   17   18   19   20   21
Bog'liq
SQL command 29-11-2021 (5)

14 - LABORATORIYA ISHI
Mavzu: SQL tilida INDEX yaratish

Ishdan maqsad: MySQL maxsus ustun qiymatlariga ega qatorlarni tezda topish uchun indekslardan foydalanishni o`rganish.
Masalani qo`yilishi: Bu laboratoriya ishida MySQL indekslari, shu jumladan indekslarni yaratish, indekslarni o'chirish, jadvalning barcha indekslarini sanab o'tish va MySQLda boshqa muhim ko'rsatkichlar bilan ishlanadi.


CREATE INDEX Syntax
Creates an index on a table. Duplicate values are allowed:


CREATE INDEX index_name
ON table_name (column1, column2, ...);


CREATE UNIQUE INDEX Syntax
Creates a unique index on a table. Duplicate values are not allowed:


CREATE UNIQUE INDEX index_name
ON table_name (column1, column2, ...);
CREATE/DELETE/SHOW INDEX Example


The SQL statement below creates an index named "idx_lastname" on the "LastName" column in the "Persons" table:


CREATE INDEX idx_lastname
ON Persons (LastName);


If you want to create an index on a combination of columns, you can list the column names within the parentheses, separated by commas:


CREATE INDEX idx_pname
ON Persons (LastName, FirstName);


DROP INDEX Statement
The DROP INDEX statement is used to delete an index in a table.


MySQL
ALTER TABLE table_name
DROP INDEX index_name;
SHOW INDEX FROM customers;
15 - LABORATORIYA ISHI
Mavzu: Tasavvur (VIEW) yaratish va undan foydalanish


Ishdan maqsad: Berilgan predmet soha ma`lumotlar bazasidan foydalanib tasavvurlar yaratish.

Download 416.23 Kb.

Do'stlaringiz bilan baham:
1   ...   13   14   15   16   17   18   19   20   21




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