Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • I really think your case statement was meant to say: case when my_col is null then 1 else my_col end Commented Mar 11, 2015 at 18:19
  • For clarity: SELECT my_col, COUNT(my_col) + COUNT(CASE WHEN my_col IS NULL THEN 1 ELSE NULL END) as CountOf from my_Table GROUP BY my_col Commented Jun 18, 2015 at 17:59
  • count(*) includes nulls Commented Jul 12, 2017 at 17:05
  • 1
    @PragmaticProgrammer I guess so, but there's not such a thing as a null row, only a null value, and count(*) is specifically a count of rows. Commented Jan 6, 2018 at 14:50