SQL Hacks - Day 2
- supriyamalla

- Sep 7, 2022
- 1 min read
So, I restarted SQL on Leetcode! I will try to be more consistent now onwards, it is a promise!
Did you know the way you use "having" clause with group by can impact your performance?
Using Having count(*) as compared to having count(field_name) even if there is only 1 field cuts the time taken to run the query by ALMOST HALF!
So, try to use having count(*) instead of a particular field name.
I was in fix between group by, having and where - if I should use just where or use having
I am still not able to wrap my head around which is better - Group by + having or Where?
Let me know in the comments!
I plan to solve 3-4 questions everyday for the next 10 days just to build consistency.
I solved 4 questions today and now am good for the day (for SQL)
Catch up with y'all later!


Comments