Computer Science

Assertion (A): Order by clause is used to sort the records of a table in ascending or descending order.

Reasoning (R): For sorting in ascending or descending order, ASC and DESC keywords are used along with the Order by clause.

  1. Both A and R are true and R is the correct explanation of A.
  2. Both A and R are true but R is not the correct explanation of A.
  3. A is true but R is false.
  4. A is false but R is true.

SQL Queries

1 Like

Answer

Both A and R are true and R is the correct explanation of A.

Explanation
The SQL ORDER BY clause is used to sort the data is ascending or descending order based on one or more columns. This clause sorts the records in ascending order (ASC) by default. To sort the records in descending order, DESC keyword is used. The syntax for ORDER BY clause is as follows: SELECT <column-list> FROM <table_name> [WHERE <condition>] ORDER BY <column_name> [ASC|DESC];.

Answered By

1 Like


Related Questions