What is order by clause

  • ORDER BY clause helps to sort the data in either ascending order to descending order.
  • Ascending order sort query:

SELECT name,age FROM pcdsEmployee ORDER BY age ASC

  • Descending order sort query

SELECT name FROM pcdsEmployee ORDER BY age DESC

The correct answer for “What is the ORDER BY clause in a database management system (DBMS)?” would be:

“The ORDER BY clause is used in SQL (Structured Query Language) to sort the result set of a query in ascending or descending order based on one or more columns. It allows you to control the presentation of data by specifying the column(s) by which you want the result set to be sorted.”