KEMBAR78
Lecture - 15 - ORDER SQL | PDF
0% found this document useful (0 votes)
29 views3 pages

Lecture - 15 - ORDER SQL

The ORDER BY clause is used to sort records in a result set and can only be used in SELECT statements. It allows sorting by one or more columns in ascending or descending order.

Uploaded by

Tauseef khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views3 pages

Lecture - 15 - ORDER SQL

The ORDER BY clause is used to sort records in a result set and can only be used in SELECT statements. It allows sorting by one or more columns in ascending or descending order.

Uploaded by

Tauseef khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

ORDER BY

The ORDER BY clause is used to sort the records in result set. It can only be used in SELECT statements.

SELECT "column_name"
FROM "table_name"
[WHERE "condition"]
ORDER BY "column_name" [ASC, DESC];
Syntax It is possible to order by more than one column.

ORDER BY "column_name1" [ASC, DESC], "column_name2" [ASC, DESC]

Start-Tech Academy
ORDER BY
The ORDER BY clause is used to sort the records in result set. It can only be used in SELECT statements.

SELECT * FROM customer


WHERE state = 'California’ ORDER BY Customer_name;

Same as
SELECT * FROM customer
WHERE state = 'California’ ORDER BY Customer_name ASC;

Example SELECT * FROM customer


ORDER BY 2 DESC;

SELECT * FROM customer


WHERE age>25 ORDER BY City ASC, Customer_name DESC;

SELECT * FROM customer


ORDER BY age;

Start-Tech Academy

You might also like