Member-only story
Top SQL Questions for Interviews Part 2
1. Highest-Grossing Items [Amazon SQL Interview Question]
Assume you’re given a table containing data on Amazon customers and their spending on products in different categories, and write a query to identify the top two highest-grossing products within each category in the year 2022. The output should include the category, product, and total spend.
Solution #1:
Solution #2: Using Subquery
Here’s an alternative approach using subquery.
2. Top 5 Artists [Spotify SQL Interview Question]
Assume there are three Spotify tables: artists, songs, and global_song_rank, which contain information about the artists, songs, and music charts, respectively.







