@param string      $column
@param string|null $alias

@return $this
338282
public function selectMin(string $column, string $alias = null)
    {
        $instance = $this->selectQueryInstance();

        $instance->selectQuery()->min($column, $alias);

        return $instance;
    }
1288301
public function selectMax(string $column, string $alias = null)
    {
        $instance = $this->selectQueryInstance();

        $instance->selectQuery()->max($column, $alias);

        return $instance;
    }
1356936
public function func($func, $column, $alias = null)
    {
        if (!is_array($column)) {
            $column = array($column);
        }

        // Append a comma if there was a column selection and no function call
        if (!empty($this->selected) && $this->hasFunctionCall === false) {
            $this->append(', ');
        }

        $this->append($this->createFunction($func, $column, $alias));
        return $this;
    }
924161
public final function alias($alias) {
        $this->alias         = $alias;
        $this->qualifiedName = $this->table . ' AS ' . $this->alias;

        return $this;
    }
1359098
public function setAlias($name, $alias)
    {
        if ($alias === null && isset($this->aliases[$name])) {
            unset($this->aliases[$name]);
        } else {
            $this->aliases[$name] = $alias;
        }

        return $this;
    }
379075
public function addAliasedRawColumn(string $alias, string $column)
    {
        $table = $this->getTable();

        if (!$table->hasColumn($column)) {
            throw InvalidArgumentException::format(
                    'Invalid column for select: must be one of (%s), \'%s\' given',
                    Debug::formatValues($table->getColumnNames()), $column
            );
        }

        $this->aliasColumnMap[$alias] = Expr::column($this->getTableAlias(), $table->findColumn($column));

        return $this;
    }
748698
public function min(string $column, string $alias = null)
    {
        $this->columnRaw($this->dialect()->min($column, $alias));

        return $this;
    }
39542
public function alias($alias)
    {
        $this->alias = $alias;

        if (!in_array('`' . $alias . '`.*', $this->select)) {
            $this->select[] = '`' . $alias . '`.*';
        }

        if (in_array('`' . $this->table . '`.*', $this->select)) {
            unset($this->select[array_search('`' . $this->table . '`.*', $this->select)]);
        }

        return $this;
    }
489164
public function count(string $column = '*', string $alias = null)
    {
        $this->columnRaw($this->dialect()->count($column, $alias));

        return $this;
    }
1101789
public function selectSum(string $column, string $alias = null)
    {
        $instance = $this->selectQueryInstance();

        $instance->selectQuery()->sum($column, $alias);

        return $instance;
    }
509440
public function count(string $column = '*', string $alias = 'count'): ResultInterface
    {
        $this->aggregate['count'] = [$column, $alias];
        $this->addAggregateDecorator($alias);

        return $this->execute();
    }
652761
public function addMax($column, string $alias = null): self
    {
        return $this->addAggregate('MAX', $column, $alias);
    }
994147
public function setAliasOf($alias) {
        $alias = $this->normalizeID($alias);

        if ($alias === $this->currentRuleName) {
            trigger_error("You cannot set alias '$alias' to itself.", E_USER_NOTICE);
        } else {
            $this->currentRule['aliasOf'] = $alias;
        }
        return $this;
    }
934332
public function column(string $column = null): self
    {
        if (! is_null($column)) {
            $this->column = $column;
        }

        if ($this->locale && ! is_null($column)) {
            $locale = '.'.app()->getLocale().'.';
            $this->column = preg_replace('/'.preg_quote('.', '/').'/', $locale, $column);
        }

        return $this;
    }
238008
public function alias(string $alias): AliasInterface
    {
        if (!in_array($alias, $this->alias)) {
            $this->alias[] = $alias;
        }
        $this->aliasHelper($alias);

        return $this;
    }
1141292
public function len($column, string $alias = null): self
    {
        return $this->column((new Expression())->len($column), $alias);
    }
727676
public function alias($alias = null)
    {
        if ($alias === null) {
            return $this->_alias;
        }
        $this->_alias = $alias;

        return $this;
    }