Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Joining Tables in SQL

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

Your question is Joining Tables in SQL. 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

GlobalLogic's project delivery portal stores client, project, and time-entry data separately. Write a PostgreSQL query that produces a Q2 delivery summary for every active project with a valid client.

Requirements

  1. Join projects to clients and preserve active projects that have no qualifying time entries.
  2. Include only time entries from April 1 through June 30, 2025, using a half-open date range.
  3. Return total billable hours, distinct consultants, and zeroes for projects without matching entries.
  4. Order results by project ID ascending.

Schema

clients
ColumnTypeDescription
client_idPKINTUnique client identifier
client_nameVARCHAR(100)Client organization name
regionVARCHAR(50)Client operating region
projects
ColumnTypeDescription
project_idPKINTUnique project identifier
client_idINTReferences clients.client_id
project_nameVARCHAR(150)Project name
project_managerVARCHAR(100)Assigned project manager
statusVARCHAR(20)Current project status
time_entries
ColumnTypeDescription
entry_idPKINTUnique time-entry identifier
project_idINTReferences projects.project_id
consultant_idINTConsultant who logged the entry
consultant_nameVARCHAR(100)Consultant display name
entry_dateDATEDate the work was performed
billable_hoursNUMERIC(6,2)Billable hours logged
Tablesclientsprojectstime_entries
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results