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 Stored Procedures
00:00
5 left

SQL Stored Procedures

HardSQL · PostgreSQL

Problem

Tell me about your experience using SQL stored procedures in data engineering or ETL workflows.

For a hands-on PostgreSQL response, implement a procedure that refreshes the customer order summary for January 2025. Include valid handling for customers without qualifying orders and ensure the result can be regenerated consistently.

Output

  1. One row per customer with customer_id, customer_name, region, completed_order_count, and completed_order_total.
  2. Include every customer, including those without qualifying orders.
  3. Order by customer_id ascending.

Schema

customer_dim
ColumnTypeDescription
customer_idPKINTUnique customer identifier
customer_nameVARCHAR(100)Customer display name
regionVARCHAR(50)Customer sales region
source_orders
ColumnTypeDescription
order_idPKINTUnique source order identifier
customer_idINTCustomer associated with the order
order_dateDATEDate the order was placed
amountNUMERIC(12,2)Order monetary amount
statusVARCHAR(20)Order processing status
customer_order_summary
ColumnTypeDescription
customer_idPKINTCustomer identifier in the refreshed summary
customer_nameVARCHAR(100)Customer display name
regionVARCHAR(50)Customer sales region
completed_order_countBIGINTNumber of completed January orders
completed_order_totalNUMERIC(12,2)Total amount of completed January orders
Tablescustomer_dimsource_orderscustomer_order_summary
Interviewer

Your question is SQL Stored Procedures. 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
Sign up free to run your codeLog inLn 1
Run your query to see results here.