Find the average salary of employees in the 'Sales' department.

This technical problem involves finding the average salary of all employees in the 'Sales' department. This can be accomplished by writing a query to select all employees in the 'Sales' department and then finding the average salary of those employees.

Problem

Write a query to find the average salary of all employees in the 'Sales' department.
Example input:
DEPARTMENT
Sales
Marketing
Accounting
Example output:
30000

Solution

This solution is in SQL. Our A.I. can create solutions in multiple languages.
by sarastevens
SELECT AVG(SALARY)
FROM EMPLOYEE
WHERE DEPARTMENT = 'Sales';

/*

The above query is optimal because it uses the WHERE clause to filter the table to only the rows that have the department 'Sales'.
This is optimal because it reduces the number of rows that need to be processed by the AVG function.

*/

A.I. Evaluation of the Solution

The candidate's solution is complete and solves the problem. The candidate's approach is efficient and uses the WHERE clause to filter the table to only the rows that have the department 'Sales', which reduces the number of rows that need to be processed by the AVG function.

Evaluated at: 2022-11-12 08:15:30