Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

SQL CodeSignal Task

MediumSQL · PostgreSQL00:00
Practice interviewer
In session
5 left
00:00

Your question is SQL CodeSignal Task. Start with the requirements and the three tables on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

Databricks wants to identify workspaces with the strongest recent engagement. Write a SQL query to return each workspace that has at least 3 active users in the last 30 days, along with the number of active users and total jobs run in that period.

Requirements

  1. Count only users with at least one successful job run in the last 30 days.
  2. Include only workspaces with 3 or more active users.
  3. Return the result ordered by active users descending, then workspace name ascending.
  4. Use CURRENT_DATE as the reference date for the 30-day window.

Schema

workspaces
ColumnTypeDescription
workspace_idPKINTPrimary key for the workspace
workspace_nameVARCHAR(255)Databricks workspace name
users
ColumnTypeDescription
user_idPKINTPrimary key for the user
workspace_idINTWorkspace the user belongs to
user_nameVARCHAR(255)User display name
job_runs
ColumnTypeDescription
run_idPKINTPrimary key for the job run
user_idINTUser who triggered the run
run_dateDATEDate the run started
statusVARCHAR(50)Run status, such as SUCCESS or FAILED
Tablesworkspacesusersjob_runs
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results