

SELECT column-list FROM tablename WHERE condition ORDER BY column1, column2. Syntax Following is the basic syntax of ORDER BY clause.

The STUDENTS table have five columns (ID, NAME, SURNAME, AGE, ADDRESS). SQLite ORDER BY clause is used to sort the data in an ascending or descending order, based on one or more columns. And we have created a STUDENTS table in this database. So let's consider we have created SCHOOL database. Generally, the SQLite tables will store data in unspecified. Whether ascending or descending order and by. In SQLite ORDER BY clause is used to sort column records either in ascending or descending order. The syntax for using ORDER BY keyword in SQLite is given below: SELECT column1, column2.

One or more columns can be used to sort the data. For example, if a query uses an ORDER BY clause to sort the results of a query in descending order, then a descending index can improve the performance of. It's very simple but incredibly important - to order your result sets in the way that you want. The CREATE INDEX command consists of the keywords 'CREATE INDEX' followed by the name of the new index, the keyword 'ON', the name of a previously created table that is to be indexed, and a parenthesized list of table column names and/or expressions that are used for the index key. To sort the result in descending order, DESC keyword is used. Using ORDER BY, data can be sorted eighther in ascending order or in descending order.ĪSC : Sorts tha result set in ascending order.ĭESC : Sorts tha result set in descending order. ORDER BY Clause in SQLite SQLite ORDER BY Clause To sort the fetched data in ascending or descending order, the SQLite ORDER BY clause is used. In SQLite the ORDER BY clause can be used to sort the result based on more than one columns.
