tags:

views:

20

answers:

1

Hi, I have a table in mysql called advertisements, in which there is an entity called position , now while creating the table i have defined the position entity as unique so that i don't get the duplicated entry into the table, now i want to remove that Unique attribute from the table entity Position in the table advertisement.

what is the mysql syntax for this?

CREATE TABLE `advertisements` (
`id` int(11) NOT NULL auto_increment,
`pos` smallint NOT NULL UNIQUE,
PRIMARY KEY (`id`)
);

Above is the Code, can someone please make a syntax for me drop that Unique Attribute attached to the pos entity.

+1  A: 

Your unique index have some name, use:

 ALTER TABLE `advertisements` DROP INDEX `index_name_on_position`  

Use:

 SHOW INDEXES IN advertisements

To obtain its name.

killer_PL
i am sorry to say but i am a newbie and i am not catching your point exactly, i am unsure of what you mean by index_name_on_postion , i have edited my post and put on the code there, can you create a mysql code for me to alter the table. thanks
Ibrahim Azhar Armar
I mean, that if you created index this way: CREATE UNIQUE INDEX mylovelyindex ON advertisements(position (10));A name for your 'index_name_on_position' will be 'mylovelyindex'
killer_PL