SQL ORDER

Posted on Updated on

SQL ORDER BY Keyword

The ORDER BY catchphrase is utilized to sort the outcome set.

The ORDER BY catchphrase is utilized to sort the outcome set by one or more segments. The ORDER BY catchphrase sorts the records in climbing request of course. To sort the records in a diving request , you can utilize the DESC catchphrase. The SQL ORDER BY proviso is utilized to sort the information in climbing or plummeting request, taking into account one or more sections. Some database sorts question results in climbing request naturally.

SQL ORDER BY Syntax

SELECT column _ name , column _ name

FROM table _ name

ORDER BY column _ name ASC | DESC , column _ name ASC | DESC ;

ORDER BY Example

The accompanying SQL articulation chooses all Employees from the “ Employees “ table , sorted by the “ City “ segment :

SELECT * FROM AptechEmployee

ORDER BY City ;

ORDER BY DESC Example

The accompanying SQL proclamation chooses all Employees from the “ Employees “ table , sorted DESCENDING by the “ City “ segment :

SELECT * FROM AptechEmployee

ORDER BY City DESC ;

ORDER BY Several Columns Example

The accompanying SQL proclamation chooses all Employees from the “ Employees “ table , sorted by the “ City “ and the “ Country “ segment :

SELECT * FROM AptechEmployee

ORDER BY City DESC , Country ASC ;

ORDER BY Several Columns Example2

The accompanying SQL articulation chooses all clients from the “ Clients “ table , sorted rising by the “ Nation “ and sliding by the “ CustomerName “ segment :

SELECT * FROM Customers

ORDER BY Country ASC , CustomerName DESC;

Parameters or Arguments expressions The sections or counts that you wish to recover.

Tables

The tables that you wish to recover records from. There must be no less than one table recorded in the FROM condition. WHERE conditions Discretionary. Conditions that should be met for the records to be chosen.

ASC

Discretionary. ASC sorts the outcome set in climbing request by expression. This is default conduct, if no modifier is supplier.

DESC

Discretionary. DESC sorts the outcome set in plummeting request by expression.

For more details and queries please feel free to email, visit or call us. Wishing you the very best for all your future endeavors.

Helpline: 9814666333, 8699444666

Email:info@technocampus.co.in

**************************************************************************************************************

Please fill the FORM and we shall contact you soon.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s