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

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

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

問(wèn)題描述

限時(shí)送ChatGPT賬號(hào)..

這有點(diǎn)哲學(xué)問(wèn)題,我猜...

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

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

Say I execute this query in SQL Server:

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

計(jì)數(shù)列包含 NULL 并且 ANSI_WARNINGS 選項(xiàng)為 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.

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

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

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

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 標(biāo)準(zhǔn)要求發(fā)出此警告,即使在這種明顯的情況下也是如此.為什么?

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

推薦答案

警告僅在聚合結(jié)果集中存在實(shí)際空值時(shí)出現(xiàn).我相信它是為了提醒您不會(huì)計(jì)算空值,并在您遇到數(shù)據(jù)一致性問(wèn)題時(shí)警告您,因?yàn)榭罩党霈F(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.

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

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

相關(guān)文檔推薦

What SQL Server Datatype Should I Use To Store A Byte[](我應(yīng)該使用什么 SQL Server 數(shù)據(jù)類型來(lái)存儲(chǔ)字節(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() 是否應(yīng)該返回“1?什么時(shí)候不能投射為日期?)
Converting the name of a day to its integer representation(將一天的名稱轉(zhuǎn)換為其整數(shù)表示)
How to convert nvarchar m/d/yy to mm/dd/yyyy in SQL Server?(如何在 SQL Server 中將 nvarchar m/d/yy 轉(zhuǎn)換為 mm/dd/yyyy?)
主站蜘蛛池模板: 成人 在线 | 在线免费观看a级片 | 久久国产精品视频 | 欧美电影大全 | 成人精品毛片国产亚洲av十九禁 | 亚洲视频中文字幕 | 精品久久久久久久久久久 | 中文字幕成人av | 精品国产乱码久久久久久牛牛 | 欧美91| 一区二区精品视频 | 精品一区二区免费视频 | 国产一区二区精华 | 久久久久久久电影 | 国产区在线视频 | 91在线视频网址 | 日韩亚洲一区二区 | 91在线视频免费观看 | 国产欧美久久精品 | 国产视频一区二区 | 91人人在线 | 国产在线视频一区 | 中文字幕国产视频 | 黄网站在线观看 | 亚洲精品一区二区三区在线 | 日韩精品一区二区三区视频播放 | 国产小u女发育末成年 | 久久久久久久av | 日韩区| 精品成人佐山爱一区二区 | 久久婷婷色| 欧美在线视频网站 | 一区二区三区日韩精品 | 一区二区三区亚洲视频 | 亚洲精品综合一区二区 | 丁香五月网久久综合 | 国产成人精品一区二区三区视频 | 精品欧美乱码久久久久久 | 91看片网| 欧美综合一区二区 | 中文精品视频 |