Building queries

September 2, 2025 ยท View on GitHub

To build a Yiisoft\Db\Query\Query object, you call various query building methods to specify different parts of a SQL query.

The names of these methods resemble the SQL keywords used in the corresponding parts of the SQL statement. For example, to specify the FROM part of a SQL query, you would call the Yiisoft\Db\Query\Query::from() method. All the query building methods return the query object itself, which allows you to chain many calls together.

Also see: