title: MySQL Triggers - Year-Month(YYMM) Prefix + Auto Increment ID
body: <p>I saw another post explaining the use of triggers to create prefixed IDs<br>
  <a href="https://stackoverflow.com/questions/17893988/how-to-make-mysql-table-primary-key-auto-increment-with-some-suffix">How to make MySQL table primary key auto increment with some prefix</a></p>
  
  <blockquote>
    <p><a href="http://sqlfiddle.com/#!2/0ed88/1" rel="nofollow noreferrer">http://sqlfiddle.com/#!2/0ed88/1</a></p>
  </blockquote>
  
  <p>I am really new to triggers and I would like to find out if there's a way to have the prefix be the Year-Month (YYMM) instead of the preset 4 letters "LHPL" as written in the SQLfiddle?</p>
  
  <p>Much appreciated! Lots to learn in this mysql journey!</p>
  
  <pre><code>    CREATE TABLE table1_seq
      (
        id INT NOT NULL AUTO_INCREMENT PRIMARY KEY
      )|
  
      CREATE TABLE Table1
      (
        id VARCHAR(7) NOT NULL PRIMARY KEY DEFAULT '0', name VARCHAR(30)
      )|
  
  
      CREATE TRIGGER tg_table1_insert
      BEFORE INSERT ON table1
      FOR EACH ROW
      BEGIN
        INSERT INTO table1_seq VALUES (NULL);
        SET NEW.id = CONCAT('LHPL', LPAD(LAST_INSERT_ID(), 3, '0'));
      END |
  
  
      INSERT INTO Table1 (name) VALUES ('Jhon'), ('Mark')|
  </code></pre>