Abs() and Avg() Function in MS Access

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
My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.