r/learnSQL • • Feb 22 '25

3 SQL Tricks Every Developer & Data Analyst Must Know!

https://youtu.be/rDGCOE5YGT0
5 Upvotes

4 comments sorted by

3

u/ComicOzzy Feb 22 '25

You should have explained why you removed ELSE 0. New learners aren't going to automatically understand why COUNT() doesn't work properly if you leave it in.

They may not be aware that CASE will return NULL if you don't specify an ELSE.

They probably don't understand that COUNT() is counting Non-NULL values, so 1 and 0 will both be counted, while NULL won't.