framework/db/Command.php
public function createView($viewName, $subquery)
    {
        $sql = $this->db->getQueryBuilder()->createView($viewName, $subquery);

        return $this->setSql($sql)->requireTableSchemaRefresh($viewName);
    }
public function createView($viewName, $subquery)
    {
        $sql = $this->db->getQueryBuilder()->createView($viewName, $subquery);

        return $this->setSql($sql)->requireTableSchemaRefresh($viewName);
    }
Creates a SQL View.

@param string $viewName the name of the view to be created.
@param string|Query $subquery the select statement which defines the view.
This can be either a string or a [[Query]] object.
@return $this the command object itself.
@since 2.0.14