I have been having issues switching to an offline version of the Lahman SQL baseball database. I was using a terminal embed into an EDX course. This command runs fine on the
For other use cases: You don't necessarily have to disable ONLY_FULL_GROUP_BY
Given a case like this, According to mysql docs, "This query is invalid if name is not a primary key of t or a unique NOT NULL column. In this case, no functional dependency can be inferred and an error occurs:"
SELECT name, address, MAX(age) FROM t GROUP BY name;
ERROR 1055 (42000): Expression #2 of SELECT list is not in GROUP
BY clause and contains nonaggregated column 'mydb.t.address' which
is not functionally dependent on columns in GROUP BY clause; this
is incompatible with sql_mode=only_full_group_by
Instead you can use this ANY_VALUE('my_column_name') my_column_name
Quoting the mysql docs, "In this case, MySQL ignores the nondeterminism of address values within each name group and accepts the query."
Use ANY_VALUE() to refer to address:
SELECT name, ANY_VALUE(address), MAX(age) FROM t GROUP BY name;