Skip to the content

2000 was last century

Problem

The library is putting its 20th-century books on a display by the front desk, and the librarian has a warning before anyone gets it wrong: there was no year zero, so every century ends on its round year. A book from 2000 goes on the display, and one from 1900 belongs to the century before.

Show the title and the year of publication of the books that go on the display, in that order.

What it has to return

These rows, in any order

titlepublished
The Lighthouse1998
Loose Leaves1987
Short Stories1975

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 title, published
FROM books
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 →