title: Generating user id in SQL by concatenating
body: <p>I need a script that generates automatically by concatenating the first letter of the first_name and the first seven characters of the last_name. Therefore, the generated userid must be in lowercase. Hence the script should not prompt for the userid. </p>
  
  <p>I must use it for insertions. There it is but I don't know how to make it work. </p>
  
  <pre><code>    INSERT INTO my_employee 
     (
      id,
      last_name,
      first_name,
      userid,
      salary
     )
      VALUES (&amp;id,
              &amp;last_name,
              &amp;first_name,
              LOWER(SUBSTR(first_name,1,1) || SUBSTR(last_name,1,7)),
              &amp;salary);
  </code></pre>
  
  <p>Well thanks to Shantanu's ideea i have found the solution, not the brightest in the world but it does the job :D : </p>
  
  <pre><code>INSERT INTO my_employee 
       VALUES ( &amp;id,
               '&amp;last_name',
               '&amp;first_name',
                NULL,
                &amp;salary); 
  UPDATE my_employee
  SET    userid = LOWER(SUBSTR(last_name,1,1) || SUBSTR(first_name,1,7))
  WHERE  userid IS NULL; 
  </code></pre>