十三:UNLL

where score IS NULL

where score IS NOT NULL

 

ISNULL()、NVL()、IFNULL() 和 COALESCE() 函数

空值返回0以便计算

SQL Server / MS Access

SELECT ProductName,UnitPrice*(UnitsInStock+ISNULL(UnitsOnOrder,0))
FROM Products

Oracle

SELECT ProductName,UnitPrice*(UnitsInStock+NVL(UnitsOnOrder,0))
FROM Products

MySQL

SELECT ProductName,UnitPrice*(UnitsInStock+IFNULL(UnitsOnOrder,0))
FROM Products

SELECT ProductName,UnitPrice*(UnitsInStock+COALESCE(UnitsOnOrder,0))
FROM Products

 

posted @ 2020-03-26 14:53  soberkkk  阅读(184)  评论(0编辑  收藏  举报