Well, pretty simple question I think, but I can\'t find a satisfying answer. Is there a difference between these two queries?
SELECT * FROM table WHERE colum
No, there's not a single difference.
See more MySQL Syntax here.
The role of parenthesis will be usefull when there is one more condition with AND operator. otherwise no difference in execution plan except syntax.
No. its the same. As long as there are only two conditions braces doesn't have much significance.
Further to my comment above, the manual explains:
Some of the optimizations performed by MySQL follow:
Removal of unnecessary parentheses:
((a AND b) AND c OR (((a AND b) AND (c AND d)))) -> (a AND b AND c) OR (a AND b AND c AND d)
So no, there is no difference whatsoever.
Right now there is NO difference in your queries.
There would be difference if there would be AND
condition as addition in your query.
e.g
SELECT * FROM table WHERE id=1 AND column1 = 'x' OR column2 = 'x'
and
SELECT * FROM table WHERE id=1 AND (column1 = 'x' OR column2 = 'x')
SELECT * FROM table WHERE id=1 AND column1 = 'x' OR column2 = 'x'
would be equivalent to
SELECT * FROM table WHERE (id=1 AND column1 = 'x') OR column2 = 'x'