I do join 2 tables via SQL and add where clauses. The join is done by a condition in the where clause. I wonder if it makes a difference whether the where clauses expect the join clause are grouped by brackets.
To ask with examples: is example 1 equivalent to example 2 and example 3?
Example 1 (no grouping):
SELECT * FROM employees, vacation
WHERE employees.first_name = 'Maria' and vacation_start > 2017
AND employees.employee_id = vacation.employee_id
Example 2 (everything except join clause is grouped):
SELECT * FROM employees, vacation
WHERE (employees.first_name = 'Maria' and vacation_start > 2017)
AND employees.employee_id = vacation.employee_id
Example 3 (join clause is first where argument):
SELECT * FROM employees, vacation
WHERE employees.employee_id = vacation.employee_id
AND (employees.first_name = 'Maria' and vacation_start > 2017)
I always assumed that databases will optimize this kind of queries. But do they? I'm primarily working with MariaDB and SQLite.