TGViewer
Data Analytics Data Analytics @sqlspecialist ยท 111K subscribers
Post #2792 6.09K
๐Ÿš€ Data Analyst Interview Questions with Answers โ€” Part 7

๐Ÿ” Advanced Analytics & SQL Patterns

61. How do you compute month-on-month or week-on-week growth?

Growth compares current performance with a previous period.

๐Ÿ“Œ Formula:
Growth % = (Current Period - Previous Period) / Previous Period * 100

โœ… Example SQL Query:
SELECT month,
revenue,
LAG(revenue) OVER (ORDER BY month) AS previous_month,
ROUND(
((revenue - LAG(revenue) OVER (ORDER BY month))
/ LAG(revenue) OVER (ORDER BY month)) * 100,
2
) AS mom_growth
FROM sales;

This calculates month-on-month growth percentage.

62. How do you write a query to calculate retention or churn?

๐Ÿ“Œ Retention: Users who continue using the product
๐Ÿ“Œ Churn: Users who stop using the product

Example retention query:
SELECT signup_month,
COUNT(DISTINCT retained_user_id) * 100.0 /
COUNT(DISTINCT user_id) AS retention_rate
FROM retention_table
GROUP BY signup_month;

Retention analysis helps measure customer loyalty and product success.

63. How do you calculate LTV (Lifetime Value) conceptually?

LTV estimates the total revenue generated by a customer during their relationship with a business.

๐Ÿ“Œ Basic Formula:
LTV = Average Purchase Value Average Purchase Frequency Average Customer Lifespan

Businesses use LTV to evaluate customer acquisition and retention strategies.

64. How do you write a funnel analysis query?

Funnel analysis tracks user progression through stages.

Example funnel:
Signup โ†’ Activation โ†’ Purchase

Example SQL:
SELECT
COUNT(DISTINCT signup_user) AS signups,
COUNT(DISTINCT activated_user) AS activations,
COUNT(DISTINCT purchased_user) AS purchases
FROM funnel_data;

Funnels help identify where users drop off.

65. How do you handle time-based aggregations?

Time aggregations summarize data daily, weekly, or monthly.

Example:
SELECT DATE_TRUNC('month', order_date) AS month,
SUM(revenue) AS total_revenue
FROM orders
GROUP BY month
ORDER BY month;

This helps track trends over time.

66. How do you compare cohorts?

Cohort analysis compares groups of users based on a shared characteristic.

Examples:
โœ”๏ธ Users acquired in January vs February
โœ”๏ธ Retention by signup month
โœ”๏ธ Revenue by acquisition channel

Cohorts help measure long-term user behavior.

67. How do you calculate lead-time, cycle-time, or business-process metrics?

๐Ÿ“Œ Lead Time: Total time from request to completion
๐Ÿ“Œ Cycle Time: Time spent actively working on a task

Example Formula:
Lead Time = Completion Date - Request Date
Cycle Time = End Work Time - Start Work Time

These metrics help improve operational efficiency.

68. How do you implement A/B test-style analysis in SQL?

A/B testing compares two groups to measure performance differences.

Example:
SELECT test_group,
AVG(conversion_rate) AS avg_conversion
FROM experiment_results
GROUP BY test_group;

Analysts compare metrics such as:
โœ”๏ธ Conversion rate
โœ”๏ธ Revenue
โœ”๏ธ Click-through rate
โœ”๏ธ Retention

69. How do you approximate segmentation (RFM-style) in SQL?

RFM segmentation classifies customers using:

๐Ÿ“Œ Recency: How recently they purchased
๐Ÿ“Œ Frequency: How often they purchase
๐Ÿ“Œ Monetary: How much they spend

Example:
SELECT customer_id,
MAX(order_date) AS last_purchase,
COUNT(order_id) AS frequency,
SUM(amount) AS monetary
FROM orders
GROUP BY customer_id;

RFM helps identify high-value customers.

70. How do you document and version your SQL queries?

Best practices include:
โœ… Use meaningful query names
โœ… Add comments in SQL scripts
โœ… Store queries in Git repositories
โœ… Maintain version history
โœ… Document assumptions and business logic
โœ… Organize queries by project or folder structure
Proper documentation improves collaboration and maintainability.

๐Ÿš€ Double Tap โค๏ธ For Part-8
  • โค 16
  • ๐Ÿ‘ 1
More from @sqlspecialist
  1. Oct 9, 2026โ€œHere, the data is sorted by the second column in descending order and the first five rowsโ€ฆ
  2. Oct 9, 2026๐Ÿ“Š Data Analyst Interview Series โ€” Part 6 Guys, let's continue our Data Analyst Interviewโ€ฆ
  3. Oct 9, 2026๐Ÿ‡ฎ๐Ÿ‡ณ ๐—š๐—ข๐—ฉ๐—˜๐—ฅ๐—ก๐— ๐—˜๐—ก๐—ง ๐—ข๐—™ ๐—œ๐—ก๐——๐—œ๐—” โ€” ๐—”๐—œ๐—–๐—ง๐—˜ ๐—œ๐—ก๐—ง๐—˜๐—ฅ๐—ก๐—ฆ๐—›๐—œ๐—ฃ๐—ฆ ๐Ÿฎ๐Ÿฌ๐Ÿฎ๐Ÿฒ ๐Ÿš€โ€ฆ
  4. Oct 8, 2026๐ŸŽ“ ๐— ๐—ถ๐—ฐ๐—ฟ๐—ผ๐˜€๐—ผ๐—ณ๐˜ ๐—™๐—ฅ๐—˜๐—˜ ๐—–๐—ผ๐˜‚๐—ฟ๐˜€๐—ฒ๐˜€ ๐˜„๐—ถ๐˜๐—ต ๐—–๐—ฒ๐—ฟ๐˜๐—ถ๐—ณ๐—ถ๐—ฐ๐—ฎ๐˜๐—ฒ๐˜€! ๐Ÿš€๐Ÿ”ฅ Upgrโ€ฆ
  5. Oct 7, 2026๐Ÿ“Š Kandinsky 6.0 Video: AI-Powered Content Creation for Analysts The new Kandinsky 6.0 Vidโ€ฆ
  6. Oct 7, 2026Alternatively, depending on the Excel version and requirement, I could use functions suchโ€ฆ
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook โ†’Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 โ†’