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

SQL 服務器查詢中的 NULL 值

NULL values in SQL server query(SQL 服務器查詢中的 NULL 值)
本文介紹了SQL 服務器查詢中的 NULL 值的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我在表中有一個 Status 列,它有 3 個值 - 'N/A'、'Single'、'Multiple'.某些行的狀態列具有 NULL 值.

I've a Status column in a table which has 3 values - 'N/A' , 'Single' ,'Multiple'. Some rows have a NULL value for the Status column.

我需要提取 Status 不為空且不為N/A"的所有行.基本上,我需要狀態為單個"或多個"的所有行.

I need to pull up all the rows in which Status is not null and is not 'N/A'. Basically, I need all the rows whose status is "Single" or "Multiple".

我剛剛了解到 NULL 實際上等同于UNKNOWN".

I've been just reading up about NULL actually being equivalent to 'UNKNOWN'.

如果我說

SELECT *
FROM t_userstatus
WHERE status <> 'N/A'

我得到了結果(僅包含單個"或多個"的所有行).

I get the results (All rows containing "Single" or "Multiple" only).

我想知道的是,上面的 WHERE 子句是否總是排除具有 NULL 值的行?這是預期的行為嗎?

What I would like to know is that , does the above WHERE clause always exclude the rows having NULL values?Is that the expected behaviour?

是什么導致即使我沒有明確指定它也會排除空行?

在我的查詢中,我是否必須明確說狀態 IS NOT NULL ?

In my query,do I have to explicitly say status IS NOT NULL ?

我對編程比較陌生,不勝感激.

I am relatively new to programming, any help is appreciated.

推薦答案

SQL 使用 三值邏輯:真、假、未知.與 null 的任何比較都會導致 unknown.

SQL uses three-valued logic: true, false, and unknown. Any comparison to null results in unknown.

所以 null <>'N/A' 計算結果為 unknown.由于 unknown 不正確,這意味著該行被排除在外.

So null <> 'N/A' evaluates to unknown. Since unknown is not true, that means the row gets excluded.

這篇關于SQL 服務器查詢中的 NULL 值的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

Converting Every Child Tags in to a Single Column with multiple Delimiters -SQL Server (3)(將每個子標記轉換為具有多個分隔符的單列-SQL Server (3))
How can I create a view from more than one table?(如何從多個表創建視圖?)
Create calculated value based on calculated value inside previous row(根據前一行內的計算值創建計算值)
How do I stack the first two columns of a table into a single column, but also pair third column with the first column only?(如何將表格的前兩列堆疊成一列,但也僅將第三列與第一列配對?) - IT屋-程序員軟件開發技
Recursive t-sql query(遞歸 t-sql 查詢)
Convert Month Name to Date / Month Number (Combinations of Questions amp; Answers)(將月份名稱轉換為日期/月份編號(問題和答案的組合))
主站蜘蛛池模板: 免费在线精品视频 | 精品av| 午夜寂寞影院列表 | 浴室洗澡偷拍一区二区 | 久久久看 | 69热视频在线观看 | 在线成人av | 久久免费小视频 | 狠狠干天天干 | 成人性生交大片免费看r链接 | 久久99精品久久久水蜜桃 | 亚洲视频在线看 | 国产日韩精品在线 | 午夜精品久久久久久久99黑人 | 国精久久 | 精品国产黄色片 | 久久久久久久久久久高潮一区二区 | 国产精品久久久久一区二区 | 国产精品视频一区二区三区, | 欧美性猛交一区二区三区精品 | 国产精品免费一区二区三区四区 | 欧美日本韩国一区二区三区 | 亚洲成人免费视频在线 | 欧美日韩一区二区视频在线观看 | 中文字幕一区在线 | 91资源在线观看 | 国产一级视频 | 亚洲第一福利视频 | 成人激情免费视频 | a久久 | 国产欧美日韩在线观看 | 久久精品国产一区 | 一区二区片 | 国产传媒在线播放 | 91精品国产麻豆 | 精品乱子伦一区二区三区 | 欧美日在线 | 精品三区 | 色婷婷综合网 | 亚洲精选久久 | 国产精品99久久久精品免费观看 |