title: Specifying UNIQUE constraints in PostgreSQL
body: <p>I would appreciate your help with the blocker I have. I created a new table with the statement <code>CREATE TABLE copy_table AS SELECT * FROM original_table</code> because I wanted the second table with similar columns as the original table. </p>
  
  <p>However, the second table came without the UNIQUE constraint that was in the original table. So far, I can insert data into the mentors' table but anything that required UNIQUE constraint is not working.</p>
  
  <p>I tried to add the UNIQUE constraints but it's throwing this error: 
  <code>syntax error at or near "UNIQUE"</code> </p>
  
  <p><strong>Unedited code</strong> </p>
  
  <pre><code>CREATE TABLE IF NOT EXISTS mentors AS SELECT users.user_id AS mentor_id, 
  first_name, last_name, email, address, password, bio, occupation, expertise, is_mentor, is_admin FROM users;
  </code></pre>
  
  <p><strong>Edited code(Adding UNIQUE constraint)</strong> </p>
  
  <pre><code>CREATE TABLE IF NOT EXISTS mentors AS SELECT users.user_id AS mentor_id(UNIQUE),first_name, last_name, email, address, password, bio, occupation, expertise, is_mentor, is_admin FROM users;
  </code></pre>
  
  <p>What am I doing wrong? Thanks.</p>