Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Build my plan
SQL Join with Aggregation
00:00
5 left

SQL Join with Aggregation

MediumSQL · PostgreSQL

Problem

The Alten Delivery Centre Spain needs a quarterly view of approved, billable work logged against active delivery projects. Write a PostgreSQL query that joins project and work-log data and returns only projects meeting the minimum effort threshold.

Requirements

  1. Consider active projects in the Alten Delivery Centre Spain portfolio.
  2. Include only approved, billable work logs recorded from 2025-01-01 through 2025-03-31.
  3. Return each qualifying project's ID, name, delivery centre, manager, total approved billable hours, and log count.
  4. Keep projects with no qualifying logs during the join, but return only projects with at least 20 approved billable hours. Classify totals of 40 hours or more as High, otherwise as Standard.

Schema

projects
ColumnTypeDescription
project_idPKINTEGERUnique project identifier
project_nameVARCHAR(100)Project name
delivery_centreVARCHAR(80)Alten delivery centre responsible for the project
manager_nameVARCHAR(100)Assigned project manager
project_statusVARCHAR(20)Current project lifecycle status
work_logs
ColumnTypeDescription
log_idPKINTEGERUnique work-log identifier
project_idINTEGERProject associated with the work log
logged_onDATEDate on which work was recorded
hoursNUMERIC(8,2)Recorded work hours
log_statusVARCHAR(20)Approval status of the work log
is_billableBOOLEANIndicates whether the work is billable
Tablesprojectswork_logs
Interviewer

Your question is SQL Join with Aggregation. Start with the requirements and the two tables in the Question tab.

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.
CodePostgreSQL
Sign up free to run your codeLog inLn 1
Run your query to see results here.