protected function addAggregate(string $function, $column, string $alias = null): self
    {
        $column = $this->checkStringValue('Argument $column', $column);

        $aggregate = new Aggregate($function, $column);
        if ($alias === null) {
            $this->select[] = $aggregate;
        } else {
            $this->select[$alias] = $aggregate;
        }

        return $this;
    }