Uploaded January 2023 | Updated December 2026, 3 hours ago
Top N is the most frequently presented SQL question in interviews. In this video, I hope to help you understand how to answer questions like, “What are the Top 5 highest-rated movies?” and “What are the Top 3 highest paid employees per department?” I’ll demonstrate the problem using an example, and fill you in on how to modify the query when there are ties in the ranks.
🟢Get all my free data science interview resources
emmading.com/get-all-my-free-resources
🟡 Product Case Interview Cheatsheet emmading.com/product-case-cheat-sheet
🟠 Statistics Interview Cheatsheet emmading.com/statistics-interview-cheat-sheet
🟣 Behavioral Interview Cheatsheet emmading.com/behavioral-interview-cheat-sheet
🔵 Data Science Resume Checklist emmading.com/data-science-resume-checklist
✅ We work with Experienced Data Scientists to help them land their next dream jobs. Apply now: emmading.com/coaching
// Comment
Got any questions? Something to add?
Write a comment below to chat.
// Let's connect on LinkedIn:
linkedin.com/in/emmading001
====================
Contents of this video:
====================
00:00 Introduction
01:22 Get My Notion Pages!
01:44 Top N Problem
02:15 Sample Questions
02:33 Top N Records
03:02 LIMIT and OFFSET
03:47 Window Functions
05:30 Top N Per Category
07:40 Top N Per Category With Ties
08:50 Topic for Next Video
Top N is the most frequently presented SQL question in interviews. In this video, I hope to help you understand how to answer questions like, “What are the Top 5 highest-rated movies?” and “What are the Top 3 highest paid employees per department?” I’ll demonstrate the problem using an example, and fill you in on how to modify the query when there are ties in the ranks.
🟢Get all my free data science interview resources
emmading.com/get-all-my-free-resources
🟡 Product Case Interview Cheatsheet emmading.com/product-case-cheat-sheet
🟠 Statistics Interview Cheatsheet emmading.com/statistics-interview-cheat-sheet
🟣 Behavioral Interview Cheatsheet emmading.com/behavioral-interview-cheat-sheet
🔵 Data Science Resume Checklist emmading.com/data-science-resume-checklist
✅ We work with Experienced Data Scientists to help them land their next dream jobs. Apply now: emmading.com/coaching
// Comment
Got any questions? Something to add?
Write a comment below to chat.
// Let's connect on LinkedIn:
linkedin.com/in/emmading001
====================
Contents of this video:
====================
00:00 Introduction
01:22 Get My Notion Pages!
01:44 Top N Problem
02:15 Sample Questions
02:33 Top N Records
03:02 LIMIT and OFFSET
03:47 Window Functions
05:30 Top N Per Category
07:40 Top N Per Category With Ties
08:50 Topic for Next Video