Does \"group by\" clause automatically guarantee that the results will be ordered by that key? In other words, is it enough to write:
select * from table group
It depends on the database vendor.
For example PostgreSQL does not automatically sort the grouped result. Here you have to use order by to get the data sorted.
But Sybase and Microsoft SQL Server do. Here you can use order by to change the default sorting.