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

@return $this
489164
public function count(string $column = '*', string $alias = null)
    {
        $this->columnRaw($this->dialect()->count($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;
    }
1128460
public function from($table, $alias = null)
    {
        if ($table) {
            if (!$this->_model && strpos($table, '\\') !== false) {
                $this->_model = $this->_di->getShared($table);
            }

            $this->_tables = $alias ? [$alias => $table] : [$table];

            if ($table instanceof self) {
                $this->_db = $table->_db;
            }
        }

        return $this;
    }
74780
public function max($column, $alias = null)
    {
        $this->queryBuilder->max($column, $alias);
        return $this;
    }
582613
public function min($column, $alias = null)
    {
        $this->queryBuilder->min($column, $alias);
        return $this;
    }
1165167
public function selectColumn(string $column, ?string $alias = null)
    {
        $instance = $this->selectQueryInstance();

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

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

        $instance->selectQuery()->min($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();
    }
736264
public function addSelectColumn($expression, $alias = null)
    {
        if (!($expression instanceof Expression)) {
            $expression = new Expr\Column($expression);
        }
        
        $expression = $this->completeExpression($expression, $alias);
        
        $this->columns->add($expression->hashCode());
        
        return $this;
    }
924161
public final function alias($alias) {
        $this->alias         = $alias;
        $this->qualifiedName = $this->table . ' AS ' . $this->alias;

        return $this;
    }
268451
public function max(string $column, string $alias = null): string
    {
        if ($alias) {
            $alias = $this->quoteName($alias);
        }

        return 'MAX(' . $this->quoteName($column) . ')' . ($alias ? ' AS ' . $alias : '');
    }
84120
public function column($name, $alias = null)
    {
        if ($alias === null) {
            $this->columns[] = $this->grammar->buildId($name);
        } else {
            $this->columns[] = $this->grammar->buildIdWithAlias($name, $alias);
        }

        return $this;
    }
846828
public function columnSelect(self $query, ?string $alias = null)
    {
        if ($alias) {
            $alias = $this->dialect()->quoteName($alias);
        }

        $this->addColumn($query, $alias);

        return $this;
    }
1055304
public function alias(string $alias, string $concrete): self
    {
        $this->data->alias($alias, $concrete);
        return $this;
    }
585831
public function ucase($column, string $alias = null): self
    {
        return $this->column((new Expression())->ucase($column), $alias);
    }
787089
public function from($table, $alias = null)
    {
        if ($alias === null) {
            $this->from[] = $this->grammar->buildId($table);
        } else {
            $this->from[] = $this->grammar->buildIdWithAlias($table, $alias);
        }

        return $this;
    }