PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Google

Write SQL and merge linked lists

Last updated: Apr 22, 2026

Quick Overview

This question evaluates SQL analytics skills—covering joins, aggregations and row-level most-recent selection—and fundamental algorithmic competency in in-place merging of sorted singly linked lists.

  • medium
  • Google
  • Coding & Algorithms
  • Data Engineer

Write SQL and merge linked lists

Company: Google

Role: Data Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

The technical interview included two coding-style tasks: 1. **SQL analytics task** You are given three tables: - `customers(customer_id, customer_name)` - `orders(order_id, customer_id, order_date, amount)` - `returns(return_id, order_id, created_at)` Write a SQL query that returns one row per customer, including customers who have never placed an order. For each customer, report: - `total_orders` - `total_amount` - `latest_order_date` - `latest_order_amount` Use a `LEFT JOIN` so customers with no orders still appear. Use a nested query, common table expression, or window function to identify the most recent order for each customer. 2. **List manipulation task** Given the heads of two singly linked lists whose values are already sorted in non-decreasing order, merge them into one sorted linked list by reusing the existing nodes, and return the head of the merged list.

Quick Answer: This question evaluates SQL analytics skills—covering joins, aggregations and row-level most-recent selection—and fundamental algorithmic competency in in-place merging of sorted singly linked lists.

Related Interview Questions

  • Solve Rooms and Top-K Streams - Google (medium)
  • Find Containing Range - Google (medium)
  • Rearrange Tasks With Cooldown - Google (medium)
  • Solve Three Array and Matrix Path Problems - Google (medium)
  • Implement Employee Management and Expression Evaluation - Google (medium)
Google logo
Google
Mar 9, 2025, 12:00 AM
Data Engineer
Technical Screen
Coding & Algorithms
1
0

The technical interview included two coding-style tasks:

  1. SQL analytics task You are given three tables:
    • customers(customer_id, customer_name)
    • orders(order_id, customer_id, order_date, amount)
    • returns(return_id, order_id, created_at)
    Write a SQL query that returns one row per customer, including customers who have never placed an order. For each customer, report:
    • total_orders
    • total_amount
    • latest_order_date
    • latest_order_amount
    Use a LEFT JOIN so customers with no orders still appear. Use a nested query, common table expression, or window function to identify the most recent order for each customer.
  2. List manipulation task Given the heads of two singly linked lists whose values are already sorted in non-decreasing order, merge them into one sorted linked list by reusing the existing nodes, and return the head of the merged list.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Google•More Data Engineer•Google Data Engineer•Google Coding & Algorithms•Data Engineer Coding & Algorithms
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.