Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Trending in AI
Hot
Agentic AI EngineerForward-Deployed EngineerGenAI EngineerAI Architect
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
Start free
SQL and Coding for Interview
00:00
5 left

SQL and Coding for Interview

HardSQL · PostgreSQL

Problem

Coding questions on SQL, AI, cloud, and networks.

For the SQL portion, use the provided customer, order, order item, and product data. Return active customers with completed revenue during the first quarter of 2025, including monthly revenue, month-over-month increases, and their regional revenue rank.

Output

  1. One row per qualifying active customer with customer_name, region, q1_revenue, january_revenue, february_revenue, march_revenue, growth_months, and regional_rank.
  2. Exclude customers with no completed revenue, order the results by region, regional_rank, and customer_name.

Schema

customers
ColumnTypeDescription
customer_idPKINTUnique customer identifier
customer_nameVARCHAR(100)Customer display name
regionVARCHAR(50)Customer region
signup_dateDATECustomer signup date
statusVARCHAR(20)Customer account status
orders
ColumnTypeDescription
order_idPKINTUnique order identifier
customer_idINTCustomer who placed the order
order_dateDATEDate the order was placed
statusVARCHAR(20)Order processing status
order_items
ColumnTypeDescription
order_item_idPKINTUnique order item identifier
order_idINTReferenced order
product_idINTReferenced product
quantityINTUnits ordered
unit_priceNUMERIC(10,2)Price per unit at order time
products
ColumnTypeDescription
product_idPKINTUnique product identifier
product_nameVARCHAR(100)Product name
categoryVARCHAR(50)Product category
Tablescustomersordersorder_itemsproducts
Interviewer

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

Sign up free to run or submit. Log in
CodePostgreSQL
Sign up free to run your code. Your draft is saved.Run with a free accountLog inLn 1
Run your query to see results here.