9.6. Sorting¶
So far, we’ve only looked at rows of data in the order of the query is
returning to us. What if we want to see the rows in a certain sorting
order? We use the ORDER BY
command to sort them by some other
criteria.
For example, to see the bike trips in the order of the duration in seconds:
Well, it turns out by default the sorting order is ascending. To
sort the rows in descending order, add the keyword DESC
.
Of course, we can mix WHERE
and ORDER BY
, to get only the bike
trips from Member type of Casual in the order of the duration.
9.6.1. Practice Exercises¶
Lesson Feedback
-
During this lesson I was primarily in my...
- 1. Comfort Zone
- 2. Learning Zone
- 3. Panic Zone
-
Completing this lesson took...
- 1. Very little time
- 2. A reasonable amount of time
- 3. More time than is reasonable
Before you keep reading...
Runestone Academy can only continue if we get support from individuals like you. As a student you are well aware of the high cost of textbooks. Our mission is to provide great books to you for free, but we ask that you consider a $10 donation, more if you can or less if $10 is a burden.
-
Based on my own interests and needs, the things taught in this lesson...
- 1. Don't seem worth learning
- 2. May be worth learning
- 3. Are definitely worth learning
-
For me to master the things taught in this lesson feels...
- 1. Definitely within reach
- 2. Within reach if I try my hardest
- 3. Out of reach no matter how hard I try