Introduction
There are three main methods to work with databases in Yii: Active Record, query builder, and direct SQL queries through DAO. All three are different in terms of syntax, features, and performance.
In this chapter we will learn how to work with the database efficiently, when to use models and when not to, how to work with multiple databases, how to automatically preprocess Active Record fields, and how to use powerful database criteria.
In this chapter we will use the Sakila sample database Version 0.8, available at the official MySQL website: http://dev.mysql.com/doc/index-other.html.