MP3JOSS

Sql query to Count 0s and 1s with Case #sql #database #sqltips #interview #databaseconcepts #views

Sql query to Count 0s and 1s with Case #sql #database #sqltips #interview #databaseconcepts #views

Choose Download Format

Download MP3 Download MP4

Details

TitleSql query to Count 0s and 1s with Case #sql #database #sqltips #interview #databaseconcepts #views
AuthorDesk For Dev
Duration0:05
File FormatMP3 / MP4
Original URL https://youtube.com/watch?v=Ty4AHSWO3KE

Description

COUNT(CASE WHEN value = 0 THEN 1 END): Counts rows where value is 0. The CASE statement returns 1 when the condition is true (i.e., value = 0), and NULL otherwise. COUNT only counts non-NULL values, so this effectively counts the number of 0s.
COUNT(CASE WHEN value = 1 THEN 1 END): Similarly, counts rows where value is 1.

🎧 Just For You

🎵 Love Me Not - Ravyn Lenae 🎵 Soda Pop - Saja Boys 🎵 Birds Of A Feather - Billie Eilish 🎵 A Bar Song (Tipsy) - Shaboozey 🎵 Shake It To The Max (Fly) - Moliy, Silent… 🎵 Happy - Pharrell Williams 🎵 Espresso Macchiato - Tommy Cash 🎵 I Gotta Feeling - Black Eyed Peas 🎵 Dont Stop Believin - Journey 🎵 Jump - Blackpink 🎵 Dont You Worry Child - Swedish House… 🎵 Nuevayol - Bad Bunny