In SQL queries, NULL behaves differently when using certain functions, eg
A table with:
| ID | Cliente | Valor Gasto |
| 01 | JOAO | 100 |
| 02 | PEDRO | NULL |
| 03 | MARIA | 50 |
When running
SELECT SUM(Valor_Gasto) * 100 / COUNT(ID) FROM tabela
SELECT SUM(Valor_Gasto) * 100 / COUNT(Valor_Gasto) FROM tabela
In the first query COUNT equals 3 and you get the value 50, already in the second COUNT equals 2 and you get 75 because null is ignored in the count.
Not too much, but depending on how you want to calculate, this avoids using validation in WHERE.
Or when you do validation with < > (other than) or IS NOT, eg:
SELECT Cliente FROM tabela WHERE Valor_Gasto <> 50
This would bring penalties to Joao, since Pedro has NULL value, would have to treat the column or use a function that considers the null, do not know for all languages but in Postgres can use:
SELECT Cliente FROM tabela WHERE Valor_Gasto IS DISTINCT FROM 50
OR (this is universal)
SELECT Cliente FROM tabela WHERE COALESCE(Valor_Gasto,0) <> 50
In the above query it trades NULL for 0, then the Expended Value will never be NULL, I hope I have helped in some way