PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep

Quick Overview

This question evaluates SQL data-manipulation skills including time-windowed aggregations, computation of derived visibility metrics, and ranking operations over event-level impression data.

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

Calculate Shop Visibility Ranking in Search Results

Company: Meta

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: Medium

Interview Round: Onsite

shop_impressions +------------+---------+----------+--------+ | date | shop_id | position | clicks | +------------+---------+----------+--------+ | 2024-06-01 | 101 | 1 | 45 | | 2024-06-01 | 102 | 3 | 12 | | 2024-06-02 | 101 | 2 | 30 | | 2024-06-02 | 103 | 1 | 18 | | 2024-06-03 | 101 | 1 | 55 | +------------+---------+----------+--------+ ##### Scenario An e-commerce marketplace wants to measure how prominently each shop is shown in search results so that marketing can reward high-visibility sellers. ##### Question Given table shop_impressions(date, shop_id, position, clicks), write a SQL query that Calculates each shop’s average daily visibility score defined as 1/position over the past 7 days. Ranks shops by that average visibility (highest first) and returns shop_id, avg_visibility, rank. ##### Hints Use window or aggregation over a 7-day rolling window; remember to filter by the latest date available.

Quick Answer: This question evaluates SQL data-manipulation skills including time-windowed aggregations, computation of derived visibility metrics, and ranking operations over event-level impression data.

Last updated: Mar 29, 2026

Loading coding console...

PracHub

Master your tech interviews with 8,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

  • Compute ad impression conversion rates - Meta (medium)
  • Count unconnected posts and reactions - Meta (medium)
  • Count heavy callers in 7 days - Meta (medium)
  • Write SQL for call metrics - Meta (medium)
  • Write SQL for multi-account metrics - Meta (medium)