Built on top of Database Access Objects, query builder allows you to construct a SQL query in a programmatic and DBMS-agnostic way- Compared to writing raw SQL statements, using query builder will help you write more readable SQL-related code and generate more secure SQL statements-
Using query builder usually involves two steps:
SELECT
, FROM
) of a SELECT SQL statement.all()
) of yii\db\Query to retrieve data from the database-The following code shows a typical way of using query builder:
登錄查看完整內(nèi)容