473,503 Members | 1,805 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to drop unique key or index from a table ?

147 New Member
Hi,

By mistakenly,i added three UNIQUE index on a single column.Out of three,i removed one UNIQUE index from a table.Now,i want to remove remaining unique index from a table.

Expand|Select|Wrap|Line Numbers
  1.      mysql> show index from uniqueindex;
  2. +-------------+------------+----------+--------------+-------------+-----------+
  3. -------------+----------+--------+------+------------+---------+
  4. | Table       | Non_unique | Key_name | Seq_in_index | Column_name | Collation |
  5.  Cardinality | Sub_part | Packed | Null | Index_type | Comment |
  6. +-------------+------------+----------+--------------+-------------+-----------+
  7. -------------+----------+--------+------+------------+---------+
  8. | uniqueindex |          0 | id_2     |            1 | id          | A         |
  9.            3 |     NULL | NULL   |      | BTREE      |         |
  10. | uniqueindex |          0 | id_3     |            1 | id          | A         |
  11.            3 |     NULL | NULL   |      | BTREE      |         |
  12. +-------------+------------+----------+--------------+-------------+-----------+
  13. -------------+----------+--------+------+------------+---------+
  14. 2 rows in set (0.00 sec)


Now, I want to remove this unique key as shown above...

Next,i am running this query.....why it shows me as a PRIMARY KEY in the key field ?


Expand|Select|Wrap|Line Numbers
  1. mysql> desc uniqueindex;
  2. +---------------+-------------+------+-----+---------+-------+
  3. | Field         | Type        | Null | Key | Default | Extra |
  4. +---------------+-------------+------+-----+---------+-------+
  5. | id            | int(11)     | NO   | PRI | 0       |       |
  6. | name          | varchar(50) | YES  |     |         |       |
  7. | place         | varchar(50) | YES  |     | NULL    |       |
  8. | qualification | varchar(50) | YES  |     | NULL    |       |
  9. +---------------+-------------+------+-----+---------+-------+
  10. 4 rows in set (0.01 sec)



Thanks in advance
May 21 '10 #1
1 5621
Banfa
9,065 Recognized Expert Moderator Expert
Can't you use

DROP INDEX index_name ON tbl_name

?

The key field is showing keys you have set up on the table, so id is the primary key of the table uniqueindex.
May 27 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1723
by: Joy | last post by:
MySQL automatically creates an index for the primary key. Now, I want to drop it before I start inserting a million rows of data. Can I drop it at all? Thanks.
5
10846
by: Kamil | last post by:
Hello What should I use for better perfomance since unique constraint always use index ? Thanks Kamil
8
8939
by: Kragen Sitaker | last post by:
ERROR: Cannot insert a duplicate key into unique index pg_class_relname_nsp_index We've been getting this error in our application every once in a while --- typically once an hour to once a day,...
10
26039
by: BuddhaBuddy | last post by:
Platform is DB2/NT 7.2.9 The table was created like this: CREATE TABLE MYTEST ( MYTESTOID bigint not null primary key, FK_OTHEROID bigint not null references other, FK_ANOTHEROID bigint not...
5
16686
by: aj | last post by:
DB2 WSE 8.1 FP5 Red Hat AS 2.1 What is the difference between adding a unique constraint like: ALTER TABLE <SCHEMA>.<TABLE> ADD CONSTRAINT CC1131378283225 UNIQUE ( <COL1>) ; and adding a...
4
14412
by: deko | last post by:
I have a Make Table query that creates a fairly large table. The Make Table query populates the new table with one AutoNumber field (which is taken form another unrelated table as part of the...
10
14652
by: Laurence | last post by:
Hi there, How to differentiate between unique constraint and unique index? These are very similar but I cannot differentiate them? Could someone give me a hand? Thanks in advance
8
2869
by: paii, Ron | last post by:
I have a table listing drawing numbers for jobs. It's primary key combines Job and numeric part of the drawing number. The structure allows the number part to repeat for each job. Job Dwg...
6
4296
by: Alvin SIU | last post by:
Hi all, I have a table in Db2 v8 like this: Team Name Role ------ -------- --------------------- A Superman Leader A Batman Member A WonderWoman Member B ...
0
7199
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7074
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7273
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6982
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5000
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4667
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3161
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3150
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
374
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.