title: Usage of Alter command to drop Primary key and Foreign Key
body: <p><strong>I have created three tables</strong></p>
  
  <p>create table employee1 (eid int, ename varchar(25),email varchar(15));</p>
  
  <p>create table accounts1 (eid int, accno int,atype varchar(2),bal int);</p>
  
  <p>create table trans1(cid int, accno int, atype varchar(2), accounts int, bal int);</p>
  
  <p><strong>using alter command I have added primary key and foreign keys</strong> </p>
  
  <p>alter table employee1 add primary key(eid);</p>
  
  <p>alter table accounts1 add foreign key(eid) references employee1(eid);</p>
  
  <p>alter table accounts1 add primary key(accno,atype);</p>
  
  <p>alter table trans1 add foreign key(accno,atype) references accounts1(accno,atype);</p>
  
  <p>Now my problem is I am trying to delete all the primary key and foreign keys of all the tables its giving me errors.</p>
  
  <p>Initially I tried deleteing the primary key. then on refering to the below links showed me that foreign key must be deleted first and I tried doing that but still i am getting the error.
  <a href="https://stackoverflow.com/questions/9243016/mysql-5-5-drop-primary-key">MYSQL 5.5 Drop Primary Key</a></p>
  
  <p>errors:</p>
  
  <p>mysql> alter table employee1 drop constraint eid;</p>
  
  <p>ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corres
  ponds to your MySQL server version for the right syntax to use near 'constraint eid' a
  t line 1</p>
  
  <p>mysql> alter table accounts1 drop primary key;</p>
  
  <p>ERROR 1025 (HY000): Error on rename of '.\jlcindia#sql-b20_1' to '.\jlcindia\accounts
  1' (errno: 150)</p>
  
  <p>mysql> alter table employee1 drop primary key;</p>
  
  <p>ERROR 1025 (HY000): Error on rename of '.\jlcindia#sql-b20_1' to '.\jlcindia\employee
  1' (errno: 150)</p>
  
  <p>mysql> alter table trans1 drop foreign key;</p>
  
  <p>ERROR 1005 (HY000): Can't create table 'jlcindia.#sql-b20_1' (errno: 150)
  mysql> show engine innodb status</p>
  
  <p>Note: I have no auto increment or any such thing in any of my tables.</p>
  
  <p>I checked the following links but none was of any help.</p>
  
  <p><a href="https://stackoverflow.com/questions/2111291/remove-primary-key-in-mysql">Remove Primary Key in MySQL</a></p>
  
  <p><a href="https://stackoverflow.com/questions/3090442/mysql-alter-column-remove-primary-key-and-auto-incremement">mysql, alter column remove primary key and auto incremement</a></p>
  
  <p><a href="https://stackoverflow.com/questions/17266401/error-altering-primary-key-column-in-mysql-table">Error altering primary key column in mysql table</a></p>
  
  <p><a href="https://stackoverflow.com/questions/8761570/how-can-i-alter-a-primary-key-constraint-using-sql-syntax">How can I alter a primary key constraint using SQL syntax?</a></p>