Sorting

We wish to sort the rows of a table.

In this section, we cover sorting the rows of a table. In particular, we cover the following scenarios:

  • Basic Sorting where we specify the columns we wish to sort by explicitly by specifying their name. We cover three scenarios:
    • Single Column where we sort the rows of a table by one column.
    • Multiple Columns where we sort the rows of a table by the values of two or more columns.
  • Custom Sorting where we cover how to sort by a transformation of the values of one or more columns instead of by the values themselves e.g. we want to sort by the numeric part of a string column.
  • Grouped Sorting where we cover sorting a grouped table. Say we wish to look at the data in groups and we wish to have each group sorted by one or more columns.
  • Implicit Sorting where rather than identifying the columns we wish to sort by via their name, we identify them via one of their properties e.g. we wish to sort the rows of a table by columns with a name that ends with the string _id.
  • Dynamic Sorting where we specify the columns to sort by dynamically i.e. through a variable.
SQL
I/O