WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

SQL ORDER BY Keyword


The ORDER BY catchphrase is chiefly use to sort the outcome set.


The SQL ORDER BY Keyword

The ORDER BY catchphrase is utilized to sort the outcome set by at least one columns.

The ORDER BY catchphrase for the most part to sort bring about climbing request as a matter of course.

SQL ORDER BY Syntax

SELECT column_name, column_name
FROM table_name
Request BY column_name ASC|DESC, column_name ASC|DESC;

Database

In this instructional exercise we will utilize the example database.

Below is a determination from the "Clients" table:

CustomerID FirstName City Country
1

Eva Dallas USA
2 Maria Houston Mexico
3 Rajesh delhi India
4

Lisa TX USA
5 Stephine New york USA

ORDER BY Example

The Define SQL explanation chooses all clients from the "Clients" table, arranged by the "City" column:

Example

SELECT * FROM Customers
Request BY City;

ORDER BY DESC Example

The Define SQL explanation chooses all clients from the "Clients" table, arranged DESCENDING by the "City" column:

Example

SELECT * FROM Customers
Request BY City DESC;

ORDER BY Several Columns Example

The characterize SQL explanation chooses all clients from the "Clients" table, arranged by the "Nation" and the "FirstName" column:

Example

SELECT * FROM Customers
Request BY Country, FirstName;