Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
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 feedbackCoaching1:1 coaching with people at your target companiesSuccess 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
Ingestion Joins and PySpark DataFrames
00:00
5 left

Ingestion Joins and PySpark DataFrames

MediumSQL · PostgreSQL

Problem

Asked me to write pyspark code to get result with all columns from datafrmse and 1 column from dataframe2 and SQL query for inner and full join

Use the two tables below for the SQL part. Write queries that return the requested join outputs.

Output

  1. For the first result, return all columns from dataframe1 plus status from dataframe2.
  2. For the second result, return only rows that match in both tables.
  3. For the third result, return all rows from both tables, keeping unmatched rows with NULL values where needed.

Schema

dataframe1
ColumnTypeDescription
idPKINTRow identifier
customer_nameVARCHAR(100)Customer name
regionVARCHAR(50)Customer region
order_amountNUMERIC(10,2)Order amount
dataframe2
ColumnTypeDescription
idPKINTRow identifier
statusVARCHAR(30)Status value to bring into the result
Tablesdataframe1dataframe2
Interviewer

Your question is Ingestion Joins and PySpark DataFrames. 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
Sign up free to run your codeLog inLn 1
Run your query to see results here.