Find the average salary of all employees in a company using SQL.

The average salary of all employees in a company can be found using a SQL query. For example, if the employees table contains the following columns: ID, NAME, and SALARY, the average salary can be calculated by querying the table for the average value of the SALARY column.

Problem

Write a SQL query to find the average salary of all employees in the company.
Example input:
EMPLOYEES table:
ID | NAME | SALARY
1 | John | 50000
2 | Jane | 60000
3 | Smith | 40000
4 | Doe | 70000
Example output:
Average salary: 55000

Solution

This solution is in SQL. Our A.I. can create solutions in multiple languages.
by sarastevens
SELECT AVG(SALARY) FROM EMPLOYEES;

/*

The above solution is optimal because it is the simplest solution that will return the correct result.

*/

A.I. Evaluation of the Solution

The candidate's solution is correct and demonstrates a level of completeness. The solution is also optimal, as it is the simplest solution that will return the correct result.

Evaluated at: 2022-11-24 02:16:23