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
ExperiencesCoaching
New
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
Get started
SQL: Friday Likes Per User
00:00
5 left

SQL: Friday Likes Per User

MediumSQL · PostgreSQL

Problem

Meta Growth Analytics wants a Friday engagement cut for the AARRR funnel across Instagram Reels, Facebook Groups, and Instagram Save-related posts. Write a PostgreSQL query that calculates how many likes each user received on a Friday.

Requirements

  1. Return every user, including users who received no Friday likes.
  2. Count likes received through the user's posts, using EXTRACT(ISODOW FROM liked_at) = 5 to identify Fridays.
  3. Include the username and Friday like count, ordered by count descending and then user_id ascending.
  4. Ignore likes with a missing timestamp or missing post relationship.

Schema

users
ColumnTypeDescription
user_idPKINTUnique Meta user identifier
usernameVARCHAR(100)User display name
posts
ColumnTypeDescription
post_idPKINTUnique post identifier
author_idINTUser who authored the post
surfaceVARCHAR(30)Meta product surface containing the post
likes
ColumnTypeDescription
like_idPKINTUnique like event identifier
post_idINTPost receiving the like
liked_atTIMESTAMPUTC timestamp of the like event
Tablesuserspostslikes
Interviewer

Whenever you're ready, walk me through your approach or go straight to the code. The requirements and the three tables are in the Question tab.

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.