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
Promotional User List From Call Logs
00:00
5 left

Promotional User List From Call Logs

MediumSQL · PostgreSQL

Problem

From a call-records table (caller, receiver), pull the list of users of a given type for a promotion, accounting for users appearing as either caller or receiver.

Asked in the technical screen stage. The question reused the first question's data and required combining caller and receiver appearances.

Output

  1. Return one row per qualifying user from users who appears in either role in call_records and has user_type = 'creator'.
  2. Return user_id and user_name, ordered by user_id ascending.

Schema

users
ColumnTypeDescription
user_idPKINTUnique user identifier
user_nameVARCHAR(100)Display name of the user
user_typeVARCHAR(30)Classification used to target promotions
call_records
ColumnTypeDescription
call_idPKINTUnique call-record identifier
caller_idINTUser who initiated the call
receiver_idINTUser who received the call
Tablesuserscall_records
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.