久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

為什么要警告 COUNT(col) 中的 NULL?

Why warn about NULLs in COUNT(col)?(為什么要警告 COUNT(col) 中的 NULL?)
本文介紹了為什么要警告 COUNT(col) 中的 NULL?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

這有點哲學問題,我猜...

This is a bit of a philosophical question, I guess...

假設我在 SQL Server 中執(zhí)行此查詢:

Say I execute this query in SQL Server:

SELECT mygroup, COUNT(mycolumn)
FROM mytable
GROUP BY mygroup

計數(shù)列包含 NULL 并且 ANSI_WARNINGS 選項為 ON,所以我得到:

The counted column contains NULLs and the ANSI_WARNINGS option is ON, so I get:

警告:空值被聚合或其他 SET 消除操作.

Warning: Null value is eliminated by an aggregate or other SET operation.

我明白這意味著什么.有很多方法可以修復"這個警告.但是... 為什么它首先要抱怨?

I understand what this means. And there are lots of ways to 'fix' this warning. But... why is it complaining in the first place?

跳過任何空值是所有 COUNT(mycolumn) 都可以!如果我想計算所有行,包括該列的空值,我會使用 COUNT(*).我意圖跳過空值不是很清楚嗎?

Skipping any NULLs is all COUNT(mycolumn) does! If I wanted to count all rows, including NULLs for this column, I would have used COUNT(*). Isn't it clear that it's my intention to skip NULLs?

我猜 ANSI 標準要求發(fā)出此警告,即使在這種明顯的情況下也是如此.為什么?

I guess the ANSI standard demands this warning, even in this obvious case. Why?

推薦答案

警告僅在聚合結果集中存在實際空值時出現(xiàn).我相信它是為了提醒您不會計算空值,并在您遇到數(shù)據(jù)一致性問題時警告您,因為空值出現(xiàn)在您意想不到的地方.

The warning only appears when an actual null is present in the aggregate resultset. I believe it is there to remind you that nulls will not be counted and to warn you should you come across data consistency issues because a null appears where you did not expect.

這篇關于為什么要警告 COUNT(col) 中的 NULL?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯(lián)網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯(lián)系我們刪除處理,感謝您的支持!

相關文檔推薦

What SQL Server Datatype Should I Use To Store A Byte[](我應該使用什么 SQL Server 數(shù)據(jù)類型來存儲字節(jié) [])
Interpreting type codes in sys.objects in SQL Server(解釋 SQL Server 中 sys.objects 中的類型代碼)
Typeorm .loadRelationCountAndMap returns zeros(Typeorm .loadRelationCountAndMap 返回零)
MS SQL: Should ISDATE() Return quot;1quot; when Cannot Cast as Date?(MS SQL:ISDATE() 是否應該返回“1?什么時候不能投射為日期?)
Converting the name of a day to its integer representation(將一天的名稱轉換為其整數(shù)表示)
How to convert nvarchar m/d/yy to mm/dd/yyyy in SQL Server?(如何在 SQL Server 中將 nvarchar m/d/yy 轉換為 mm/dd/yyyy?)
主站蜘蛛池模板: 自拍偷拍第一页 | 成人在线免费观看 | 日韩av在线不卡 | 中文字幕在线视频一区二区三区 | 久久伊人亚洲 | 男女羞羞视频免费 | 亚洲成人精品国产 | 久久99精品久久 | 亚洲国产一区在线 | 日韩成人中文字幕 | 日韩欧美久久 | 红色av社区 | 日韩成人一区 | 国产精品久久久久一区二区三区 | 欧美男人亚洲天堂 | 精品久久久久久亚洲综合网 | 亚洲精品在线免费观看视频 | 羞羞网站在线观看 | 69精品久久久久久 | 中文字幕在线一区二区三区 | 国产一级在线 | 欧美日韩一 | 中文字幕 在线观看 | 国产精品一区二区三区四区 | 在线视频一区二区 | 韩日在线观看视频 | 免费欧美视频 | 久久人体视频 | 另类二区 | www久久久 | 精品视频免费 | 视频一区二区中文字幕日韩 | 国产精品一区在线 | 亚洲网站在线观看 | 婷婷福利| 日本成人在线观看网站 | 天天人人精品 | 国产精品毛片久久久久久 | 久久久99国产精品免费 | 精品视频在线一区 | 成人免费视频在线观看 |