Learn in your language
Skip to content
IGCSE · Cambridge (CIE) · 0478

Sort query results in descending order

Use ORDER BY DESCENDING to place larger or later values first.

Section 9 · Databases

Cambridge IGCSE Computer Science 0478 · Databases · 2026–2028 Version 6 · Topic 9
Exam scope and assessment notes

This sequence follows Cambridge IGCSE Computer Science 0478, 2026–2028 syllabus Version 6, Topic 9. It covers single-table databases only and the specified SELECT, FROM, WHERE, ORDER BY, SUM, COUNT, AND and OR content. The official specimen also demonstrates NOT in a filter. Multi-table joins, GROUP BY, database implementation and the separate 2029–2031 syllabus are not mapped here. Practice is original, self-checked and does not award an official Cambridge grade. Full timed papers and human subject-teacher review remain outstanding.

Before you begin

  • Be able to read a small table and compare values. Each lesson introduces the database and SQL terms it uses.

Work on paper. Try each question before revealing help, and explain why your method works.

Quick readiness check

What does DESCENDING mean for numeric values?

What you will learn

  • Read descending order as high to low
  • Write the ORDER BY clause
  • Use sorting to answer ranking requests

Descending reverses ascending order

ORDER BY FieldName DESCENDING lists larger values before smaller ones, or later alphabetical values before earlier ones.

Use DESCENDING when the request asks for the highest, newest or Z-to-A result first, subject to the field's meaning.

Keep the query clauses in order

A query can select fields, name a source table, filter records with WHERE and finally sort with ORDER BY.

The sort direction does not change which rows match a WHERE condition. Apply the requested filter first conceptually, then order those results.

Pause and explain

A leaderboard asks for the highest score first. Which clause is appropriate?

Put the idea to work

Worked example

Return Title and Seats from WORKSHOP with the largest number of seats first.

Show the worked solution
  1. Select Title and Seats.
  2. Use WORKSHOP as the source table.
  3. Sort Seats in descending order.

Answer SELECT Title, Seats FROM WORKSHOP ORDER BY Seats DESCENDING;

Try a topic test

Choose Easy, Normal or Difficult. Save your answers and open worked review after finishing.

Test this topic →

From guided practice to a new situation

Write your answer and reasoning first. Use a hint only if you are stuck. The model solution is for self-checking; your written work is not automatically marked.

1 · Guided

Write a query to return Name and Points from TEAMS, highest points first.

Give me a hint

Use descending order on Points.

Compare my reasoning
  1. Select Name and Points.
  2. Use TEAMS after FROM.
  3. Sort by Points DESCENDING.

SELECT Name, Points FROM TEAMS ORDER BY Points DESCENDING;

Look for these in your work

  • Fields
  • Table
  • Direction
2 · Independent

Scores are 61, 90 and 75. Give their output order for DESCENDING.

Give me a hint

Place the greatest first.

Compare my reasoning
  1. 90 is greatest.
  2. 75 is next.
  3. 61 is least.

90, 75, 61.

Look for these in your work

  • Largest identified
  • Sequence correct
3 · Transfer

A query filters workshops with Seats >= 10 and sorts Seats descending. Does the sort cause a workshop with 8 seats to appear? Explain.

Give me a hint

Filtering decides membership before display order.

Compare my reasoning
  1. Seats >= 10 excludes the 8-seat row.
  2. ORDER BY only rearranges rows that remain.
  3. The row does not appear.

No; WHERE excludes it, and descending order only sorts matching rows.

Look for these in your work

  • Filter effect
  • Sort effect

Common mistakes

  • Using ASCENDING when largest-first is required
  • Sorting by the displayed title instead of the requested score
  • Believing sort direction affects WHERE
Recall without your notes

What can you explain now?

Which direction puts the largest numeric value first?

Compare with the explanation

DESCENDING

Descending order goes from larger to smaller values.

After trying it yourself, choose your next review. This is your self-assessment.

Your review choice appears on Today. Sign in to sync it across devices.

Make it stick

What kind of request signals that descending order may be needed?

If you needed the solution, close it and solve the problem again from a blank page. A correct answer is stronger when you can explain the reason for each step.

Keep learning Computer Science

Course scope and assessment

165 original lessons map the listed objectives across all 10 main topics in the 2026–2028 Version 6 syllabus, with worked explanations and guided, independent and transfer practice. This is mapped teaching coverage, not proof of full exam readiness. Three earlier starter lessons remain available but are not counted as syllabus-mapped teaching. Practical programming experience in an executable browser workspace, full timed-paper practice, human subject-teacher review and the separate 2029–2031 syllabus remain outstanding. Practice is self-checked and does not award an official Cambridge grade.

StudyForA · Learn with understanding

Original teaching content and links to official sources. Check your exam year and qualification before using a resource.