SonicBase. In-memory embedded or distributed streaming sql database

SQL Select With Order By Statement

Reads records from the database and returns them in the specified sort order.

Syntax

SELECT select_columns FROM table_name [WHERE expression] [ORDER BY column direction [, column direction...]]
column:  column to sort on
direction:  "asc" for ascending order. "desc" for descending order

You may sort on any number of columns. Each column added to the query is nested in the sort order.

Example


select * from persons order by name asc, age desc

name age occupation
bob 30 plumber
bob 29 carpenter
bob 29 electrician
chris 40 plumber
chris 29 plumber