Weather Observation Station 5

  • + 0 comments

    If someone still doesn't understand,

    basically with the ORDER BY clause you can sort by multiple things, not just one. So in this example,

    when the following code is executed:

    ORDER BY LEN(CITY), CITY

    you are first ordering by LEN(CITY) meaning that the query will order the results by the length of the city name.

    So all of the city names with 3 letters, then 4, then 5, and so on....

    But, this is all it does, and it will not order them any other way because you did not explicity say to do so. So now the length of the city name is sorted in ascending order, but the results are not alphabetical. This is where the ,CITY part comes in.