-- Database schema
| location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID |
-- -- Calculate the monthly average salary of the employee with highest salary. Mention his name, position title and location city.

SELECT SUM(CAST(REPLACE(SUBSTR(T1.salary, 4), ',', '') AS REAL)) / 12 AS avg, T1.firstname, T1.lastname , T2.positiontitle, T3.locationcity FROM employee AS T1  INNER JOIN position AS T2  ON T1.positionID = T2.positionID INNER JOIN location AS T3  ON T1.locationID = T3.locationID WHERE CAST(REPLACE(SUBSTR(T1.salary, 4), ',', '') AS REAL) = ( SELECT MAX(CAST(REPLACE(SUBSTR(T1.salary, 4), ',', '') AS REAL)) FROM employee AS T1  INNER JOIN position AS T2  ON T1.positionID = T2.positionID INNER JOIN location AS T3  ON T1.locationID = T3.locationID );