title: SQL: How to generate a unique value for a Primary Key
body: <p>as the title states. I do have the following table:</p>
  
  <pre><code>CREATE TABLE exampleTable(
      ID int NOT NULL,
      Text varchar(255),
      PRIMARY KEY (ID)
  );
  </code></pre>
  
  <p>By inserting Values:</p>
  
  <pre><code>INSERT INTO exampleTable (ID, Text)
  VALUES (123, 'Hello World');
  </code></pre>
  
  <p>Sometimes a value can be added for a Primary Key, which is already in the Table, thereby will give you an <code>Error</code>.</p>
  
  <p><strong>Questions</strong>: </p>
  
  <ol>
  <li><p>By which approach can we ensure that the value of a choosen Primary Key is always unique?</p></li>
  <li><p>How to generate a Primary Key value, that is always going to be unique.</p></li>
  </ol>
  
  <p><strong>For 2. Question</strong>, possible approach:</p>
  
  <pre><code>//Check if the new Value is already in the Table by
  //Iterating and comparing through all the Primary Key Values.
  </code></pre>