title: Creating unique primary key to ignore duplicates
body: <p>I have a main large table which I have had to put into 3rd normal form and into smaller tables (with primary and foreign keys linking them). The table is about renting books.</p>
  
  <p>I have a customer table which I need to create a primary key for. In the main large table there are duplicates of the customer_id, as the table as a whole is for renting the books, so one customer may have more than one renting. </p>
  
  <p>The table I am currently trying to add a primary key for will not have any nulls or duplicates, however i am unsure how to create the primary key for this without the error- unsure how to make it unique. </p>
  
  <pre><code>CREATE TABLE customer AS 
      SELECT cust_id, country_id, name, address, postcode
      FROM BOOKS
      WHERE cust_id != 0;
  
  
  ALTER TABLE customer
      ADD PRIMARY KEY (cust_id);
  </code></pre>
  
  <p>Is anyone able to help me in how to create the primary key on my customer table, but just taking each unique cust_id from the main table. </p>