title: MySQL: ERROR 1022 (23000): Can't write; duplicate key in table '#sql-2b8_2'
body: <p>I'm going to implement a bookstore database. I have created the table <code>book</code>, <code>author</code>, and <code>publisher</code>. I'd like to make the following two relationships.</p>
  
  <pre><code>Book is written by Author.
  Book is published by Publisher.
  </code></pre>
  
  <p>In order to implement these relationships, I write some SQL statements like:</p>
  
  <pre><code>create table book(
              ISBN varchar(30) NOT NULL,
              title varchar(30) not null,
              author varchar(30) not null,
              stock Int,
              price Int,
              category varchar(30), 
              PRIMARY KEY ( ISBN )
  );
  
  create table author(
              author_id int not null auto_increment,
              author_name varchar(15) NOT NULL,
              address varchar(50) not null,
              ISBN varchar(30) not null,
              primary key (author_id)
  );
  
  alter table author add constraint ISBN foreign key (ISBN) references book (ISBN);
  
  create table publisher(
              publisher_id int not null auto_increment,
              publisher_name varchar(15) NOT NULL,
              address varchar(50) not null,
              ISBN varchar(30) not null,
              primary key (publisher_id)
  );
  
  alter table publisher add constraint ISBN foreign key (ISBN) references book (ISBN);
  </code></pre>
  
  <p>When MySQL shell executes the last <code>alter</code> statement, I get this error.</p>
  
  <pre><code>ERROR 1022 (23000): Can't write; duplicate key in table '#sql-2b8_2'
  </code></pre>
  
  <p>Originally, can't foreign key be designated two times? What's wrong with? Thank you in advance.</p>