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
MVC API on Table Data
00:00
5 left

MVC API on Table Data

MediumSQL · PostgreSQL

Problem

Create an MVC API call on table data using HTTP routes with on-click events.

Asked in the Round 1 HackerRank stage. For the SQL portion, prepare the query supporting a route that returns active application pages and their January 2025 click activity.

Output

  1. One row per active page, including pages with no matching clicks.
  2. Columns: page_id, page_name, click_count, and last_clicked_at.
  3. Sort by click_count descending, then page_id ascending.

Schema

pages
ColumnTypeDescription
page_idPKINTUnique application page identifier
page_nameVARCHAR(100)Display name of the page
is_activeBOOLEANWhether the page is currently active
click_events
ColumnTypeDescription
event_idPKINTUnique click event identifier
page_idINTPage associated with the click, when available
event_typeVARCHAR(30)Type of recorded interaction
clicked_atTIMESTAMPTimestamp when the interaction occurred
Tablespagesclick_events
Interviewer

Your question is MVC API on Table Data. 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.