Google-style Company ChallengeEasyVerified answerSQLite live

Users Without Searches

Which registered users have never made a single search query?

  • Joins
  • NULL handling
  • Filtering
  • Sorting

Challenge brief

Understand the request

User Engagement is investigating dormant users who signed up but have never performed a search — a key early-churn signal.

Return user_id in the declared deterministic order.

Return

  • user_id

Constraints

  • Return registered users with no search records
  • Order by user ID

Data you will use

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

users

  • user_idINTEGER
  • countryVARCHAR(50)
  • device_typeVARCHAR(20)
  • signup_dateDATE

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

Preserve the full registered-user population while matching search activity.

Hint 2

A missing key on the activity side identifies users without searches.

Hint 3

Return only the preserved user identifier and stabilize its order.

Verified SQL answer

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

Reveal solution and explanation
SELECT u.user_id FROM users u LEFT JOIN search_queries s ON u.user_id = s.user_id WHERE s.user_id IS NULL ORDER BY u.user_id

Why this works

LEFT JOIN keeps all users even those with no searches. Unmatched rows have NULL in search_queries columns. WHERE s.user_id IS NULL isolates the 3 users (21=Spain, 22=Italy, 23=Mexico) who signed up in Feb 2024 and haven't searched.

Success check

Returns the complete deterministic result for users without searches

Expected result

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

user_id
21
22
23
24

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.