function addRole() {

  connection.query("SELECT name FROM department", function (err, res) {
    console.log(res)
    var role_title = []
    for (var i = 0; i < res.length; i++) {


      role_title.push(res[i].name)
      console.log(role_title)
    }

    inquirer
      .prompt([
        {
          name: "role",
          type: "input",
          message: "Enter new role name"
        },
        {
          name: "salary",
          type: "input",
          message: "Enter new role salary"
        },
        {
          name: "employee_role",
          type: "list",
          message: "What is the department for the new role?",
          pageSize: 7,
          choices: role_title
        }

      ])
      .then(function (answer) {
        // when finished prompting, insert new depsrtment info into table
        connection.query("SELECT id FROM department WHERE name = ? ",
          [answer.role_title],
          function (err, res) {
            if (err) throw err;
            connection.query(
              "INSERT INTO employee_role(title, salary, department_id) VALUES (?, ?, ?)",

              [answer.role, answer.salary, res.id],

              function (err) {
                if (err) throw err;
                console.log("Your new role has been entered");

                start();
              }
            )
          }

        );
      }
      )

  })
}
//   NOT WORKING WHEN ENTER NEW DEPARTMENT.  GET THIS ERROR:  Unknown column 'department' in 'field list'
NOT WORKING WHEN ENTER NEW DEPARTMENT.  GET THIS ERROR:  Unknown column 'department' in 'field list'
NOT WORKING WHEN ENTER NEW DEPARTMENT . GET THIS ERROR : Unknown column ' department ' in ' field list '
function addRole() {
  connection.query("SELECT name FROM department", function (err, res) {
    console.log(res)
    var role_title = []
    for (var i = 0; i < res.length; i++) {
      role_title.push(res[i].name)
      console.log(role_title)
    }
    inquirer
      .prompt([
        {
          name: "role",
          type: "input",
          message: "Enter new role name"
        },
        {
          name: "salary",
          type: "input",
          message: "Enter new role salary"
        },
        {
          name: "employee_role",
          type: "list",
          message: "What is the department for the new role?",
          pageSize: 7,
          choices: role_title
        }
      ])
      .then(function (answer) {
        connection.query("SELECT id FROM department WHERE name = ? ",
          [answer.role_title],
          function (err, res) {
            if (err) throw err;
            connection.query(
              "INSERT INTO employee_role(title, salary, department_id) VALUES (?, ?, ?)",
              [answer.role, answer.salary, res.id],
              function (err) {
                if (err) throw err;
                console.log("Your new role has been entered");
                start();
              }
            )
          }
        );
      }
      )
  })
}
function addRole ( ) { connection . query ( "SELECT name FROM department" , function ( err , res ) { console . log ( res ) var role_title = [ ] for ( var i = 0 ; i < res . length ; i ++ ) { role_title . push ( res [ i ] . name ) console . log ( role_title ) } inquirer . prompt ( [ { name : "role" , type : "input" , message : "Enter new role name" } , { name : "salary" , type : "input" , message : "Enter new role salary" } , { name : "employee_role" , type : "list" , message : "What is the department for the new role?" , pageSize : 7 , choices : role_title } ] ) . then ( function ( answer ) { connection . query ( "SELECT id FROM department WHERE name = ? " , [ answer . role_title ] , function ( err , res ) { if ( err ) throw err ; connection . query ( "INSERT INTO employee_role(title, salary, department_id) VALUES (?, ?, ?)" , [ answer . role , answer . salary , res . id ] , function ( err ) { if ( err ) throw err ; console . log ( "Your new role has been entered" ) ; start ( ) ; } ) } ) ; } ) } ) }
NOT WORKING WHEN ENTER NEW DEPARTMENT.
NOT WORKING WHEN ENTER NEW DEPARTMENT .
// when finished prompting, insert new depsrtment info into table