Count Unique Street Names by Postal Code! 🚀 | SQL Query Explained from Scratch

preview_player
Показать описание

Want to level up your SQL skills? 🤯 In this video, we break down a tricky SQL query that counts the number of unique street names for each postal code—using only the first word, case-insensitively, and handling reversed street structures like "Pier 39" and "39 Pier" as the same!

🔍 Key SQL Concepts Covered:
✅ String manipulation with LEFT(), SUBSTRING(), and CHARINDEX()
✅ Handling case-insensitive comparisons using LOWER()
✅ Dealing with streets starting with numbers
✅ Counting unique values with COUNT(DISTINCT …)
✅ Sorting results in descending & ascending order

📌 SQL Query Breakdown:
We extract the first meaningful word from street names, count distinct values, and order them efficiently.

👨‍💻 Dataset: sf_restaurant_health_violations
📌 Columns Used: business_address, business_postal_code

🎯 Whether you're preparing for SQL interviews or sharpening your query skills, this tutorial is perfect for you!

🔥 Don't forget to LIKE, SHARE, and SUBSCRIBE for more SQL tutorials!

#SQL #DataAnalytics #SQLInterview #LearnSQL #SQLQueries #DataScience 🚀
Рекомендации по теме
Комментарии
Автор

One suggestion ma'am
While explaining substring concepts pls use Excel, notepad or any other platforms so it feels easy to understand
Because if you explain everything in the code editor it's hard to keep up with the original answer 😊

Thanks for the hard work & everything 😊

vandanapatil
welcome to shbcf.ru