Data Analyst Interview Questions 2026: Complete SQL, Python and Analytics Guide
A comprehensive guide to data analyst interview questions covering SQL window functions, Python pandas operations, statistical concepts, and business analytics scenarios that companies ask in 2026.

Data analyst interview questions in 2026 test three core areas: SQL proficiency, Python data manipulation, and business problem-solving. Companies like Google, Meta, and Amazon have standardized their technical screens around these skills, with SQL window functions and pandas operations appearing in over 80% of interviews according to Glassdoor's 2026 hiring trends report.
The strongest candidates demonstrate not just syntax knowledge but the ability to explain their analytical approach. Interviewers assess whether a candidate can translate a business question into a technical query and communicate findings to non-technical stakeholders.
SQL Window Functions: The Most Common Interview Topic
Window functions appear in nearly every data analyst technical screen. Unlike aggregate functions that collapse rows, window functions perform calculations across a set of rows related to the current row while preserving individual row data.
Question: Calculate each employee's salary as a percentage of their department's total salary.
-- employee_salary_percentage.sql
SELECT
employee_id,
department,
salary,
-- SUM as window function preserves each row
ROUND(
salary * 100.0 / SUM(salary) OVER (PARTITION BY department),
2
) AS pct_of_dept_salary
FROM employees
ORDER BY department, pct_of_dept_salary DESC;The PARTITION BY clause creates separate windows for each department. Each employee's salary divides by their department's total, not the company total. This distinction catches many candidates who use a subquery or join instead.
Question: Find the running total of sales by date, resetting each month.
-- monthly_running_total.sql
SELECT
sale_date,
amount,
SUM(amount) OVER (
PARTITION BY DATE_TRUNC('month', sale_date)
ORDER BY sale_date
-- Default frame: RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
) AS monthly_running_total
FROM sales
ORDER BY sale_date;Interviewers expect candidates to know the default window frame behavior. Without an explicit ROWS or RANGE clause, the frame extends from the partition start to the current row, which produces a running total. Practice these patterns with the SQL window functions module.
CTEs and Subqueries: Organizing Complex Queries
Common Table Expressions make queries readable and maintainable. Interviewers assess whether candidates structure queries logically rather than writing monolithic statements.
Question: Find customers who made purchases in consecutive months.
-- consecutive_month_purchasers.sql
WITH monthly_purchases AS (
-- Step 1: Get distinct customer-month combinations
SELECT DISTINCT
customer_id,
DATE_TRUNC('month', purchase_date) AS purchase_month
FROM orders
),
with_prev_month AS (
-- Step 2: Add previous purchase month for each customer
SELECT
customer_id,
purchase_month,
LAG(purchase_month) OVER (
PARTITION BY customer_id
ORDER BY purchase_month
) AS prev_purchase_month
FROM monthly_purchases
)
-- Step 3: Filter to consecutive months only
SELECT DISTINCT customer_id
FROM with_prev_month
WHERE purchase_month = prev_purchase_month + INTERVAL '1 month';This pattern combines CTEs with the LAG window function. Breaking the query into named steps demonstrates the thought process, which interviewers value as much as the correct answer.
Python Pandas: Data Manipulation Essentials
Pandas questions test data cleaning, aggregation, and transformation skills. Interviewers present messy datasets and ask candidates to extract insights.
Question: Given a DataFrame of user sessions, calculate the average session duration by user segment, excluding sessions shorter than 10 seconds.
# session_analysis.py
import pandas as pd
def analyze_sessions(df: pd.DataFrame) -> pd.DataFrame:
"""Calculate average session duration by user segment.
Args:
df: DataFrame with columns [user_id, segment, session_start, session_end]
Returns:
DataFrame with average duration per segment
"""
# Calculate duration in seconds
df['duration_seconds'] = (
df['session_end'] - df['session_start']
).dt.total_seconds()
# Filter short sessions and aggregate
return (
df[df['duration_seconds'] >= 10]
.groupby('segment')
.agg(
avg_duration=('duration_seconds', 'mean'),
session_count=('user_id', 'count')
)
.round(2)
.reset_index()
)The answer demonstrates method chaining, datetime handling, and the agg function with named outputs. Interviewers check that candidates filter before aggregating rather than after, which would skew the averages.
Question: Merge two DataFrames and handle missing values appropriately.
# merge_and_clean.py
import pandas as pd
import numpy as np
def merge_user_data(
users: pd.DataFrame,
transactions: pd.DataFrame
) -> pd.DataFrame:
"""Merge user demographics with transaction history.
Users without transactions get total_spent = 0.
Transactions without user data are excluded.
"""
merged = pd.merge(
users,
transactions.groupby('user_id')['amount'].sum().reset_index(),
on='user_id',
how='left' # Keep all users, even without transactions
)
# Fill NaN for users with no transactions
merged['amount'] = merged['amount'].fillna(0)
merged.rename(columns={'amount': 'total_spent'}, inplace=True)
return mergedThe how='left' parameter and explicit fillna handling show attention to edge cases. Candidates who use how='inner' lose users without transactions, which changes the analysis population.
Ready to ace your Data Analytics interviews?
Practice with our interactive simulators, flashcards, and technical tests.
Statistical Concepts: What Analysts Must Explain Clearly
Statistical questions assess whether candidates can apply concepts to real business problems and communicate findings to stakeholders.
Question: A product manager claims the new checkout flow increased conversion by 5%. The test ran for one week with 10,000 users per variant. Is this result statistically significant?
A complete answer addresses sample size, statistical power, and practical significance:
-
Calculate the standard error: For conversion rates, SE = sqrt(p(1-p)/n). With a baseline conversion of 10% and n=10,000, SE equals roughly 0.003.
-
Compute the z-score: A 5% relative lift means the new conversion is 10.5%. The difference of 0.5 percentage points divided by the pooled SE determines significance.
-
Consider practical significance: Even if p < 0.05, a 0.5 percentage point lift may not justify the engineering cost of the new flow.
-
Check for confounds: One week captures weekend vs. weekday patterns but may miss monthly cycles or seasonal effects.
Interviewers value candidates who question assumptions rather than mechanically calculating p-values. The data visualization principles module covers how to present these findings.
Question: Explain the difference between correlation and causation with a business example.
Ice cream sales and drowning deaths correlate positively. Both increase in summer due to the confounding variable of temperature. Recommending reduced ice cream production to prevent drownings mistakes correlation for causation.
In business analytics: ad spend and revenue often correlate, but the relationship may reflect that companies increase ad spend when revenue projections are already strong, not that ads drive revenue. Establishing causation requires controlled experiments or causal inference techniques like difference-in-differences.
Business Case Questions: Translating Problems to Queries
Case questions test the ability to decompose ambiguous business problems into concrete analytical steps.
Question: User retention dropped 15% last month. How would you investigate?
A structured approach:
-
Validate the metric: Confirm the retention definition matches historical calculations. Check for data pipeline issues or tracking changes.
-
Segment the drop: Break retention by user cohort, acquisition channel, device type, and geography. A 15% overall drop might be a 50% drop in one segment masking stability elsewhere.
-
Identify timing: Did retention drop gradually or suddenly? A sudden drop suggests a product change or bug. A gradual decline points to market or competitive factors.
-
Correlate with events: Align the timeline with product releases, marketing campaigns, competitor launches, and external events.
-
Form hypotheses: Based on segmentation patterns, propose testable explanations and the data needed to confirm or reject each.
-- retention_by_cohort.sql
WITH user_cohorts AS (
SELECT
user_id,
DATE_TRUNC('week', created_at) AS cohort_week
FROM users
),
weekly_activity AS (
SELECT
user_id,
DATE_TRUNC('week', activity_date) AS activity_week
FROM user_events
)
SELECT
c.cohort_week,
a.activity_week,
COUNT(DISTINCT a.user_id) AS active_users,
COUNT(DISTINCT c.user_id) AS cohort_size,
ROUND(
COUNT(DISTINCT a.user_id) * 100.0 / COUNT(DISTINCT c.user_id),
1
) AS retention_pct
FROM user_cohorts c
LEFT JOIN weekly_activity a
ON c.user_id = a.user_id
AND a.activity_week >= c.cohort_week
GROUP BY c.cohort_week, a.activity_week
ORDER BY c.cohort_week, a.activity_week;This cohort analysis query produces the data needed for step 2. The cohort retention module covers variations of this pattern.
Take-Home Assignments: What Evaluators Assess
Many companies include take-home assignments lasting 2 to 4 hours. Evaluators score submissions on code quality, analytical rigor, and communication.
Common assignment: Given a dataset of e-commerce transactions, identify factors that predict customer churn.
Strong submissions share these characteristics:
- Exploratory analysis first: Summary statistics, distribution plots, and missing value assessment before modeling
- Feature engineering: Creating relevant features like recency, frequency, monetary value (RFM), and trend indicators
- Model selection rationale: Explaining why logistic regression or random forest fits the problem, not just running defaults
- Validation approach: Using time-based splits rather than random splits to avoid data leakage
- Clear communication: Executive summary at the top, technical details in appendix, visualizations that support conclusions
# churn_analysis_structure.py
import pandas as pd
from sklearn.model_selection import TimeSeriesSplit
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import precision_recall_curve, auc
def create_rfm_features(df: pd.DataFrame, analysis_date: str) -> pd.DataFrame:
"""Create Recency, Frequency, Monetary features per customer."""
analysis_dt = pd.to_datetime(analysis_date)
rfm = df.groupby('customer_id').agg(
recency=('order_date', lambda x: (analysis_dt - x.max()).days),
frequency=('order_id', 'nunique'),
monetary=('order_total', 'sum')
).reset_index()
return rfm
def evaluate_with_time_split(
X: pd.DataFrame,
y: pd.Series,
n_splits: int = 5
) -> list:
"""Evaluate model using time-based cross-validation."""
tscv = TimeSeriesSplit(n_splits=n_splits)
scores = []
for train_idx, val_idx in tscv.split(X):
model = RandomForestClassifier(n_estimators=100, random_state=42)
model.fit(X.iloc[train_idx], y.iloc[train_idx])
y_pred_proba = model.predict_proba(X.iloc[val_idx])[:, 1]
precision, recall, _ = precision_recall_curve(y.iloc[val_idx], y_pred_proba)
scores.append(auc(recall, precision))
return scoresThe code demonstrates domain-relevant feature engineering and appropriate validation methodology for time-series data.
Key Takeaways for Data Analyst Interviews in 2026
-
SQL window functions with
PARTITION BYandORDER BYappear in most technical screens. Practice calculating running totals, percentages, and rankings. -
Python pandas questions emphasize method chaining, groupby aggregations, and merge operations with proper handling of missing values.
-
Statistical questions require explaining concepts in business terms. Interviewers assess communication ability, not just technical knowledge.
-
Business case questions test structured problem decomposition. Start by validating the metric, then segment to isolate the issue.
-
Take-home assignments are scored on code quality and communication as much as analytical accuracy. Include an executive summary and explain your choices.
-
The BigQuery advanced module and Python pandas basics module provide additional practice questions aligned with current interview patterns.
Start practicing!
Test your knowledge with our interview simulators and technical tests.
Can you spot the bug in Data Analytics?
One real snippet, one hidden bug, one attempt a day. No account needed to try.

Written by
Anthony Fillion-MailletFounder of SharpSkill
Full-stack developer for over 10 years. Runs SharpSkill and answers for everything published here.
Updated on September 8, 2026
Share
Related articles

Data Analyst Interview Questions Italy 2026: SQL, Python and Analytics
Prepare for data analyst interviews in Italy with 30 essential questions covering SQL, Python, and business analytics. Includes expected answers for 2026 job market.

Polars vs Pandas in 2026: Performance, Syntax and Data Analyst Interview Questions
Compare Polars and Pandas for Python data analysis in 2026. Benchmark results, syntax differences, lazy evaluation, and interview questions for data analyst roles.

Google BigQuery vs Amazon Redshift in 2026: Comparison and Data Analyst Interview Questions
BigQuery vs Redshift comparison for data analysts: architecture, pricing, performance benchmarks, SQL syntax differences, and common interview questions with answers.