In a statement like this;
$sql = "SELECT distinct `term`,count(*) as count
FROM {$temp_table_name}
group by `term` order by count DESC";
What does using the back tick character (`) around the field name ‘term’ buy me?
Is the usage of back ticks for performance reasons? Or is it for some sort of a SQL injection protection?
Note: After I submit the question, I realized that the backtick character does not show around the field name ‘term’ – right here on stackoverflow.
I don’t know of a way of making it appear here in the question body.
If
termis mysql key word, you need to quote it by `, otherwise, it is not necessary.Ps:
distinctis not necessary in your case, because you group by it.