Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

SQL Execution Order

MediumSQL · PostgreSQL00:00
Practice interviewer
In session
5 left
00:00

Your question is SQL Execution Order. Start with the requirements and the two tables on the right.

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.

Problem

Explain the order of execution in Tableau when building a view or dashboard.

For the SQL portion, use the supplied PostgreSQL tables to produce the requested result while explaining how the query stages correspond to Tableau's order of operations.

Output

  1. One row per qualifying account, with region, account_name, and total_revenue.
  2. Include only qualifying closed-won revenue from 2025 with a positive account total.
  3. Order by total_revenue descending, then region and account_name ascending.

Schema

accounts
ColumnTypeDescription
account_idPKINTUnique account identifier
account_nameVARCHAR(100)Account name
regionVARCHAR(50)Account sales region
opportunities
ColumnTypeDescription
opportunity_idPKINTUnique opportunity identifier
account_idINTRelated account identifier
stageVARCHAR(40)Opportunity sales stage
close_dateDATEOpportunity close date
amountDECIMAL(12,2)Opportunity revenue amount
Tablesaccountsopportunities
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results