June 2010
Intermediate to advanced
328 pages
7h 51m
English
As we’ve seen, MySQL and SQLite can’t guarantee a reliable result for a column that doesn’t fit the Single-Value Rule. There are cases when you can take advantage of the fact that these databases enforce the rule less strictly than other brands.
| Groups/legit/functional.sql | |
| | SELECT b.reported_by, a.account_name |
| | FROM Bugs b JOIN Accounts a ON (b.reported_by = a.account_id) |
| | GROUP BY b.reported_by; |
In the previous query, the account_name column technically violates the Single-Value Rule, since it’s named neither in the GROUP BY clause nor in an aggregate function. Nevertheless, there is only one value possible for account_name in each group; the groups are based on Bugs.reported_by, which is a foreign ...
Read now
Unlock full access