On the Group by lesson, we have the query
group by first_name;
I match results, but when I add in COUNT after SELECT and before (first_name)
my returned results come back different with the same order of names or counts before the count function was added.
In other words, when adding the first_name before count(First_name) it comes back alphabetical, while mine comes out in order of Georgi, Bezalel, Parto etc.
Is this normal or okay, as long as the point of the query gets across, or must the results match exactly?
Thanks for reaching out.
If I’ve managed to understand you correctly, you are referring to the following query, right?
GROUP BY first_name;
If yes, then the output is not sorted in alphabetical order only because you have not added an ORDER BY clause in the following way.
GROUP BY first_name
ORDER BY first_name;
Hope this helps.