You can drop a percent sign if you don’t have a table prefix.
$this->addColumn(’{{sku}}’
But I don’t understand why would you need to use that second option, if everything works fine. So I’d say the best practice is provided by developers, the first one.
If there is some prefix configured on the db connection, the {{}} prefix it and you don’t have to type it everywhere. Then you need to change the prefix, you change in the connection setting and not in all the code.
Consider that your tables are named tbl_user, tbl_thing
in the connection the prefix is set to ‘tbl_’
then, in active records the value for tableName is {{user}}, {{thing}}
I don’t know how to put it well, but curly braces are for a correct SQL-command.
// executes this SQL for MySQL: SELECT COUNT(`id`) FROM `employee`
$count = Yii::$app->db->createCommand("SELECT COUNT([[id]]) FROM {{employee}}")->queryScalar();