DEV Community

Philemon Adaghe
Philemon Adaghe

Posted on

Business Analyst Interview Questions with Answers:

Business Analyst Interview Questions with Answers:

A. SQL Questions

  1. Find the employee with the highest salary in each location

SELECT
e.Employee_Name,
d.Location,
e.Salary
FROM
Employee e
JOIN
Department d ON e.Department_id = d.Department_id
WHERE
(e.Salary, d.Location) IN (
SELECT
MAX(e2.Salary), d2.Location
FROM
Employee e2
JOIN
Department d2 ON e2.Department_id = d2.Department_id
GROUP BY
d2.Location
);

Alternate using window function:

SELECT
Employee_Name,
Location,
Salary
FROM (
SELECT
e.Employee_Name,
d.Location,
e.Salary,
RANK() OVER (PARTITION BY d.Location ORDER BY e.Salary DESC) as rnk
FROM
Employee e
JOIN
Department d ON e.Department_id = d.Department_id
) sub
WHERE rnk = 1;

  1. Total order amount for customers who joined in the current year

SELECT
c.Customer_Name,
SUM(o.Amount) AS Total_Amount
FROM
Customers c
JOIN
Orders o ON c.Customer_id = o.Customer_id
WHERE
EXTRACT(YEAR FROM c.Join_Date) = EXTRACT(YEAR FROM CURRENT_DATE)
GROUP BY
c.Customer_Name;

B. Python Questions

  1. Oral Topics to Prepare:

NumPy

Creating arrays: np.array(), np.zeros(), np.ones(), np.arange(), np.linspace()

Indexing and slicing: arr[1:5], arr[:, 1]

Broadcasting: Adding scalar to array, or adding arrays of different shapes

Useful functions: np.mean(), np.sum(), np.max(), np.sort()

Matplotlib

Plot types: plt.plot(), plt.bar(), plt.hist(), plt.scatter()

Customization: titles, labels, colors, legends

plt.title("Sales Trend")
plt.xlabel("Month")
plt.ylabel("Sales")
plt.legend()
plt.grid(True)

Pandas

groupby(), agg()

Filtering with loc[] and position-based with iloc[]

Merging: pd.merge(), join(), concat()

Useful functions: isnull(), fillna(), dropna()

  1. Python code for SQL Q2 (Total order amount for current year customers)

import pandas as pd
from datetime import datetime

Sample data

customers = pd.DataFrame({
'Customer_id': [1, 2, 3],
'Customer_Name': ['Alice', 'Bob', 'Charlie'],
'Join_Date': ['2025-01-10', '2023-06-20', '2025-03-15']
})

orders = pd.DataFrame({
'Order_id': [101, 102, 103, 104],
'Customer_id': [1, 2, 1, 3],
'Order_Date': ['2025-01-11', '2023-06-21', '2025-02-05', '2025-03-20'],
'Amount': [100, 200, 150, 300]
})

Convert Join_Date to datetime

customers['Join_Date'] = pd.to_datetime(customers['Join_Date'])
orders['Order_Date'] = pd.to_datetime(orders['Order_Date'])

Filter customers who joined this year

current_year = datetime.now().year
filtered_customers = customers[customers['Join_Date'].dt.year == current_year]

Merge and group

merged = pd.merge(filtered_customers, orders, on='Customer_id')
result = merged.groupby('Customer_Name')['Amount'].sum().reset_index()

print(result)

C. Leadership Principles (Sample Answers)

Bias for Action

In my previous role, a data feed failed right before a critical monthly report deadline. I quickly investigated the source, identified a schema change in the API, and manually pulled data from a backup. I then created a temporary ETL script to fill in the gap. This quick decision allowed us to deliver the report on time.

Dive Deep

During a marketing campaign analysis, I noticed a sudden drop in conversion rates. Rather than accepting surface-level metrics, I dove into user-level data, funnel drop-off points, and traffic sources. I discovered that a change in our landing page URL had broken tracking. Fixing this brought conversion back to normal and saved future revenue loss.

Customer Obsession

A customer team struggled with our dashboard tool. I set up a 1:1 session, listened to their challenges, and built a custom version tailored to their daily tasks. This not only improved their productivity but they also became one of our strongest advocates.

D. Excel Interview Topics

Functions You Must Know:

VLOOKUP, XLOOKUP → Lookup values from other tables

INDEX + MATCH → More dynamic alternative to VLOOKUP

SUMPRODUCT → Conditional multiplications and filters

INDIRECT → Refer to dynamic ranges

TEXT, LEFT, RIGHT, MID → Clean and manipulate strings

SUMIFS, COUNTIFS, AVERAGEIFS → Aggregate with multiple criteria

Other Topics:

Pivot Tables: Summarize and analyze large datasets

Conditional Formatting: Highlight cells based on rules

Data Validation: Dropdowns, restricting inputs

Charts: Line, bar, pie – how to visualize trends

React ❤️ for more interview Q&A

Top comments (0)