The options that are not logically equivalent are:Ĭ: COUNT(CASE WHEN order_type = 'purchase' then NULL END) These queries are equivalent because they also produce non-null values for each row where order_type = 'purchase', and hence will be counted by the COUNT() function. Given this understanding, the logically equivalent options to COUNT(CASE WHEN order_type = 'purchase' then 1 END) are: The COUNT() function then counts the number of rows that do not have a NULL value generated by the case statement. The case statement inside the COUNT() function generates a value for each row in the dataset. In SQL, the COUNT() function only considers non-null values. ![]() D: COUNT(CASE WHEN order_type = 'purchase' then 1 ELSE 0 END). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |