473,657 Members | 2,993 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 5629
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
1731
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
10867
by: Kamil | last post by:
Hello What should I use for better perfomance since unique constraint always use index ? Thanks Kamil
8
8979
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, although it varies over time. The daemon that gets the error exits and restarts a few seconds later. Usually it's fine then, but sometimes the error happens three or more times in a row. Occasionally, instead, we get "ERROR: Cannot insert a...
10
26095
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 null references another, FK_LASTLYOID bigint not null references lastly, unique (FK_OTHEROID,FK_ANOTHEROID))
5
16716
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 unique index like:
4
14418
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 query). I want to make the AutoNumber field the Primary Key: DoCmd.OpenQuery "qryXL_To" ' this is the make table query DoCmd.RunSQL "CREATE UNIQUE INDEX idxTxAcct ON tblXL_To (TxAcct_ID)" This seems to work okay, but it does not create a...
10
14671
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
2884
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 6692 001 6692 002 6692 003 6721 001 6721 002
6
4315
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 Alvin Leader
0
8384
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8718
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8601
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6162
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5630
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1937
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1601
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.