Skip to the content

The afternoon session

Problem

The school is adding an afternoon session, and only two teachers can stay for it: Rose and Paul. Afternoons are short, so there's only room for courses worth 3 credits or fewer.

Which courses can move to the afternoon? Show the course's name, its teacher, and its credits, in that order.

What it has to return

These rows, in any order

nameteachercredits
HistoryPaul3
ChessPaul1

This is what comes out with the data in the practice database this challenge uses. The column names don’t count, so name yours however you like: what counts is how many there are and the order they come in. Besides this one, the challenge has hidden tests with other data that are revealed when you submit your solution.

You start with this

SQL

SELECT name, teacher, credits
FROM courses
WHERE teacher = 'Rose'
Solve this challenge

It opens in your browser, with the editor and the tests. It is free and you do not need an account to start.

More O(1) challenges

See all challenges →