List some Aggregates methods provided by query builder in Laravel ?
List some Aggregates methods provided by query builder in Laravel ?
Laravel's query builder provides a variety of aggregate methods that allow you to perform calculations on your database records. Here are some of the key aggregate methods available:
count(): This method returns the number of records that match the query.
$userCount = DB::table('users')->count();
max(): This method retrieves the maximum value of a specified column.
$maxPrice = DB::table('orders')->max('price');
min(): This method retrieves the minimum value of a specified column.
Đăng nhập để tham gia thảo luận cùng mọi người.
Chưa có bình luận nào
Hãy là người đầu tiên chia sẻ suy nghĩ của bạn.