Suchergebnisse mit Tag „orderby“

TOP

Did you know GROUP BY ... ORDER BY NULL?

Here are three SQL queries and one simple challenge: Order them by speed assuming that city has an index.

1. SELECT city, SUM(inhabitants) FROM population GROUP BY city
2. SELECT city, SUM(inhabitants) FROM population GROUP BY city ORDER BY city
3. SELECT city, SUM(inhabitants) FROM population GROUP BY city ORDER BY city DESC
Weiterlesen