Open In App

Abs() and Avg() Function in MS Access

Last Updated : 08 Sep, 2020
Comments
Improve
Suggest changes
Like Article
Like
Report
1. Abs() Function : In MS Access, the abs() function returns a positive (absolute) number. In this function, either a positive number or a negative number is passed, and it returns the absolute of that number. It takes a number as a parameter and it returns the positive value of that number. Syntax :
Abs(number)
Example -
SELECT Abs(-240.7) AS AbsNum;
Output -
AbsNum
240.7
Example -
SELECT Abs(120.89) AS AbsNum;
Output -
AbsNum
120.89

2. Avg() Function : In MS Access, the Avg() function is used for calculating the average of the numbers. In this function, a set of numbers/expression is passed and it returns the average of the input numbers. Note - If the null values are given then it will be ignored. Syntax :
Avg(expression)
Table - Stu_Details
TESTID USERNAME MARKS
101 GFG_1 47
102 GFG_2 78
103 GFG_3 67
Example-1:
SELECT Avg(MARKS) AS Average 
FROM Stu_Details;
Output -
Average
64
Example-2:
SELECT * 
FROM Stu_Details
WHERE MARKS > (SELECT Avg(MARKS) FROM Stu_Details);
Output -
TESTID USERNAME MARKS
102 GFG_2 78
103 GFG_3 67

Next Article
Article Tags :

Similar Reads