PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches

Quick Overview

This question evaluates proficiency in SQL time-series aggregation, weekly grouping, and prior-period comparison for calculating percentage changes in revenue.

  • Medium
  • Shopify
  • Data Manipulation (SQL/Python)
  • Data Scientist

Calculate Week-over-Week Revenue Change Using SQL

Company: Shopify

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: Medium

Interview Round: Technical Screen

transactions +----+---------+---------+------------+ | id | user_id | revenue | order_date | +----+---------+---------+------------+ | 1 | 101 | 100 | 2023-01-02 | | 2 | 102 | 200 | 2023-01-05 | | 3 | 103 | 150 | 2023-01-09 | | 4 | 101 | 120 | 2023-01-10 | | 5 | 104 | 180 | 2023-01-16 | +----+---------+---------+------------+ ##### Scenario Technical phone screen (CodePad) using sample data; candidate must compute week-over-week revenue change in SQL. ##### Question Write a SQL query that returns each calendar week and the percentage change in total revenue versus the previous week. ##### Hints Apply DATE_TRUNC to define weeks, ali​as columns with non-reserved words, handle NULL or zero prior-week revenue.

Quick Answer: This question evaluates proficiency in SQL time-series aggregation, weekly grouping, and prior-period comparison for calculating percentage changes in revenue.

Last updated: Mar 29, 2026

Loading coding console...

PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.

Related Coding Questions

  • Analyze Pirated Theme Usage Impact - Shopify (medium)
  • Compute pirated-theme usage and revenue loss - Shopify (easy)
  • Calculate Pirated Usage and Revenue Loss - Shopify (hard)
  • Justify and harden your analytics and BI stack - Shopify (Medium)
  • Determine Growth of Pirated Theme Installations Over Years - Shopify (Medium)