Google-style Company ChallengeEasyVerified answerSQLite live

Active Search Queries

Which distinct search queries were entered on or after January 18, 2024?

  • Filtering
  • Sorting
  • Distinct values

Challenge brief

Understand the request

Search Quality is auditing recent search activity and needs a deduplicated list of all queries entered on or after January 18.

Return query_text in the declared deterministic order.

Return

  • query_text

Constraints

  • Include searches on or after 2024-01-18
  • Return each query text once
  • Order query text alphabetically

Data you will use

Review the relevant tables before deciding how to join, filter, or aggregate them.

search_queries

  • query_idINTEGER
  • user_idINTEGER
  • query_textVARCHAR(200)
  • search_dateDATE

Hints, when you need them

Open one clue at a time so you still do the reasoning.

Hint 1

Begin with the search-event table and isolate the requested date range.

Hint 2

Collapse repeated query text after filtering.

Hint 3

Project the query label and apply the requested alphabetical order.

Verified SQL answer

Attempt the problem first, then compare structure and reasoning—not just syntax.

Reveal solution and explanation
SELECT DISTINCT query_text FROM search_queries WHERE search_date >= '2024-01-18' ORDER BY query_text

Why this works

DISTINCT removes duplicate query texts. User 1 searches many different queries from Jan 21 onward — all are distinct so all appear. The date filter >= includes Jan 18 itself.

Success check

Returns the complete deterministic result for active search queries

Expected result

Use this output to verify values, aliases, ordering, and row count.

query_text
ai tools 2024
best smartphone 2024
book recommendations
brazilian music
canadian holidays
car insurance
coffee shops
concert tickets
dentist near me
electric cars

Previewing 10 of 27 expected rows. Run the query in the editor to inspect the full result.

Learn the concepts behind this answer

Strengthen your understanding with these targeted learning topics:

Continue practicing

SQL Interview Practice

Return to the complete interview preparation experience.