Databases and SQL: Suggested Command in W3 Schools Editor Causes Error
Checks
- [X] This is not a duplicate of an existing issue (please have a look through our open issues list to make sure)
- [X] I have thoroughly read and understand The Odin Project Contributing Guide
- [X] Would you like to work on this issue?
Describe your suggestion
Issue
The section on aggregate functions contains the following suggestion:
See W3 Schools’ article and play around with the SQL in the window (try deleting the GROUP BY line) for an interactive visual.
Deleting this line in the linked editor changes the query from:
SELECT COUNT(CustomerID), Country FROM Customers GROUP BY Country;
To:
SELECT COUNT(CustomerID), Country FROM Customers;
When the new query is run, it causes the editor to throw an error:
Error in SQL: You tried to execute a query that does not include the specified expression 'Country' as part of an aggregate function.
Suggestion
Remove the text in parentheses.
play around with the SQL in the window (try deleting the GROUP BY line) for an interactive visual.
Alternatively, the lesson should be more specific in what it wants students to learn by deleting this line. If the goal is to show students the error then it should come with an explanation that SQL needs to know how to group the rows for non-aggregated columns. The syntax in the current error message isn't enough for someone new to SQL.
Path
Ruby / Rails
Lesson Url
https://www.theodinproject.com/lessons/databases-databases-and-sql
(Optional) Discord Name
columk
(Optional) Additional Comments
No response