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

🎵 Forget You - Ceelo Green 🎵 Sorry Im Here For Someone Else - Benson… 🎵 4X4 - Travis Scott 🎵 Titanium - David Guetta Feat. Sia 🎵 Jump - Blackpink 🎵 Golden - Huntr/X 🎵 Ordinary - Alex Warren 🎵 We Found Love - Rihanna Feat. Calvin… 🎵 I Gotta Feeling - Black Eyed Peas 🎵 Mystical Magical - Benson Boone 🎵 Beautiful People - David Guetta & Sia 🎵 Azizam - Ed Sheeran