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 Joins and Data Structures
00:00
5 left

SQL Joins and Data Structures

MediumSQL · PostgreSQL

Problem

Tell me about how you use SQL joins and how you choose between lists and tuples in Python when transforming data.

Using the provided Comcast service tables, write a query for active subscriptions and briefly explain the Python collection choice for transforming its result rows.

Output

  1. One row per active subscription, including subscriptions without a matching plan.
  2. Columns: account_id, account_name, subscription_id, plan_name, status, and monthly_charge.
  3. Sort by account_id, then subscription_id ascending.

Schema

accounts
ColumnTypeDescription
account_idPKINTUnique Comcast account identifier
account_nameVARCHAR(100)Account holder name
subscriptions
ColumnTypeDescription
subscription_idPKINTUnique subscription identifier
account_idINTOwning account identifier
plan_idINTReferenced service plan identifier
statusVARCHAR(20)Current subscription status
monthly_chargeNUMERIC(8,2)Monthly recurring charge
plans
ColumnTypeDescription
plan_idPKINTUnique service plan identifier
plan_nameVARCHAR(100)Service plan name
Tablesaccountssubscriptionsplans
Interviewer

Your question is SQL Joins and Data Structures. Start with the requirements and the three 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.