Well, I came late, so I missed the first one….so we start with #2
#2. Ambiguous GROUP BY –
query BUGS and include details on the corresponding PRODUCT rows —
SELECT b.bug_id, p.product_name from bugs b NATURAL JOIN
bugs_products NATURAL JOIN products GROUP BY b.bug_id;
We use the GROUP BY to get one row per bug, but then you lose information.
Standard SQL says that GROUP BY queries require the GROUP BY columns to be in the SELECT clause. MySQL does not enforce this. If a column is in a SELECT clause but not in the GROUP BY clause it displays a random value.
[my note, not said in the presentation this fools people when they want the groupwise maximum, they think that selecting multiple columns and …
[Read more]