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
SQL Joins for Web Traffic Data
00:00
5 left

SQL Joins for Web Traffic Data

MediumSQL · PostgreSQL

Problem

Question on web monthly traffic data with multiple tables. It required joining tables and fetching the traffic data based on some criteria. Coding questions were based on distributed servers with power of 2 load capability. Very similar to what other internship candidates have mentioned here.

Write a query for active pages belonging to North America sites during January and February 2025, retaining site-month totals of at least 1,000 visits.

Output

  1. One row per qualifying site and month with site_name, month_start, total_visits, and page_count
  2. Include only qualifying site-months, ordered by site_name, then month_start

Schema

sites
ColumnTypeDescription
site_idPKINTUnique site identifier
site_nameVARCHAR(100)Name of the website
regionVARCHAR(50)Geographic region assigned to the site
web_pages
ColumnTypeDescription
page_idPKINTUnique page identifier
site_idINTSite containing the page
page_nameVARCHAR(100)Page label
is_activeBOOLEANWhether the page is currently active
monthly_traffic
ColumnTypeDescription
traffic_idPKINTUnique traffic record identifier
page_idINTPage receiving the traffic
month_startDATEFirst day of the traffic month
visitsINTNumber of recorded visits
Tablessitesweb_pagesmonthly_traffic
Interviewer

Your question is SQL Joins for Web Traffic Data. 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.