The reason its considered good practice to store the query in a variable is simply to make debugging easier. You can then do something like this to help in finding problems:
$sql = "SELECT columns FROM table WHERE column = 'value'";
$result = mysql_query($sql);
if( !$result ) {
$err = sprintf('Query Error: (%d) %s<br>Query: %s',mysql_errno(),mysql_error(),$sql);
trigger_error($err,E_USER_ERROR);
}
This is especially helpful when using variables to create the query, as you can then output the query exactly as sent to the mysql engine. Otherwise, without storing the query in a variable, you would have no way of seeing exactly what was sent to the DB when an error occurred.
HTH