Junior — Middle
How can you calculate the average value of a column in an SQL query?
sobes.tech AI
Answer from AI
To calculate the average value of a column in SQL, the aggregate function AVG() is used. For example, if you have a table employees with a column salary, the query to compute the average salary would look like:
SELECT AVG(salary) AS average_salary FROM employees;
This query will return a single number — the average value of the salary column.