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
Counting Order Edits by Day
00:00
5 left

Counting Order Edits by Day

EasySQL · PostgreSQL

Problem

Staffline Solutions uses its order operations data to monitor how frequently orders are changed. Write a PostgreSQL query that returns the number of edits made to orders during the last seven calendar days, grouped by the day on which each edit occurred.

For the sample data, assume the query runs on 2026-08-29. In production, use the database server's current date.

Requirements

  1. Join order_edits to orders using the order identifier.
  2. Include edits from today and the six preceding calendar days, excluding older records and future records.
  3. Group by the calendar date extracted from edited_at and return one row per day with the edit count.
  4. Sort the results chronologically by day.

Schema

orders
ColumnTypeDescription
order_idPKINTEGERUnique identifier for the order
order_statusVARCHAR(30)Current processing status of the order
created_atTIMESTAMPTimestamp when the order was created
order_edits
ColumnTypeDescription
edit_idPKINTEGERUnique identifier for the edit event
order_idINTEGERReferences the edited order
edit_typeVARCHAR(40)Category of change made to the order
editor_nameVARCHAR(100)Staff member who made the edit
edited_atTIMESTAMPTimestamp when the edit occurred
Tablesordersorder_edits
Interviewer

Your question is Counting Order Edits by Day. 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.