HR Schema for MySQL and Maria DB

If you are familiar with Oracle’s HR schema you may find the following useful.

I’ve written a script that generates a similar sample schema for MySQL and MariaDB. The table structure and data remains the same.

Database Diagram (this file was generated using MySQL Workbench):

hr_mysql

 

The SQL script can be found here

To clone the GitHub project:

10 thoughts to “HR Schema for MySQL and Maria DB”

  1. With my thanks to the author for this effort , Here it is the missing part of the Job_Hostory

    INSERT INTO job_history
    VALUES (
    102,
    STR_TO_DATE(’13-Jan-1993′, ‘%d-%M-%Y’),
    STR_TO_DATE(’24-Jul-1998′, ‘%d-%M-%Y’),
    ‘IT_PROG’,
    60
    );

    INSERT INTO job_history
    VALUES (
    101,
    STR_TO_DATE(’21-Sep-1989′, ‘%d-%M-%Y’),
    STR_TO_DATE(’27-Oct-1993′, ‘%d-%M-%Y’),
    ‘AC_ACCOUNT’,
    110
    );

    INSERT INTO job_history
    VALUES (
    101,
    STR_TO_DATE(’28-Oct-1993′, ‘%d-%M-%Y’),
    STR_TO_DATE(’15-Mar-1997′, ‘%d-%M-%Y’),
    ‘AC_MGR’,
    110
    );

    INSERT INTO job_history
    VALUES (
    201,
    STR_TO_DATE(’27-Feb-1996′, ‘%d-%M-%Y’),
    STR_TO_DATE(’19-Dec-1999′, ‘%d-%M-%Y’),
    ‘MK_REP’,
    20
    );

    INSERT INTO job_history
    VALUES (
    114,
    STR_TO_DATE(’24-Mar-1998′, ‘%d-%M-%Y’),
    STR_TO_DATE(’31-Dec-1999′, ‘%d-%M-%Y’),
    ‘ST_CLERK’,
    50
    );

    INSERT INTO job_history
    VALUES (
    122,
    STR_TO_DATE(’01-Jan-1999′, ‘%d-%M-%Y’),
    STR_TO_DATE(’31-Dec-1999′, ‘%d-%M-%Y’),
    ‘ST_CLERK’,
    50
    );

    INSERT INTO job_history
    VALUES (
    200,
    STR_TO_DATE(’17-Sep-1987′, ‘%d-%M-%Y’),
    STR_TO_DATE(’17-Jun-1993′, ‘%d-%M-%Y’),
    ‘AD_ASST’,
    90
    );

    INSERT INTO job_history
    VALUES (
    176,
    STR_TO_DATE(’24-Mar-1998′, ‘%d-%M-%Y’),
    STR_TO_DATE(’31-Dec-1998′, ‘%d-%M-%Y’),
    ‘SA_REP’,
    80
    );

    INSERT INTO job_history
    VALUES (
    176,
    STR_TO_DATE(’01-Jan-1999′, ‘%d-%M-%Y’),
    STR_TO_DATE(’31-Dec-1999′, ‘%d-%M-%Y’),
    ‘SA_MAN’,
    80
    );

    INSERT INTO job_history
    VALUES (
    200,
    STR_TO_DATE(’01-Jul-1994′, ‘%d-%M-%Y’),
    STR_TO_DATE(’31-Dec-1998′, ‘%d-%M-%Y’),
    ‘AC_ACCOUNT’,
    90
    );

  2. Hi, the script below gives me an error syntax, it seems that does not recognizes STR_YO_DATE, can someone help me?

    1. Dear Sebastian
      Above script has some typing errors you may follow replace above script with following:
      INSERT INTO job_history
      VALUES (
      102,
      STR_TO_DATE(’13-Jan-1993′, ‘%d-%M-%Y’),
      STR_TO_DATE(’24-Jul-1998′, ‘%d-%M-%Y’),
      ‘IT_PROG’,
      60
      );

      INSERT INTO job_history
      VALUES (
      101,
      STR_TO_DATE(’21-Sep-1989′, ‘%d-%M-%Y’),
      STR_TO_DATE(’27-Oct-1993′, ‘%d-%M-%Y’),
      ‘AC_ACCOUNT’,
      110
      );

      INSERT INTO job_history
      VALUES (
      101,
      STR_TO_DATE(’28-Oct-1993′,’%d-%M-%Y’),
      STR_TO_DATE(’15-Mar-1997′,’%d-%M-%Y’),
      ‘AC_MGR’,
      110
      );

      INSERT INTO job_history
      VALUES (
      201,
      STR_TO_DATE(’27-Feb-1996′,’%d-%M-%Y’),
      STR_TO_DATE(’19-Dec-1999′,’%d-%M-%Y’),
      ‘MK_REP’,
      20
      );

      INSERT INTO job_history
      VALUES (
      114,
      STR_TO_DATE(’24-Mar-1998′,’%d-%M-%Y’),
      STR_TO_DATE(’31-Dec-1999′,’%d-%M-%Y’),
      ‘ST_CLERK’,
      50
      );

      INSERT INTO job_history
      VALUES (
      122,
      STR_TO_DATE(’01-Jan-1999′,’%d-%M-%Y’),
      STR_TO_DATE(’31-Dec-1999′,’%d-%M-%Y’),
      ‘ST_CLERK’,
      50
      );

      INSERT INTO job_history
      VALUES (
      200,
      STR_TO_DATE(’17-Sep-1987′,’%d-%M-%Y’),
      STR_TO_DATE(’17-Jun-1993′,’%d-%M-%Y’),
      ‘AD_ASST’,
      90
      );

      INSERT INTO job_history
      VALUES (
      176,
      STR_TO_DATE(’24-Mar-1998′,’%d-%M-%Y’),
      STR_TO_DATE(’31-Dec-1998′,’%d-%M-%Y’),
      ‘SA_REP’,
      80
      );

      INSERT INTO job_history
      VALUES (
      176,
      STR_TO_DATE(’01-Jan-1999′,’%d-%M-%Y’),
      STR_TO_DATE(’31-Dec-1999′,’%d-%M-%Y’),
      ‘SA_MAN’,
      80
      );

      INSERT INTO job_history
      VALUES (
      200,
      STR_TO_DATE(’01-Jul-1994′,’%d-%M-%Y’),
      STR_TO_DATE(’31-Dec-1998′,’%d-%M-%Y’),
      ‘AC_ACCOUNT’,
      90
      );

      This will work for sure.

  3. The job_history inserting statement got syntax errors because of some of the quotes are not of the right font. Try replacing the doggy ones with (‘).

Leave a Reply

Your email address will not be published. Required fields are marked *

Are we human, or are we dancer *