?

Log in

No account? Create an account
AlbertJayNock

SQL syntax and Cannibalism

The other day in my database class I was going over a test I had just given back. A common mistake was students omitting a needed GROUP BY clause in a query. One of the students asked why it was necessary. I told her that without the GROUP BY  clause, the query would still be syntactically correct, but would not give the desired results, or even useful ones.

I talked a little about what the differences were, and then told the class that leaving out the GROUP BY clause is as serious an error as leaving out the comma in this sentence:

Let's eat, grandma


Of course the "let's eat, grandma" example is an old internet meme. I was still pleased with  myself for thinking of it and seeing how it applied to my lesson. But I was also grateful to the internet grammar nazis for providing me with useful material. Thanks, internet grammar nazis!!




I did not want to give the test question or correct query here. That's why I was a bit skimpy in this post about the SQL-specific parts of my explanation. For those wanting a little more depth, I found a remarkably similar example here.
Tags:

Comments