SQL Window Functions | Clearly Explained | PARTITION BY, ORDER BY, ROW_NUMBER, RANK, DENSE_RANK

Maven Analytics β€’ June 5, 2024
Video Thumbnail
Maven Analytics Logo

Maven Analytics

@mavenanalytics

About

We empower everyday people and teams with future-proof data & AI skills. We've helped 2M+ people build job-ready data literacy & AI skills, master tools like Excel, SQL, Power BI, Tableau and Python, and build the foundation for successful careers. Start learning for free at www.mavenanalytics.io

Video Description

SQL Pocket Guide author Alice Zhao breaks down each part of a window function, step-by-step. πŸ—“οΈ MARK YOUR CALENDARS! πŸ—“οΈ 10/20-10/30: Maven Analytics Open Campus is BACK! Here’s what you can expect from the event… πŸ”“ UNLIMITED LEARNING! During Open Campus, anyone with a free Maven Analytics account can enjoy unlimited access to courses and platform features! πŸ“… LIVE EVENTS! Join seasoned data experts to kick off your learning with 12 live learning sessions covering technical skills, career advice, AI in data, and more! πŸ†EXCLUSIVE AWARDS & PRIZES! Compete to be named Open Campus MVP and win prizes like Maven apparel and lifetime access! Unlimited platform access. Live training and career sessions. Exclusive awards & prizes. 100% Free! LEARN MORE AND REGISTER πŸ‘‰ https://bit.ly/4hbuMlB Hope to see you there! πŸ”— Helpful Links: πŸ‘‰ Alice's Advanced SQL Querying course: https://bit.ly/3ZgI0Xa πŸ‘‰ MySQL Specialist Learning Path: https://mavenanalytics.io/path/mysql-specialist πŸ‘‰ Follow Alice: https://www.linkedin.com/in/alicexzhao πŸ‘‰ Follow Maven Analytics: https://www.linkedin.com/company/maven-analytics ⏱️ Timestamps ⏱️ 00:00 Intro 0:09: View the table 0:28: ORDER BY 1:18: Window function with ROW_NUMBER 1:40: OVER 2:36: Breaking down the window function 3:28: ROW_NUMBER vs RANK vs DENSE_RANK 5:13: PARTITION BY 6:52: Window function in a subquery πŸ“„ CREATE & INSERT Statements πŸ“„ CREATE TABLE baby_names ( Gender VARCHAR(10), Name VARCHAR(50), Total INT ); INSERT INTO baby_names (Gender, Name, Total) VALUES ('Girl', 'Ava', 95), ('Girl', 'Emma', 106), ('Boy', 'Ethan', 115), ('Girl', 'Isabella', 100), ('Boy', 'Jacob', 101), ('Boy', 'Liam', 84), ('Boy', 'Logan', 73), ('Boy', 'Noah', 120), ('Girl', 'Olivia', 100), ('Girl', 'Sophia', 88); At Maven Analytics, we empower everyday people with life-changing data & AI skills. Head to http://mavenanalytics.io and master in-demand tools like Excel, SQL, Power BI, Tableau, Python and more. Design your own personalized learning plan and get started for FREE! Looking for more opportunities to sharpen your skills? Explore sample datasets and practice solving real business problems with unique, expert-led guided projects: https://mavenanalytics.io/guided-projects

You May Also Like