Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Complex SQL Data Manipulation
00:00
5 left

Complex SQL Data Manipulation

HardSQL · PostgreSQL

Problem

How do you use SQL to perform data manipulations in complex queries?

Use the provided tables to produce creator-level performance metrics for videos published in January 2025. Include creators without qualifying videos or views, and classify and rank creators based on their January activity.

Output

  1. One row per creator, with creator_id, creator_name, video_count, total_views, total_watch_seconds, avg_watch_seconds, engagement_label, and creator_rank.
  2. Include all creators, order by total_watch_seconds descending and creator_id ascending for ties.

Schema

creators
ColumnTypeDescription
creator_idPKINTUnique creator identifier
creator_nameVARCHAR(100)Creator display name
regionVARCHAR(50)Creator region
videos
ColumnTypeDescription
video_idPKINTUnique video identifier
creator_idINTCreator who published the video
video_titleVARCHAR(150)Video title
video_categoryVARCHAR(50)Video category
published_atDATEVideo publication date
video_views
ColumnTypeDescription
view_idPKINTUnique view identifier
video_idINTVideo that received the view
viewed_atDATEDate of the view
watch_secondsINTSeconds watched during the view
Tablescreatorsvideosvideo_views
Interviewer

Your question is Complex SQL Data Manipulation. 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
You need to log in / sign up to run or submit.Ln 1
Run your query to see results here.