Skip to content

Challenging SQL problems

Warning

These questions are not for people new to SQL! Most of them expect you to use advanced SQL techniques that aren't widely known.

Note

The database versions used for the solutions can be found at the top of the following page:

Problems

🟤 Bronze Tier

As long as you know your database features and query patterns, these are fairly straightforward.

  1. Temperature anomaly detection
  2. Outstanding invoices
  3. Personalised customer emails
  4. Suspicious login activity
  5. Combining dimensions
  6. Customer churn
  7. Fibonacci sequence
  8. UK bank holidays

⚪ Silver Tier

These require a bit more thinking.

  1. Metric correlation
  2. Funnel analytics
  3. Bannable login activity
  4. Bus routes
  5. Decoding datelist ints
  6. Region precipitation
  7. Predicting values
  8. Mandelbrot set
  9. Customer sales running totals

🟡 Gold Tier

Expect to spend a bit of time on these.

  1. Loan repayment schedules
  2. Risk invasions
  3. Supply chain network
  4. Encoding datelist ints
  5. Travel plans

Questions by topic

To see the questions grouped by topic, head over to the topics page.


Looking for more?

The repo billwallis/sql-models has a collection of custom SQL models, some of which come with exercises.

For example, the loans model has exercises ranging from very easy to very hard: