Skip to main content
All Questions

Most Recent Transaction

Medium
Unlock detailed company stats for this questionUpgrade

Given an e-commerce database with the schema shown below, write a query to fetch the product name and stock of the most recently purchased product

diagramsales by customer

Your query should return a result in the following format:

id | name | stock ----+---------+------- int | varchar | int

Related courses

Course

Data Analyst Interview Prep

Ace your data analyst interviews—whether you're targeting product, marketing, or business analyst roles. Tackle real take-home case studies, sharpen your technical and dashboarding skills, and get strategies from interviewers at top tech companies and startups.

Course

Data Science Interview Prep

Land your dream data science role at Google, Amazon, Microsoft, Meta, Apple, and other top companies. Learn from mock interviews, frameworks, and advice from senior candidates. Practice statistics, experimentation, coding, SQL, machine learning, behavioral interviews, and more.