title: how to use MySQL code directly into a Yii query
body: <p>I have this MySQL insert:</p>
  
  <pre><code>INSERT INTO restaurant (id_restaurant, id_category)
  SELECT id_rest, id_cat
  FROM restaurant_menu rm, category_menu cm
  WHERE rm.name = "discount" AND cm.name = "beach";
  </code></pre>
  
  <p>but now I want to do this insert in Yii. I know that I can do it using <a href="http://www.yiiframework.com/doc/guide/1.1/en/database.query-builder" rel="nofollow">Yii query builder</a>, but I think that if the query/insert/delete/update is very long, that is too complex. Therefore, I would like to know if is possible to use MySQL code into a Yii code directly, I mean, for example something similar to this:</p>
  
  <pre><code>$sql='INSERT INTO restaurant (id_restaurant, id_category) SELECT id_rest, id_cat FROM restaurant_menu rm, category_menu cm WHERE rm.name = "discount" AND cm.name = "beach"'
  
  $command=$connection-&gt;createCommand($sql);
  </code></pre>
  
  <p>Please, someone could show me how to do this insert using the MySQL code directly in Yii?</p>