NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
You assume... (Score:1)
SQL is not about reducing redundancy.
SQL is about offloading work related to data storage retrieval to a dedicated machine.
Should I have to implement my own grouping code in every single application?
Re: (Score:2)
Should I have to implement my own grouping code in every single application?
No, I think his basic idea is that the database should be able to deduce the
GROUP BYclause from the rest of the statement. Now, a database complains if you output a column that isn't in an aggregate function, or in the GROUP BY clause. Instead, it could implicitly add the column to the GROUP BY clause.I don't think that overall it would save much typing. And having to be explicit has its advantages, in cases the SQL statement implies a different grouping than what you had in mind.
Offered without further comment (Score:1)
Re: (Score:2)
Maybe I need the comments to clue me in. The last two won't work ... is your point that in such an instance having the GROUP BY allows the programmer to figure out what the previous programmer meant and correct? Because I thought I clearly limited myself to talking about interactive, one-shot queries. This is like requiring strict for a perl-one liner. :)
As near as I can tell, there is no difference between the first two, although I'm willing to be enlightened. I may just be sleepy on this early Monda
J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
Re: (Score:1)
Why won’t the last two work?
As for the first two, you’re right, there is no difference. Order matters when you use window functions, but not in ordinary grouping.
Re: (Score:2)
Never mind, they will. It's just not something I do often. And I think you've shown me why that clause can't be made optional. Of course, I'd prefer that it be made optional and that expressing the fields to group by in the SELECT be made mandatory, but I guess that would probably bork a lot of people up. :)
J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers