Use ANSI Style for MySQL
I prefer to use ANSI style for writing MySQL queries. When I started working on SQL, I used the old style aka Theta style for all my queries. Example of a query in Theta style :
SELECT e.title, i.first_name, i.response
FROM invitees i,
events e
WHERE e.id = i.event_id
AND e.date = ‘2008-07-04’;
which , in ANSI style is equivalent to :
SELECT e.title, i.name, i.response
FROM invitees i
INNER JOIN events e on e.id = i.event_id
WHERE e.date = ‘2008-07-04’
Many developers prefer using the old style. But believe me, ANSI style is lot better and advantageous.
First, MySQL supports OUTER JOINs in ANSI style. Second, ANSI style forces you to think about your joins clearly. Your code is lot more readable in ANSI style. For example, all the joins go in the FROM clause, and the WHERE clause is left with only statements which filter out the result set of the tables in the join. You get a clear picture of how the tables are linked with each other.
For more information on Joins, see Reference below.
Reference : Join Syntax in MySQL
[Permalink](the_permalink(); ?>)