nerdexam
CompTIA

DA0-001 · Question #481

Given the following produce data for a small retail grocery store: Which of the following queries returns the quantity from highest to lowest?

The correct answer is C. ORDER. The ORDER BY clause (C) is the SQL clause used to sort query results. To return quantity from highest to lowest, you would use ORDER BY quantity DESC. GROUP BY (A) is used to aggregate rows sharing a common value, not to sort. MAX (B) is an aggregate function that returns only th

Data Analysis

Question

Given the following produce data for a small retail grocery store:

Which of the following queries returns the quantity from highest to lowest?

Options

  • AGROUP BY
  • BMAX
  • CORDER
  • DSELECT

How the community answered

(26 responses)
  • B
    4% (1)
  • C
    92% (24)
  • D
    4% (1)

Explanation

The ORDER BY clause (C) is the SQL clause used to sort query results. To return quantity from highest to lowest, you would use ORDER BY quantity DESC. GROUP BY (A) is used to aggregate rows sharing a common value, not to sort. MAX (B) is an aggregate function that returns only the single highest value, not a sorted list. SELECT (D) specifies which columns to retrieve but has no sorting capability on its own.

Topics

#SQL queries#Data sorting#ORDER BY clause

Community Discussion

No community discussion yet for this question.

Full DA0-001 Practice