"if you encounter any errors in SAP, send me a screenshot at pramod@learntosap.com, and I will help you resolve the issue."

SQL AVG() Function

SQL TUTORIALS-

SQL AVG() Function

Introduction-


Trulli Trulli

-✅SQL AVG() function is used to calculate the average value of a numeric column in a database table...


Emoji Examples in HTML

🔸 Example Table: Employees


ID Name Department Salary Location
1 ANNI IT 10000 PUNE
2 SUJAN HR 8000 MUMBAI
3 BOULT SALES 5000 DELHI

✅ Example 1: Average Salary of All Employees.



SELECT AVG(Salary) AS AverageSalary
FROM Employees;

✅Result Show :-

Result → 7000 |


✅ Example 2: Average Salary for IT Department Only.



SELECT AVG(Salary) AS AvgITSalary
FROM Employees
WHERE Department = 'IT';

✅Result Show :-

Average Salary → 10000 |


✅ Example 3: Departments Having Average Salary > 8000.



SELECT Department, AVG(Salary) AS AvgSalary
FROM Employees
GROUP BY Department
HAVING AVG(Salary) > 8000;



✅Result Show :-

Salary → 10000 |

✅ Example 4: AVG() with GROUP BY and a WHERE clause.



SELECT Department, AVG(Salary) AS AvgSalary
FROM Employees
WHERE Location = 'Mumbai'
GROUP BY Department;

✅Result Show :-

Salary → 8000 |


May Be Like Important Link-

-How To Import Data(LSMW) LEGACY SYSTEM MIGRATION WORKBENCH

-Define Condition Type-OBYZ

-Genral Ledger Chart Of Accounts-OBD4

-Document 90039783 saved (no accounting document generated)