Given Clients table
+------+--------------+----------+
| ID   |  Name        |  Summa   |
+------+--------------+----------+
| 1    |  Sasha       |  4000    |
| 2    |  Marina      |  2000    |
| 3    |  Stepan      |   0      |
| 4    |  Klara       |  NULL    |
+------+--------------+----------+
After it is updated using:
UPDATE Clients SET Summa = Summa + 700
What will be the result of the following query execution?
SELECT AVG(Summa) FROM Clients;
Explanation
If binary arithmetic operator (+ in our case) accepts NULL as one of its arguments, the result will always be NULL.
Aggregate functions (like AVG() in our case) ignore NULL values.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes