title: SQL - How to INSERT a foreign key as a value for a column
body: <p>I know this is rather basic, and i've searched for answers for quite some time, but I'm troubled.</p>
  
  <p>I don't know how to make my coding readable on here but here it is.</p>
  
  <p>Here's the query for making the table in question:</p>
  
  <pre><code>CREATE TABLE customer   
  (   customer_id INT NOT NULL CONSTRAINT customer_pk PRIMARY KEY IDENTITY,
      first_name  VARCHAR(20) NOT NULL,       
      surname VARCHAR(20) NOT NULL,       
      dob DATETIME    NOT NULL,       
      home_address    VARCHAR(50) NOT NULL,       
      contact_number  VARCHAR(10) NOT NULL,       
      referrer_id INT NULL    FOREIGN KEY REFERENCES customer(customer_id),   
  );
  </code></pre>
  
  <p>And here's the problem code:</p>
  
  <pre><code>--fill customer table
  INSERT INTO customer
  VALUES ( 'Harold', 'Kumar', '2010-07-07 14:03:54', '3 Blue Ln, Perth', 0812391245, NULL )
  INSERT INTO customer 
  VALUES ( 'Bingo', 'Washisnameoh', '2010-09-21 12:30:07', '3 Red St, Perth', 0858239471, NULL )
  INSERT INTO customer
  VALUES ( 'John', 'Green', '2010-11-07 14:13:34', '4 Blue St, Perth', 0423904823, NULL )
  INSERT INTO customer
  VALUES ( 'Amir', 'Blumenfeld', '2010-11-01 11:03:04', '166 Yellow Rd, Perth', 0432058323, NULL)
  
  INSERT INTO customer
  VALUES ( 'Hank', 'Green', '2010-07-07 16:04:24', '444 Orange Crs, Perth', 0898412429, 8)
  </code></pre>
  
  <p>(Specifically the line with the 8 value at the end.)</p>
  
  <p>When executing the second query it responds with this:</p>
  
  <blockquote>
    <p>Msg 547, Level 16, State 0, Line 1<br>
    The INSERT statement conflicted
    with the FOREIGN KEY SAME TABLE constraint
    "FK_<em>customer</em>_referr__5772F790". The conflict occurred in database
    "master", table "dbo.customer", column 'customer_id'. The statement
    has been terminated.</p>
  </blockquote>
  
  <p>Appreciate your help with this.</p>