SQL is not just about writing queries, you also need to make sure that your queries are performant, fast, and readable. This video shows you the best practices for structuring SQL queries. Even when your SQL code works correctly, it can still be improved, in particular when it comes to performance and readability.
Link to the question to follow along with me: https://platform.stratascratch.com/co...
______________________________________________________________________
👉 Subscribe to my channel: https://bit.ly/2GsFxmA
👉 Playlist for more data science interview questions and answers: https://bit.ly/3jifw81
👉 Playlist for data science interview tips: https://bit.ly/2G5hNoJ
👉 Practice more real data science interview questions: https://platform.stratascratch.com/co...
______________________________________________________________________
Timeline:
Intro: (0:00)
Example Question: (0:40)
Initial Solution to Refactor: (2:51)
Remove Multiple Nested Queries: (3:30)
Ensure Consistent Aliases: (7:12)
Remove Unnecessary ORDER BY Clauses: (10:32)
Remove Unnecessary Subqueries and CTEs: (11:18)
HAVING vs WHERE: (12:48)
Formatting: (14:23)
Conclusion: (15:36)
______________________________________________________________________
About The Platform:
I'm using StrataScratch (https://platform.stratascratch.com/co..., a platform that allows you to practice real data science interview questions. There are over 1000+ interview questions that cover coding (SQL and python), statistics, probability, product sense, and business cases.
So, if you want more interview practice with real data science interview questions, visit https://platform.stratascratch.com/co.... All questions are free and you can even execute SQL and python code in the IDE, but if you want to check out the solutions from me or from other users, you can use ss15 for a 15% discount on the premium plans.
______________________________________________________________________
Contact:
If you have any questions, comments, or feedback, please leave them here!
Feel free to also email me at [email protected]
______________________________________________________________________
#StructureYourSQLCode