$command = $connection->createCommand('SELECT * from table ');
$result = $command->queryAll();
or you can this also
use yii\db\Query; //import this first
$query = new Query();
$query = Student::find() //student is model class
->select(['attributes','...']) // if u need specific fields
->where('condition')
->asArray()
->all();