Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

SQL Join for Managers

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

Your question is SQL Join for Managers. Start with the requirements and the two 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

Context

Fidelity Investments maintains employee details separately from current position assignments. HR reporting needs the complete employee records for people currently assigned to the Manager position.

Task

Write a PostgreSQL query that returns all columns from employee_info for employees whose matching record in employee_position has position_title = 'Manager'.

Requirements

  1. Join the tables using emp_id.
  2. Return every column from employee_info, excluding position table columns.
  3. Include only employees whose position is exactly Manager.
  4. Order the results by emp_id ascending for deterministic output.

Schema

employee_info
ColumnTypeDescription
emp_idPKINTEGEREmployee identifier
full_nameVARCHAR(100)Employee's full name
departmentVARCHAR(80)Fidelity business department
emailVARCHAR(150)Corporate email address
hire_dateDATEEmployee hire date
employee_position
ColumnTypeDescription
emp_idPKINTEGEREmployee identifier from the position feed
position_titleVARCHAR(80)Current position assignment
effective_dateDATEDate the position became effective
Tablesemployee_infoemployee_position
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results