Working with my own SQL query

Hi, I found this docs

http://www.yiiframework.com/doc/guide/1.1/en/database.dao

After reading this docs I want to try it.but I am confuse where should I put those sql statements and the connections statements of my db. Is it in my created model or I need to create a new php file under models folder. then put those sql statements ?

please enlighten my mind.

Thank you.

hi, commonly database connection query is inside the config/mains.php which You may know ,you can override this query using the database connection string which u have found, and before that u have to close the previous connection if it is there. u can put your mannual new database string query anywhere and better if u trigger that string from Yii base controller.

thank you