0 follower

Interface Yiisoft\Db\Query\QueryFunctionsInterface

Implemented byYiisoft\Db\Query\QueryInterface

A query function is a function that's called in a query to perform operation on the data selected or updated.

Examples of query functions might include {@see \Yiisoft\Db\Query\count()}, {@see \Yiisoft\Db\Query\sum()}, {@see \Yiisoft\Db\Query\average()}, and {@see \Yiisoft\Db\Query\max()}.

Public Methods

Hide inherited methods

Method Description Defined By
average() Returns the average of the specified column values. Yiisoft\Db\Query\QueryFunctionsInterface
count() Returns the number of records. Yiisoft\Db\Query\QueryFunctionsInterface
max() Returns the maximum of the specified column values. Yiisoft\Db\Query\QueryFunctionsInterface
min() Returns the minimum of the specified column values. Yiisoft\Db\Query\QueryFunctionsInterface
sum() Returns the sum of the specified column values. Yiisoft\Db\Query\QueryFunctionsInterface

Method Details

Hide inherited methods

average() public abstract method

Returns the average of the specified column values.

public abstract float|integer|string|null average ( string $sql )
$sql string

The column name or expression.

return float|integer|string|null

The average of the specified column values.

Note: Make sure you quote column names in the expression.

throws Throwable

                public function average(string $sql): int|float|string|null;

            
count() public abstract method

Returns the number of records.

Note: Make sure you quote column names in the expression.

public abstract integer|string count ( string $sql '*' )
$sql string

The COUNT expression. Defaults to '*'.

return integer|string

Number of records. The result will be a string when value is higher than {@see \Yiisoft\Db\Query\PHP_INT_MAX}.

throws Yiisoft\Db\Exception\InvalidConfigException
throws Throwable
throws Yiisoft\Db\Exception\Exception

                public function count(string $sql = '*'): int|string;

            
max() public abstract method

Returns the maximum of the specified column values.

public abstract float|integer|string|null max ( string $sql )
$sql string

The column name or expression.

return float|integer|string|null

The maximum of the specified column values.

Note: Make sure you quote column names in the expression.

throws Yiisoft\Db\Exception\InvalidConfigException
throws Throwable
throws Yiisoft\Db\Exception\Exception

                public function max(string $sql): int|float|string|null;

            
min() public abstract method

Returns the minimum of the specified column values.

public abstract float|integer|string|null min ( string $sql )
$sql string

The column name or expression.

return float|integer|string|null

The minimum of the specified column values.

Note: Make sure you quote column names in the expression.

throws Yiisoft\Db\Exception\InvalidConfigException
throws Throwable
throws Yiisoft\Db\Exception\Exception

                public function min(string $sql): int|float|string|null;

            
sum() public abstract method

Returns the sum of the specified column values.

public abstract float|integer|string|null sum ( string $sql )
$sql string

The column name or expression.

return float|integer|string|null

The sum of the specified column values.

Note: Make sure you quote column names in the expression.

throws Yiisoft\Db\Exception\InvalidConfigException
throws Throwable
throws Yiisoft\Db\Exception\Exception

                public function sum(string $sql): int|float|string|null;