Dropping Unique constraint from MySQL table





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







169















How can I drop the "Unique Key Constraint" on a column of a MySQL table using phpMyAdmin?










share|improve this question

























  • Look at forums.mysql.com/read.php?98,70887,70974#msg-70974

    – James Black
    Aug 15 '10 at 14:13


















169















How can I drop the "Unique Key Constraint" on a column of a MySQL table using phpMyAdmin?










share|improve this question

























  • Look at forums.mysql.com/read.php?98,70887,70974#msg-70974

    – James Black
    Aug 15 '10 at 14:13














169












169








169


43






How can I drop the "Unique Key Constraint" on a column of a MySQL table using phpMyAdmin?










share|improve this question
















How can I drop the "Unique Key Constraint" on a column of a MySQL table using phpMyAdmin?







mysql






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 18 '13 at 20:17









Peter O.

21k96069




21k96069










asked Aug 15 '10 at 14:07









Ankur MukherjeeAnkur Mukherjee

1,62442234




1,62442234













  • Look at forums.mysql.com/read.php?98,70887,70974#msg-70974

    – James Black
    Aug 15 '10 at 14:13



















  • Look at forums.mysql.com/read.php?98,70887,70974#msg-70974

    – James Black
    Aug 15 '10 at 14:13

















Look at forums.mysql.com/read.php?98,70887,70974#msg-70974

– James Black
Aug 15 '10 at 14:13





Look at forums.mysql.com/read.php?98,70887,70974#msg-70974

– James Black
Aug 15 '10 at 14:13












9 Answers
9






active

oldest

votes


















286














A unique constraint is also an index.



First use SHOW INDEX FROM tbl_name to find out the name of the index. The name of the index is stored in the column called key_name in the results of that query.



Then you can use DROP INDEX:



DROP INDEX index_name ON tbl_name


or the ALTER TABLE syntax:



ALTER TABLE tbl_name DROP INDEX index_name





share|improve this answer





















  • 1





    Sorry sir i had tried it before raising the question ,but its not working

    – Ankur Mukherjee
    Aug 15 '10 at 14:26











  • @Ankur Mukherjee: I forgot to mention: You have to change tbl_name and index_name to the name of your actual table and the name of the actual index, respectively. You can see the names in MySQL Query Browser. You can also do SHOW CREATE TABLE tbl_name.

    – Mark Byers
    Aug 15 '10 at 14:33








  • 1





    Sir I know that very well and i had tried that only

    – Ankur Mukherjee
    Aug 15 '10 at 14:34






  • 1





    @Ankur Mukherjee: The way I have suggested is in my opinion the best way to do it.

    – Mark Byers
    Aug 15 '10 at 15:33






  • 1





    I read somewhere in the question using phpMyAdmin... The answer provided by @systemovich should be marked as the accepted one.

    – Pere
    Sep 16 '14 at 14:16





















109














You can DROP a unique constraint from a table using phpMyAdmin as requested as shown in the table below. A unique constraint has been placed on the Wingspan field. The name of the constraint is the same as the field name, in this instance.



alt text






share|improve this answer



















  • 34





    It is important to note that the indexes section is collapsed by default, and is expanded by a small, subtle link in 12px font where the section is in the screenshot. But thanks to you, I found it. Bless your face. +1

    – Jack
    May 25 '13 at 17:39











  • I just removed 25 indexes...

    – CousinCocaine
    Sep 29 '15 at 19:46



















11














The indexes capable of placing a unique key constraint on a table are PRIMARY and UNIQUE indexes.



To remove the unique key constraint on a column but keep the index, you could remove and recreate the index with type INDEX.



Note that it is a good idea for all tables to have an index marked PRIMARY.






share|improve this answer



















  • 1





    Upvoted because @thomasrutter has touched on the fact that removing a unique constraint may adversely affect query performance - and this can be mitigated by replacing the UNIQUE index with a regular INDEX.

    – Alex
    Apr 18 '14 at 16:17





















1














For WAMP 3.0 :
Click Structure
Below Add 1 Column you will see '- Indexes'
Click -Indexes and drop whichever index you want.






