Active records query interface provide us with some very nice features to perform calculations or mathematical operations to retrieve selected records on the basis of those mathematical calculations. Those methods are as follows:
Count method allows us to count the specific records which we need from our table. This can be applied on any query to count the records retrieved from the table. It can be written as follows :
This will give us the number of all users whose name is Harry.
This method will give us the average (most probably a floating point number) of all the selected records. It can be written as follows:
This will give us the average salary of all the employees stored in the database.
This method gives us the maximum value of a field in the table.
This will give us the student who has got maximum attendance.
This method gives us the minimum value of a field in the table.
This will give us the student who has got minimum attendance.
This method gives us the sum of the records of the field in the table.
This will give us the total orders given by customers.