How to use aggregate functions in Laravel Query?

Laravel provides a variety of aggregate functions such as max, min, count,avg, and sum. We can call any of these functions after constructing our query.

$users = DB::table(‘admin’)->count();
$maxComment = DB::table(‘blogs’)->max('comments');

Suggest An Answer

No suggestions avaliable!

Latest post from Laravel Interview Questions

Ask Question