title: Foreign key issue while insert or delete
body: <p>i have 3 tables below</p>
  
  <p>books</p>
  
  <p><a href="https://i.stack.imgur.com/Bloee.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Bloee.png" alt="enter image description here"></a></p>
  
  <p>users</p>
  
  <p><a href="https://i.stack.imgur.com/M5EKI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/M5EKI.png" alt="enter image description here"></a></p>
  
  <p>and 
   test.users_books with foreign keys </p>
  
  <pre><code>CREATE TABLE test.users_books (
    user_id int NOT NULL,
    PRIMARY KEY (user_id),
    FOREIGN KEY (user_id) REFERENCES test.users(id) ON UPDATE CASCADE ON DELETE CASCADE,
    FOREIGN KEY (user_id) REFERENCES test.books(id) ON UPDATE CASCADE ON DELETE CASCADE
  
  );
  </code></pre>
  
  <p>while am trying to insert in to </p>
  
  <pre><code>INSERT INTO test.users_books values(11)
  </code></pre>
  
  <p>getting below error </p>
  
  <pre class="lang-none prettyprint-override"><code>ERROR:  insert or update on table "users_books" violates foreign key constraint "users_books_user_id_fkey"
  DETAIL:  Key (user_id)=(11) is not present in table "users".
  ********** Error **********
  
  ERROR: insert or update on table "users_books" violates foreign key constraint "users_books_user_id_fkey"
  SQL state: 23503
  Detail: Key (user_id)=(11) is not present in table "users".
  </code></pre>
  
  <p>how to insert 11 into this table with foreign key the id 11 having in books table.
  is there any condition need insert for this table please let meknow</p>