Skip to content
Related Articles

Related Articles

Save Article
Improve Article
Save Article
Like Article

Abs() and Avg() Function in MS Access

  • Difficulty Level : Medium
  • Last Updated : 08 Sep, 2020

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 :

Attention reader! Don’t stop learning now. Learn SQL for interviews using SQL Course  by GeeksforGeeks.

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

TESTIDUSERNAMEMARKS
101GFG_147
102GFG_278
103GFG_367

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 –

TESTIDUSERNAMEMARKS
102GFG_278
103GFG_367
My Personal Notes arrow_drop_up
Recommended Articles
Page :