HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Problems
  2. /A community hall stores its events in a table Events…
HardComputer ScienceHigh School (9–10)Computer Science › Databases and SQLNumericalIGCSE

A community hall stores its events in a table Events…

StemPy LabContributed by StemPy Lab

Try it on paper first. A hint, the key idea and the worked solution are here when you need them.

A community hall stores its events in a table Events. Dates are stored year first, so they sort in date order.

table
EventID  Name        EventDate   Tickets
E1       Quiz night  2025-05-17  60
E2       Art fair    2025-07-02  150
E3       Fun run     2025-06-01  300
E4       Bake sale   2025-04-26  80
E5       Film club   2025-09-12  45
E6       Book swap   2025-06-21  35
  1. Write down the output of this script.
sql
SELECT Name, EventDate
FROM Events
WHERE EventDate >= '2025-06-01'
ORDER BY EventDate ASC;
  1. How many rows does it output?
  1. Which event is first, and why is the Fun run in the output at all?

Check your answer

Work it out on paper, then type your number. The answer itself stays hidden.

Need a reminder? The key ideaShowHide

ORDER BY field ASC sorts the output smallest first (A to Z, earliest date first); DESC sorts largest first. The clauses come in the order SELECT, FROM, WHERE, ORDER BY. Keep the records that pass, sort them, then show the selected fields.

The worked solution

Have you tried it?

Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, go through the solution one step at a time, and check each step against your own.

Step 1. Keep the dates on or after 1 June. Art fair (2 July), Fun run (1 June), Film club (12 September) and Book swap (21 June). Quiz night (17 May) and Bake sale (26 April) are earlier, so they are left out.

Step 2. Sort the four dates, earliest first.

sql
SELECT Name, EventDate
FROM Events
WHERE EventDate >= '2025-06-01'
ORDER BY EventDate ASC;

The output:

table
Name       EventDate
Fun run    2025-06-01
Book swap  2025-06-21
Art fair   2025-07-02
Film club  2025-09-12

Step 3. The Fun run. Its date is exactly 1 June. The operator is >=, so a date equal to the one in the condition passes. With > it would be left out.

Answer: (a) Fun run, Book swap, Art fair, Film club, with their dates. (b) 444 rows. (c) The Fun run is first; it is in the output because >= includes 1 June itself.

Log in to save this for later
← All Problems
← A shop keeps this table, Products. Write down the output of this script…A café keeps its orders in a table Orders. Cost is in dollars. Give the output of each script. →
More onComputer Science › Databases and SQL

Discussion (0)

Log in to join the discussion.

Loading…

Learn it in

  1. ORDER BY: sorting the outputSQL Queries: SELECT, WHERE and ORDER BY

More on this topic

  1. A restaurant stores its staff in a table Staff…Hard
  2. A town library stores its readers in a table Readers…Medium
  3. A gym stores its members in a table Gym…Easy
  4. A school garden club records each plot in a table Plots: the water it needs each day in litres, its…
Hard
  • A school weather station stores one record a day in a table Weather: the rainfall in millimetres…Medium
  • All problems on this topic →