Sort resultSet using ORDER BY clause in SQL

Right now, will find out about the way toward arranging information utilizing ORDER BY proviso in SQL.

On the off chance that you are utilizing SQL, you will some way or another need this to orchestrate your outcome in a specific way.

This is valuable when we need don’t need work in our server or front end to orchestrate information. Suppose you have a table of enlistment of understudies in a school.

Each enrolled record will have an id or a date on which it was made. Having a made date is extremely helpful at these minutes yet an auto produced id will do the stunt as well.

We should simply to choose the information in however we need and at last simply use request by watchword and give the fieldname with which we need to utilize the request by catchphrase.

There is a discretionary catchphrase for arranging the information in climbing or diving request. So to the state for the circumstance above we will require dropping information.

Sham information:

Sort resultSet using ORDER BY clause in SQL

Syntax 1:

SELECT c-list 
FROM t 
[WHERE condition] 
[ORDER BY c1, c2, ... c] [ASC];

Syntax 2:

SELECT c-list 
FROM t 
[WHERE condition] 
[ORDER BY c1, c2, ... c] [DESC];

Example 1:

SELECT * FROM 'JustTechReview'.'employee' 
ORDER BY NAME, SALARY;
Sort resultSet using ORDER BY clause in SQL

Example 2:

SELECT * FROM 'includehelp'.'employee' 
ORDER BY NAME DESC;
Sort resultSet using ORDER BY clause in SQL

Example 3:

SELECT * FROM 'includehelp'.'employee' 
ORDER BY SALARY ASC;
Sort resultSet using ORDER BY clause in SQL

Leave a Comment

error: Alert: Content is protected!!