We wish to sort the rows of a table by the values of one column.
We wish to sort a table in increasing order of the values of one column.
In this example, we wish to sort a table in ascending order of the values of a column col_1
.
SELECT *
FROM refcon.examples.dummy_table
ORDER BY col_1;
Here is how this works:
col_1
after the ORDER BY
clause.ORDER BY
sorts in ascending (increasing) order by default.We wish to sort a table in descending order of the values of one column.
In this example, we wish to sort dummy_table
in descending order of the values of a column col_1
.
SELECT *
FROM refcon.examples.dummy_table
ORDER BY col_1 DESC;
Here is how this works:
col_1
after ORDER BY
clause.DESC
keyword after ORDER BY
clause to sort in descending order.