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
ExperiencesCoaching
New
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
Get started
Filter Active Projects by Quarterly Billable Hours
00:00
5 left

Filter Active Projects by Quarterly Billable Hours

MediumSQL · PostgreSQL

Problem

The delivery centre 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 delivery centre 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.

Output details

  • Return columns in this order: project_id, project_name, delivery_centre, manager_name, approved_billable_hours, log_count, effort_level.
  • Order rows by approved_billable_hours descending, then project_id ascending.
  • Preserve NULL manager_name values as NULL.

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

Whenever you're ready, walk me through your approach or go straight to the code. The requirements and the two tables are in the Question tab.

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.