Back to Questdb

ORDER BY keyword

documentation/query/sql/order-by.md

latest666 B
Original Source

Sort the results of a query in ascending or descending order.

Syntax

Default order is ASC. You can omit to order in ascending order.

Notes

Ordering data requires holding it in RAM. For large operations, we suggest you check you have sufficient memory to perform the operation.

Examples

questdb-sql
ratings ORDER BY userId;
questdb-sql
ratings ORDER BY userId DESC;
questdb-sql
ratings ORDER BY userId, rating DESC;