Skip to the content

A ticket by text

Problem

The store is raffling off a Tablet. In Denver and in Boston, tickets are handed out at each city's street fair. Every other customer gets a ticket by text message, and so does anyone who never gave a city, since there's no telling whether a fair is anywhere near them.

The raffle is for adults only: you're in if you're 18 or older, and with no age on file there's no ticket.

Show the name and the age of everyone who gets a ticket by text, in that order.

What it has to return

These rows, in any order

nameage
Luke27
Chloë41
Mason19

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, age
FROM customers
WHERE city NOT IN
  ('Denver', 'Boston')
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(log n) challenges

See all challenges →