I wanted to drop indexes from 2 fields "title" and "cycle" from the table "Regions"
This is structure of my table and the fields within it
SHOW COLUMNS from Regions
+------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+-------+
| id | int(10) | NO | MUL | 0 | |
| first | int(10) | NO | MUL | 0 | |
| last | int(10) | NO | MUL | 0 | |
| title | varchar(200) | YES | MUL | NULL | |
| cycle | varchar(45) | NO | MUL | NULL | |
+------------+--------------+------+-----+---------+-------+
I wanted to drop indexing from fields "title" and "cycle"
I tried this :
DROP index cycle ON Regions
I also tried :
ALTER TABLE Regions drop index cycle
but it didnt work
Could anyone advise?
Thanks!
What are the names of the index? If they are the same as the field name this should work...
DROP INDEX `title` ON Regions;
Or this...
ALTER TABLE `Regions` DROP INDEX `title`;
Your syntax was actually right. DROP INDEX
will remove the index from your column.
However, you have to use the name of the index, not the name of the column. The name you used, cycle
, is actually the column name. To find out the name of the index, use the SHOW INDEX
command:
SHOW INDEX FROM Regions
After you figured out the index name, you can delete it:
DROP INDEX name_of_your_index FROM Regions
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.