Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
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

Your question is Promotional User List From Call Logs. 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
You need to log in / sign up to run or submit.Ln 1
Run your query to see results here.