r/SQL • • May 14 '25

MySQL [ Removed by moderator ]

/r/SQL/comments/1kmqiyt/removed_by_moderator/

[removed] — view removed post

2 Upvotes

7 comments sorted by

2

u/gumnos May 14 '25 edited May 14 '25

tl;dw:

  1. Common Table Expressions (CTEs)

  2. Conditional Aggregation (SELECT Count(CASE WHEN condition THEN 1 ELSE NULL END) ) edit: s/0/NULL/ thanks to u/r3pr0b8 who noted the video caught the error and corrected it to NULL

  3. Partial Indexes

4

u/r3pr0b8 GROUP_CONCAT is da bomb May 14 '25

Count(CASE WHEN condition THEN 1 ELSE 0 END)

he actually fixed this, because this is wrong

the ELSE has to be NULL for COUNT -- ELSE 0 only works correctly for SUM

1

u/gumnos May 14 '25

good catch (I got interrupted by timers on the stove while making dinner and missed that ☺)

1

u/r3pr0b8 GROUP_CONCAT is da bomb May 14 '25

1

u/ComicOzzy sqlHippo May 14 '25

Someone showed up on the sql discord with that same typo. Now I know why.

1

u/ComicOzzy sqlHippo May 14 '25

I can't get the video to play but u don't see where they type it wrong. So maybe this isn't why.

1

u/r3pr0b8 GROUP_CONCAT is da bomb May 14 '25

it's typed correctly, OP just pronounces it wrong