
產品表如上所示。
select *
from product
where isnull(product_description, null) = product_description
SQL 腳本是我想要運行的。
我可以知道如何閱讀或它對條件的實際含義是什么?為什么沒有選擇第 4 行?感覺查詢是一樣的
select *
from product
where product_description is not null
我對查詢中的條件有點困惑。
uj5u.com熱心網友回復:
ISNULL接受兩個引數。它回傳第一個,除非它為空,在這種情況下它回傳第二個引數 - 所以寫類似的東西ISNULL(SomethingHere, NULL)是沒有意義的 - 這意味著 where 子句與where product_description = product_description.
由于在 T-SQL 中NULL = NULL回傳UNKNOWN(相當于false在WHERE子句的背景關系中),它與where product_description is not null.
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/397712.html
標籤:sql sql-server 查询语句
