2000 was last century
- O(1) · Trivial
- Free
- SQL
- filtering
- comparisons
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
| title | published |
|---|---|
| The Lighthouse | 1998 |
| Loose Leaves | 1987 |
| Short Stories | 1975 |
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 booksIt opens in your browser, with the editor and the tests. It is free and you do not need an account to start.