New MySQL version, YAY!
MySQL 5.7 is full of new features, like virtual columns, virtual indexes and JSON fields! But, it came with some changes to the default configuration. When running:
SELECT @@GLOBAL.sql_mode;
We get:
ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
What I want to talk about is the ONLY_FULL_GROUP_BY
mode. This mode rejects queries where nonaggregated columns are
expected, but aren’t on the GROUP BY
or
HAVING
clause. Before MySQL 5.7.5,
ONLY_FULL_GROUP_BY
was disabled by default, now it
is enabled.
You know the drill…
This is a simple statement, people use it everywhere, it shouldn’t be that hard to use, right?
Given the following schema:
Suppose I want to list all users that commented on …
[Read more]