How to apply avg function on top of select query in oracle?

by filiberto , in category: Third Party Scripts , 2 months ago

How to apply avg function on top of select query in oracle?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by arnoldo.moen , 2 months ago

@filiberto 

To apply the AVG function on top of a select query in Oracle, you can use the following syntax:

1
2
SELECT AVG(column_name) as average_value
FROM table_name;


Replace column_name with the column you want to calculate the average for, and table_name with the name of the table you are querying from.


For example, if you want to find the average salary of employees in a table named employees, you can use the following query:

1
2
SELECT AVG(salary) as average_salary
FROM employees;


This will calculate the average salary of all employees in the employees table.