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 Average Sales Per Month
00:00
5 left

SQL Average Sales Per Month

EasySQL · PostgreSQL

Problem

Aviso AI wants a monthly view of sales performance for a selected reporting period. Write a PostgreSQL query using the sales table to calculate the average non-null sale amount for each month from January through March 2025.

Requirements

  1. Group sales by calendar month and return the month as YYYY-MM.
  2. Calculate the average sale_amount, rounded to two decimal places, and sort the results chronologically.
  3. Include only sales dated from 2025-01-01 through 2025-03-31.

Schema

sales
ColumnTypeDescription
sale_idPKINTEGERUnique sale identifier
sale_dateDATEDate the sale was recorded
sale_amountNUMERIC(10,2)Sale amount, which may be NULL
sales_channelVARCHAR(30)Channel through which the sale occurred
Tablessales
Interviewer

Your question is SQL Average Sales Per Month. Start with the requirements and the one table 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.