share|improve this answer































    1














    If you want to remove unique constraints from mysql database table, use alter table with drop index.



    Example:



    create table unique_constraints(unid int,activity_name varchar(100),CONSTRAINT activty_uqniue UNIQUE(activity_name),primary key (unid));



    alter table unique_constraints drop index activty_uqniue;


    Where activty_uqniue is UNIQUE constraint for activity_name column.






    share|improve this answer































      1














      To add UNIQUE constraint using phpmyadmin, go to the structure of that table and find below and click that,



      enter image description here



      To remove the UNIQUE constraint, same way, go to the structure and scroll down till Indexes Tab and find below and click drop,
      enter image description here



      Hope this works.



      Enjoy ;)






      share|improve this answer
























      • this solution was exactly what i was looking for.

        – Aryeh Beitz
        Dec 30 '18 at 12:29



















      0














      while dropping unique key we use index



      ALTER TABLE tbl
      DROP INDEX unique_address;





      share|improve this answer































        -2














        1.First delete table



        2.go to sql



        CREATE  TABLE service( --tablename 
        `serviceid` int(11) NOT NULL,--coloums
        `customerid` varchar(20) DEFAULT NULL,--coloums
        `dos` varchar(30) NOT NULL,--coloums
        `productname` varchar(150) NOT NULL,--coloums
        `modelnumber` bigint(12) NOT NULL,--coloums
        `serialnumber` bigint(20) NOT NULL,--coloums
        `serviceby` varchar(20) DEFAULT NULL--coloums
        )
        --INSERT VALUES
        INSERT INTO `service` (`serviceid`, `customerid`, `dos`, `productname`, `modelnumber`, `serialnumber`, `serviceby`) VALUES
        (1, '1', '12/10/2018', 'mouse', 1234555, 234234324, '9999'),
        (2, '09', '12/10/2018', 'vhbgj', 79746385, 18923984, '9999'),
        (3, '23', '12/10/2018', 'mouse', 123455534, 11111123, '9999'),
        (4, '23', '12/10/2018', 'mouse', 12345, 84848, '9999'),
        (5, '546456', '12/10/2018', 'ughg', 772882, 457283, '9999'),
        (6, '23', '12/10/2018', 'keyboard', 7878787878, 22222, '1'),
        (7, '23', '12/10/2018', 'java', 11, 98908, '9999'),
        (8, '128', '12/10/2018', 'mouse', 9912280626, 111111, '9999'),
        (9, '23', '15/10/2018', 'hg', 29829354, 4564564646, '9999'),
        (10, '12', '15/10/2018', '2', 5256, 888888, '9999');
        --before droping table
        ALTER TABLE `service`
        ADD PRIMARY KEY (`serviceid`),
        ADD unique`modelnumber` (`modelnumber`),
        ADD unique`serialnumber` (`serialnumber`),
        ADD unique`modelnumber_2` (`modelnumber`);
        --after droping table
        ALTER TABLE `service`
        ADD PRIMARY KEY (`serviceid`),
        ADD modelnumber` (`modelnumber`),
        ADD serialnumber` (`serialnumber`),
        ADD modelnumber_2` (`modelnumber`);





        share|improve this answer

































          -2














          my table name is buyers which has a unique constraint column emp_id now iam going to drop the emp_id



          step 1: exec sp_helpindex buyers, see the image file



          step 2: copy the index address



          enter image description here



          step3: alter table buyers drop constraint [UQ__buyers__1299A860D9793F2E]
          alter table buyers
          drop column emp_id



          note:




          Blockquote




          instead of buyers change it to your table name :)




          Blockquote




          thats all column name emp_id with constraints is dropped!






          share|improve this answer


























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f3487691%2fdropping-unique-constraint-from-mysql-table%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            9 Answers
            9






            active

            oldest

            votes








            9 Answers
            9






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            286














            A unique constraint is also an index.



            First use SHOW INDEX FROM tbl_name to find out the name of the index. The name of the index is stored in the column called key_name in the results of that query.



            Then you can use DROP INDEX:



            DROP INDEX index_name ON tbl_name


            or the ALTER TABLE syntax:



            ALTER TABLE tbl_name DROP INDEX index_name





            share|improve this answer





















            • 1





              Sorry sir i had tried it before raising the question ,but its not working

              – Ankur Mukherjee
              Aug 15 '10 at 14:26











            • @Ankur Mukherjee: I forgot to mention: You have to change tbl_name and index_name to the name of your actual table and the name of the actual index, respectively. You can see the names in MySQL Query Browser. You can also do SHOW CREATE TABLE tbl_name.

              – Mark Byers
              Aug 15 '10 at 14:33








            • 1





              Sir I know that very well and i had tried that only

              – Ankur Mukherjee
              Aug 15 '10 at 14:34






            • 1





              @Ankur Mukherjee: The way I have suggested is in my opinion the best way to do it.

              – Mark Byers
              Aug 15 '10 at 15:33






            • 1





              I read somewhere in the question using phpMyAdmin... The answer provided by @systemovich should be marked as the accepted one.

              – Pere
              Sep 16 '14 at 14:16


















            286














            A unique constraint is also an index.



            First use SHOW INDEX FROM tbl_name to find out the name of the index. The name of the index is stored in the column called key_name in the results of that query.



            Then you can use DROP INDEX:



            DROP INDEX index_name ON tbl_name


            or the ALTER TABLE syntax:



            ALTER TABLE tbl_name DROP INDEX index_name





            share|improve this answer





















            • 1





              Sorry sir i had tried it before raising the question ,but its not working

              – Ankur Mukherjee
              Aug 15 '10 at 14:26











            • @Ankur Mukherjee: I forgot to mention: You have to change tbl_name and index_name to the name of your actual table and the name of the actual index, respectively. You can see the names in MySQL Query Browser. You can also do SHOW CREATE TABLE tbl_name.

              – Mark Byers
              Aug 15 '10 at 14:33








            • 1





              Sir I know that very well and i had tried that only

              – Ankur Mukherjee
              Aug 15 '10 at 14:34






            • 1





              @Ankur Mukherjee: The way I have suggested is in my opinion the best way to do it.

              – Mark Byers
              Aug 15 '10 at 15:33






            • 1





              I read somewhere in the question using phpMyAdmin... The answer provided by @systemovich should be marked as the accepted one.

              – Pere
              Sep 16 '14 at 14:16
















            286












            286








            286







            A unique constraint is also an index.



            First use SHOW INDEX FROM tbl_name to find out the name of the index. The name of the index is stored in the column called key_name in the results of that query.



            Then you can use DROP INDEX:



            DROP INDEX index_name ON tbl_name


            or the ALTER TABLE syntax:



            ALTER TABLE tbl_name DROP INDEX index_name





            share|improve this answer















            A unique constraint is also an index.



            First use SHOW INDEX FROM tbl_name to find out the name of the index. The name of the index is stored in the column called key_name in the results of that query.



            Then you can use DROP INDEX:



            DROP INDEX index_name ON tbl_name


            or the ALTER TABLE syntax:



            ALTER TABLE tbl_name DROP INDEX index_name






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Aug 15 '10 at 15:05

























            answered Aug 15 '10 at 14:15









            Mark ByersMark Byers

            600k12913711349




            600k12913711349








            • 1





              Sorry sir i had tried it before raising the question ,but its not working

              – Ankur Mukherjee
              Aug 15 '10 at 14:26











            • @Ankur Mukherjee: I forgot to mention: You have to change tbl_name and index_name to the name of your actual table and the name of the actual index, respectively. You can see the names in MySQL Query Browser. You can also do SHOW CREATE TABLE tbl_name.

              – Mark Byers
              Aug 15 '10 at 14:33








            • 1





              Sir I know that very well and i had tried that only

              – Ankur Mukherjee
              Aug 15 '10 at 14:34






            • 1





              @Ankur Mukherjee: The way I have suggested is in my opinion the best way to do it.

              – Mark Byers
              Aug 15 '10 at 15:33






            • 1





              I read somewhere in the question using phpMyAdmin... The answer provided by @systemovich should be marked as the accepted one.

              – Pere
              Sep 16 '14 at 14:16
















            • 1





              Sorry sir i had tried it before raising the question ,but its not working

              – Ankur Mukherjee
              Aug 15 '10 at 14:26











            • @Ankur Mukherjee: I forgot to mention: You have to change tbl_name and index_name to the name of your actual table and the name of the actual index, respectively. You can see the names in MySQL Query Browser. You can also do SHOW CREATE TABLE tbl_name.

              – Mark Byers
              Aug 15 '10 at 14:33








            • 1





              Sir I know that very well and i had tried that only

              – Ankur Mukherjee
              Aug 15 '10 at 14:34






            • 1





              @Ankur Mukherjee: The way I have suggested is in my opinion the best way to do it.

              – Mark Byers
              Aug 15 '10 at 15:33






            • 1





              I read somewhere in the question using phpMyAdmin... The answer provided by @systemovich should be marked as the accepted one.

              – Pere
              Sep 16 '14 at 14:16










            1




            1





            Sorry sir i had tried it before raising the question ,but its not working

            – Ankur Mukherjee
            Aug 15 '10 at 14:26





            Sorry sir i had tried it before raising the question ,but its not working

            – Ankur Mukherjee
            Aug 15 '10 at 14:26













            @Ankur Mukherjee: I forgot to mention: You have to change tbl_name and index_name to the name of your actual table and the name of the actual index, respectively. You can see the names in MySQL Query Browser. You can also do SHOW CREATE TABLE tbl_name.

            – Mark Byers
            Aug 15 '10 at 14:33







            @Ankur Mukherjee: I forgot to mention: You have to change tbl_name and index_name to the name of your actual table and the name of the actual index, respectively. You can see the names in MySQL Query Browser. You can also do SHOW CREATE TABLE tbl_name.

            – Mark Byers
            Aug 15 '10 at 14:33






            1




            1





            Sir I know that very well and i had tried that only

            – Ankur Mukherjee
            Aug 15 '10 at 14:34





            Sir I know that very well and i had tried that only

            – Ankur Mukherjee
            Aug 15 '10 at 14:34




            1




            1





            @Ankur Mukherjee: The way I have suggested is in my opinion the best way to do it.

            – Mark Byers
            Aug 15 '10 at 15:33





            @Ankur Mukherjee: The way I have suggested is in my opinion the best way to do it.

            – Mark Byers
            Aug 15 '10 at 15:33




            1




            1





            I read somewhere in the question using phpMyAdmin... The answer provided by @systemovich should be marked as the accepted one.

            – Pere
            Sep 16 '14 at 14:16







            I read somewhere in the question using phpMyAdmin... The answer provided by @systemovich should be marked as the accepted one.

            – Pere
            Sep 16 '14 at 14:16















            109














            You can DROP a unique constraint from a table using phpMyAdmin as requested as shown in the table below. A unique constraint has been placed on the Wingspan field. The name of the constraint is the same as the field name, in this instance.



            alt text






            share|improve this answer



















            • 34





              It is important to note that the indexes section is collapsed by default, and is expanded by a small, subtle link in 12px font where the section is in the screenshot. But thanks to you, I found it. Bless your face. +1

              – Jack
              May 25 '13 at 17:39











            • I just removed 25 indexes...

              – CousinCocaine
              Sep 29 '15 at 19:46
















            109














            You can DROP a unique constraint from a table using phpMyAdmin as requested as shown in the table below. A unique constraint has been placed on the Wingspan field. The name of the constraint is the same as the field name, in this instance.



            alt text






            share|improve this answer



















            • 34





              It is important to note that the indexes section is collapsed by default, and is expanded by a small, subtle link in 12px font where the section is in the screenshot. But thanks to you, I found it. Bless your face. +1

              – Jack
              May 25 '13 at 17:39











            • I just removed 25 indexes...

              – CousinCocaine
              Sep 29 '15 at 19:46














            109












            109








            109







            You can DROP a unique constraint from a table using phpMyAdmin as requested as shown in the table below. A unique constraint has been placed on the Wingspan field. The name of the constraint is the same as the field name, in this instance.



            alt text






            share|improve this answer













            You can DROP a unique constraint from a table using phpMyAdmin as requested as shown in the table below. A unique constraint has been placed on the Wingspan field. The name of the constraint is the same as the field name, in this instance.



            alt text







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Oct 6 '10 at 17:42









            systemovichsystemovich

            3,98573570




            3,98573570








            • 34





              It is important to note that the indexes section is collapsed by default, and is expanded by a small, subtle link in 12px font where the section is in the screenshot. But thanks to you, I found it. Bless your face. +1

              – Jack
              May 25 '13 at 17:39











            • I just removed 25 indexes...

              – CousinCocaine
              Sep 29 '15 at 19:46














            • 34





              It is important to note that the indexes section is collapsed by default, and is expanded by a small, subtle link in 12px font where the section is in the screenshot. But thanks to you, I found it. Bless your face. +1

              – Jack
              May 25 '13 at 17:39











            • I just removed 25 indexes...

              – CousinCocaine
              Sep 29 '15 at 19:46








            34




            34





            It is important to note that the indexes section is collapsed by default, and is expanded by a small, subtle link in 12px font where the section is in the screenshot. But thanks to you, I found it. Bless your face. +1

            – Jack
            May 25 '13 at 17:39





            It is important to note that the indexes section is collapsed by default, and is expanded by a small, subtle link in 12px font where the section is in the screenshot. But thanks to you, I found it. Bless your face. +1

            – Jack
            May 25 '13 at 17:39













            I just removed 25 indexes...

            – CousinCocaine
            Sep 29 '15 at 19:46





            I just removed 25 indexes...

            – CousinCocaine
            Sep 29 '15 at 19:46











            11














            The indexes capable of placing a unique key constraint on a table are PRIMARY and UNIQUE indexes.



            To remove the unique key constraint on a column but keep the index, you could remove and recreate the index with type INDEX.



            Note that it is a good idea for all tables to have an index marked PRIMARY.






            share|improve this answer



















            • 1





              Upvoted because @thomasrutter has touched on the fact that removing a unique constraint may adversely affect query performance - and this can be mitigated by replacing the UNIQUE index with a regular INDEX.

              – Alex
              Apr 18 '14 at 16:17


















            11














            The indexes capable of placing a unique key constraint on a table are PRIMARY and UNIQUE indexes.



            To remove the unique key constraint on a column but keep the index, you could remove and recreate the index with type INDEX.



            Note that it is a good idea for all tables to have an index marked PRIMARY.






            share|improve this answer



















            • 1





              Upvoted because @thomasrutter has touched on the fact that removing a unique constraint may adversely affect query performance - and this can be mitigated by replacing the UNIQUE index with a regular INDEX.

              – Alex
              Apr 18 '14 at 16:17
















            11












            11








            11







            The indexes capable of placing a unique key constraint on a table are PRIMARY and UNIQUE indexes.



            To remove the unique key constraint on a column but keep the index, you could remove and recreate the index with type INDEX.



            Note that it is a good idea for all tables to have an index marked PRIMARY.






            share|improve this answer













            The indexes capable of placing a unique key constraint on a table are PRIMARY and UNIQUE indexes.



            To remove the unique key constraint on a column but keep the index, you could remove and recreate the index with type INDEX.



            Note that it is a good idea for all tables to have an index marked PRIMARY.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Aug 15 '10 at 14:28









            thomasrutterthomasrutter

            90.8k21125148




            90.8k21125148








            • 1





              Upvoted because @thomasrutter has touched on the fact that removing a unique constraint may adversely affect query performance - and this can be mitigated by replacing the UNIQUE index with a regular INDEX.

              – Alex
              Apr 18 '14 at 16:17
















            • 1





              Upvoted because @thomasrutter has touched on the fact that removing a unique constraint may adversely affect query performance - and this can be mitigated by replacing the UNIQUE index with a regular INDEX.

              – Alex
              Apr 18 '14 at 16:17










            1




            1





            Upvoted because @thomasrutter has touched on the fact that removing a unique constraint may adversely affect query performance - and this can be mitigated by replacing the UNIQUE index with a regular INDEX.

            – Alex
            Apr 18 '14 at 16:17







            Upvoted because @thomasrutter has touched on the fact that removing a unique constraint may adversely affect query performance - and this can be mitigated by replacing the UNIQUE index with a regular INDEX.

            – Alex
            Apr 18 '14 at 16:17













            1














            For WAMP 3.0 :
            Click Structure
            Below Add 1 Column you will see '- Indexes'
            Click -Indexes and drop whichever index you want.






            share|improve this answer




























              1














              For WAMP 3.0 :
              Click Structure
              Below Add 1 Column you will see '- Indexes'
              Click -Indexes and drop whichever index you want.






              share|improve this answer


























                1












                1








                1







                For WAMP 3.0 :
                Click Structure
                Below Add 1 Column you will see '- Indexes'
                Click -Indexes and drop whichever index you want.






                share|improve this answer













                For WAMP 3.0 :
                Click Structure
                Below Add 1 Column you will see '- Indexes'
                Click -Indexes and drop whichever index you want.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Sep 2 '17 at 19:39









                Jeffry LouisJeffry Louis

                111




                111























                    1














                    If you want to remove unique constraints from mysql database table, use alter table with drop index.



                    Example:



                    create table unique_constraints(unid int,activity_name varchar(100),CONSTRAINT activty_uqniue UNIQUE(activity_name),primary key (unid));



                    alter table unique_constraints drop index activty_uqniue;


                    Where activty_uqniue is UNIQUE constraint for activity_name column.






                    share|improve this answer




























                      1














                      If you want to remove unique constraints from mysql database table, use alter table with drop index.



                      Example:



                      create table unique_constraints(unid int,activity_name varchar(100),CONSTRAINT activty_uqniue UNIQUE(activity_name),primary key (unid));



                      alter table unique_constraints drop index activty_uqniue;


                      Where activty_uqniue is UNIQUE constraint for activity_name column.






                      share|improve this answer


























                        1












                        1








                        1







                        If you want to remove unique constraints from mysql database table, use alter table with drop index.



                        Example:



                        create table unique_constraints(unid int,activity_name varchar(100),CONSTRAINT activty_uqniue UNIQUE(activity_name),primary key (unid));



                        alter table unique_constraints drop index activty_uqniue;


                        Where activty_uqniue is UNIQUE constraint for activity_name column.






                        share|improve this answer













                        If you want to remove unique constraints from mysql database table, use alter table with drop index.



                        Example:



                        create table unique_constraints(unid int,activity_name varchar(100),CONSTRAINT activty_uqniue UNIQUE(activity_name),primary key (unid));



                        alter table unique_constraints drop index activty_uqniue;


                        Where activty_uqniue is UNIQUE constraint for activity_name column.







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered Feb 2 '18 at 11:23









                        Manjunatha H CManjunatha H C

                        112




                        112























                            1














                            To add UNIQUE constraint using phpmyadmin, go to the structure of that table and find below and click that,



                            enter image description here



                            To remove the UNIQUE constraint, same way, go to the structure and scroll down till Indexes Tab and find below and click drop,
                            enter image description here



                            Hope this works.



                            Enjoy ;)






                            share|improve this answer
























                            • this solution was exactly what i was looking for.

                              – Aryeh Beitz
                              Dec 30 '18 at 12:29
















                            1














                            To add UNIQUE constraint using phpmyadmin, go to the structure of that table and find below and click that,



                            enter image description here



                            To remove the UNIQUE constraint, same way, go to the structure and scroll down till Indexes Tab and find below and click drop,
                            enter image description here



                            Hope this works.



                            Enjoy ;)






                            share|improve this answer
























                            • this solution was exactly what i was looking for.

                              – Aryeh Beitz
                              Dec 30 '18 at 12:29














                            1












                            1








                            1







                            To add UNIQUE constraint using phpmyadmin, go to the structure of that table and find below and click that,



                            enter image description here



                            To remove the UNIQUE constraint, same way, go to the structure and scroll down till Indexes Tab and find below and click drop,
                            enter image description here



                            Hope this works.



                            Enjoy ;)






                            share|improve this answer













                            To add UNIQUE constraint using phpmyadmin, go to the structure of that table and find below and click that,



                            enter image description here



                            To remove the UNIQUE constraint, same way, go to the structure and scroll down till Indexes Tab and find below and click drop,
                            enter image description here



                            Hope this works.



                            Enjoy ;)







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Aug 30 '18 at 8:19









                            Umesh PatilUmesh Patil

                            2,2021918




                            2,2021918













                            • this solution was exactly what i was looking for.

                              – Aryeh Beitz
                              Dec 30 '18 at 12:29



















                            • this solution was exactly what i was looking for.

                              – Aryeh Beitz
                              Dec 30 '18 at 12:29

















                            this solution was exactly what i was looking for.

                            – Aryeh Beitz
                            Dec 30 '18 at 12:29





                            this solution was exactly what i was looking for.

                            – Aryeh Beitz
                            Dec 30 '18 at 12:29











                            0














                            while dropping unique key we use index



                            ALTER TABLE tbl
                            DROP INDEX unique_address;





                            share|improve this answer




























                              0














                              while dropping unique key we use index



                              ALTER TABLE tbl
                              DROP INDEX unique_address;





                              share|improve this answer


























                                0












                                0








                                0







                                while dropping unique key we use index



                                ALTER TABLE tbl
                                DROP INDEX unique_address;





                                share|improve this answer













                                while dropping unique key we use index



                                ALTER TABLE tbl
                                DROP INDEX unique_address;






                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered Feb 21 at 10:39









                                Hamza.SHamza.S

                                855314




                                855314























                                    -2














                                    1.First delete table



                                    2.go to sql



                                    CREATE  TABLE service( --tablename 
                                    `serviceid` int(11) NOT NULL,--coloums
                                    `customerid` varchar(20) DEFAULT NULL,--coloums
                                    `dos` varchar(30) NOT NULL,--coloums
                                    `productname` varchar(150) NOT NULL,--coloums
                                    `modelnumber` bigint(12) NOT NULL,--coloums
                                    `serialnumber` bigint(20) NOT NULL,--coloums
                                    `serviceby` varchar(20) DEFAULT NULL--coloums
                                    )
                                    --INSERT VALUES
                                    INSERT INTO `service` (`serviceid`, `customerid`, `dos`, `productname`, `modelnumber`, `serialnumber`, `serviceby`) VALUES
                                    (1, '1', '12/10/2018', 'mouse', 1234555, 234234324, '9999'),
                                    (2, '09', '12/10/2018', 'vhbgj', 79746385, 18923984, '9999'),
                                    (3, '23', '12/10/2018', 'mouse', 123455534, 11111123, '9999'),
                                    (4, '23', '12/10/2018', 'mouse', 12345, 84848, '9999'),
                                    (5, '546456', '12/10/2018', 'ughg', 772882, 457283, '9999'),
                                    (6, '23', '12/10/2018', 'keyboard', 7878787878, 22222, '1'),
                                    (7, '23', '12/10/2018', 'java', 11, 98908, '9999'),
                                    (8, '128', '12/10/2018', 'mouse', 9912280626, 111111, '9999'),
                                    (9, '23', '15/10/2018', 'hg', 29829354, 4564564646, '9999'),
                                    (10, '12', '15/10/2018', '2', 5256, 888888, '9999');
                                    --before droping table
                                    ALTER TABLE `service`
                                    ADD PRIMARY KEY (`serviceid`),
                                    ADD unique`modelnumber` (`modelnumber`),
                                    ADD unique`serialnumber` (`serialnumber`),
                                    ADD unique`modelnumber_2` (`modelnumber`);
                                    --after droping table
                                    ALTER TABLE `service`
                                    ADD PRIMARY KEY (`serviceid`),
                                    ADD modelnumber` (`modelnumber`),
                                    ADD serialnumber` (`serialnumber`),
                                    ADD modelnumber_2` (`modelnumber`);





                                    share|improve this answer






























                                      -2














                                      1.First delete table



                                      2.go to sql



                                      CREATE  TABLE service( --tablename 
                                      `serviceid` int(11) NOT NULL,--coloums
                                      `customerid` varchar(20) DEFAULT NULL,--coloums
                                      `dos` varchar(30) NOT NULL,--coloums
                                      `productname` varchar(150) NOT NULL,--coloums
                                      `modelnumber` bigint(12) NOT NULL,--coloums
                                      `serialnumber` bigint(20) NOT NULL,--coloums
                                      `serviceby` varchar(20) DEFAULT NULL--coloums
                                      )
                                      --INSERT VALUES
                                      INSERT INTO `service` (`serviceid`, `customerid`, `dos`, `productname`, `modelnumber`, `serialnumber`, `serviceby`) VALUES
                                      (1, '1', '12/10/2018', 'mouse', 1234555, 234234324, '9999'),
                                      (2, '09', '12/10/2018', 'vhbgj', 79746385, 18923984, '9999'),
                                      (3, '23', '12/10/2018', 'mouse', 123455534, 11111123, '9999'),
                                      (4, '23', '12/10/2018', 'mouse', 12345, 84848, '9999'),
                                      (5, '546456', '12/10/2018', 'ughg', 772882, 457283, '9999'),
                                      (6, '23', '12/10/2018', 'keyboard', 7878787878, 22222, '1'),
                                      (7, '23', '12/10/2018', 'java', 11, 98908, '9999'),
                                      (8, '128', '12/10/2018', 'mouse', 9912280626, 111111, '9999'),
                                      (9, '23', '15/10/2018', 'hg', 29829354, 4564564646, '9999'),
                                      (10, '12', '15/10/2018', '2', 5256, 888888, '9999');
                                      --before droping table
                                      ALTER TABLE `service`
                                      ADD PRIMARY KEY (`serviceid`),
                                      ADD unique`modelnumber` (`modelnumber`),
                                      ADD unique`serialnumber` (`serialnumber`),
                                      ADD unique`modelnumber_2` (`modelnumber`);
                                      --after droping table
                                      ALTER TABLE `service`
                                      ADD PRIMARY KEY (`serviceid`),
                                      ADD modelnumber` (`modelnumber`),
                                      ADD serialnumber` (`serialnumber`),
                                      ADD modelnumber_2` (`modelnumber`);





                                      share|improve this answer




























                                        -2












                                        -2








                                        -2







                                        1.First delete table



                                        2.go to sql



                                        CREATE  TABLE service( --tablename 
                                        `serviceid` int(11) NOT NULL,--coloums
                                        `customerid` varchar(20) DEFAULT NULL,--coloums
                                        `dos` varchar(30) NOT NULL,--coloums
                                        `productname` varchar(150) NOT NULL,--coloums
                                        `modelnumber` bigint(12) NOT NULL,--coloums
                                        `serialnumber` bigint(20) NOT NULL,--coloums
                                        `serviceby` varchar(20) DEFAULT NULL--coloums
                                        )
                                        --INSERT VALUES
                                        INSERT INTO `service` (`serviceid`, `customerid`, `dos`, `productname`, `modelnumber`, `serialnumber`, `serviceby`) VALUES
                                        (1, '1', '12/10/2018', 'mouse', 1234555, 234234324, '9999'),
                                        (2, '09', '12/10/2018', 'vhbgj', 79746385, 18923984, '9999'),
                                        (3, '23', '12/10/2018', 'mouse', 123455534, 11111123, '9999'),
                                        (4, '23', '12/10/2018', 'mouse', 12345, 84848, '9999'),
                                        (5, '546456', '12/10/2018', 'ughg', 772882, 457283, '9999'),
                                        (6, '23', '12/10/2018', 'keyboard', 7878787878, 22222, '1'),
                                        (7, '23', '12/10/2018', 'java', 11, 98908, '9999'),
                                        (8, '128', '12/10/2018', 'mouse', 9912280626, 111111, '9999'),
                                        (9, '23', '15/10/2018', 'hg', 29829354, 4564564646, '9999'),
                                        (10, '12', '15/10/2018', '2', 5256, 888888, '9999');
                                        --before droping table
                                        ALTER TABLE `service`
                                        ADD PRIMARY KEY (`serviceid`),
                                        ADD unique`modelnumber` (`modelnumber`),
                                        ADD unique`serialnumber` (`serialnumber`),
                                        ADD unique`modelnumber_2` (`modelnumber`);
                                        --after droping table
                                        ALTER TABLE `service`
                                        ADD PRIMARY KEY (`serviceid`),
                                        ADD modelnumber` (`modelnumber`),
                                        ADD serialnumber` (`serialnumber`),
                                        ADD modelnumber_2` (`modelnumber`);





                                        share|improve this answer















                                        1.First delete table



                                        2.go to sql



                                        CREATE  TABLE service( --tablename 
                                        `serviceid` int(11) NOT NULL,--coloums
                                        `customerid` varchar(20) DEFAULT NULL,--coloums
                                        `dos` varchar(30) NOT NULL,--coloums
                                        `productname` varchar(150) NOT NULL,--coloums
                                        `modelnumber` bigint(12) NOT NULL,--coloums
                                        `serialnumber` bigint(20) NOT NULL,--coloums
                                        `serviceby` varchar(20) DEFAULT NULL--coloums
                                        )
                                        --INSERT VALUES
                                        INSERT INTO `service` (`serviceid`, `customerid`, `dos`, `productname`, `modelnumber`, `serialnumber`, `serviceby`) VALUES
                                        (1, '1', '12/10/2018', 'mouse', 1234555, 234234324, '9999'),
                                        (2, '09', '12/10/2018', 'vhbgj', 79746385, 18923984, '9999'),
                                        (3, '23', '12/10/2018', 'mouse', 123455534, 11111123, '9999'),
                                        (4, '23', '12/10/2018', 'mouse', 12345, 84848, '9999'),
                                        (5, '546456', '12/10/2018', 'ughg', 772882, 457283, '9999'),
                                        (6, '23', '12/10/2018', 'keyboard', 7878787878, 22222, '1'),
                                        (7, '23', '12/10/2018', 'java', 11, 98908, '9999'),
                                        (8, '128', '12/10/2018', 'mouse', 9912280626, 111111, '9999'),
                                        (9, '23', '15/10/2018', 'hg', 29829354, 4564564646, '9999'),
                                        (10, '12', '15/10/2018', '2', 5256, 888888, '9999');
                                        --before droping table
                                        ALTER TABLE `service`
                                        ADD PRIMARY KEY (`serviceid`),
                                        ADD unique`modelnumber` (`modelnumber`),
                                        ADD unique`serialnumber` (`serialnumber`),
                                        ADD unique`modelnumber_2` (`modelnumber`);
                                        --after droping table
                                        ALTER TABLE `service`
                                        ADD PRIMARY KEY (`serviceid`),
                                        ADD modelnumber` (`modelnumber`),
                                        ADD serialnumber` (`serialnumber`),
                                        ADD modelnumber_2` (`modelnumber`);






                                        share|improve this answer














                                        share|improve this answer



                                        share|improve this answer








                                        edited Oct 15 '18 at 13:14









                                        Pancho

                                        3,25011631




                                        3,25011631










                                        answered Oct 15 '18 at 12:36









                                        ramram

                                        1




                                        1























                                            -2














                                            my table name is buyers which has a unique constraint column emp_id now iam going to drop the emp_id



                                            step 1: exec sp_helpindex buyers, see the image file



                                            step 2: copy the index address



                                            enter image description here



                                            step3: alter table buyers drop constraint [UQ__buyers__1299A860D9793F2E]
                                            alter table buyers
                                            drop column emp_id



                                            note:




                                            Blockquote




                                            instead of buyers change it to your table name :)




                                            Blockquote




                                            thats all column name emp_id with constraints is dropped!






                                            share|improve this answer






























                                              -2














                                              my table name is buyers which has a unique constraint column emp_id now iam going to drop the emp_id



                                              step 1: exec sp_helpindex buyers, see the image file



                                              step 2: copy the index address



                                              enter image description here



                                              step3: alter table buyers drop constraint [UQ__buyers__1299A860D9793F2E]
                                              alter table buyers
                                              drop column emp_id



                                              note:




                                              Blockquote




                                              instead of buyers change it to your table name :)




                                              Blockquote




                                              thats all column name emp_id with constraints is dropped!






                                              share|improve this answer




























                                                -2












                                                -2








                                                -2







                                                my table name is buyers which has a unique constraint column emp_id now iam going to drop the emp_id



                                                step 1: exec sp_helpindex buyers, see the image file



                                                step 2: copy the index address



                                                enter image description here



                                                step3: alter table buyers drop constraint [UQ__buyers__1299A860D9793F2E]
                                                alter table buyers
                                                drop column emp_id



                                                note:




                                                Blockquote




                                                instead of buyers change it to your table name :)




                                                Blockquote




                                                thats all column name emp_id with constraints is dropped!






                                                share|improve this answer















                                                my table name is buyers which has a unique constraint column emp_id now iam going to drop the emp_id



                                                step 1: exec sp_helpindex buyers, see the image file



                                                step 2: copy the index address



                                                enter image description here



                                                step3: alter table buyers drop constraint [UQ__buyers__1299A860D9793F2E]
                                                alter table buyers
                                                drop column emp_id



                                                note:




                                                Blockquote




                                                instead of buyers change it to your table name :)




                                                Blockquote




                                                thats all column name emp_id with constraints is dropped!







                                                share|improve this answer














                                                share|improve this answer



                                                share|improve this answer








                                                edited Jan 4 at 8:08









                                                s_t

                                                3,69121133




                                                3,69121133










                                                answered Jan 4 at 7:30









                                                vignesh .Bvignesh .B

                                                42




                                                42






























                                                    draft saved

                                                    draft discarded




















































                                                    Thanks for contributing an answer to Stack Overflow!


                                                    • Please be sure to answer the question. Provide details and share your research!

                                                    But avoid



                                                    • Asking for help, clarification, or responding to other answers.

                                                    • Making statements based on opinion; back them up with references or personal experience.


                                                    To learn more, see our tips on writing great answers.




                                                    draft saved


                                                    draft discarded














                                                    StackExchange.ready(
                                                    function () {
                                                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f3487691%2fdropping-unique-constraint-from-mysql-table%23new-answer', 'question_page');
                                                    }
                                                    );

                                                    Post as a guest















                                                    Required, but never shown





















































                                                    Required, but never shown














                                                    Required, but never shown












                                                    Required, but never shown







                                                    Required, but never shown

































                                                    Required, but never shown














                                                    Required, but never shown












                                                    Required, but never shown







                                                    Required, but never shown







                                                    Popular posts from this blog

                                                    Mossoró

                                                    Error while reading .h5 file using the rhdf5 package in R

                                                    Pushsharp Apns notification error: 'InvalidToken'