title: why does junction table of many to many relation in sql implemet both foreign key as primary key?
body: <pre><code>CREATE TABLE Books(
          BookID SMALLINT NOT NULL PRIMARY KEY,
          BookTitle VARCHAR(60) NOT NULL,
          Copyright YEAR NOT NULL
       )
  
  
  
  
  CREATE TABLE Authors(
          AuthID SMALLINT NOT NULL PRIMARY KEY,
          AuthFN VARCHAR(20),
          AuthMN VARCHAR(20),
          AuthLN VARCHAR(20)
       )
  
  
  CREATE TABLE AuthorBook(
          AuthID SMALLINT NOT NULL,
          BookID SMALLINT NOT NULL,
          PRIMARY KEY (AuthID, BookID),
          FOREIGN KEY (AuthID) REFERENCES Authors (AuthID),
          FOREIGN KEY (BookID) REFERENCES Books (BookID)
      )
  </code></pre>
  
  <p>here junction table  is authorbook
  why primary key is (authorid,bookid) is used</p>
  
  <p>why not have a seperate table id and make it primary key? </p>