Sample Data
This table shows names of students and their scores.
| Cell | Value |
|---|---|
| A1 | Name |
| B1 | Score |
| A2 | Alice |
| B2 | 85 |
| A3 | Bob |
| B3 | 92 |
| A4 | Charlie |
| B4 | 78 |
| A5 | Diana |
| B5 | 90 |
This table shows names of students and their scores.
| Cell | Value |
|---|---|
| A1 | Name |
| B1 | Score |
| A2 | Alice |
| B2 | 85 |
| A3 | Bob |
| B3 | 92 |
| A4 | Charlie |
| B4 | 78 |
| A5 | Diana |
| B5 | 90 |
=QUERY(A1:B5, "SELECT A, B ORDER BY B DESC", 1)A B 1 |Name |Score | 2 |Alice | 85 | 3 |Bob | 92 | 4 |Charlie| 78 | 5 |Diana | 90 | Formula references range A1:B5 for data and headers.
D E 1 |Name |Score | 2 |Bob | 92 | 3 |Diana | 90 | 4 |Alice | 85 | 5 |Charlie| 78 |
ORDER BY clause do inside a Google Sheets QUERY function?ORDER BY clause is used to sort data in a query result.ASC, descending by DESC.ORDER BY B ASC which is correct syntax for ascending order. Options B and C use invalid keywords DOWN and UP. =QUERY(A1:C10, "SELECT * ORDER BY B DESC") sorts descending, not ascending.A Score John 85 Anna 92 Mike 78 Sara 90
=QUERY(A1:B4, "SELECT A, B ORDER BY B DESC")?=QUERY(A1:C10, "SELECT A, B ORDER BY C DESCENDING") but it gives an error. What is the problem?DESC, not DESCENDING.Name, Age, and Score. You want to list all names and scores sorted by Age ascending, then Score descending. Which QUERY formula is correct?Pass the test and this pattern moves unknown