Oracle下:
count()會統計所有不為空的行數,count() for the not null count。
sum(null)不做彙總,sum(0)輸出為0
第一行SQL将不會傳回任何内容,而第二行将會傳回field字段為NULL的行。
原因如下:
在SQL中,null值與另外一個值(包括null值)的邏輯比較(=,!=,<>等),傳回的結果也是null,而這個null值在where子句中是被當做false來看待的。null表示”未知“,是以比較的結果也是”未知“。
<a href="http://stackoverflow.com/questions/354070/sql-join-where-clause-vs-on-clause">http://stackoverflow.com/questions/354070/sql-join-where-clause-vs-on-clause</a>