Computer Science, asked by KingAdi1733, 10 months ago

How to use order by in writing queries in sql ? Give examples.

Answers

Answered by smartbrainz
0

ORDER BY clause is used in SQL queries, to sort the retrieved rows in ascending or descending order of specified column.

  • SELECT statement is used in SQL queries to fetch data based on some conditions. ORDER BY clause is used to sort this data on the basis of one or more columns.
  • By default, the ORDER BY clause fetches rows in ascending order. To sort data in descending order keyword DESC is used with ORDER BY clause.
  • For example - if the ORDER BY clause states - ORDER BY SAL DESC, where SAL is the salary (numeric) column. Here, the fetched rows would be sorted by SAL column, in descending order.

To know more about ORDER BY clause, visit:

https://brainly.in/question/9046316

Similar questions